From rpaulo at freebsd.org Thu Oct 1 02:06:07 2009 From: rpaulo at freebsd.org (Rui Paulo) Date: Thu Oct 1 02:06:51 2009 Subject: svn commit: r197614 - stable/8/sys/net80211 In-Reply-To: <4AC3B02B.90703@FreeBSD.org> References: <200909291218.n8TCINmv085038@svn.freebsd.org> <558A76C2-0F8C-472F-A235-16BDAD15C634@freebsd.org> <4AC3B02B.90703@FreeBSD.org> Message-ID: On 30 Sep 2009, at 20:23, Doug Barton wrote: > Rui Paulo wrote: >> On 29 Sep 2009, at 13:18, Rui Paulo wrote: >> >>> Author: rpaulo >>> Date: Tue Sep 29 12:18:23 2009 >>> New Revision: 197614 >>> URL: http://svn.freebsd.org/changeset/base/197614 >>> >>> Log: >>> Update 802.11s mesh support to draft 3.03. This includes a revised >>> frame >>> format for peering and changes to the PERR frames. >>> Note that this is incompatible with the previous code. >>> >>> Reviewed by: sam >>> Approved by: re (kib) >> >> >> Please note that, while these changes are being made very late in the >> release process, they are necessary to keep in sync with the new >> draft. >> There should be no impact on ports, mesh support is brand new to 8.0. > > Is it my imagination, or does GENERIC still refer to D3.0? Perhaps > other places as well? I'll fix it. Thanks. -- Rui Paulo From rpaulo at FreeBSD.org Thu Oct 1 02:08:44 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Thu Oct 1 02:08:51 2009 Subject: svn commit: r197653 - in head/sys: amd64/conf i386/conf Message-ID: <200910010208.n9128hbK033492@svn.freebsd.org> Author: rpaulo Date: Thu Oct 1 02:08:42 2009 New Revision: 197653 URL: http://svn.freebsd.org/changeset/base/197653 Log: Improve 802.11s comment. Spotted by: dougb MFC after: 1 day Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Wed Sep 30 19:40:51 2009 (r197652) +++ head/sys/amd64/conf/GENERIC Thu Oct 1 02:08:42 2009 (r197653) @@ -257,7 +257,7 @@ device xe # Xircom pccard Ethernet device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Wed Sep 30 19:40:51 2009 (r197652) +++ head/sys/i386/conf/GENERIC Thu Oct 1 02:08:42 2009 (r197653) @@ -269,7 +269,7 @@ device xe # Xircom pccard Ethernet device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support From cokane at FreeBSD.org Thu Oct 1 02:43:51 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 02:43:57 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis Message-ID: <200910010243.n912hpSM034846@svn.freebsd.org> Author: cokane Date: Thu Oct 1 02:43:51 2009 New Revision: 197654 URL: http://svn.freebsd.org/changeset/base/197654 Log: style(9) fixes (always compare pointers to NULL) Also, the previous commit to sys/dev/if_ndis/if_ndis.c also included the removal of a call to ndis_setstate_80211 that is no longer needed. Submitted by: sam MFC after: 3 days Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:08:42 2009 (r197653) +++ head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:43:51 2009 (r197654) @@ -1534,7 +1534,7 @@ ndis_inputtask(dobj, arg) if (m == NULL) break; KeReleaseSpinLock(&sc->ndis_rxlock, irql); - if (sc->ndis_80211 && vap) + if ((sc->ndis_80211 != NULL) && (vap != NULL)) vap->iv_deliver_data(vap, vap->iv_bss, m); else (*ifp->if_input)(ifp, m); @@ -1746,7 +1746,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) { sc->ndis_link = 1; NDIS_UNLOCK(sc); - if (sc->ndis_80211 && vap) { + if ((sc->ndis_80211 != NULL) && (vap != NULL)) { ndis_getstate_80211(sc); ieee80211_new_state(vap, IEEE80211_S_RUN, -1); } @@ -1758,7 +1758,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) { sc->ndis_link = 0; NDIS_UNLOCK(sc); - if (sc->ndis_80211 && vap) + if ((sc->ndis_80211 != NULL) && (vap != NULL)) ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); NDIS_LOCK(sc); if_link_state_change(sc->ifp, LINK_STATE_DOWN); From philip at FreeBSD.org Thu Oct 1 08:16:47 2009 From: philip at FreeBSD.org (Philip Paeps) Date: Thu Oct 1 08:16:58 2009 Subject: svn commit: r197655 - svnadmin/conf Message-ID: <200910010816.n918GlT2042456@svn.freebsd.org> Author: philip Date: Thu Oct 1 08:16:46 2009 New Revision: 197655 URL: http://svn.freebsd.org/changeset/base/197655 Log: Take thomas's commit bit into safekeeping per his request. Approved by: core Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Thu Oct 1 02:43:51 2009 (r197654) +++ svnadmin/conf/access Thu Oct 1 08:16:46 2009 (r197655) @@ -209,7 +209,6 @@ suz syrinx takawata tanimura -thomas thompsa ticso trasz From rpaulo at FreeBSD.org Thu Oct 1 10:06:10 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Thu Oct 1 10:06:22 2009 Subject: svn commit: r197656 - in stable/8/sys: . amd64/conf amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/conf Message-ID: <200910011006.n91A6AFT047448@svn.freebsd.org> Author: rpaulo Date: Thu Oct 1 10:06:09 2009 New Revision: 197656 URL: http://svn.freebsd.org/changeset/base/197656 Log: MFC r197653: Improve 802.11s comment. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/conf/GENERIC stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/i386/conf/GENERIC Modified: stable/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Thu Oct 1 08:16:46 2009 (r197655) +++ stable/8/sys/amd64/conf/GENERIC Thu Oct 1 10:06:09 2009 (r197656) @@ -248,7 +248,7 @@ device xe # Xircom pccard Ethernet device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support Modified: stable/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Thu Oct 1 08:16:46 2009 (r197655) +++ stable/8/sys/i386/conf/GENERIC Thu Oct 1 10:06:09 2009 (r197656) @@ -260,7 +260,7 @@ device xe # Xircom pccard Ethernet device wlan # 802.11 support options IEEE80211_DEBUG # enable debug msgs options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support From bz at FreeBSD.org Thu Oct 1 10:30:08 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Oct 1 10:30:14 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <200910010243.n912hpSM034846@svn.freebsd.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> Message-ID: <20091001102557.E26486@maildrop.int.zabbadoz.net> On Thu, 1 Oct 2009, Coleman Kane wrote: > Author: cokane > Date: Thu Oct 1 02:43:51 2009 > New Revision: 197654 > URL: http://svn.freebsd.org/changeset/base/197654 > > Log: > style(9) fixes (always compare pointers to NULL) > > Also, the previous commit to sys/dev/if_ndis/if_ndis.c also included the > removal of a call to ndis_setstate_80211 that is no longer needed. The problem just is that sc->ndis_80211 is an integer and this broke the build. > Submitted by: sam > MFC after: 3 days > > Modified: > head/sys/dev/if_ndis/if_ndis.c > > Modified: head/sys/dev/if_ndis/if_ndis.c > ============================================================================== > --- head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:08:42 2009 (r197653) > +++ head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 02:43:51 2009 (r197654) > @@ -1534,7 +1534,7 @@ ndis_inputtask(dobj, arg) > if (m == NULL) > break; > KeReleaseSpinLock(&sc->ndis_rxlock, irql); > - if (sc->ndis_80211 && vap) > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > vap->iv_deliver_data(vap, vap->iv_bss, m); > else > (*ifp->if_input)(ifp, m); > @@ -1746,7 +1746,7 @@ ndis_ticktask(d, xsc) > sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) { > sc->ndis_link = 1; > NDIS_UNLOCK(sc); > - if (sc->ndis_80211 && vap) { > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) { > ndis_getstate_80211(sc); > ieee80211_new_state(vap, IEEE80211_S_RUN, -1); > } > @@ -1758,7 +1758,7 @@ ndis_ticktask(d, xsc) > sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) { > sc->ndis_link = 0; > NDIS_UNLOCK(sc); > - if (sc->ndis_80211 && vap) > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); > NDIS_LOCK(sc); > if_link_state_change(sc->ifp, LINK_STATE_DOWN); > -- Bjoern A. Zeeb It will not break if you know what you are doing. From des at des.no Thu Oct 1 10:33:52 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Oct 1 10:34:03 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <200910010243.n912hpSM034846@svn.freebsd.org> (Coleman Kane's message of "Thu, 1 Oct 2009 02:43:51 +0000 (UTC)") References: <200910010243.n912hpSM034846@svn.freebsd.org> Message-ID: <86eipno12p.fsf@ds4.des.no> Coleman Kane writes: > - if (sc->ndis_80211 && vap) > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) sc->ndis_80211 is an int. NULL is a pointer. DES -- Dag-Erling Sm?rgrav - des@des.no From nyan at FreeBSD.org Thu Oct 1 10:46:23 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Thu Oct 1 10:46:33 2009 Subject: svn commit: r197657 - head/sys/pc98/conf Message-ID: <200910011046.n91AkMqI048438@svn.freebsd.org> Author: nyan Date: Thu Oct 1 10:46:22 2009 New Revision: 197657 URL: http://svn.freebsd.org/changeset/base/197657 Log: MFi386: revision 197653 Improve 802.11s comment. MFC after: 1 day Modified: head/sys/pc98/conf/GENERIC Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Thu Oct 1 10:06:09 2009 (r197656) +++ head/sys/pc98/conf/GENERIC Thu Oct 1 10:46:22 2009 (r197657) @@ -223,7 +223,7 @@ device xe # Xircom pccard Ethernet #device wlan # 802.11 support #options IEEE80211_DEBUG # enable debug msgs #options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -#options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +#options IEEE80211_SUPPORT_MESH # enable 802.11s draft support #device wlan_wep # 802.11 WEP support #device wlan_ccmp # 802.11 CCMP support #device wlan_tkip # 802.11 TKIP support From avg at FreeBSD.org Thu Oct 1 10:53:13 2009 From: avg at FreeBSD.org (Andriy Gapon) Date: Thu Oct 1 10:53:19 2009 Subject: svn commit: r197658 - head/sys/kern Message-ID: <200910011053.n91ArCLW048615@svn.freebsd.org> Author: avg Date: Thu Oct 1 10:53:12 2009 New Revision: 197658 URL: http://svn.freebsd.org/changeset/base/197658 Log: print machine in kernel boot version string Discussed with: gavin, kib, jhb PR: kern/126926 MFC after: 2 weeks Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Oct 1 10:46:22 2009 (r197657) +++ head/sys/kern/init_main.c Thu Oct 1 10:53:12 2009 (r197658) @@ -288,11 +288,24 @@ print_caddr_t(void *data) { printf("%s", (char *)data); } + +static void +print_version(void *data __unused) +{ + int len; + + /* Strip a trailing newline from version. */ + len = strlen(version); + while (len > 0 && version[len - 1] == '\n') + len--; + printf("%.*s %s\n", len, version, machine); +} + SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, copyright); SYSINIT(trademark, SI_SUB_COPYRIGHT, SI_ORDER_SECOND, print_caddr_t, trademark); -SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_caddr_t, version); +SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_version, NULL); #ifdef WITNESS static char wit_warn[] = From cokane at FreeBSD.org Thu Oct 1 11:52:07 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 11:52:20 2009 Subject: svn commit: r197659 - head/sys/dev/if_ndis Message-ID: <200910011152.n91Bq7lt050048@svn.freebsd.org> Author: cokane Date: Thu Oct 1 11:52:06 2009 New Revision: 197659 URL: http://svn.freebsd.org/changeset/base/197659 Log: Fix a bad use of NULL instead of zero for int comparison. Sorry for the breakage. Submitted by: bz, des, onemda MFC after: 3 days Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 10:53:12 2009 (r197658) +++ head/sys/dev/if_ndis/if_ndis.c Thu Oct 1 11:52:06 2009 (r197659) @@ -1534,7 +1534,7 @@ ndis_inputtask(dobj, arg) if (m == NULL) break; KeReleaseSpinLock(&sc->ndis_rxlock, irql); - if ((sc->ndis_80211 != NULL) && (vap != NULL)) + if ((sc->ndis_80211 != 0) && (vap != NULL)) vap->iv_deliver_data(vap, vap->iv_bss, m); else (*ifp->if_input)(ifp, m); @@ -1746,7 +1746,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) { sc->ndis_link = 1; NDIS_UNLOCK(sc); - if ((sc->ndis_80211 != NULL) && (vap != NULL)) { + if ((sc->ndis_80211 != 0) && (vap != NULL)) { ndis_getstate_80211(sc); ieee80211_new_state(vap, IEEE80211_S_RUN, -1); } @@ -1758,7 +1758,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) { sc->ndis_link = 0; NDIS_UNLOCK(sc); - if ((sc->ndis_80211 != NULL) && (vap != NULL)) + if ((sc->ndis_80211 != 0) && (vap != NULL)) ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); NDIS_LOCK(sc); if_link_state_change(sc->ifp, LINK_STATE_DOWN); From amdmi3 at amdmi3.ru Thu Oct 1 12:06:56 2009 From: amdmi3 at amdmi3.ru (Dmitry Marakasov) Date: Thu Oct 1 12:07:02 2009 Subject: svn commit: r197608 - head/sys/geom/part In-Reply-To: References: <200909282352.n8SNql1n069970@svn.freebsd.org> <200909290749.08764.jhb@freebsd.org> <20090929145447.GA82539@hades.panopticon> <20090929235146.GA64567@hades.panopticon> Message-ID: <20091001120652.GI50565@hades.panopticon> * Marcel Moolenaar (xcllnt@mac.com) wrote: > >> Seconded. I've seen a report of geom_part_ebr unable to detect > >> partitions which were actually there. Will inquiry the reporter if > >> this change solved the problem. > > > > Seems like it hasn't. Here's the first sector from that partition: > > I'll see about checking the partition table more rigorously > so that we can eliminate the check for the unused space. > > With what tool was this created? Dunno. I've pointed the person who had that problem to this thread. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru From kib at FreeBSD.org Thu Oct 1 12:46:58 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:47:04 2009 Subject: svn commit: r197660 - head/sys/kern Message-ID: <200910011246.n91Ckw96051354@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:46:58 2009 New Revision: 197660 URL: http://svn.freebsd.org/changeset/base/197660 Log: Fix typo. MFC after: 3 days Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Thu Oct 1 11:52:06 2009 (r197659) +++ head/sys/kern/kern_sig.c Thu Oct 1 12:46:58 2009 (r197660) @@ -1892,7 +1892,7 @@ sigtd(struct proc *p, int sig, int prop) /* * Check if current thread can handle the signal without - * switching conetxt to another thread. + * switching context to another thread. */ if (curproc == p && !SIGISMEMBER(curthread->td_sigmask, sig)) return (curthread); From kib at FreeBSD.org Thu Oct 1 12:48:36 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:48:46 2009 Subject: svn commit: r197661 - head/sys/vm Message-ID: <200910011248.n91CmZBH051431@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:48:35 2009 New Revision: 197661 URL: http://svn.freebsd.org/changeset/base/197661 Log: Move the annotation for vm_map_startup() immediately before the function. MFC after: 3 days Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Thu Oct 1 12:46:58 2009 (r197660) +++ head/sys/vm/vm_map.c Thu Oct 1 12:48:35 2009 (r197661) @@ -116,22 +116,6 @@ __FBSDID("$FreeBSD$"); * another, and then marking both regions as copy-on-write. */ -/* - * vm_map_startup: - * - * Initialize the vm_map module. Must be called before - * any other vm_map routines. - * - * Map and entry structures are allocated from the general - * purpose memory pool with some exceptions: - * - * - The kernel map and kmem submap are allocated statically. - * - Kernel map entries are allocated out of a static pool. - * - * These restrictions are necessary since malloc() uses the - * maps and requires map entries. - */ - static struct mtx map_sleep_mtx; static uma_zone_t mapentzone; static uma_zone_t kmapentzone; @@ -176,6 +160,22 @@ static void vmspace_zdtor(void *mem, int start = end; \ } +/* + * vm_map_startup: + * + * Initialize the vm_map module. Must be called before + * any other vm_map routines. + * + * Map and entry structures are allocated from the general + * purpose memory pool with some exceptions: + * + * - The kernel map and kmem submap are allocated statically. + * - Kernel map entries are allocated out of a static pool. + * + * These restrictions are necessary since malloc() uses the + * maps and requires map entries. + */ + void vm_map_startup(void) { From kib at FreeBSD.org Thu Oct 1 12:50:27 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:50:34 2009 Subject: svn commit: r197662 - head/sys/kern Message-ID: <200910011250.n91CoQ5G051511@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:50:26 2009 New Revision: 197662 URL: http://svn.freebsd.org/changeset/base/197662 Log: Do not dereference vp->v_mount without holding vnode lock and checking that the vnode is not reclaimed. Noted by: Igor Sysoev MFC after: 1 week Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu Oct 1 12:48:35 2009 (r197661) +++ head/sys/kern/uipc_syscalls.c Thu Oct 1 12:50:26 2009 (r197662) @@ -2086,9 +2086,11 @@ retry_space: /* * Get the page from backing store. */ - bsize = vp->v_mount->mnt_stat.f_iosize; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_SHARED | LK_RETRY); + error = vn_lock(vp, LK_SHARED); + if (error != 0) + goto after_read; + bsize = vp->v_mount->mnt_stat.f_iosize; /* * XXXMAC: Because we don't have fp->f_cred @@ -2101,6 +2103,7 @@ retry_space: IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), td->td_ucred, NOCRED, &resid, td); VOP_UNLOCK(vp, 0); + after_read: VFS_UNLOCK_GIANT(vfslocked); VM_OBJECT_LOCK(obj); vm_page_io_finish(pg); From kib at FreeBSD.org Thu Oct 1 12:52:49 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 1 12:53:00 2009 Subject: svn commit: r197663 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200910011252.n91Cqmlb051599@svn.freebsd.org> Author: kib Date: Thu Oct 1 12:52:48 2009 New Revision: 197663 URL: http://svn.freebsd.org/changeset/base/197663 Log: As a workaround, for Intel CPUs, do not use CLFLUSH in pmap_invalidate_cache_range() when self-snoop is apparently not reported in cpu features. We get a reserved trap when clflushing APIC registers window. XEN in full system virtualization mode removes self-snoop from CPU features, making this a problem. Tested by: csjp Reviewed by: alc MFC after: 3 days Modified: head/sys/amd64/amd64/initcpu.c head/sys/i386/i386/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Thu Oct 1 12:50:26 2009 (r197662) +++ head/sys/amd64/amd64/initcpu.c Thu Oct 1 12:52:48 2009 (r197663) @@ -165,4 +165,10 @@ initializecpu(void) */ if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; + /* + * XXXKIB: (temporary) hack to work around traps generated when + * CLFLUSHing APIC registers window. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + cpu_feature &= ~CPUID_CLFSH; } Modified: head/sys/i386/i386/initcpu.c ============================================================================== --- head/sys/i386/i386/initcpu.c Thu Oct 1 12:50:26 2009 (r197662) +++ head/sys/i386/i386/initcpu.c Thu Oct 1 12:52:48 2009 (r197663) @@ -717,6 +717,12 @@ initializecpu(void) */ if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; + /* + * XXXKIB: (temporary) hack to work around traps generated when + * CLFLUSHing APIC registers window. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + cpu_feature &= ~CPUID_CLFSH; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) /* From jamie at FreeBSD.org Thu Oct 1 13:11:46 2009 From: jamie at FreeBSD.org (Jamie Gritton) Date: Thu Oct 1 13:11:57 2009 Subject: svn commit: r197667 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern rpc/rpcsec_gss Message-ID: <200910011311.n91DBkOf052250@svn.freebsd.org> Author: jamie Date: Thu Oct 1 13:11:45 2009 New Revision: 197667 URL: http://svn.freebsd.org/changeset/base/197667 Log: MFC r197581, r197583, r197584: Set the prison in NFS anon and GSS SVC creds. Reviewed by: marcel Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/vfs_export.c stable/8/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Modified: stable/8/sys/kern/vfs_export.c ============================================================================== --- stable/8/sys/kern/vfs_export.c Thu Oct 1 13:03:17 2009 (r197666) +++ stable/8/sys/kern/vfs_export.c Thu Oct 1 13:11:45 2009 (r197667) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -122,6 +123,8 @@ vfs_hang_addrlist(struct mount *mp, stru np->netc_anon->cr_uid = argp->ex_anon.cr_uid; crsetgroups(np->netc_anon, argp->ex_anon.cr_ngroups, argp->ex_anon.cr_groups); + np->netc_anon->cr_prison = &prison0; + prison_hold(np->netc_anon->cr_prison); np->netc_numsecflavors = argp->ex_numsecflavors; bcopy(argp->ex_secflavors, np->netc_secflavors, sizeof(np->netc_secflavors)); @@ -206,6 +209,8 @@ vfs_hang_addrlist(struct mount *mp, stru np->netc_anon->cr_uid = argp->ex_anon.cr_uid; crsetgroups(np->netc_anon, argp->ex_anon.cr_ngroups, np->netc_anon->cr_groups); + np->netc_anon->cr_prison = &prison0; + prison_hold(np->netc_anon->cr_prison); np->netc_numsecflavors = argp->ex_numsecflavors; bcopy(argp->ex_secflavors, np->netc_secflavors, sizeof(np->netc_secflavors)); Modified: stable/8/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c ============================================================================== --- stable/8/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Thu Oct 1 13:03:17 2009 (r197666) +++ stable/8/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Thu Oct 1 13:11:45 2009 (r197667) @@ -449,6 +449,8 @@ rpc_gss_svc_getcred(struct svc_req *req, cr->cr_uid = cr->cr_ruid = cr->cr_svuid = uc->uid; cr->cr_rgid = cr->cr_svgid = uc->gid; crsetgroups(cr, uc->gidlen, uc->gidlist); + cr->cr_prison = &prison0; + prison_hold(cr->cr_prison); *crp = crhold(cr); return (TRUE); From cokane at FreeBSD.org Thu Oct 1 13:13:08 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 13:13:15 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <86eipno12p.fsf@ds4.des.no> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> Message-ID: <1254401817.4255.14.camel@localhost> On Thu, 2009-10-01 at 12:33 +0200, Dag-Erling Sm?rgrav wrote: > Coleman Kane writes: > > - if (sc->ndis_80211 && vap) > > + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > > sc->ndis_80211 is an int. NULL is a pointer. > > DES Thanks, fix committed... I know style(9) says I should have not bothered with the commit, but the assume-that-zero-is-false logic seemed egregious enough at the time to warrant correcting it. I just corrected it improperly in my haste. Enjoy being able to buildkernel again. I'll be sitting in the corner. -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091001/948de7d1/attachment.pgp From attilio at freebsd.org Thu Oct 1 13:21:36 2009 From: attilio at freebsd.org (Attilio Rao) Date: Thu Oct 1 13:21:48 2009 Subject: svn commit: r197643 - in head/sys: kern sys In-Reply-To: References: <200909301326.n8UDQVB1016396@svn.freebsd.org> Message-ID: <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> 2009/9/30 Robert Watson : > On Wed, 30 Sep 2009, Attilio Rao wrote: > >> When releasing a read/shared lock we need to use a write memory barrier >> in order to avoid, on architectures which doesn't have strong ordered >> writes, CPU instructions reordering. > > Hi Attilio (Fabio, et al), > > Nice catch! Are we aware of specific reported problems that can be laid at > the feet of this bug, or was this more of a "wait a moment, shouldn't there > be a barrier there?". Could you comment on the scope of this problem across > architectures we support? A possible problem related to that would be MD specific and not on ia32/amd64 because there the barriers and simple atomics are the same. Given that sun4v suffers of serveral other problems, that MIPS has no SMP support, you would find it only for arm, ia64 and sparc eventually. Thus I'm not aware of any problem which can be reconducted to that. Attilio -- Peace can only be achieved by understanding - A. Einstein From stas at FreeBSD.org Thu Oct 1 13:41:39 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Thu Oct 1 13:41:54 2009 Subject: svn commit: r197643 - in head/sys: kern sys In-Reply-To: <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> References: <200909301326.n8UDQVB1016396@svn.freebsd.org> <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> Message-ID: <20091001174130.0d3bec21.stas@FreeBSD.org> On Thu, 1 Oct 2009 15:21:34 +0200 Attilio Rao mentioned: > 2009/9/30 Robert Watson : > > On Wed, 30 Sep 2009, Attilio Rao wrote: > > > >> When releasing a read/shared lock we need to use a write memory barrier > >> in order to avoid, on architectures which doesn't have strong ordered > >> writes, CPU instructions reordering. > > > > Hi Attilio (Fabio, et al), > > > > Nice catch! Are we aware of specific reported problems that can be laid at > > the feet of this bug, or was this more of a "wait a moment, shouldn't there > > be a barrier there?". Could you comment on the scope of this problem across > > architectures we support? > > A possible problem related to that would be MD specific and not on > ia32/amd64 because there the barriers and simple atomics are the same. > Given that sun4v suffers of serveral other problems, that MIPS has no > SMP support, you would find it only for arm, ia64 and sparc > eventually. Thus I'm not aware of any problem which can be reconducted > to that. > Actually, MIPS is going to grow SMP support really soon, and ARM cpus do not do reordering until ARMv7 afaik. So this should not result in any real problems on ARM too. OTOH, I suspect powerpc may be affected. I'm not sure if any of the models we support perform OOO, though. -- Stanislav Sedov ST4096-RIPE -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091001/411577bc/attachment.pgp From raj at semihalf.com Thu Oct 1 13:56:09 2009 From: raj at semihalf.com (Rafal Jaworowski) Date: Thu Oct 1 13:56:20 2009 Subject: svn commit: r197643 - in head/sys: kern sys In-Reply-To: <20091001174130.0d3bec21.stas@FreeBSD.org> References: <200909301326.n8UDQVB1016396@svn.freebsd.org> <3bbf2fe10910010621u72d0f692h8f9c4a783667253d@mail.gmail.com> <20091001174130.0d3bec21.stas@FreeBSD.org> Message-ID: <2B51434B-9A1D-4711-9648-1A49B125C785@semihalf.com> On 2009-10-01, at 15:41, Stanislav Sedov wrote: > On Thu, 1 Oct 2009 15:21:34 +0200 > Attilio Rao mentioned: > >> 2009/9/30 Robert Watson : >>> On Wed, 30 Sep 2009, Attilio Rao wrote: >>> >>>> When releasing a read/shared lock we need to use a write memory >>>> barrier >>>> in order to avoid, on architectures which doesn't have strong >>>> ordered >>>> writes, CPU instructions reordering. >>> >>> Hi Attilio (Fabio, et al), >>> >>> Nice catch! Are we aware of specific reported problems that can >>> be laid at >>> the feet of this bug, or was this more of a "wait a moment, >>> shouldn't there >>> be a barrier there?". Could you comment on the scope of this >>> problem across >>> architectures we support? >> >> A possible problem related to that would be MD specific and not on >> ia32/amd64 because there the barriers and simple atomics are the >> same. >> Given that sun4v suffers of serveral other problems, that MIPS has no >> SMP support, you would find it only for arm, ia64 and sparc >> eventually. Thus I'm not aware of any problem which can be >> reconducted >> to that. >> > > Actually, MIPS is going to grow SMP support really soon, and ARM cpus > do not do reordering until ARMv7 afaik. So this should not result in > any real problems on ARM too. Even past generation ARM can do out-of-order execution: see Marvell Feroceon cores which are v5 ISA compatible, although their internal microarchitecture has extended features like this. > OTOH, I suspect powerpc may be affected. I'm not sure if any of the > models > we support perform OOO, though. PowerPC is inherently OOOE. Rafal From des at des.no Thu Oct 1 14:03:22 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Oct 1 14:03:33 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <1254401817.4255.14.camel@localhost> (Coleman Kane's message of "Thu, 01 Oct 2009 08:56:57 -0400") References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <1254401817.4255.14.camel@localhost> Message-ID: <86ab0bnrdj.fsf@ds4.des.no> Coleman Kane writes: > Thanks, fix committed... I know style(9) says I should have not bothered > with the commit, but the assume-that-zero-is-false logic seemed > egregious enough at the time to warrant correcting it. Depends. Is ndis_80211 purely a boolean value? If yes, it should probably be a bit field; if no, style(9) clearly says that you should use an explicit comparison. (a quick perusal of the source says it isn't, so an explicit comparison is required) > I just corrected it improperly in my haste. Enjoy being able to > buildkernel again. I'll be sitting in the corner. Don't worry, you'll be in good company there :) DES -- Dag-Erling Sm?rgrav - des@des.no From brde at optusnet.com.au Thu Oct 1 14:36:15 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Thu Oct 1 14:36:27 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <86eipno12p.fsf@ds4.des.no> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> Message-ID: <20091002002534.D21507@delplex.bde.org> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Smørgrav wrote: > Coleman Kane writes: >> - if (sc->ndis_80211 && vap) >> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > > sc->ndis_80211 is an int. NULL is a pointer. Also, the number of style bugs was doubled on (almost?) every changed line by adding 2 sets of unnecessary parentheses. Bruce From nyan at FreeBSD.org Thu Oct 1 14:42:55 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Thu Oct 1 14:43:12 2009 Subject: svn commit: r197669 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci modules/nfslockd Message-ID: <200910011442.n91Egt6A054377@svn.freebsd.org> Author: nyan Date: Thu Oct 1 14:42:55 2009 New Revision: 197669 URL: http://svn.freebsd.org/changeset/base/197669 Log: MFC: revision 197535 Add '#define NFSCLIENT' into opt_nfs.h if the NFSCLIENT variable is 1 (the default is 1). This makes the nfslockd module works for NFS client. Reviewed by: dfr Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/nfslockd/Makefile Modified: stable/8/sys/modules/nfslockd/Makefile ============================================================================== --- stable/8/sys/modules/nfslockd/Makefile Thu Oct 1 13:16:24 2009 (r197668) +++ stable/8/sys/modules/nfslockd/Makefile Thu Oct 1 14:42:55 2009 (r197669) @@ -14,11 +14,18 @@ SRCS+= opt_inet6.h opt_nfs.h .if !defined(KERNBUILDDIR) NFS_INET6?= 1 # 0/1 - requires INET6 to be configured in kernel +NFSCLIENT?= 1 # 0/1 - requires NFSCLIENT to be configured in kernel .if ${NFS_INET6} > 0 opt_inet6.h: echo "#define INET6 1" > ${.TARGET} .endif + +.if ${NFSCLIENT} > 0 +opt_nfs.h: + echo "#define NFSCLIENT 1" > ${.TARGET} +.endif + .endif .include From des at FreeBSD.org Thu Oct 1 15:19:38 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Thu Oct 1 15:19:47 2009 Subject: svn commit: r197670 - in vendor-crypto/openssh/dist: . contrib/aix contrib/caldera contrib/cygwin contrib/redhat contrib/suse openbsd-compat Message-ID: <200910011519.n91FJbKT055320@svn.freebsd.org> Author: des Date: Thu Oct 1 15:19:37 2009 New Revision: 197670 URL: http://svn.freebsd.org/changeset/base/197670 Log: Vendor import of OpenSSH 5.3p1 Added: vendor-crypto/openssh/dist/roaming.h (contents, props changed) vendor-crypto/openssh/dist/roaming_common.c (contents, props changed) vendor-crypto/openssh/dist/roaming_dummy.c (contents, props changed) vendor-crypto/openssh/dist/schnorr.h (contents, props changed) Modified: vendor-crypto/openssh/dist/ChangeLog vendor-crypto/openssh/dist/Makefile.in vendor-crypto/openssh/dist/README vendor-crypto/openssh/dist/README.platform vendor-crypto/openssh/dist/auth-pam.c vendor-crypto/openssh/dist/auth-passwd.c vendor-crypto/openssh/dist/auth-sia.c vendor-crypto/openssh/dist/auth1.c vendor-crypto/openssh/dist/auth2-jpake.c vendor-crypto/openssh/dist/auth2-kbdint.c vendor-crypto/openssh/dist/auth2-none.c vendor-crypto/openssh/dist/auth2-passwd.c vendor-crypto/openssh/dist/auth2-pubkey.c vendor-crypto/openssh/dist/auth2.c vendor-crypto/openssh/dist/canohost.c vendor-crypto/openssh/dist/canohost.h vendor-crypto/openssh/dist/channels.c vendor-crypto/openssh/dist/clientloop.c vendor-crypto/openssh/dist/config.h.in vendor-crypto/openssh/dist/configure (contents, props changed) vendor-crypto/openssh/dist/configure.ac vendor-crypto/openssh/dist/contrib/aix/buildbff.sh vendor-crypto/openssh/dist/contrib/caldera/openssh.spec vendor-crypto/openssh/dist/contrib/cygwin/ssh-host-config vendor-crypto/openssh/dist/contrib/cygwin/ssh-user-config vendor-crypto/openssh/dist/contrib/redhat/openssh.spec vendor-crypto/openssh/dist/contrib/suse/openssh.spec vendor-crypto/openssh/dist/defines.h vendor-crypto/openssh/dist/gss-genr.c vendor-crypto/openssh/dist/includes.h vendor-crypto/openssh/dist/jpake.c vendor-crypto/openssh/dist/jpake.h vendor-crypto/openssh/dist/kex.c vendor-crypto/openssh/dist/kex.h vendor-crypto/openssh/dist/kexdhs.c vendor-crypto/openssh/dist/kexgexs.c vendor-crypto/openssh/dist/moduli.0 vendor-crypto/openssh/dist/monitor.c vendor-crypto/openssh/dist/monitor_mm.c vendor-crypto/openssh/dist/monitor_wrap.c vendor-crypto/openssh/dist/monitor_wrap.h vendor-crypto/openssh/dist/openbsd-compat/bsd-cygwin_util.c vendor-crypto/openssh/dist/openbsd-compat/bsd-cygwin_util.h vendor-crypto/openssh/dist/openbsd-compat/daemon.c vendor-crypto/openssh/dist/openbsd-compat/getrrsetbyname.c vendor-crypto/openssh/dist/openbsd-compat/openssl-compat.c vendor-crypto/openssh/dist/openbsd-compat/openssl-compat.h vendor-crypto/openssh/dist/openbsd-compat/port-aix.c vendor-crypto/openssh/dist/openbsd-compat/port-aix.h vendor-crypto/openssh/dist/packet.c vendor-crypto/openssh/dist/packet.h vendor-crypto/openssh/dist/readconf.c vendor-crypto/openssh/dist/readconf.h vendor-crypto/openssh/dist/schnorr.c vendor-crypto/openssh/dist/scp.0 vendor-crypto/openssh/dist/servconf.c vendor-crypto/openssh/dist/serverloop.c vendor-crypto/openssh/dist/session.c vendor-crypto/openssh/dist/sftp-client.c vendor-crypto/openssh/dist/sftp-server.0 vendor-crypto/openssh/dist/sftp-server.8 vendor-crypto/openssh/dist/sftp-server.c vendor-crypto/openssh/dist/sftp.0 vendor-crypto/openssh/dist/ssh-add.0 vendor-crypto/openssh/dist/ssh-agent.0 vendor-crypto/openssh/dist/ssh-agent.1 vendor-crypto/openssh/dist/ssh-agent.c vendor-crypto/openssh/dist/ssh-keygen.0 vendor-crypto/openssh/dist/ssh-keygen.c vendor-crypto/openssh/dist/ssh-keyscan.0 vendor-crypto/openssh/dist/ssh-keysign.0 vendor-crypto/openssh/dist/ssh-rand-helper.0 vendor-crypto/openssh/dist/ssh.0 vendor-crypto/openssh/dist/ssh.1 vendor-crypto/openssh/dist/ssh.c vendor-crypto/openssh/dist/ssh_config.0 vendor-crypto/openssh/dist/sshconnect.c vendor-crypto/openssh/dist/sshconnect.h vendor-crypto/openssh/dist/sshconnect2.c vendor-crypto/openssh/dist/sshd.0 vendor-crypto/openssh/dist/sshd.8 vendor-crypto/openssh/dist/sshd.c vendor-crypto/openssh/dist/sshd_config.0 vendor-crypto/openssh/dist/sshd_config.5 vendor-crypto/openssh/dist/sshlogin.c vendor-crypto/openssh/dist/uuencode.c vendor-crypto/openssh/dist/version.h Modified: vendor-crypto/openssh/dist/ChangeLog ============================================================================== --- vendor-crypto/openssh/dist/ChangeLog Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/ChangeLog Thu Oct 1 15:19:37 2009 (r197670) @@ -1,3 +1,282 @@ +20090926 + - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Update for release + - (djm) [README] update relnotes URL + - (djm) [packet.c] Restore EWOULDBLOCK handling that got lost somewhere + - (djm) Release 5.3p1 + +20090911 + - (dtucker) [configure.ac] Change the -lresolv check so it works on Mac OS X + 10.6 (which doesn't have BIND8_COMPAT and thus uses res_9_query). Patch + from jbasney at ncsa uiuc edu. + +20090908 + - (djm) [serverloop.c] Fix test for server-assigned remote forwarding port + (-R 0:...); bz#1578, spotted and fix by gavin AT emf.net; ok dtucker@ + +20090901 + - (dtucker) [configure.ac] Bug #1639: use AC_PATH_PROG to search the path for + krb5-config if it's not in the location specified by --with-kerberos5. + Patch from jchadima at redhat. + +20090829 + - (dtucker) [README.platform] Add text about development packages, based on + text from Chris Pepper in bug #1631. + +20090828 + - dtucker [auth-sia.c] Roll back the change for bug #1241 as it apparently + causes problems in some Tru64 configurations. + - (djm) [sshd_config.5] downgrade mention of login.conf to be an example + and mention PAM as another provider for ChallengeResponseAuthentication; + bz#1408; ok dtucker@ + - (djm) [sftp-server.c] bz#1535: accept ENOSYS as a fallback error when + attempting atomic rename(); ok dtucker@ + - (djm) [Makefile.in] bz#1505: Solaris make(1) doesn't accept make variables + in argv, so pass them in the environment; ok dtucker@ + - (dtucker) [channels.c configure.ac] Bug #1528: skip the tcgetattr call on + the pty master on Solaris, since it never succeeds and can hang if large + amounts of data is sent to the slave (eg a copy-paste). Based on a patch + originally from Doke Scott, ok djm@ + - (dtucker) [clientloop.c configure.ac defines.h] Make the client's IO buffer + size a compile-time option and set it to 64k on Cygwin, since Corinna + reports that it makes a significant difference to performance. ok djm@ + - (dtucker) [configure.ac] Fix the syntax of the Solaris tcgetattr entry. + +20090820 + - (dtucker) [includes.h] Bug #1634: do not include system glob.h if we're not + using it since the type conflicts can cause problems on FreeBSD. Patch + from Jonathan Chen. + - (dtucker) [session.c openbsd-compat/port-aix.h] Bugs #1249 and #1567: move + the setpcred call on AIX to immediately before the permanently_set_uid(). + Ensures that we still have privileges when we call chroot and + pam_open_sesson. Based on a patch from David Leonard. + +20090817 + - (dtucker) [configure.ac] Check for headers before libraries for openssl an + zlib, which should make the errors slightly more meaningful on platforms + where there's separate "-devel" packages for those. + - (dtucker) [sshlogin.c openbsd-compat/port-aix.{c,h}] Bug #1595: make + PrintLastLog work on AIX. Based in part on a patch from Miguel Sanders. + +20090729 + - (tim) [contrib/cygwin/ssh-user-config] Change script to call correct error + function. Patch from Corinna Vinschen. + +20090713 + - (dtucker) [openbsd-compat/getrrsetbyname.c] Reduce answer buffer size so it + fits into 16 bits to work around a bug in glibc's resolver where it masks + off the buffer size at 16 bits. Patch from Hauke Lampe, ok djm jakob. + +20090712 + - (dtucker) [configure.ac] Include sys/param.h for the sys/mount.h test, + prevents configure complaining on older BSDs. + - (dtucker [contrib/cygwin/ssh-{host,user}-config] Add license text. Patch + from Corinna Vinschen. + - (dtucker) [auth-pam.c] Bug #1534: move the deletion of PAM credentials on + logout to after the session close. Patch from Anicka Bernathova, + originally from Andreas Schwab via Novelll ok djm. + +20090707 + - (dtucker) [contrib/cygwin/ssh-host-config] better support for automated + scripts and fix usage of eval. Patch from Corinna Vinschen. + +20090705 + - (dtucker) OpenBSD CVS Sync + - andreas@cvs.openbsd.org 2009/06/27 09:29:06 + [packet.h packet.c] + packet_bacup_state() and packet_restore_state() will be used to + temporarily save the current state ren resuming a suspended connection. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:32:43 + [roaming_common.c roaming.h] + It may be necessary to retransmit some data when resuming, so add it + to a buffer when roaming is enabled. + Most of this code was written by Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:35:06 + [readconf.h readconf.c] + Add client option UseRoaming. It doesn't do anything yet but will + control whether the client tries to use roaming if enabled on the + server. From Martin Forssen. + ok markus@ + - markus@cvs.openbsd.org 2009/06/30 14:54:40 + [version.h] + crank version; ok deraadt + - dtucker@cvs.openbsd.org 2009/07/02 02:11:47 + [ssh.c] + allow for long home dir paths (bz #1615). ok deraadt + (based in part on a patch from jchadima at redhat) + - stevesk@cvs.openbsd.org 2009/07/05 19:28:33 + [clientloop.c] + only send SSH2_MSG_DISCONNECT if we're in compat20; from dtucker@ + ok deraadt@ markus@ + +20090622 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2009/06/22 05:39:28 + [monitor_wrap.c monitor_mm.c ssh-keygen.c auth2.c gss-genr.c sftp-client.c] + alphabetize includes; reduces diff vs portable and style(9). + ok stevesk djm + (Id sync only; these were already in order in -portable) + +20090621 + - (dtucker) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2009/03/17 21:37:00 + [ssh.c] + pass correct argv[0] to openlog(); ok djm@ + - jmc@cvs.openbsd.org 2009/03/19 15:15:09 + [ssh.1] + for "Ciphers", just point the reader to the keyword in ssh_config(5), just + as we do for "MACs": this stops us getting out of sync when the lists + change; + fixes documentation/6102, submitted by Peter J. Philipp + alternative fix proposed by djm + ok markus + - tobias@cvs.openbsd.org 2009/03/23 08:31:19 + [ssh-agent.c] + Fixed a possible out-of-bounds memory access if the environment variable + SHELL is shorter than 3 characters. + with input by and ok dtucker + - tobias@cvs.openbsd.org 2009/03/23 19:38:04 + [ssh-agent.c] + My previous commit didn't fix the problem at all, so stick at my first + version of the fix presented to dtucker. + Issue notified by Matthias Barkhoff (matthias dot barkhoff at gmx dot de). + ok dtucker + - sobrado@cvs.openbsd.org 2009/03/26 08:38:39 + [sftp-server.8 sshd.8 ssh-agent.1] + fix a few typographical errors found by spell(1). + ok dtucker@, jmc@ + - stevesk@cvs.openbsd.org 2009/04/13 19:07:44 + [sshd_config.5] + fix possessive; ok djm@ + - stevesk@cvs.openbsd.org 2009/04/14 16:33:42 + [sftp-server.c] + remove unused option character from getopt() optstring; ok markus@ + - jj@cvs.openbsd.org 2009/04/14 21:10:54 + [servconf.c] + Fixed a few the-the misspellings in comments. Skipped a bunch in + binutils,gcc and so on. ok jmc@ + - stevesk@cvs.openbsd.org 2009/04/17 19:23:06 + [session.c] + use INTERNAL_SFTP_NAME for setproctitle() of in-process sftp-server; + ok djm@ markus@ + - stevesk@cvs.openbsd.org 2009/04/17 19:40:17 + [sshd_config.5] + clarify that even internal-sftp needs /dev/log for logging to work; ok + markus@ + - jmc@cvs.openbsd.org 2009/04/18 18:39:10 + [sshd_config.5] + tweak previous; ok stevesk + - stevesk@cvs.openbsd.org 2009/04/21 15:13:17 + [sshd_config.5] + clarify we cd to user's home after chroot; ok markus@ on + earlier version; tweaks and ok jmc@ + - andreas@cvs.openbsd.org 2009/05/25 06:48:01 + [channels.c packet.c clientloop.c packet.h serverloop.c monitor_wrap.c + monitor.c] + Put the globals in packet.c into a struct and don't access it directly + from other files. No functional changes. + ok markus@ djm@ + - andreas@cvs.openbsd.org 2009/05/27 06:31:25 + [canohost.h canohost.c] + Add clear_cached_addr(), needed for upcoming changes allowing the peer + address to change. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:33:39 + [clientloop.c] + Send SSH2_MSG_DISCONNECT when the client disconnects. From a larger + change from Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:34:36 + [kex.c kex.h] + Move the KEX_COOKIE_LEN define to kex.h + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:36:07 + [packet.h packet.c] + Add packet_put_int64() and packet_get_int64(), part of a larger change + from Martin Forssen. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:38:16 + [sshconnect.h sshconnect.c] + Un-static ssh_exchange_identification(), part of a larger change from + Martin Forssen and needed for upcoming changes. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/28 16:50:16 + [sshd.c packet.c serverloop.c monitor_wrap.c clientloop.c sshconnect.c + monitor.c Added roaming.h roaming_common.c roaming_dummy.c] + Keep track of number of bytes read and written. Needed for upcoming + changes. Most code from Martin Forssen, maf at appgate dot com. + ok markus@ + Also, applied appropriate changes to Makefile.in + - andreas@cvs.openbsd.org 2009/06/12 20:43:22 + [monitor.c packet.c] + Fix warnings found by chl@ and djm@ and change roaming_atomicio's + return type to match atomicio's + Diff from djm@, ok markus@ + - andreas@cvs.openbsd.org 2009/06/12 20:58:32 + [packet.c] + Move some more statics into session_state + ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 07:37:15 + [kexdhs.c kexgexs.c] + abort if key_sign fails, preventing possible null deref. Based on report + from Paolo Ganci, ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 09:04:03 + [roaming.h roaming_common.c roaming_dummy.c] + Add tags for the benefit of the sync scripts + Also: pull in the changes for 1.1->1.2 missed in the previous sync. + - (dtucker) [auth2-jpake.c auth2.c canohost.h session.c] Whitespace and + header-order changes to reduce diff vs OpenBSD. + - (dtucker) [servconf.c sshd.c] More whitespace sync. + - (dtucker) [roaming_common.c roaming_dummy.c] Wrap #include in + ifdef. + +20090616 + - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t + is a struct with a __val member. Fixes build on, eg, Redhat 6.2. + +20090504 + - (dtucker) [sshlogin.c] Move the NO_SSH_LASTLOG #ifndef line to include + variable declarations. Should prevent unused warnings anywhere it's set + (only Crays as far as I can tell) and be a no-op everywhere else. + +20090318 + - (tim) [configure.ac] Remove setting IP_TOS_IS_BROKEN for Cygwin. The problem + that setsockopt(IP_TOS) doesn't work on Cygwin has been fixed since 2005. + Based on patch from vinschen at redhat com. + +20090308 + - (dtucker) [auth-passwd.c auth1.c auth2-kbdint.c auth2-none.c auth2-passwd.c + auth2-pubkey.c session.c openbsd-compat/bsd-cygwin_util.{c,h} + openbsd-compat/daemon.c] Remove support for Windows 95/98/ME and very old + version of Cygwin. Patch from vinschen at redhat com. + +20090307 + - (dtucker) [contrib/aix/buildbff.sh] Only try to rename ssh_prng_cmds if it + exists (it's not created if OpenSSL's PRNG is self-seeded, eg if the OS + has a /dev/random). + - (dtucker) [schnorr.c openbsd-compat/openssl-compat.{c,h}] Add + EVP_DigestUpdate to the OLD_EVP compatibility functions and tell schnorr.c + to use them. Allows building with older OpenSSL versions. + - (dtucker) [configure.ac defines.h] Check for in_port_t and typedef if needed. + - (dtucker) [configure.ac] Missing comma in type list. + - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] + EVP_DigestUpdate does not exactly match the other OLD_EVP functions (eg + in openssl 0.9.6) so add an explicit test for it. + +20090306 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2009/03/05 07:18:19 + [auth2-jpake.c jpake.c jpake.h monitor_wrap.c monitor_wrap.h schnorr.c] + [sshconnect2.c] + refactor the (disabled) Schnorr proof code to make it a little more + generally useful + - djm@cvs.openbsd.org 2009/03/05 11:30:50 + [uuencode.c] + document what these functions do so I don't ever have to recuse into + b64_pton/ntop to remember their return values + 20090223 - (djm) OpenBSD CVS Sync - djm@cvs.openbsd.org 2009/02/22 23:50:57 Modified: vendor-crypto/openssh/dist/Makefile.in ============================================================================== --- vendor-crypto/openssh/dist/Makefile.in Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/Makefile.in Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.298 2008/11/05 05:20:46 djm Exp $ +# $Id: Makefile.in,v 1.300 2009/08/28 00:47:38 djm Exp $ # uncomment if you run a non bourne compatable shell. Ie. csh #SHELL = @SH@ @@ -74,7 +74,8 @@ LIBSSH_OBJS=acss.o authfd.o authfile.o b entropy.o scard-opensc.o gss-genr.o umac.o jpake.o schnorr.o SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ - sshconnect.o sshconnect1.o sshconnect2.o mux.o + sshconnect.o sshconnect1.o sshconnect2.o mux.o \ + roaming_common.o SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ sshpty.o sshlogin.o servconf.o serverloop.o \ @@ -86,7 +87,8 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passw auth-krb5.o \ auth2-gss.o gss-serv.o gss-serv-krb5.o \ loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ - audit.o audit-bsm.o platform.o sftp-server.o sftp-common.o + audit.o audit-bsm.o platform.o sftp-server.o sftp-common.o \ + roaming_common.o MANPAGES = moduli.5.out scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-rand-helper.8.out ssh-keysign.8.out sshd_config.5.out ssh_config.5.out MANPAGES_IN = moduli.5 scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 ssh-rand-helper.8 ssh-keysign.8 sshd_config.5 ssh_config.5 @@ -151,11 +153,11 @@ ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh. ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o $(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) -ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o - $(LD) -o $@ ssh-keysign.o readconf.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) +ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o roaming_dummy.o + $(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) -ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o - $(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) +ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o + $(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o $(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) @@ -240,7 +242,7 @@ check-config: -$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config scard-install: - (cd scard && $(MAKE) DESTDIR=$(DESTDIR) install) + (cd scard && env DESTDIR=$(DESTDIR) $(MAKE) DESTDIR=$(DESTDIR) install) install-files: scard-install $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) Modified: vendor-crypto/openssh/dist/README ============================================================================== --- vendor-crypto/openssh/dist/README Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/README Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -See http://www.openssh.com/txt/release-5.2 for the release notes. +See http://www.openssh.com/txt/release-5.3 for the release notes. - A Japanese translation of this document and of the OpenSSH FAQ is - available at http://www.unixuser.org/~haruyama/security/openssh/index.html @@ -62,4 +62,4 @@ References - [6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 [7] http://www.openssh.com/faq.html -$Id: README,v 1.70 2009/02/23 00:11:57 djm Exp $ +$Id: README,v 1.70.4.1 2009/09/26 04:11:47 djm Exp $ Modified: vendor-crypto/openssh/dist/README.platform ============================================================================== --- vendor-crypto/openssh/dist/README.platform Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/README.platform Thu Oct 1 15:19:37 2009 (r197670) @@ -56,6 +56,18 @@ using a third party driver. More informa http://www-user.rhrk.uni-kl.de/~nissler/tuntap/ +Linux +----- + +Some Linux distributions (including Red Hat/Fedora/CentOS) include +headers and library links in the -devel RPMs rather than the main +binary RPMs. If you get an error about headers, or complaining about a +missing prerequisite then you may need to install the equivalent +development packages. On Redhat based distros these may be openssl-devel, +zlib-devel and pam-devel, on Debian based distros these may be +libssl-dev, libz-dev and libpam-dev. + + Solaris ------- If you enable BSM auditing on Solaris, you need to update audit_event(4) @@ -81,4 +93,4 @@ account stacks which will prevent authen return the output from pam_nologin to the client. -$Id: README.platform,v 1.9 2007/08/09 04:31:53 dtucker Exp $ +$Id: README.platform,v 1.10 2009/08/28 23:14:48 dtucker Exp $ Modified: vendor-crypto/openssh/dist/auth-pam.c ============================================================================== --- vendor-crypto/openssh/dist/auth-pam.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth-pam.c Thu Oct 1 15:19:37 2009 (r197670) @@ -602,16 +602,16 @@ sshpam_cleanup(void) return; debug("PAM: cleanup"); pam_set_item(sshpam_handle, PAM_CONV, (const void *)&null_conv); - if (sshpam_cred_established) { - debug("PAM: deleting credentials"); - pam_setcred(sshpam_handle, PAM_DELETE_CRED); - sshpam_cred_established = 0; - } if (sshpam_session_open) { debug("PAM: closing session"); pam_close_session(sshpam_handle, PAM_SILENT); sshpam_session_open = 0; } + if (sshpam_cred_established) { + debug("PAM: deleting credentials"); + pam_setcred(sshpam_handle, PAM_DELETE_CRED); + sshpam_cred_established = 0; + } sshpam_authenticated = 0; pam_end(sshpam_handle, sshpam_err); sshpam_handle = NULL; Modified: vendor-crypto/openssh/dist/auth-passwd.c ============================================================================== --- vendor-crypto/openssh/dist/auth-passwd.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth-passwd.c Thu Oct 1 15:19:37 2009 (r197670) @@ -102,7 +102,7 @@ auth_password(Authctxt *authctxt, const } #endif #ifdef HAVE_CYGWIN - if (is_winnt) { + { HANDLE hToken = cygwin_logon_user(pw, password); if (hToken == INVALID_HANDLE_VALUE) Modified: vendor-crypto/openssh/dist/auth-sia.c ============================================================================== --- vendor-crypto/openssh/dist/auth-sia.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth-sia.c Thu Oct 1 15:19:37 2009 (r197670) @@ -34,10 +34,6 @@ #include #include #include -#include -#include -#include -#include #include "ssh.h" #include "key.h" @@ -53,52 +49,6 @@ extern ServerOptions options; extern int saved_argc; extern char **saved_argv; -static int -sia_password_change_required(const char *user) -{ - struct es_passwd *acct; - time_t pw_life; - time_t pw_date; - - set_auth_parameters(saved_argc, saved_argv); - - if ((acct = getespwnam(user)) == NULL) { - error("Couldn't access protected database entry for %s", user); - endprpwent(); - return (0); - } - - /* If forced password change flag is set, honor it */ - if (acct->uflg->fg_psw_chg_reqd && acct->ufld->fd_psw_chg_reqd) { - endprpwent(); - return (1); - } - - /* Obtain password lifetime; if none, it can't have expired */ - if (acct->uflg->fg_expire) - pw_life = acct->ufld->fd_expire; - else if (acct->sflg->fg_expire) - pw_life = acct->sfld->fd_expire; - else { - endprpwent(); - return (0); - } - - /* Offset from last change; if none, it must be expired */ - if (acct->uflg->fg_schange) - pw_date = acct->ufld->fd_schange + pw_life; - else { - endprpwent(); - return (1); - } - - endprpwent(); - - /* If expiration date is prior to now, change password */ - - return (pw_date <= time((time_t *) NULL)); -} - int sys_auth_passwd(Authctxt *authctxt, const char *pass) { @@ -126,9 +76,6 @@ sys_auth_passwd(Authctxt *authctxt, cons sia_ses_release(&ent); - authctxt->force_pwchange = sia_password_change_required( - authctxt->user); - return (1); } Modified: vendor-crypto/openssh/dist/auth1.c ============================================================================== --- vendor-crypto/openssh/dist/auth1.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth1.c Thu Oct 1 15:19:37 2009 (r197670) @@ -318,15 +318,7 @@ do_authloop(Authctxt *authctxt) } #endif /* _UNICOS */ -#ifdef HAVE_CYGWIN - if (authenticated && - !check_nt_auth(type == SSH_CMSG_AUTH_PASSWORD, - authctxt->pw)) { - packet_disconnect("Authentication rejected for uid %d.", - authctxt->pw == NULL ? -1 : authctxt->pw->pw_uid); - authenticated = 0; - } -#else +#ifndef HAVE_CYGWIN /* Special handling for root */ if (authenticated && authctxt->pw->pw_uid == 0 && !auth_root_allowed(meth->name)) { Modified: vendor-crypto/openssh/dist/auth2-jpake.c ============================================================================== --- vendor-crypto/openssh/dist/auth2-jpake.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth2-jpake.c Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth2-jpake.c,v 1.2 2008/11/07 23:34:48 dtucker Exp $ */ +/* $OpenBSD: auth2-jpake.c,v 1.3 2009/03/05 07:18:19 djm Exp $ */ /* * Copyright (c) 2008 Damien Miller. All rights reserved. * @@ -42,8 +42,8 @@ #include "ssh2.h" #include "key.h" #include "hostfile.h" -#include "buffer.h" #include "auth.h" +#include "buffer.h" #include "packet.h" #include "dispatch.h" #include "log.h" @@ -55,6 +55,7 @@ #endif #include "monitor_wrap.h" +#include "schnorr.h" #include "jpake.h" /* @@ -359,7 +360,7 @@ auth2_jpake_get_pwdata(Authctxt *authctx } /* - * Being authentication attempt. + * Begin authentication attempt. * Note, sets authctxt->postponed while in subprotocol */ static int Modified: vendor-crypto/openssh/dist/auth2-kbdint.c ============================================================================== --- vendor-crypto/openssh/dist/auth2-kbdint.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth2-kbdint.c Thu Oct 1 15:19:37 2009 (r197670) @@ -58,10 +58,6 @@ userauth_kbdint(Authctxt *authctxt) xfree(devs); xfree(lang); -#ifdef HAVE_CYGWIN - if (check_nt_auth(0, authctxt->pw) == 0) - authenticated = 0; -#endif return authenticated; } Modified: vendor-crypto/openssh/dist/auth2-none.c ============================================================================== --- vendor-crypto/openssh/dist/auth2-none.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth2-none.c Thu Oct 1 15:19:37 2009 (r197670) @@ -61,10 +61,6 @@ userauth_none(Authctxt *authctxt) { none_enabled = 0; packet_check_eom(); -#ifdef HAVE_CYGWIN - if (check_nt_auth(1, authctxt->pw) == 0) - return (0); -#endif if (options.password_authentication) return (PRIVSEP(auth_password(authctxt, ""))); return (0); Modified: vendor-crypto/openssh/dist/auth2-passwd.c ============================================================================== --- vendor-crypto/openssh/dist/auth2-passwd.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth2-passwd.c Thu Oct 1 15:19:37 2009 (r197670) @@ -68,10 +68,6 @@ userauth_passwd(Authctxt *authctxt) logit("password change not supported"); else if (PRIVSEP(auth_password(authctxt, password)) == 1) authenticated = 1; -#ifdef HAVE_CYGWIN - if (check_nt_auth(1, authctxt->pw) == 0) - authenticated = 0; -#endif memset(password, 0, len); xfree(password); return authenticated; Modified: vendor-crypto/openssh/dist/auth2-pubkey.c ============================================================================== --- vendor-crypto/openssh/dist/auth2-pubkey.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth2-pubkey.c Thu Oct 1 15:19:37 2009 (r197670) @@ -170,10 +170,6 @@ done: key_free(key); xfree(pkalg); xfree(pkblob); -#ifdef HAVE_CYGWIN - if (check_nt_auth(0, authctxt->pw) == 0) - authenticated = 0; -#endif return authenticated; } Modified: vendor-crypto/openssh/dist/auth2.c ============================================================================== --- vendor-crypto/openssh/dist/auth2.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/auth2.c Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth2.c,v 1.120 2008/11/04 08:22:12 djm Exp $ */ +/* $OpenBSD: auth2.c,v 1.121 2009/06/22 05:39:28 dtucker Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -35,8 +35,8 @@ #include #include -#include "xmalloc.h" #include "atomicio.h" +#include "xmalloc.h" #include "ssh2.h" #include "packet.h" #include "log.h" Modified: vendor-crypto/openssh/dist/canohost.c ============================================================================== --- vendor-crypto/openssh/dist/canohost.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/canohost.c Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -/* $OpenBSD: canohost.c,v 1.64 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: canohost.c,v 1.65 2009/05/27 06:31:25 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -35,6 +35,8 @@ #include "misc.h" static void check_ip_options(int, char *); +static char *canonical_host_ip = NULL; +static int cached_port = -1; /* * Return the canonical name of the host at the other end of the socket. The @@ -304,6 +306,16 @@ get_local_name(int sock) return get_socket_address(sock, 0, NI_NAMEREQD); } +void +clear_cached_addr(void) +{ + if (canonical_host_ip != NULL) { + xfree(canonical_host_ip); + canonical_host_ip = NULL; + } + cached_port = -1; +} + /* * Returns the IP-address of the remote host as a string. The returned * string must not be freed. @@ -312,8 +324,6 @@ get_local_name(int sock) const char * get_remote_ipaddr(void) { - static char *canonical_host_ip = NULL; - /* Check whether we have cached the ipaddr. */ if (canonical_host_ip == NULL) { if (packet_connection_is_on_socket()) { @@ -402,13 +412,11 @@ get_peer_port(int sock) int get_remote_port(void) { - static int port = -1; - /* Cache to avoid getpeername() on a dead connection */ - if (port == -1) - port = get_port(0); + if (cached_port == -1) + cached_port = get_port(0); - return port; + return cached_port; } int Modified: vendor-crypto/openssh/dist/canohost.h ============================================================================== --- vendor-crypto/openssh/dist/canohost.h Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/canohost.h Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -/* $OpenBSD: canohost.h,v 1.10 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: canohost.h,v 1.11 2009/05/27 06:31:25 andreas Exp $ */ /* * Author: Tatu Ylonen @@ -24,6 +24,6 @@ char *get_local_name(int); int get_remote_port(void); int get_local_port(void); int get_sock_port(int, int); - +void clear_cached_addr(void); void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *); Modified: vendor-crypto/openssh/dist/channels.c ============================================================================== --- vendor-crypto/openssh/dist/channels.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/channels.c Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.295 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.296 2009/05/25 06:48:00 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1653,6 +1653,7 @@ channel_handle_wfd(Channel *c, fd_set *r } return -1; } +#ifndef BROKEN_TCGETATTR_ICANON if (compat20 && c->isatty && dlen >= 1 && buf[0] != '\r') { if (tcgetattr(c->wfd, &tio) == 0 && !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { @@ -1666,6 +1667,7 @@ channel_handle_wfd(Channel *c, fd_set *r packet_send(); } } +#endif buffer_consume(&c->output, len); if (compat20 && len > 0) { c->local_consumed += len; @@ -2431,7 +2433,7 @@ channel_input_status_confirm(int type, u int id; /* Reset keepalive timeout */ - keep_alive_timeouts = 0; + packet_set_alive_timeouts(0); id = packet_get_int(); packet_check_eom(); Modified: vendor-crypto/openssh/dist/clientloop.c ============================================================================== --- vendor-crypto/openssh/dist/clientloop.c Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/clientloop.c Thu Oct 1 15:19:37 2009 (r197670) @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.209 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.213 2009/07/05 19:28:33 stevesk Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -109,6 +109,7 @@ #include "misc.h" #include "match.h" #include "msg.h" +#include "roaming.h" /* import options */ extern Options options; @@ -491,13 +492,13 @@ client_global_request_reply(int type, u_ xfree(gc); } - keep_alive_timeouts = 0; + packet_set_alive_timeouts(0); } static void server_alive_check(void) { - if (++keep_alive_timeouts > options.server_alive_count_max) { + if (packet_inc_alive_timeouts() > options.server_alive_count_max) { logit("Timeout, server not responding."); cleanup_exit(255); } @@ -634,8 +635,8 @@ client_suspend_self(Buffer *bin, Buffer static void client_process_net_input(fd_set *readset) { - int len; - char buf[8192]; + int len, cont = 0; + char buf[SSH_IOBUFSZ]; /* * Read input from the server, and add any such data to the buffer of @@ -643,8 +644,8 @@ client_process_net_input(fd_set *readset */ if (FD_ISSET(connection_in, readset)) { /* Read as much as possible. */ - len = read(connection_in, buf, sizeof(buf)); - if (len == 0) { + len = roaming_read(connection_in, buf, sizeof(buf), &cont); + if (len == 0 && cont == 0) { /* * Received EOF. The remote host has closed the * connection. @@ -1128,7 +1129,7 @@ static void client_process_input(fd_set *readset) { int len; - char buf[8192]; + char buf[SSH_IOBUFSZ]; /* Read input from stdin. */ if (FD_ISSET(fileno(stdin), readset)) { @@ -1476,6 +1477,14 @@ client_loop(int have_pty, int escape_cha /* Stop watching for window change. */ signal(SIGWINCH, SIG_DFL); + if (compat20) { + packet_start(SSH2_MSG_DISCONNECT); + packet_put_int(SSH2_DISCONNECT_BY_APPLICATION); + packet_put_cstring("disconnected by user"); + packet_send(); + packet_write_wait(); + } + channel_free_all(); if (have_pty) Modified: vendor-crypto/openssh/dist/config.h.in ============================================================================== --- vendor-crypto/openssh/dist/config.h.in Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/config.h.in Thu Oct 1 15:19:37 2009 (r197670) @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + /* Define if you have a getaddrinfo that fails for the all-zeros IPv6 address */ #undef AIX_GETNAMEINFO_HACK @@ -68,6 +71,9 @@ /* Define if your snprintf is busted */ #undef BROKEN_SNPRINTF +/* tcgetattr with ICANON may hang */ +#undef BROKEN_TCGETATTR_ICANON + /* updwtmpx is broken (if present) */ #undef BROKEN_UPDWTMPX @@ -122,9 +128,12 @@ /* Builtin PRNG command timeout */ #undef ENTROPY_TIMEOUT_MSEC -/* f_fsid has members */ +/* fsid_t has member val */ #undef FSID_HAS_VAL +/* fsid_t has member __val */ +#undef FSID_HAS___VAL + /* Define to 1 if the `getpgrp' function requires zero arguments. */ #undef GETPGRP_VOID @@ -518,6 +527,9 @@ /* Define to 1 if the system has the type `in_addr_t'. */ #undef HAVE_IN_ADDR_T +/* Define to 1 if the system has the type `in_port_t'. */ +#undef HAVE_IN_PORT_T + /* Define to 1 if you have the header file. */ #undef HAVE_LASTLOG_H @@ -1226,6 +1238,9 @@ /* Define if X11 doesn't support AF_UNIX sockets on that system */ #undef NO_X11_UNIX_SOCKETS +/* Define if EVP_DigestUpdate returns void */ +#undef OPENSSL_EVP_DIGESTUPDATE_VOID + /* libcrypto is missing AES 192 and 256 bit functions */ #undef OPENSSL_LOBOTOMISED_AES @@ -1309,6 +1324,9 @@ /* Use audit debugging module */ #undef SSH_AUDIT_EVENTS +/* Windows is sensitive to read buffer size */ +#undef SSH_IOBUFSZ + /* non-privileged user for privilege separation */ #undef SSH_PRIVSEP_USER @@ -1397,9 +1415,17 @@ /* Define if you want SELinux support. */ #undef WITH_SELINUX -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif /* Define if xauth is found in your path */ #undef XAUTH_PATH Modified: vendor-crypto/openssh/dist/configure ============================================================================== --- vendor-crypto/openssh/dist/configure Thu Oct 1 14:42:55 2009 (r197669) +++ vendor-crypto/openssh/dist/configure Thu Oct 1 15:19:37 2009 (r197670) @@ -1,12 +1,12 @@ #! /bin/sh -# From configure.ac Revision: 1.415 . +# From configure.ac Revision: 1.427 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for OpenSSH Portable. +# Generated by GNU Autoconf 2.62 for OpenSSH Portable. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -18,7 +18,7 @@ DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -40,17 +40,45 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTE as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi # Support unset when possible. @@ -66,8 +94,6 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -90,7 +116,7 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi @@ -103,17 +129,10 @@ PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From des at FreeBSD.org Thu Oct 1 15:22:35 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Thu Oct 1 15:22:43 2009 Subject: svn commit: r197671 - in vendor-crypto/openssh/5.3p1: . contrib/aix contrib/caldera contrib/cygwin contrib/redhat contrib/suse openbsd-compat Message-ID: <200910011522.n91FMZVG055518@svn.freebsd.org> Author: des Date: Thu Oct 1 15:22:34 2009 New Revision: 197671 URL: http://svn.freebsd.org/changeset/base/197671 Log: Tag OpenSSH 5.3p1 Added: vendor-crypto/openssh/5.3p1/ - copied from r197669, vendor-crypto/openssh/dist/ vendor-crypto/openssh/5.3p1/roaming.h - copied unchanged from r197670, vendor-crypto/openssh/dist/roaming.h vendor-crypto/openssh/5.3p1/roaming_common.c - copied unchanged from r197670, vendor-crypto/openssh/dist/roaming_common.c vendor-crypto/openssh/5.3p1/roaming_dummy.c - copied unchanged from r197670, vendor-crypto/openssh/dist/roaming_dummy.c vendor-crypto/openssh/5.3p1/schnorr.h - copied unchanged from r197670, vendor-crypto/openssh/dist/schnorr.h Replaced: vendor-crypto/openssh/5.3p1/ChangeLog - copied unchanged from r197670, vendor-crypto/openssh/dist/ChangeLog vendor-crypto/openssh/5.3p1/Makefile.in - copied unchanged from r197670, vendor-crypto/openssh/dist/Makefile.in vendor-crypto/openssh/5.3p1/README - copied unchanged from r197670, vendor-crypto/openssh/dist/README vendor-crypto/openssh/5.3p1/README.platform - copied unchanged from r197670, vendor-crypto/openssh/dist/README.platform vendor-crypto/openssh/5.3p1/auth-pam.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth-pam.c vendor-crypto/openssh/5.3p1/auth-passwd.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth-passwd.c vendor-crypto/openssh/5.3p1/auth-sia.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth-sia.c vendor-crypto/openssh/5.3p1/auth1.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth1.c vendor-crypto/openssh/5.3p1/auth2-jpake.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth2-jpake.c vendor-crypto/openssh/5.3p1/auth2-kbdint.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth2-kbdint.c vendor-crypto/openssh/5.3p1/auth2-none.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth2-none.c vendor-crypto/openssh/5.3p1/auth2-passwd.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth2-passwd.c vendor-crypto/openssh/5.3p1/auth2-pubkey.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth2-pubkey.c vendor-crypto/openssh/5.3p1/auth2.c - copied unchanged from r197670, vendor-crypto/openssh/dist/auth2.c vendor-crypto/openssh/5.3p1/canohost.c - copied unchanged from r197670, vendor-crypto/openssh/dist/canohost.c vendor-crypto/openssh/5.3p1/canohost.h - copied unchanged from r197670, vendor-crypto/openssh/dist/canohost.h vendor-crypto/openssh/5.3p1/channels.c - copied unchanged from r197670, vendor-crypto/openssh/dist/channels.c vendor-crypto/openssh/5.3p1/clientloop.c - copied unchanged from r197670, vendor-crypto/openssh/dist/clientloop.c vendor-crypto/openssh/5.3p1/config.h.in - copied unchanged from r197670, vendor-crypto/openssh/dist/config.h.in vendor-crypto/openssh/5.3p1/configure - copied unchanged from r197670, vendor-crypto/openssh/dist/configure vendor-crypto/openssh/5.3p1/configure.ac - copied unchanged from r197670, vendor-crypto/openssh/dist/configure.ac vendor-crypto/openssh/5.3p1/contrib/aix/buildbff.sh - copied unchanged from r197670, vendor-crypto/openssh/dist/contrib/aix/buildbff.sh vendor-crypto/openssh/5.3p1/contrib/caldera/openssh.spec - copied unchanged from r197670, vendor-crypto/openssh/dist/contrib/caldera/openssh.spec vendor-crypto/openssh/5.3p1/contrib/cygwin/ssh-host-config - copied unchanged from r197670, vendor-crypto/openssh/dist/contrib/cygwin/ssh-host-config vendor-crypto/openssh/5.3p1/contrib/cygwin/ssh-user-config - copied unchanged from r197670, vendor-crypto/openssh/dist/contrib/cygwin/ssh-user-config vendor-crypto/openssh/5.3p1/contrib/redhat/openssh.spec - copied unchanged from r197670, vendor-crypto/openssh/dist/contrib/redhat/openssh.spec vendor-crypto/openssh/5.3p1/contrib/suse/openssh.spec - copied unchanged from r197670, vendor-crypto/openssh/dist/contrib/suse/openssh.spec vendor-crypto/openssh/5.3p1/defines.h - copied unchanged from r197670, vendor-crypto/openssh/dist/defines.h vendor-crypto/openssh/5.3p1/gss-genr.c - copied unchanged from r197670, vendor-crypto/openssh/dist/gss-genr.c vendor-crypto/openssh/5.3p1/includes.h - copied unchanged from r197670, vendor-crypto/openssh/dist/includes.h vendor-crypto/openssh/5.3p1/jpake.c - copied unchanged from r197670, vendor-crypto/openssh/dist/jpake.c vendor-crypto/openssh/5.3p1/jpake.h - copied unchanged from r197670, vendor-crypto/openssh/dist/jpake.h vendor-crypto/openssh/5.3p1/kex.c - copied unchanged from r197670, vendor-crypto/openssh/dist/kex.c vendor-crypto/openssh/5.3p1/kex.h - copied unchanged from r197670, vendor-crypto/openssh/dist/kex.h vendor-crypto/openssh/5.3p1/kexdhs.c - copied unchanged from r197670, vendor-crypto/openssh/dist/kexdhs.c vendor-crypto/openssh/5.3p1/kexgexs.c - copied unchanged from r197670, vendor-crypto/openssh/dist/kexgexs.c vendor-crypto/openssh/5.3p1/moduli.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/moduli.0 vendor-crypto/openssh/5.3p1/monitor.c - copied unchanged from r197670, vendor-crypto/openssh/dist/monitor.c vendor-crypto/openssh/5.3p1/monitor_mm.c - copied unchanged from r197670, vendor-crypto/openssh/dist/monitor_mm.c vendor-crypto/openssh/5.3p1/monitor_wrap.c - copied unchanged from r197670, vendor-crypto/openssh/dist/monitor_wrap.c vendor-crypto/openssh/5.3p1/monitor_wrap.h - copied unchanged from r197670, vendor-crypto/openssh/dist/monitor_wrap.h vendor-crypto/openssh/5.3p1/openbsd-compat/bsd-cygwin_util.c - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/bsd-cygwin_util.c vendor-crypto/openssh/5.3p1/openbsd-compat/bsd-cygwin_util.h - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/bsd-cygwin_util.h vendor-crypto/openssh/5.3p1/openbsd-compat/daemon.c - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/daemon.c vendor-crypto/openssh/5.3p1/openbsd-compat/getrrsetbyname.c - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/getrrsetbyname.c vendor-crypto/openssh/5.3p1/openbsd-compat/openssl-compat.c - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/openssl-compat.c vendor-crypto/openssh/5.3p1/openbsd-compat/openssl-compat.h - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/openssl-compat.h vendor-crypto/openssh/5.3p1/openbsd-compat/port-aix.c - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/port-aix.c vendor-crypto/openssh/5.3p1/openbsd-compat/port-aix.h - copied unchanged from r197670, vendor-crypto/openssh/dist/openbsd-compat/port-aix.h vendor-crypto/openssh/5.3p1/packet.c - copied unchanged from r197670, vendor-crypto/openssh/dist/packet.c vendor-crypto/openssh/5.3p1/packet.h - copied unchanged from r197670, vendor-crypto/openssh/dist/packet.h vendor-crypto/openssh/5.3p1/readconf.c - copied unchanged from r197670, vendor-crypto/openssh/dist/readconf.c vendor-crypto/openssh/5.3p1/readconf.h - copied unchanged from r197670, vendor-crypto/openssh/dist/readconf.h vendor-crypto/openssh/5.3p1/schnorr.c - copied unchanged from r197670, vendor-crypto/openssh/dist/schnorr.c vendor-crypto/openssh/5.3p1/scp.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/scp.0 vendor-crypto/openssh/5.3p1/servconf.c - copied unchanged from r197670, vendor-crypto/openssh/dist/servconf.c vendor-crypto/openssh/5.3p1/serverloop.c - copied unchanged from r197670, vendor-crypto/openssh/dist/serverloop.c vendor-crypto/openssh/5.3p1/session.c - copied unchanged from r197670, vendor-crypto/openssh/dist/session.c vendor-crypto/openssh/5.3p1/sftp-client.c - copied unchanged from r197670, vendor-crypto/openssh/dist/sftp-client.c vendor-crypto/openssh/5.3p1/sftp-server.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/sftp-server.0 vendor-crypto/openssh/5.3p1/sftp-server.8 - copied unchanged from r197670, vendor-crypto/openssh/dist/sftp-server.8 vendor-crypto/openssh/5.3p1/sftp-server.c - copied unchanged from r197670, vendor-crypto/openssh/dist/sftp-server.c vendor-crypto/openssh/5.3p1/sftp.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/sftp.0 vendor-crypto/openssh/5.3p1/ssh-add.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-add.0 vendor-crypto/openssh/5.3p1/ssh-agent.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-agent.0 vendor-crypto/openssh/5.3p1/ssh-agent.1 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-agent.1 vendor-crypto/openssh/5.3p1/ssh-agent.c - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-agent.c vendor-crypto/openssh/5.3p1/ssh-keygen.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-keygen.0 vendor-crypto/openssh/5.3p1/ssh-keygen.c - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-keygen.c vendor-crypto/openssh/5.3p1/ssh-keyscan.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-keyscan.0 vendor-crypto/openssh/5.3p1/ssh-keysign.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-keysign.0 vendor-crypto/openssh/5.3p1/ssh-rand-helper.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh-rand-helper.0 vendor-crypto/openssh/5.3p1/ssh.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh.0 vendor-crypto/openssh/5.3p1/ssh.1 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh.1 vendor-crypto/openssh/5.3p1/ssh.c - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh.c vendor-crypto/openssh/5.3p1/ssh_config.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/ssh_config.0 vendor-crypto/openssh/5.3p1/sshconnect.c - copied unchanged from r197670, vendor-crypto/openssh/dist/sshconnect.c vendor-crypto/openssh/5.3p1/sshconnect.h - copied unchanged from r197670, vendor-crypto/openssh/dist/sshconnect.h vendor-crypto/openssh/5.3p1/sshconnect2.c - copied unchanged from r197670, vendor-crypto/openssh/dist/sshconnect2.c vendor-crypto/openssh/5.3p1/sshd.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/sshd.0 vendor-crypto/openssh/5.3p1/sshd.8 - copied unchanged from r197670, vendor-crypto/openssh/dist/sshd.8 vendor-crypto/openssh/5.3p1/sshd.c - copied unchanged from r197670, vendor-crypto/openssh/dist/sshd.c vendor-crypto/openssh/5.3p1/sshd_config.0 - copied unchanged from r197670, vendor-crypto/openssh/dist/sshd_config.0 vendor-crypto/openssh/5.3p1/sshd_config.5 - copied unchanged from r197670, vendor-crypto/openssh/dist/sshd_config.5 vendor-crypto/openssh/5.3p1/sshlogin.c - copied unchanged from r197670, vendor-crypto/openssh/dist/sshlogin.c vendor-crypto/openssh/5.3p1/uuencode.c - copied unchanged from r197670, vendor-crypto/openssh/dist/uuencode.c vendor-crypto/openssh/5.3p1/version.h - copied unchanged from r197670, vendor-crypto/openssh/dist/version.h Copied: vendor-crypto/openssh/5.3p1/ChangeLog (from r197670, vendor-crypto/openssh/dist/ChangeLog) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-crypto/openssh/5.3p1/ChangeLog Thu Oct 1 15:22:34 2009 (r197671, copy of r197670, vendor-crypto/openssh/dist/ChangeLog) @@ -0,0 +1,1648 @@ +20090926 + - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Update for release + - (djm) [README] update relnotes URL + - (djm) [packet.c] Restore EWOULDBLOCK handling that got lost somewhere + - (djm) Release 5.3p1 + +20090911 + - (dtucker) [configure.ac] Change the -lresolv check so it works on Mac OS X + 10.6 (which doesn't have BIND8_COMPAT and thus uses res_9_query). Patch + from jbasney at ncsa uiuc edu. + +20090908 + - (djm) [serverloop.c] Fix test for server-assigned remote forwarding port + (-R 0:...); bz#1578, spotted and fix by gavin AT emf.net; ok dtucker@ + +20090901 + - (dtucker) [configure.ac] Bug #1639: use AC_PATH_PROG to search the path for + krb5-config if it's not in the location specified by --with-kerberos5. + Patch from jchadima at redhat. + +20090829 + - (dtucker) [README.platform] Add text about development packages, based on + text from Chris Pepper in bug #1631. + +20090828 + - dtucker [auth-sia.c] Roll back the change for bug #1241 as it apparently + causes problems in some Tru64 configurations. + - (djm) [sshd_config.5] downgrade mention of login.conf to be an example + and mention PAM as another provider for ChallengeResponseAuthentication; + bz#1408; ok dtucker@ + - (djm) [sftp-server.c] bz#1535: accept ENOSYS as a fallback error when + attempting atomic rename(); ok dtucker@ + - (djm) [Makefile.in] bz#1505: Solaris make(1) doesn't accept make variables + in argv, so pass them in the environment; ok dtucker@ + - (dtucker) [channels.c configure.ac] Bug #1528: skip the tcgetattr call on + the pty master on Solaris, since it never succeeds and can hang if large + amounts of data is sent to the slave (eg a copy-paste). Based on a patch + originally from Doke Scott, ok djm@ + - (dtucker) [clientloop.c configure.ac defines.h] Make the client's IO buffer + size a compile-time option and set it to 64k on Cygwin, since Corinna + reports that it makes a significant difference to performance. ok djm@ + - (dtucker) [configure.ac] Fix the syntax of the Solaris tcgetattr entry. + +20090820 + - (dtucker) [includes.h] Bug #1634: do not include system glob.h if we're not + using it since the type conflicts can cause problems on FreeBSD. Patch + from Jonathan Chen. + - (dtucker) [session.c openbsd-compat/port-aix.h] Bugs #1249 and #1567: move + the setpcred call on AIX to immediately before the permanently_set_uid(). + Ensures that we still have privileges when we call chroot and + pam_open_sesson. Based on a patch from David Leonard. + +20090817 + - (dtucker) [configure.ac] Check for headers before libraries for openssl an + zlib, which should make the errors slightly more meaningful on platforms + where there's separate "-devel" packages for those. + - (dtucker) [sshlogin.c openbsd-compat/port-aix.{c,h}] Bug #1595: make + PrintLastLog work on AIX. Based in part on a patch from Miguel Sanders. + +20090729 + - (tim) [contrib/cygwin/ssh-user-config] Change script to call correct error + function. Patch from Corinna Vinschen. + +20090713 + - (dtucker) [openbsd-compat/getrrsetbyname.c] Reduce answer buffer size so it + fits into 16 bits to work around a bug in glibc's resolver where it masks + off the buffer size at 16 bits. Patch from Hauke Lampe, ok djm jakob. + +20090712 + - (dtucker) [configure.ac] Include sys/param.h for the sys/mount.h test, + prevents configure complaining on older BSDs. + - (dtucker [contrib/cygwin/ssh-{host,user}-config] Add license text. Patch + from Corinna Vinschen. + - (dtucker) [auth-pam.c] Bug #1534: move the deletion of PAM credentials on + logout to after the session close. Patch from Anicka Bernathova, + originally from Andreas Schwab via Novelll ok djm. + +20090707 + - (dtucker) [contrib/cygwin/ssh-host-config] better support for automated + scripts and fix usage of eval. Patch from Corinna Vinschen. + +20090705 + - (dtucker) OpenBSD CVS Sync + - andreas@cvs.openbsd.org 2009/06/27 09:29:06 + [packet.h packet.c] + packet_bacup_state() and packet_restore_state() will be used to + temporarily save the current state ren resuming a suspended connection. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:32:43 + [roaming_common.c roaming.h] + It may be necessary to retransmit some data when resuming, so add it + to a buffer when roaming is enabled. + Most of this code was written by Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:35:06 + [readconf.h readconf.c] + Add client option UseRoaming. It doesn't do anything yet but will + control whether the client tries to use roaming if enabled on the + server. From Martin Forssen. + ok markus@ + - markus@cvs.openbsd.org 2009/06/30 14:54:40 + [version.h] + crank version; ok deraadt + - dtucker@cvs.openbsd.org 2009/07/02 02:11:47 + [ssh.c] + allow for long home dir paths (bz #1615). ok deraadt + (based in part on a patch from jchadima at redhat) + - stevesk@cvs.openbsd.org 2009/07/05 19:28:33 + [clientloop.c] + only send SSH2_MSG_DISCONNECT if we're in compat20; from dtucker@ + ok deraadt@ markus@ + +20090622 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2009/06/22 05:39:28 + [monitor_wrap.c monitor_mm.c ssh-keygen.c auth2.c gss-genr.c sftp-client.c] + alphabetize includes; reduces diff vs portable and style(9). + ok stevesk djm + (Id sync only; these were already in order in -portable) + +20090621 + - (dtucker) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2009/03/17 21:37:00 + [ssh.c] + pass correct argv[0] to openlog(); ok djm@ + - jmc@cvs.openbsd.org 2009/03/19 15:15:09 + [ssh.1] + for "Ciphers", just point the reader to the keyword in ssh_config(5), just + as we do for "MACs": this stops us getting out of sync when the lists + change; + fixes documentation/6102, submitted by Peter J. Philipp + alternative fix proposed by djm + ok markus + - tobias@cvs.openbsd.org 2009/03/23 08:31:19 + [ssh-agent.c] + Fixed a possible out-of-bounds memory access if the environment variable + SHELL is shorter than 3 characters. + with input by and ok dtucker + - tobias@cvs.openbsd.org 2009/03/23 19:38:04 + [ssh-agent.c] + My previous commit didn't fix the problem at all, so stick at my first + version of the fix presented to dtucker. + Issue notified by Matthias Barkhoff (matthias dot barkhoff at gmx dot de). + ok dtucker + - sobrado@cvs.openbsd.org 2009/03/26 08:38:39 + [sftp-server.8 sshd.8 ssh-agent.1] + fix a few typographical errors found by spell(1). + ok dtucker@, jmc@ + - stevesk@cvs.openbsd.org 2009/04/13 19:07:44 + [sshd_config.5] + fix possessive; ok djm@ + - stevesk@cvs.openbsd.org 2009/04/14 16:33:42 + [sftp-server.c] + remove unused option character from getopt() optstring; ok markus@ + - jj@cvs.openbsd.org 2009/04/14 21:10:54 + [servconf.c] + Fixed a few the-the misspellings in comments. Skipped a bunch in + binutils,gcc and so on. ok jmc@ + - stevesk@cvs.openbsd.org 2009/04/17 19:23:06 + [session.c] + use INTERNAL_SFTP_NAME for setproctitle() of in-process sftp-server; + ok djm@ markus@ + - stevesk@cvs.openbsd.org 2009/04/17 19:40:17 + [sshd_config.5] + clarify that even internal-sftp needs /dev/log for logging to work; ok + markus@ + - jmc@cvs.openbsd.org 2009/04/18 18:39:10 + [sshd_config.5] + tweak previous; ok stevesk + - stevesk@cvs.openbsd.org 2009/04/21 15:13:17 + [sshd_config.5] + clarify we cd to user's home after chroot; ok markus@ on + earlier version; tweaks and ok jmc@ + - andreas@cvs.openbsd.org 2009/05/25 06:48:01 + [channels.c packet.c clientloop.c packet.h serverloop.c monitor_wrap.c + monitor.c] + Put the globals in packet.c into a struct and don't access it directly + from other files. No functional changes. + ok markus@ djm@ + - andreas@cvs.openbsd.org 2009/05/27 06:31:25 + [canohost.h canohost.c] + Add clear_cached_addr(), needed for upcoming changes allowing the peer + address to change. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:33:39 + [clientloop.c] + Send SSH2_MSG_DISCONNECT when the client disconnects. From a larger + change from Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:34:36 + [kex.c kex.h] + Move the KEX_COOKIE_LEN define to kex.h + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:36:07 + [packet.h packet.c] + Add packet_put_int64() and packet_get_int64(), part of a larger change + from Martin Forssen. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:38:16 + [sshconnect.h sshconnect.c] + Un-static ssh_exchange_identification(), part of a larger change from + Martin Forssen and needed for upcoming changes. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/28 16:50:16 + [sshd.c packet.c serverloop.c monitor_wrap.c clientloop.c sshconnect.c + monitor.c Added roaming.h roaming_common.c roaming_dummy.c] + Keep track of number of bytes read and written. Needed for upcoming + changes. Most code from Martin Forssen, maf at appgate dot com. + ok markus@ + Also, applied appropriate changes to Makefile.in + - andreas@cvs.openbsd.org 2009/06/12 20:43:22 + [monitor.c packet.c] + Fix warnings found by chl@ and djm@ and change roaming_atomicio's + return type to match atomicio's + Diff from djm@, ok markus@ + - andreas@cvs.openbsd.org 2009/06/12 20:58:32 + [packet.c] + Move some more statics into session_state + ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 07:37:15 + [kexdhs.c kexgexs.c] + abort if key_sign fails, preventing possible null deref. Based on report + from Paolo Ganci, ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 09:04:03 + [roaming.h roaming_common.c roaming_dummy.c] + Add tags for the benefit of the sync scripts + Also: pull in the changes for 1.1->1.2 missed in the previous sync. + - (dtucker) [auth2-jpake.c auth2.c canohost.h session.c] Whitespace and + header-order changes to reduce diff vs OpenBSD. + - (dtucker) [servconf.c sshd.c] More whitespace sync. + - (dtucker) [roaming_common.c roaming_dummy.c] Wrap #include in + ifdef. + +20090616 + - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t + is a struct with a __val member. Fixes build on, eg, Redhat 6.2. + +20090504 + - (dtucker) [sshlogin.c] Move the NO_SSH_LASTLOG #ifndef line to include + variable declarations. Should prevent unused warnings anywhere it's set + (only Crays as far as I can tell) and be a no-op everywhere else. + +20090318 + - (tim) [configure.ac] Remove setting IP_TOS_IS_BROKEN for Cygwin. The problem + that setsockopt(IP_TOS) doesn't work on Cygwin has been fixed since 2005. + Based on patch from vinschen at redhat com. + +20090308 + - (dtucker) [auth-passwd.c auth1.c auth2-kbdint.c auth2-none.c auth2-passwd.c + auth2-pubkey.c session.c openbsd-compat/bsd-cygwin_util.{c,h} + openbsd-compat/daemon.c] Remove support for Windows 95/98/ME and very old + version of Cygwin. Patch from vinschen at redhat com. + +20090307 + - (dtucker) [contrib/aix/buildbff.sh] Only try to rename ssh_prng_cmds if it + exists (it's not created if OpenSSL's PRNG is self-seeded, eg if the OS + has a /dev/random). + - (dtucker) [schnorr.c openbsd-compat/openssl-compat.{c,h}] Add + EVP_DigestUpdate to the OLD_EVP compatibility functions and tell schnorr.c + to use them. Allows building with older OpenSSL versions. + - (dtucker) [configure.ac defines.h] Check for in_port_t and typedef if needed. + - (dtucker) [configure.ac] Missing comma in type list. + - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] + EVP_DigestUpdate does not exactly match the other OLD_EVP functions (eg + in openssl 0.9.6) so add an explicit test for it. + +20090306 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2009/03/05 07:18:19 + [auth2-jpake.c jpake.c jpake.h monitor_wrap.c monitor_wrap.h schnorr.c] + [sshconnect2.c] + refactor the (disabled) Schnorr proof code to make it a little more + generally useful + - djm@cvs.openbsd.org 2009/03/05 11:30:50 + [uuencode.c] + document what these functions do so I don't ever have to recuse into + b64_pton/ntop to remember their return values + +20090223 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2009/02/22 23:50:57 + [ssh_config.5 sshd_config.5] + don't advertise experimental options + - djm@cvs.openbsd.org 2009/02/22 23:59:25 + [sshd_config.5] + missing period + - djm@cvs.openbsd.org 2009/02/23 00:06:15 + [version.h] + openssh-5.2 + - (djm) [README] update for 5.2 + - (djm) Release openssh-5.2p1 + +20090222 + - (djm) OpenBSD CVS Sync + - tobias@cvs.openbsd.org 2009/02/21 19:32:04 + [misc.c sftp-server-main.c ssh-keygen.c] + Added missing newlines in error messages. + ok dtucker + +20090221 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2009/02/17 01:28:32 + [ssh_config] + sync with revised default ciphers; pointed out by dkrause@ + - djm@cvs.openbsd.org 2009/02/18 04:31:21 + [schnorr.c] + signature should hash over the entire group, not just the generator + (this is still disabled code) + - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Prepare for 5.2p1 + +20090216 + - (djm) [regress/conch-ciphers.sh regress/putty-ciphers.sh] + [regress/putty-kex.sh regress/putty-transfer.sh] Downgrade disabled + interop tests from FATAL error to a warning. Allows some interop + tests to proceed if others are missing necessary prerequisites. + - (djm) [configure.ac] support GNU/kFreeBSD and GNU/kOpensolaris + systems; patch from Aurelien Jarno via rmh AT aybabtu.com + +20090214 + - (djm) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2009/02/02 11:15:14 + [sftp.c] + Initialize a few variables to prevent spurious "may be used + uninitialized" warnings from newer gcc's. ok djm@ + - djm@cvs.openbsd.org 2009/02/12 03:00:56 + [canohost.c canohost.h channels.c channels.h clientloop.c readconf.c] + [readconf.h serverloop.c ssh.c] + support remote port forwarding with a zero listen port (-R0:...) to + dyamically allocate a listen port at runtime (this is actually + specified in rfc4254); bz#1003 ok markus@ + - djm@cvs.openbsd.org 2009/02/12 03:16:01 + [serverloop.c] + tighten check for -R0:... forwarding: only allow dynamic allocation + if want_reply is set in the packet + - djm@cvs.openbsd.org 2009/02/12 03:26:22 + [monitor.c] + some paranoia: check that the serialised key is really KEY_RSA before + diddling its internals + - djm@cvs.openbsd.org 2009/02/12 03:42:09 + [ssh.1] + document -R0:... usage + - djm@cvs.openbsd.org 2009/02/12 03:44:25 + [ssh.1] + consistency: Dq => Ql + - djm@cvs.openbsd.org 2009/02/12 03:46:17 + [ssh_config.5] + document RemoteForward usage with 0 listen port + - jmc@cvs.openbsd.org 2009/02/12 07:34:20 + [ssh_config.5] + kill trailing whitespace; + - markus@cvs.openbsd.org 2009/02/13 11:50:21 + [packet.c] + check for enc !=NULL in packet_start_discard + - djm@cvs.openbsd.org 2009/02/14 06:35:49 + [PROTOCOL] + mention that eow and no-more-sessions extensions are sent only to + OpenSSH peers + +20090212 + - (djm) [sshpty.c] bz#1419: OSX uses cloning ptys that automagically + set ownership and modes, so avoid explicitly setting them + - (djm) [configure.ac loginrec.c] bz#1421: fix lastlog support for OSX. + OSX provides a getlastlogxbyname function that automates the reading of + a lastlog file. Also, the pututxline function will update lastlog so + there is no need for loginrec.c to do it explicitly. Collapse some + overly verbose code while I'm in there. + +20090201 + - (dtucker) [defines.h sshconnect.c] INET6_ADDRSTRLEN is now needed in + channels.c too, so move the definition for non-IP6 platforms to defines.h + where it can be shared. + +20090129 + - (tim) [contrib/cygwin/ssh-host-config] Patch from Corinna Vinschen. + If the CYGWIN environment variable is empty, the installer script + should not install the service with an empty CYGWIN variable, but + rather without setting CYGWNI entirely. + - (tim) [contrib/cygwin/ssh-host-config] Whitespace cleanup. No code changes. + +20090128 + - (tim) [contrib/cygwin/ssh-host-config] Patch from Corinna Vinschen. + Changes to work on Cygwin 1.5.x as well as on the new Cygwin 1.7.x. + The information given for the setting of the CYGWIN environment variable + is wrong for both releases so I just removed it, together with the + unnecessary (Cygwin 1.5.x) or wrong (Cygwin 1.7.x) default setting. + +20081228 + - (djm) OpenBSD CVS Sync + - stevesk@cvs.openbsd.org 2008/12/09 03:20:42 + [channels.c servconf.c] + channel_print_adm_permitted_opens() should deal with all the printing + for that config option. suggested by markus@; ok markus@ djm@ + dtucker@ + - djm@cvs.openbsd.org 2008/12/09 04:32:22 + [auth2-chall.c] + replace by-hand string building with xasprinf(); ok deraadt@ + - sobrado@cvs.openbsd.org 2008/12/09 15:35:00 + [sftp.1 sftp.c] + update for the synopses displayed by the 'help' command, there are a + few missing flags; add 'bye' to the output of 'help'; sorting and spacing. + jmc@ suggested replacing .Oo/.Oc with a single .Op macro. + ok jmc@ + - stevesk@cvs.openbsd.org 2008/12/09 22:37:33 + [clientloop.c] + fix typo in error message + - stevesk@cvs.openbsd.org 2008/12/10 03:55:20 + [addrmatch.c] + o cannot be NULL here but use xfree() to be consistent; ok djm@ + - stevesk@cvs.openbsd.org 2008/12/29 01:12:36 + [ssh-keyscan.1] + fix example, default key type is rsa for 3+ years; from + frederic.perrin@resel.fr + - stevesk@cvs.openbsd.org 2008/12/29 02:23:26 + [pathnames.h] + no need to escape single quotes in comments + - okan@cvs.openbsd.org 2008/12/30 00:46:56 + [sshd_config.5] + add AllowAgentForwarding to available Match keywords list + ok djm + - djm@cvs.openbsd.org 2009/01/01 21:14:35 + [channels.c] + call channel destroy callbacks on receipt of open failure messages. + fixes client hangs when connecting to a server that has MaxSessions=0 + set spotted by imorgan AT nas.nasa.gov; ok markus@ + - djm@cvs.openbsd.org 2009/01/01 21:17:36 + [kexgexs.c] + fix hash calculation for KEXGEX: hash over the original client-supplied + values and not the sanity checked versions that we acutally use; + bz#1540 reported by john.smith AT arrows.demon.co.uk + ok markus@ + - djm@cvs.openbsd.org 2009/01/14 01:38:06 + [channels.c] + support SOCKS4A protocol, from dwmw2 AT infradead.org via bz#1482; + "looks ok" markus@ + - stevesk@cvs.openbsd.org 2009/01/15 17:38:43 + [readconf.c] + 1) use obsolete instead of alias for consistency + 2) oUserKnownHostsFile not obsolete but oGlobalKnownHostsFile2 is + so move the comment. + 3) reorder so like options are together + ok djm@ + - djm@cvs.openbsd.org 2009/01/22 09:46:01 + [channels.c channels.h session.c] + make Channel->path an allocated string, saving a few bytes here and + there and fixing bz#1380 in the process; ok markus@ + - djm@cvs.openbsd.org 2009/01/22 09:49:57 + [channels.c] + oops! I committed the wrong version of the Channel->path diff, + it was missing some tweaks suggested by stevesk@ + - djm@cvs.openbsd.org 2009/01/22 10:02:34 + [clientloop.c misc.c readconf.c readconf.h servconf.c servconf.h] + [serverloop.c ssh-keyscan.c ssh.c sshd.c] + make a2port() return -1 when it encounters an invalid port number + rather than 0, which it will now treat as valid (needed for future work) + adjust current consumers of a2port() to check its return value is <= 0, + which in turn required some things to be converted from u_short => int + make use of int vs. u_short consistent in some other places too + feedback & ok markus@ + - djm@cvs.openbsd.org 2009/01/22 10:09:16 + [auth-options.c] + another chunk of a2port() diff that got away. wtfdjm?? + - djm@cvs.openbsd.org 2009/01/23 07:58:11 + [myproposal.h] + prefer CTR modes and revised arcfour (i.e w/ discard) modes to CBC + modes; ok markus@ + - naddy@cvs.openbsd.org 2009/01/24 17:10:22 + [ssh_config.5 sshd_config.5] + sync list of preferred ciphers; ok djm@ + - markus@cvs.openbsd.org 2009/01/26 09:58:15 + [cipher.c cipher.h packet.c] + Work around the CPNI-957037 Plaintext Recovery Attack by always + reading 256K of data on packet size or HMAC errors (in CBC mode only). + Help, feedback and ok djm@ + Feedback from Martin Albrecht and Paterson Kenny + +20090107 + - (djm) [uidswap.c] bz#1412: Support >16 supplemental groups in OS X. + Patch based on one from vgiffin AT apple.com; ok dtucker@ + - (djm) [channels.c] bz#1419: support "on demand" X11 forwarding via + launchd on OS X; patch from vgiffin AT apple.com, slightly tweaked; + ok dtucker@ + - (djm) [contrib/ssh-copy-id.1 contrib/ssh-copy-id] bz#1492: Make + ssh-copy-id copy id_rsa.pub by default (instead of the legacy "identity" + key). Patch from cjwatson AT debian.org + +20090107 + - (tim) [configure.ac defines.h openbsd-compat/port-uw.c + openbsd-compat/xcrypt.c] Add SECUREWARE support to OpenServer 6 SVR5 ABI. + OK djm@ dtucker@ + - (tim) [configure.ac] Move check_for_libcrypt_later=1 in *-*-sysv5*) section. + OpenServer 6 doesn't need libcrypt. + +20081209 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/12/09 02:38:18 + [clientloop.c] + The ~C escape handler does not work correctly for multiplexed sessions - + it opens a commandline on the master session, instead of on the slave + that requested it. Disable it on slave sessions until such time as it + is fixed; bz#1543 report from Adrian Bridgett via Colin Watson + ok markus@ + - djm@cvs.openbsd.org 2008/12/09 02:39:59 + [sftp.c] + Deal correctly with failures in remote stat() operation in sftp, + correcting fail-on-error behaviour in batchmode. bz#1541 report and + fix from anedvedicky AT gmail.com; ok markus@ + - djm@cvs.openbsd.org 2008/12/09 02:58:16 + [readconf.c] + don't leave junk (free'd) pointers around in Forward *fwd argument on + failure; avoids double-free in ~C -L handler when given an invalid + forwarding specification; bz#1539 report from adejong AT debian.org + via Colin Watson; ok markus@ dtucker@ + - djm@cvs.openbsd.org 2008/12/09 03:02:37 + [sftp.1 sftp.c] + correct sftp(1) and corresponding usage syntax; + bz#1518 patch from imorgan AT nas.nasa.gov; ok deraadt@ improved diff jmc@ + +20081208 + - (djm) [configure.ac] bz#1538: better test for ProPolice/SSP: actually + use some stack in main(). + Report and suggested fix from vapier AT gentoo.org + - (djm) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2008/12/02 19:01:07 + [clientloop.c] + we have to use the recipient's channel number (RFC 4254) for + SSH2_MSG_CHANNEL_SUCCESS/SSH2_MSG_CHANNEL_FAILURE messages, + otherwise we trigger 'Non-public channel' error messages on sshd + systems with clientkeepalive enabled; noticed by sturm; ok djm; + - markus@cvs.openbsd.org 2008/12/02 19:08:59 + [serverloop.c] + backout 1.149, since it's not necessary and openssh clients send + broken CHANNEL_FAILURE/SUCCESS messages since about 2004; ok djm@ + - markus@cvs.openbsd.org 2008/12/02 19:09:38 + [channels.c] + s/remote_id/id/ to be more consistent with other code; ok djm@ + +20081201 + - (dtucker) [contrib/cygwin/{Makefile,ssh-host-config}] Add new doc files + and tweak the is-sshd-running check in ssh-host-config. Patch from + vinschen at redhat com. + - (dtucker) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2008/11/21 15:47:38 + [packet.c] + packet_disconnect() on padding error, too. should reduce the success + probability for the CPNI-957037 Plaintext Recovery Attack to 2^-18 + ok djm@ + - dtucker@cvs.openbsd.org 2008/11/30 11:59:26 + [monitor_fdpass.c] + Retry sendmsg/recvmsg on EAGAIN and EINTR; ok djm@ + +20081123 + - (dtucker) [monitor_fdpass.c] Reduce diff vs OpenBSD by moving some + declarations, removing an unnecessary union member and adding whitespace. + cmsgbuf.tmp thing spotted by des at des no, ok djm some time ago. + +20081118 + - (tim) [addrmatch.c configure.ac] Some platforms do not have sin6_scope_id + member of sockaddr_in6. Also reported in Bug 1491 by David Leonard. OK and + feedback by djm@ + +20081111 + - (dtucker) OpenBSD CVS Sync + - jmc@cvs.openbsd.org 2008/11/05 11:22:54 + [servconf.c] + passord -> password; + fixes user/5975 from Rene Maroufi + - stevesk@cvs.openbsd.org 2008/11/07 00:42:12 + [ssh-keygen.c] + spelling/typo in comment + - stevesk@cvs.openbsd.org 2008/11/07 18:50:18 + [nchan.c] + add space to some log/debug messages for readability; ok djm@ markus@ + - dtucker@cvs.openbsd.org 2008/11/07 23:34:48 + [auth2-jpake.c] + Move JPAKE define to make life easier for portable. ok djm@ + - tobias@cvs.openbsd.org 2008/11/09 12:34:47 + [session.c ssh.1] + typo fixed (overriden -> overridden) + ok espie, jmc + - stevesk@cvs.openbsd.org 2008/11/11 02:58:09 + [servconf.c] + USE_AFS not referenced so remove #ifdef. fixes sshd -T not printing + kerberosgetafstoken. ok dtucker@ + (Id sync only, we still want the ifdef in portable) + - stevesk@cvs.openbsd.org 2008/11/11 03:55:11 + [channels.c] + for sshd -T print 'permitopen any' vs. 'permitopen' for case of no + permitopen's; ok and input dtucker@ + - djm@cvs.openbsd.org 2008/11/10 02:06:35 + [regress/putty-ciphers.sh] + PuTTY supports AES CTR modes, so interop test against them too + +20081105 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/11/03 08:59:41 + [servconf.c] + include MaxSessions in sshd -T output; patch from imorgan AT nas.nasa.gov + - djm@cvs.openbsd.org 2008/11/04 07:58:09 + [auth.c] + need unistd.h for close() prototype + (ID sync only) + - djm@cvs.openbsd.org 2008/11/04 08:22:13 + [auth.h auth2.c monitor.c monitor.h monitor_wrap.c monitor_wrap.h] + [readconf.c readconf.h servconf.c servconf.h ssh2.h ssh_config.5] + [sshconnect2.c sshd_config.5 jpake.c jpake.h schnorr.c auth2-jpake.c] + [Makefile.in] + Add support for an experimental zero-knowledge password authentication + method using the J-PAKE protocol described in F. Hao, P. Ryan, + "Password Authenticated Key Exchange by Juggling", 16th Workshop on + Security Protocols, Cambridge, April 2008. + + This method allows password-based authentication without exposing + the password to the server. Instead, the client and server exchange + cryptographic proofs to demonstrate of knowledge of the password while + revealing nothing useful to an attacker or compromised endpoint. + + This is experimental, work-in-progress code and is presently + compiled-time disabled (turn on -DJPAKE in Makefile.inc). + + "just commit it. It isn't too intrusive." deraadt@ + - stevesk@cvs.openbsd.org 2008/11/04 19:18:00 + [readconf.c] + because parse_forward() is now used to parse all forward types (DLR), + and it malloc's space for host variables, we don't need to malloc + here. fixes small memory leaks. + + previously dynamic forwards were not parsed in parse_forward() and + space was not malloc'd in that case. + + ok djm@ + - stevesk@cvs.openbsd.org 2008/11/05 03:23:09 + [clientloop.c ssh.1] + add dynamic forward escape command line; ok djm@ + +20081103 + - OpenBSD CVS Sync + - sthen@cvs.openbsd.org 2008/07/24 23:55:30 + [ssh-keygen.1] + Add "ssh-keygen -F -l" to synopsis (displays fingerprint from + known_hosts). ok djm@ + - grunk@cvs.openbsd.org 2008/07/25 06:56:35 + [ssh_config] + Add VisualHostKey to example file, ok djm@ + - grunk@cvs.openbsd.org 2008/07/25 07:05:16 + [key.c] + In random art visualization, make sure to use the end marker only at the + end. Initial diff by Dirk Loss, tweaks and ok djm@ + - markus@cvs.openbsd.org 2008/07/31 14:48:28 + [sshconnect2.c] + don't allocate space for empty banners; report t8m at centrum.cz; + ok deraadt + - krw@cvs.openbsd.org 2008/08/02 04:29:51 + [ssh_config.5] + whitepsace -> whitespace. From Matthew Clarke via bugs@. + - djm@cvs.openbsd.org 2008/08/21 04:09:57 + [session.c] + allow ForceCommand internal-sftp with arguments. based on patch from + michael.barabanov AT gmail.com; ok markus@ + - djm@cvs.openbsd.org 2008/09/06 12:24:13 + [kex.c] + OpenSSL 0.9.8h supplies a real EVP_sha256 so we do not need our + replacement anymore + (ID sync only for portable - we still need this) + - markus@cvs.openbsd.org 2008/09/11 14:22:37 + [compat.c compat.h nchan.c ssh.c] + only send eow and no-more-sessions requests to openssh 5 and newer; + fixes interop problems with broken ssh v2 implementations; ok djm@ + - millert@cvs.openbsd.org 2008/10/02 14:39:35 + [session.c] + Convert an unchecked strdup to xstrdup. OK deraadt@ + - jmc@cvs.openbsd.org 2008/10/03 13:08:12 + [sshd.8] + do not give an example of how to chmod files: we can presume the user + knows that. removes an ambiguity in the permission of authorized_keys; + ok deraadt + - deraadt@cvs.openbsd.org 2008/10/03 23:56:28 + [sshconnect2.c] + Repair strnvis() buffersize of 4*n+1, with termination gauranteed by the + function. + spotted by des@freebsd, who commited an incorrect fix to the freebsd tree + and (as is fairly typical) did not report the problem to us. But this fix + is correct. + ok djm + - djm@cvs.openbsd.org 2008/10/08 23:34:03 + [ssh.1 ssh.c] + Add -y option to force logging via syslog rather than stderr. + Useful for daemonised ssh connection (ssh -f). Patch originally from + and ok'd by markus@ + - djm@cvs.openbsd.org 2008/10/09 03:50:54 + [servconf.c sshd_config.5] + support setting PermitEmptyPasswords in a Match block + requested in PR3891; ok dtucker@ + - jmc@cvs.openbsd.org 2008/10/09 06:54:22 + [ssh.c] + add -y to usage(); + - stevesk@cvs.openbsd.org 2008/10/10 04:55:16 + [scp.c] + spelling in comment; ok djm@ + - stevesk@cvs.openbsd.org 2008/10/10 05:00:12 + [key.c] + typo in error message; ok djm@ + - stevesk@cvs.openbsd.org 2008/10/10 16:43:27 + [ssh_config.5] + use 'Privileged ports can be forwarded only when logging in as root on + the remote machine.' for RemoteForward just like ssh.1 -R. + ok djm@ jmc@ + - stevesk@cvs.openbsd.org 2008/10/14 18:11:33 + [sshconnect.c] + use #define ROQUIET here; no binary change. ok dtucker@ + - stevesk@cvs.openbsd.org 2008/10/17 18:36:24 + [ssh_config.5] + correct and clarify VisualHostKey; ok jmc@ + - stevesk@cvs.openbsd.org 2008/10/30 19:31:16 + [clientloop.c sshd.c] + don't need to #include "monitor_fdpass.h" + - stevesk@cvs.openbsd.org 2008/10/31 15:05:34 + [dispatch.c] + remove unused #define DISPATCH_MIN; ok markus@ + - djm@cvs.openbsd.org 2008/11/01 04:50:08 + [sshconnect2.c] + sprinkle ARGSUSED on dispatch handlers + nuke stale unusued prototype + - stevesk@cvs.openbsd.org 2008/11/01 06:43:33 + [channels.c] + fix some typos in log messages; ok djm@ + - sobrado@cvs.openbsd.org 2008/11/01 11:14:36 + [ssh-keyscan.1 ssh-keyscan.c] + the ellipsis is not an optional argument; while here, improve spacing. + - stevesk@cvs.openbsd.org 2008/11/01 17:40:33 + [clientloop.c readconf.c readconf.h ssh.c] + merge dynamic forward parsing into parse_forward(); + 'i think this is OK' djm@ + - stevesk@cvs.openbsd.org 2008/11/02 00:16:16 + [ttymodes.c] + protocol 2 tty modes support is now 7.5 years old so remove these + debug3()s; ok deraadt@ + - stevesk@cvs.openbsd.org 2008/11/03 01:07:02 + [readconf.c] + remove valueless comment + - stevesk@cvs.openbsd.org 2008/11/03 02:44:41 + [readconf.c] + fix comment + - (djm) [contrib/caldera/ssh-host-keygen contrib/suse/rc.sshd] + Make example scripts generate keys with default sizes rather than fixed, + non-default 1024 bits; patch from imorgan AT nas.nasa.gov + - (djm) [contrib/sshd.pam.generic contrib/caldera/sshd.pam] + [contrib/redhat/sshd.pam] Move pam_nologin to account group from + incorrect auth group in example files; + patch from imorgan AT nas.nasa.gov + +20080906 + - (dtucker) [config.guess config.sub] Update to latest versions from + http://git.savannah.gnu.org/gitweb/ (2008-04-14 and 2008-06-16 + respectively). + +20080830 + - (dtucker) [openbsd-compat/bsd-poll.c] correctly check for number of FDs + larger than FD_SETSIZE (OpenSSH only ever uses poll with one fd). Patch + from Nicholas Marriott. + +20080721 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/07/23 07:36:55 + [servconf.c] + do not try to print options that have been compile-time disabled + in config test mode (sshd -T); report from nix-corp AT esperi.org.uk + ok dtucker@ + - (djm) [servconf.c] Print UsePAM option in config test mode (when it + has been compiled in); report from nix-corp AT esperi.org.uk + ok dtucker@ + +20080721 + - (djm) OpenBSD CVS Sync + - jmc@cvs.openbsd.org 2008/07/18 22:51:01 + [sftp-server.8] + no need for .Pp before or after .Sh; + - djm@cvs.openbsd.org 2008/07/21 08:19:07 + [version.h] + openssh-5.1 + - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Update version number in README and RPM specs + - (djm) Release OpenSSH-5.1 + +20080717 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/07/17 08:48:00 + [sshconnect2.c] + strnvis preauth banner; pointed out by mpf@ ok markus@ + - djm@cvs.openbsd.org 2008/07/17 08:51:07 + [auth2-hostbased.c] + strip trailing '.' from hostname when HostbasedUsesNameFromPacketOnly=yes + report and patch from res AT qoxp.net (bz#1200); ok markus@ + - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Remove long-unneeded compat + code, replace with equivalent cygwin library call. Patch from vinschen + at redhat.com, ok djm@. + - (djm) [sshconnect2.c] vis.h isn't available everywhere + +20080716 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/07/15 02:23:14 + [sftp.1] + number of pipelined requests is now 64; + prodded by Iain.Morgan AT nasa.gov + - djm@cvs.openbsd.org 2008/07/16 11:51:14 + [clientloop.c] + rename variable first_gc -> last_gc (since it is actually the last + in the list). + - djm@cvs.openbsd.org 2008/07/16 11:52:19 + [channels.c] + this loop index should be automatic, not static + +20080714 + - (djm) OpenBSD CVS Sync + - sthen@cvs.openbsd.org 2008/07/13 21:22:52 + [ssh-keygen.c] + Change "ssh-keygen -F [host] -l" to not display random art unless + -v is also specified, making it consistent with the manual and other + uses of -l. + ok grunk@ + - djm@cvs.openbsd.org 2008/07/13 22:13:07 + [channels.c] + use struct sockaddr_storage instead of struct sockaddr for accept(2) + address argument. from visibilis AT yahoo.com in bz#1485; ok markus@ + - djm@cvs.openbsd.org 2008/07/13 22:16:03 + [sftp.c] + increase number of piplelined requests so they properly fill the + (recently increased) channel window. prompted by rapier AT psc.edu; + ok markus@ + - djm@cvs.openbsd.org 2008/07/14 01:55:56 + [sftp-server.8] + mention requirement for /dev/log inside chroot when using sftp-server + with ChrootDirectory + - (djm) [openbsd-compat/bindresvport.c] Rename variables s/sin/in/ to + avoid clash with sin(3) function; reported by + cristian.ionescu-idbohrn AT axis.com + - (djm) [openbsd-compat/rresvport.c] Add unistd.h for missing close() + prototype; reported by cristian.ionescu-idbohrn AT axis.com + - (djm) [umac.c] Rename variable s/buffer_ptr/bufp/ to avoid clash; + reported by cristian.ionescu-idbohrn AT axis.com + - (djm) [contrib/cygwin/Makefile contrib/cygwin/ssh-host-config] + [contrib/cygwin/ssh-user-config contrib/cygwin/sshd-inetd] + Revamped and simplified Cygwin ssh-host-config script that uses + unified csih configuration tool. Requires recent Cygwin. + Patch from vinschen AT redhat.com + +20080712 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/07/12 04:52:50 + [channels.c] + unbreak; move clearing of cctx struct to before first use + reported by dkrause@ + - djm@cvs.openbsd.org 2008/07/12 05:33:41 + [scp.1] + better description for -i flag: + s/RSA authentication/public key authentication/ + - (djm) [openbsd-compat/fake-rfc2553.c openbsd-compat/fake-rfc2553.h] + return EAI_FAMILY when trying to lookup unsupported address family; + from vinschen AT redhat.com + +20080711 + - (djm) OpenBSD CVS Sync + - stevesk@cvs.openbsd.org 2008/07/07 00:31:41 + [ttymodes.c] + we don't need arg after the debug3() was removed. from lint. + ok djm@ + - stevesk@cvs.openbsd.org 2008/07/07 23:32:51 + [key.c] + /*NOTREACHED*/ for lint warning: + warning: function key_equal falls off bottom without returning value + ok djm@ + - markus@cvs.openbsd.org 2008/07/10 18:05:58 + [channels.c] + missing bzero; from mickey; ok djm@ + - markus@cvs.openbsd.org 2008/07/10 18:08:11 + [clientloop.c monitor.c monitor_wrap.c packet.c packet.h sshd.c] + sync v1 and v2 traffic accounting; add it to sshd, too; + ok djm@, dtucker@ + +20080709 + - (djm) [Makefile.in] Print "all tests passed" when all regress tests pass + - (djm) [auth1.c] Fix format string vulnerability in protocol 1 PAM + account check failure path. The vulnerable format buffer is supplied + from PAM and should not contain attacker-supplied data. + - (djm) [auth.c] Missing unistd.h for close() + - (djm) [configure.ac] Add -Wformat-security to CFLAGS for gcc 3.x and 4.x + +20080705 + - (djm) [auth.c] Fixed test for locked account on HP/UX with shadowed + passwords disabled. bz#1083 report & patch from senthilkumar_sen AT + hotpop.com, w/ dtucker@ + - (djm) [atomicio.c configure.ac] Disable poll() fallback in atomiciov for + Tru64. readv doesn't seem to be a comparable object there. + bz#1386, patch from dtucker@ ok me + - (djm) [Makefile.in] Pass though pass to conch for interop tests + - (djm) [configure.ac] unbreak: remove extra closing brace + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/07/04 23:08:25 + [packet.c] + handle EINTR in packet_write_poll()l ok dtucker@ + - djm@cvs.openbsd.org 2008/07/04 23:30:16 + [auth1.c auth2.c] + Make protocol 1 MaxAuthTries logic match protocol 2's. + Do not treat the first protocol 2 authentication attempt as + a failure IFF it is for method "none". + Makes MaxAuthTries' user-visible behaviour identical for + protocol 1 vs 2. + ok dtucker@ + - djm@cvs.openbsd.org 2008/07/05 05:16:01 + [PROTOCOL] + grammar + +20080704 + - (dtucker) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/07/02 13:30:34 + [auth2.c] + really really remove the freebie "none" auth try for protocol 2 + - djm@cvs.openbsd.org 2008/07/02 13:47:39 + [ssh.1 ssh.c] + When forking after authentication ("ssh -f") with ExitOnForwardFailure + enabled, delay the fork until after replies for any -R forwards have + been seen. Allows for robust detection of -R forward failure when + using -f (similar to bz#92); ok dtucker@ + - otto@cvs.openbsd.org 2008/07/03 21:46:58 + [auth2-pubkey.c] + avoid nasty double free; ok dtucker@ djm@ + - djm@cvs.openbsd.org 2008/07/04 03:44:59 + [servconf.c groupaccess.h groupaccess.c] + support negation of groups in "Match group" block (bz#1315); ok dtucker@ + - dtucker@cvs.openbsd.org 2008/07/04 03:47:02 + [monitor.c] + Make debug a little clearer. ok djm@ + - djm@cvs.openbsd.org 2008/06/30 08:07:34 + [regress/key-options.sh] + shell portability: use "=" instead of "==" in test(1) expressions, + double-quote string with backslash escaped / + - djm@cvs.openbsd.org 2008/06/30 10:31:11 + [regress/{putty-transfer,putty-kex,putty-ciphers}.sh] + remove "set -e" left over from debugging + - djm@cvs.openbsd.org 2008/06/30 10:43:03 + [regress/conch-ciphers.sh] + explicitly disable conch options that could interfere with the test + - (dtucker) [sftp-server.c] Bug #1447: fall back to racy rename if link + returns EXDEV. Patch from Mike Garrison, ok djm@ + - (djm) [atomicio.c channels.c clientloop.c defines.h includes.h] + [packet.c scp.c serverloop.c sftp-client.c ssh-agent.c ssh-keyscan.c] + [sshd.c] Explicitly handle EWOULDBLOCK wherever we handle EAGAIN, on + some platforms (HP nonstop) it is a distinct errno; + bz#1467 reported by sconeu AT yahoo.com; ok dtucker@ + +20080702 + - (dtucker) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2008/06/30 08:05:59 + [PROTOCOL.agent] + typo: s/constraint_date/constraint_data/ + - djm@cvs.openbsd.org 2008/06/30 12:15:39 + [serverloop.c] + only pass channel requests on session channels through to the session + channel handler, avoiding spurious log messages; ok! markus@ + - djm@cvs.openbsd.org 2008/06/30 12:16:02 + [nchan.c] + only send eow@openssh.com notifications for session channels; ok! markus@ + - djm@cvs.openbsd.org 2008/06/30 12:18:34 + [PROTOCOL] + clarify that eow@openssh.com is only sent on session channels + - dtucker@cvs.openbsd.org 2008/07/01 07:20:52 + [sshconnect.c] + Check ExitOnForwardFailure if forwardings are disabled due to a failed + host key check. ok djm@ + - dtucker@cvs.openbsd.org 2008/07/01 07:24:22 + [sshconnect.c sshd.c] + Send CR LF during protocol banner exchanges, but only for Protocol 2 only, + in order to comply with RFC 4253. bz #1443, ok djm@ + - stevesk@cvs.openbsd.org 2008/07/01 23:12:47 + [PROTOCOL.agent] + fix some typos; ok djm@ + - djm@cvs.openbsd.org 2008/07/02 02:24:18 + [sshd_config sshd_config.5 sshd.8 servconf.c] + increase default size of ssh protocol 1 ephemeral key from 768 to 1024 + bits; prodded by & ok dtucker@ ok deraadt@ + - dtucker@cvs.openbsd.org 2008/07/02 12:03:51 + [auth-rsa.c auth.c auth2-pubkey.c auth.h] + Merge duplicate host key file checks, based in part on a patch from Rob + Holland via bz #1348 . Also checks for non-regular files during protocol + 1 RSA auth. ok djm@ + - djm@cvs.openbsd.org 2008/07/02 12:36:39 + [auth2-none.c auth2.c] + Make protocol 2 MaxAuthTries behaviour a little more sensible: + Check whether client has exceeded MaxAuthTries before running + an authentication method and skip it if they have, previously it + would always allow one try (for "none" auth). + Preincrement failure count before post-auth test - previously this + checked and postincremented, also to allow one "none" try. + Together, these two changes always count the "none" auth method + which could be skipped by a malicious client (e.g. an SSH worm) + to get an extra attempt at a real auth method. They also make *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From vanhu at FreeBSD.org Thu Oct 1 15:33:53 2009 From: vanhu at FreeBSD.org (VANHULLEBUS Yvan) Date: Thu Oct 1 15:34:05 2009 Subject: svn commit: r197674 - head/sys/netipsec Message-ID: <200910011533.n91FXron055903@svn.freebsd.org> Author: vanhu Date: Thu Oct 1 15:33:53 2009 New Revision: 197674 URL: http://svn.freebsd.org/changeset/base/197674 Log: Changed an IPSEC_ASSERT to a simple test, as such invalid packets may come from outside without being discarded before. Submitted by: aurelien.ansel@netasq.com Reviewed by: bz (secteam) Obtained from: NETASQ MFC after: 1m Modified: head/sys/netipsec/xform_esp.c Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Thu Oct 1 15:28:40 2009 (r197673) +++ head/sys/netipsec/xform_esp.c Thu Oct 1 15:33:53 2009 (r197674) @@ -282,9 +282,15 @@ esp_input(struct mbuf *m, struct secasva IPSEC_ASSERT(sav != NULL, ("null SA")); IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding xform")); - IPSEC_ASSERT((skip&3) == 0 && (m->m_pkthdr.len&3) == 0, - ("misaligned packet, skip %u pkt len %u", - skip, m->m_pkthdr.len)); + + /* Valid IP Packet length ? */ + if ( (skip&3) || (m->m_pkthdr.len&3) ){ + DPRINTF(("%s: misaligned packet, skip %u pkt len %u", + __func__, skip, m->m_pkthdr.len)); + V_espstat.esps_badilen++; + m_freem(m); + return EINVAL; + } /* XXX don't pullup, just copy header */ IP6_EXTHDR_GET(esp, struct newesp *, m, skip, sizeof (struct newesp)); From gallatin at FreeBSD.org Thu Oct 1 15:40:09 2009 From: gallatin at FreeBSD.org (Andrew Gallatin) Date: Thu Oct 1 15:40:16 2009 Subject: svn commit: r197675 - in stable/7/sys: . contrib/pf dev/mxge Message-ID: <200910011540.n91Fe9gg056132@svn.freebsd.org> Author: gallatin Date: Thu Oct 1 15:40:08 2009 New Revision: 197675 URL: http://svn.freebsd.org/changeset/base/197675 Log: MFC: more fixes for mxge watchdog reset handling (194761 197645) 194761: Fix bug where device would loose promisc setting when reset. 197645: Restore the PCI Express control register after reset Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/mxge/if_mxge.c stable/7/sys/dev/mxge/if_mxge_var.h Modified: stable/7/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/7/sys/dev/mxge/if_mxge.c Thu Oct 1 15:33:53 2009 (r197674) +++ stable/7/sys/dev/mxge/if_mxge.c Thu Oct 1 15:40:08 2009 (r197675) @@ -1296,7 +1296,7 @@ mxge_reset(mxge_softc_t *sc, int interru } sc->rdma_tags_available = 15; status = mxge_update_mac_address(sc); - mxge_change_promisc(sc, 0); + mxge_change_promisc(sc, sc->ifp->if_flags & IFF_PROMISC); mxge_change_pause(sc, sc->pause); mxge_set_multicast_list(sc); return status; @@ -3419,10 +3419,16 @@ mxge_setup_cfg_space(mxge_softc_t *sc) if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { lnk = pci_read_config(dev, reg + 0x12, 2); sc->link_width = (lnk >> 4) & 0x3f; - - pectl = pci_read_config(dev, reg + 0x8, 2); - pectl = (pectl & ~0x7000) | (5 << 12); - pci_write_config(dev, reg + 0x8, pectl, 2); + + if (sc->pectl == 0) { + pectl = pci_read_config(dev, reg + 0x8, 2); + pectl = (pectl & ~0x7000) | (5 << 12); + pci_write_config(dev, reg + 0x8, pectl, 2); + sc->pectl = pectl; + } else { + /* restore saved pectl after watchdog reset */ + pci_write_config(dev, reg + 0x8, sc->pectl, 2); + } } /* Enable DMA and Memory space access */ @@ -3533,6 +3539,9 @@ mxge_watchdog_reset(mxge_softc_t *sc) /* release all TX locks */ for (s = 0; s < num_tx_slices; s++) { ss = &sc->ss[s]; +#ifdef IFNET_BUF_RING + mxge_start_locked(ss); +#endif mtx_unlock(&ss->tx.mtx); } } @@ -3795,7 +3804,7 @@ mxge_fetch_tunables(mxge_softc_t *sc) mxge_ticks = hz / 2; sc->pause = mxge_flow_control; if (mxge_rss_hash_type < MXGEFW_RSS_HASH_TYPE_IPV4 - || mxge_rss_hash_type > MXGEFW_RSS_HASH_TYPE_SRC_PORT) { + || mxge_rss_hash_type > MXGEFW_RSS_HASH_TYPE_MAX) { mxge_rss_hash_type = MXGEFW_RSS_HASH_TYPE_SRC_PORT; } } Modified: stable/7/sys/dev/mxge/if_mxge_var.h ============================================================================== --- stable/7/sys/dev/mxge/if_mxge_var.h Thu Oct 1 15:33:53 2009 (r197674) +++ stable/7/sys/dev/mxge/if_mxge_var.h Thu Oct 1 15:40:08 2009 (r197675) @@ -254,6 +254,7 @@ struct mxge_softc { struct sysctl_ctx_list slice_sysctl_ctx; char *mac_addr_string; uint8_t mac_addr[6]; /* eeprom mac address */ + uint16_t pectl; /* save PCIe CTL state */ char product_code_string[64]; char serial_number_string[64]; char cmd_mtx_name[16]; From xcllnt at mac.com Thu Oct 1 15:41:15 2009 From: xcllnt at mac.com (Marcel Moolenaar) Date: Thu Oct 1 15:41:27 2009 Subject: svn commit: r197608 - head/sys/geom/part In-Reply-To: <20091001120652.GI50565@hades.panopticon> References: <200909282352.n8SNql1n069970@svn.freebsd.org> <200909290749.08764.jhb@freebsd.org> <20090929145447.GA82539@hades.panopticon> <20090929235146.GA64567@hades.panopticon> <20091001120652.GI50565@hades.panopticon> Message-ID: On Oct 1, 2009, at 5:06 AM, Dmitry Marakasov wrote: > * Marcel Moolenaar (xcllnt@mac.com) wrote: > >>>> Seconded. I've seen a report of geom_part_ebr unable to detect >>>> partitions which were actually there. Will inquiry the reporter if >>>> this change solved the problem. >>> >>> Seems like it hasn't. Here's the first sector from that partition: >> >> I'll see about checking the partition table more rigorously >> so that we can eliminate the check for the unused space. >> >> With what tool was this created? > > Dunno. I've pointed the person who had that problem to this thread. It should not matter; I was just curious... -- Marcel Moolenaar xcllnt@mac.com From gallatin at FreeBSD.org Thu Oct 1 15:51:29 2009 From: gallatin at FreeBSD.org (Andrew Gallatin) Date: Thu Oct 1 15:51:40 2009 Subject: svn commit: r197676 - in stable/6/sys: . conf contrib/pf dev/cxgb dev/mxge Message-ID: <200910011551.n91FpTnj056477@svn.freebsd.org> Author: gallatin Date: Thu Oct 1 15:51:29 2009 New Revision: 197676 URL: http://svn.freebsd.org/changeset/base/197676 Log: MFC: more fixes for mxge watchdog reset handling (194761 197645) 194761: Fix bug where device would loose promisc setting when reset. 197645: Restore the PCI Express control register after reset Modified: stable/6/sys/ (props changed) stable/6/sys/conf/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/dev/mxge/if_mxge.c stable/6/sys/dev/mxge/if_mxge_var.h Modified: stable/6/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/6/sys/dev/mxge/if_mxge.c Thu Oct 1 15:40:08 2009 (r197675) +++ stable/6/sys/dev/mxge/if_mxge.c Thu Oct 1 15:51:29 2009 (r197676) @@ -1296,7 +1296,7 @@ mxge_reset(mxge_softc_t *sc, int interru } sc->rdma_tags_available = 15; status = mxge_update_mac_address(sc); - mxge_change_promisc(sc, 0); + mxge_change_promisc(sc, sc->ifp->if_flags & IFF_PROMISC); mxge_change_pause(sc, sc->pause); mxge_set_multicast_list(sc); return status; @@ -3420,10 +3420,16 @@ mxge_setup_cfg_space(mxge_softc_t *sc) if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { lnk = pci_read_config(dev, reg + 0x12, 2); sc->link_width = (lnk >> 4) & 0x3f; - - pectl = pci_read_config(dev, reg + 0x8, 2); - pectl = (pectl & ~0x7000) | (5 << 12); - pci_write_config(dev, reg + 0x8, pectl, 2); + + if (sc->pectl == 0) { + pectl = pci_read_config(dev, reg + 0x8, 2); + pectl = (pectl & ~0x7000) | (5 << 12); + pci_write_config(dev, reg + 0x8, pectl, 2); + sc->pectl = pectl; + } else { + /* restore saved pectl after watchdog reset */ + pci_write_config(dev, reg + 0x8, sc->pectl, 2); + } } /* Enable DMA and Memory space access */ @@ -3534,6 +3540,9 @@ mxge_watchdog_reset(mxge_softc_t *sc) /* release all TX locks */ for (s = 0; s < num_tx_slices; s++) { ss = &sc->ss[s]; +#ifdef IFNET_BUF_RING + mxge_start_locked(ss); +#endif mtx_unlock(&ss->tx.mtx); } } @@ -3796,7 +3805,7 @@ mxge_fetch_tunables(mxge_softc_t *sc) mxge_ticks = hz / 2; sc->pause = mxge_flow_control; if (mxge_rss_hash_type < MXGEFW_RSS_HASH_TYPE_IPV4 - || mxge_rss_hash_type > MXGEFW_RSS_HASH_TYPE_SRC_PORT) { + || mxge_rss_hash_type > MXGEFW_RSS_HASH_TYPE_MAX) { mxge_rss_hash_type = MXGEFW_RSS_HASH_TYPE_SRC_PORT; } } Modified: stable/6/sys/dev/mxge/if_mxge_var.h ============================================================================== --- stable/6/sys/dev/mxge/if_mxge_var.h Thu Oct 1 15:40:08 2009 (r197675) +++ stable/6/sys/dev/mxge/if_mxge_var.h Thu Oct 1 15:51:29 2009 (r197676) @@ -253,6 +253,7 @@ struct mxge_softc { struct sysctl_ctx_list slice_sysctl_ctx; char *mac_addr_string; uint8_t mac_addr[6]; /* eeprom mac address */ + uint16_t pectl; /* save PCIe CTL state */ char product_code_string[64]; char serial_number_string[64]; char cmd_mtx_name[16]; From des at FreeBSD.org Thu Oct 1 17:12:53 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Thu Oct 1 17:13:01 2009 Subject: svn commit: r197679 - in head: crypto/openssh crypto/openssh/openbsd-compat secure/libexec/sftp-server secure/libexec/ssh-keysign secure/usr.bin/scp secure/usr.bin/sftp secure/usr.bin/ssh secure/us... Message-ID: <200910011712.n91HCqaT058548@svn.freebsd.org> Author: des Date: Thu Oct 1 17:12:52 2009 New Revision: 197679 URL: http://svn.freebsd.org/changeset/base/197679 Log: Upgrade to OpenSSH 5.3p1. Added: head/crypto/openssh/roaming.h - copied unchanged from r197675, vendor-crypto/openssh/dist/roaming.h head/crypto/openssh/roaming_common.c - copied unchanged from r197675, vendor-crypto/openssh/dist/roaming_common.c head/crypto/openssh/roaming_dummy.c - copied unchanged from r197675, vendor-crypto/openssh/dist/roaming_dummy.c head/crypto/openssh/schnorr.h - copied unchanged from r197675, vendor-crypto/openssh/dist/schnorr.h Modified: head/crypto/openssh/ (props changed) head/crypto/openssh/ChangeLog head/crypto/openssh/README head/crypto/openssh/README.platform head/crypto/openssh/auth-pam.c head/crypto/openssh/auth-passwd.c head/crypto/openssh/auth-sia.c head/crypto/openssh/auth1.c head/crypto/openssh/auth2-jpake.c head/crypto/openssh/auth2-kbdint.c head/crypto/openssh/auth2-none.c head/crypto/openssh/auth2-passwd.c head/crypto/openssh/auth2-pubkey.c head/crypto/openssh/auth2.c head/crypto/openssh/canohost.c head/crypto/openssh/canohost.h head/crypto/openssh/channels.c head/crypto/openssh/clientloop.c head/crypto/openssh/config.h head/crypto/openssh/config.h.in head/crypto/openssh/defines.h head/crypto/openssh/gss-genr.c head/crypto/openssh/includes.h head/crypto/openssh/jpake.c head/crypto/openssh/jpake.h head/crypto/openssh/kex.c head/crypto/openssh/kex.h head/crypto/openssh/kexdhs.c head/crypto/openssh/kexgexs.c head/crypto/openssh/monitor.c head/crypto/openssh/monitor_mm.c head/crypto/openssh/monitor_wrap.c head/crypto/openssh/monitor_wrap.h head/crypto/openssh/openbsd-compat/bsd-cygwin_util.c head/crypto/openssh/openbsd-compat/bsd-cygwin_util.h head/crypto/openssh/openbsd-compat/daemon.c head/crypto/openssh/openbsd-compat/getrrsetbyname.c head/crypto/openssh/openbsd-compat/openssl-compat.c head/crypto/openssh/openbsd-compat/openssl-compat.h head/crypto/openssh/openbsd-compat/port-aix.c head/crypto/openssh/openbsd-compat/port-aix.h head/crypto/openssh/packet.c head/crypto/openssh/packet.h head/crypto/openssh/readconf.c head/crypto/openssh/readconf.h head/crypto/openssh/schnorr.c head/crypto/openssh/servconf.c head/crypto/openssh/serverloop.c head/crypto/openssh/session.c head/crypto/openssh/sftp-client.c head/crypto/openssh/sftp-server.8 head/crypto/openssh/sftp-server.c head/crypto/openssh/ssh-agent.1 head/crypto/openssh/ssh-agent.c head/crypto/openssh/ssh-keygen.c head/crypto/openssh/ssh.1 head/crypto/openssh/ssh.c head/crypto/openssh/ssh_config head/crypto/openssh/ssh_config.5 head/crypto/openssh/ssh_namespace.h head/crypto/openssh/sshconnect.c head/crypto/openssh/sshconnect.h head/crypto/openssh/sshconnect2.c head/crypto/openssh/sshd.8 head/crypto/openssh/sshd.c head/crypto/openssh/sshd_config head/crypto/openssh/sshd_config.5 head/crypto/openssh/sshlogin.c head/crypto/openssh/uuencode.c head/crypto/openssh/version.h head/secure/libexec/sftp-server/Makefile head/secure/libexec/ssh-keysign/Makefile head/secure/usr.bin/scp/Makefile head/secure/usr.bin/sftp/Makefile head/secure/usr.bin/ssh-add/Makefile head/secure/usr.bin/ssh-agent/Makefile head/secure/usr.bin/ssh-keygen/Makefile head/secure/usr.bin/ssh-keyscan/Makefile head/secure/usr.bin/ssh/Makefile head/secure/usr.sbin/sshd/Makefile Modified: head/crypto/openssh/ChangeLog ============================================================================== --- head/crypto/openssh/ChangeLog Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/ChangeLog Thu Oct 1 17:12:52 2009 (r197679) @@ -1,3 +1,282 @@ +20090926 + - (djm) [contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Update for release + - (djm) [README] update relnotes URL + - (djm) [packet.c] Restore EWOULDBLOCK handling that got lost somewhere + - (djm) Release 5.3p1 + +20090911 + - (dtucker) [configure.ac] Change the -lresolv check so it works on Mac OS X + 10.6 (which doesn't have BIND8_COMPAT and thus uses res_9_query). Patch + from jbasney at ncsa uiuc edu. + +20090908 + - (djm) [serverloop.c] Fix test for server-assigned remote forwarding port + (-R 0:...); bz#1578, spotted and fix by gavin AT emf.net; ok dtucker@ + +20090901 + - (dtucker) [configure.ac] Bug #1639: use AC_PATH_PROG to search the path for + krb5-config if it's not in the location specified by --with-kerberos5. + Patch from jchadima at redhat. + +20090829 + - (dtucker) [README.platform] Add text about development packages, based on + text from Chris Pepper in bug #1631. + +20090828 + - dtucker [auth-sia.c] Roll back the change for bug #1241 as it apparently + causes problems in some Tru64 configurations. + - (djm) [sshd_config.5] downgrade mention of login.conf to be an example + and mention PAM as another provider for ChallengeResponseAuthentication; + bz#1408; ok dtucker@ + - (djm) [sftp-server.c] bz#1535: accept ENOSYS as a fallback error when + attempting atomic rename(); ok dtucker@ + - (djm) [Makefile.in] bz#1505: Solaris make(1) doesn't accept make variables + in argv, so pass them in the environment; ok dtucker@ + - (dtucker) [channels.c configure.ac] Bug #1528: skip the tcgetattr call on + the pty master on Solaris, since it never succeeds and can hang if large + amounts of data is sent to the slave (eg a copy-paste). Based on a patch + originally from Doke Scott, ok djm@ + - (dtucker) [clientloop.c configure.ac defines.h] Make the client's IO buffer + size a compile-time option and set it to 64k on Cygwin, since Corinna + reports that it makes a significant difference to performance. ok djm@ + - (dtucker) [configure.ac] Fix the syntax of the Solaris tcgetattr entry. + +20090820 + - (dtucker) [includes.h] Bug #1634: do not include system glob.h if we're not + using it since the type conflicts can cause problems on FreeBSD. Patch + from Jonathan Chen. + - (dtucker) [session.c openbsd-compat/port-aix.h] Bugs #1249 and #1567: move + the setpcred call on AIX to immediately before the permanently_set_uid(). + Ensures that we still have privileges when we call chroot and + pam_open_sesson. Based on a patch from David Leonard. + +20090817 + - (dtucker) [configure.ac] Check for headers before libraries for openssl an + zlib, which should make the errors slightly more meaningful on platforms + where there's separate "-devel" packages for those. + - (dtucker) [sshlogin.c openbsd-compat/port-aix.{c,h}] Bug #1595: make + PrintLastLog work on AIX. Based in part on a patch from Miguel Sanders. + +20090729 + - (tim) [contrib/cygwin/ssh-user-config] Change script to call correct error + function. Patch from Corinna Vinschen. + +20090713 + - (dtucker) [openbsd-compat/getrrsetbyname.c] Reduce answer buffer size so it + fits into 16 bits to work around a bug in glibc's resolver where it masks + off the buffer size at 16 bits. Patch from Hauke Lampe, ok djm jakob. + +20090712 + - (dtucker) [configure.ac] Include sys/param.h for the sys/mount.h test, + prevents configure complaining on older BSDs. + - (dtucker [contrib/cygwin/ssh-{host,user}-config] Add license text. Patch + from Corinna Vinschen. + - (dtucker) [auth-pam.c] Bug #1534: move the deletion of PAM credentials on + logout to after the session close. Patch from Anicka Bernathova, + originally from Andreas Schwab via Novelll ok djm. + +20090707 + - (dtucker) [contrib/cygwin/ssh-host-config] better support for automated + scripts and fix usage of eval. Patch from Corinna Vinschen. + +20090705 + - (dtucker) OpenBSD CVS Sync + - andreas@cvs.openbsd.org 2009/06/27 09:29:06 + [packet.h packet.c] + packet_bacup_state() and packet_restore_state() will be used to + temporarily save the current state ren resuming a suspended connection. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:32:43 + [roaming_common.c roaming.h] + It may be necessary to retransmit some data when resuming, so add it + to a buffer when roaming is enabled. + Most of this code was written by Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/06/27 09:35:06 + [readconf.h readconf.c] + Add client option UseRoaming. It doesn't do anything yet but will + control whether the client tries to use roaming if enabled on the + server. From Martin Forssen. + ok markus@ + - markus@cvs.openbsd.org 2009/06/30 14:54:40 + [version.h] + crank version; ok deraadt + - dtucker@cvs.openbsd.org 2009/07/02 02:11:47 + [ssh.c] + allow for long home dir paths (bz #1615). ok deraadt + (based in part on a patch from jchadima at redhat) + - stevesk@cvs.openbsd.org 2009/07/05 19:28:33 + [clientloop.c] + only send SSH2_MSG_DISCONNECT if we're in compat20; from dtucker@ + ok deraadt@ markus@ + +20090622 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2009/06/22 05:39:28 + [monitor_wrap.c monitor_mm.c ssh-keygen.c auth2.c gss-genr.c sftp-client.c] + alphabetize includes; reduces diff vs portable and style(9). + ok stevesk djm + (Id sync only; these were already in order in -portable) + +20090621 + - (dtucker) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2009/03/17 21:37:00 + [ssh.c] + pass correct argv[0] to openlog(); ok djm@ + - jmc@cvs.openbsd.org 2009/03/19 15:15:09 + [ssh.1] + for "Ciphers", just point the reader to the keyword in ssh_config(5), just + as we do for "MACs": this stops us getting out of sync when the lists + change; + fixes documentation/6102, submitted by Peter J. Philipp + alternative fix proposed by djm + ok markus + - tobias@cvs.openbsd.org 2009/03/23 08:31:19 + [ssh-agent.c] + Fixed a possible out-of-bounds memory access if the environment variable + SHELL is shorter than 3 characters. + with input by and ok dtucker + - tobias@cvs.openbsd.org 2009/03/23 19:38:04 + [ssh-agent.c] + My previous commit didn't fix the problem at all, so stick at my first + version of the fix presented to dtucker. + Issue notified by Matthias Barkhoff (matthias dot barkhoff at gmx dot de). + ok dtucker + - sobrado@cvs.openbsd.org 2009/03/26 08:38:39 + [sftp-server.8 sshd.8 ssh-agent.1] + fix a few typographical errors found by spell(1). + ok dtucker@, jmc@ + - stevesk@cvs.openbsd.org 2009/04/13 19:07:44 + [sshd_config.5] + fix possessive; ok djm@ + - stevesk@cvs.openbsd.org 2009/04/14 16:33:42 + [sftp-server.c] + remove unused option character from getopt() optstring; ok markus@ + - jj@cvs.openbsd.org 2009/04/14 21:10:54 + [servconf.c] + Fixed a few the-the misspellings in comments. Skipped a bunch in + binutils,gcc and so on. ok jmc@ + - stevesk@cvs.openbsd.org 2009/04/17 19:23:06 + [session.c] + use INTERNAL_SFTP_NAME for setproctitle() of in-process sftp-server; + ok djm@ markus@ + - stevesk@cvs.openbsd.org 2009/04/17 19:40:17 + [sshd_config.5] + clarify that even internal-sftp needs /dev/log for logging to work; ok + markus@ + - jmc@cvs.openbsd.org 2009/04/18 18:39:10 + [sshd_config.5] + tweak previous; ok stevesk + - stevesk@cvs.openbsd.org 2009/04/21 15:13:17 + [sshd_config.5] + clarify we cd to user's home after chroot; ok markus@ on + earlier version; tweaks and ok jmc@ + - andreas@cvs.openbsd.org 2009/05/25 06:48:01 + [channels.c packet.c clientloop.c packet.h serverloop.c monitor_wrap.c + monitor.c] + Put the globals in packet.c into a struct and don't access it directly + from other files. No functional changes. + ok markus@ djm@ + - andreas@cvs.openbsd.org 2009/05/27 06:31:25 + [canohost.h canohost.c] + Add clear_cached_addr(), needed for upcoming changes allowing the peer + address to change. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:33:39 + [clientloop.c] + Send SSH2_MSG_DISCONNECT when the client disconnects. From a larger + change from Martin Forssen, maf at appgate dot com. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:34:36 + [kex.c kex.h] + Move the KEX_COOKIE_LEN define to kex.h + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:36:07 + [packet.h packet.c] + Add packet_put_int64() and packet_get_int64(), part of a larger change + from Martin Forssen. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:38:16 + [sshconnect.h sshconnect.c] + Un-static ssh_exchange_identification(), part of a larger change from + Martin Forssen and needed for upcoming changes. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/28 16:50:16 + [sshd.c packet.c serverloop.c monitor_wrap.c clientloop.c sshconnect.c + monitor.c Added roaming.h roaming_common.c roaming_dummy.c] + Keep track of number of bytes read and written. Needed for upcoming + changes. Most code from Martin Forssen, maf at appgate dot com. + ok markus@ + Also, applied appropriate changes to Makefile.in + - andreas@cvs.openbsd.org 2009/06/12 20:43:22 + [monitor.c packet.c] + Fix warnings found by chl@ and djm@ and change roaming_atomicio's + return type to match atomicio's + Diff from djm@, ok markus@ + - andreas@cvs.openbsd.org 2009/06/12 20:58:32 + [packet.c] + Move some more statics into session_state + ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 07:37:15 + [kexdhs.c kexgexs.c] + abort if key_sign fails, preventing possible null deref. Based on report + from Paolo Ganci, ok markus@ djm@ + - dtucker@cvs.openbsd.org 2009/06/21 09:04:03 + [roaming.h roaming_common.c roaming_dummy.c] + Add tags for the benefit of the sync scripts + Also: pull in the changes for 1.1->1.2 missed in the previous sync. + - (dtucker) [auth2-jpake.c auth2.c canohost.h session.c] Whitespace and + header-order changes to reduce diff vs OpenBSD. + - (dtucker) [servconf.c sshd.c] More whitespace sync. + - (dtucker) [roaming_common.c roaming_dummy.c] Wrap #include in + ifdef. + +20090616 + - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t + is a struct with a __val member. Fixes build on, eg, Redhat 6.2. + +20090504 + - (dtucker) [sshlogin.c] Move the NO_SSH_LASTLOG #ifndef line to include + variable declarations. Should prevent unused warnings anywhere it's set + (only Crays as far as I can tell) and be a no-op everywhere else. + +20090318 + - (tim) [configure.ac] Remove setting IP_TOS_IS_BROKEN for Cygwin. The problem + that setsockopt(IP_TOS) doesn't work on Cygwin has been fixed since 2005. + Based on patch from vinschen at redhat com. + +20090308 + - (dtucker) [auth-passwd.c auth1.c auth2-kbdint.c auth2-none.c auth2-passwd.c + auth2-pubkey.c session.c openbsd-compat/bsd-cygwin_util.{c,h} + openbsd-compat/daemon.c] Remove support for Windows 95/98/ME and very old + version of Cygwin. Patch from vinschen at redhat com. + +20090307 + - (dtucker) [contrib/aix/buildbff.sh] Only try to rename ssh_prng_cmds if it + exists (it's not created if OpenSSL's PRNG is self-seeded, eg if the OS + has a /dev/random). + - (dtucker) [schnorr.c openbsd-compat/openssl-compat.{c,h}] Add + EVP_DigestUpdate to the OLD_EVP compatibility functions and tell schnorr.c + to use them. Allows building with older OpenSSL versions. + - (dtucker) [configure.ac defines.h] Check for in_port_t and typedef if needed. + - (dtucker) [configure.ac] Missing comma in type list. + - (dtucker) [configure.ac openbsd-compat/openssl-compat.{c,h}] + EVP_DigestUpdate does not exactly match the other OLD_EVP functions (eg + in openssl 0.9.6) so add an explicit test for it. + +20090306 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2009/03/05 07:18:19 + [auth2-jpake.c jpake.c jpake.h monitor_wrap.c monitor_wrap.h schnorr.c] + [sshconnect2.c] + refactor the (disabled) Schnorr proof code to make it a little more + generally useful + - djm@cvs.openbsd.org 2009/03/05 11:30:50 + [uuencode.c] + document what these functions do so I don't ever have to recuse into + b64_pton/ntop to remember their return values + 20090223 - (djm) OpenBSD CVS Sync - djm@cvs.openbsd.org 2009/02/22 23:50:57 Modified: head/crypto/openssh/README ============================================================================== --- head/crypto/openssh/README Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/README Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -See http://www.openssh.com/txt/release-5.2 for the release notes. +See http://www.openssh.com/txt/release-5.3 for the release notes. - A Japanese translation of this document and of the OpenSSH FAQ is - available at http://www.unixuser.org/~haruyama/security/openssh/index.html @@ -62,4 +62,4 @@ References - [6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 [7] http://www.openssh.com/faq.html -$Id: README,v 1.70 2009/02/23 00:11:57 djm Exp $ +$Id: README,v 1.70.4.1 2009/09/26 04:11:47 djm Exp $ Modified: head/crypto/openssh/README.platform ============================================================================== --- head/crypto/openssh/README.platform Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/README.platform Thu Oct 1 17:12:52 2009 (r197679) @@ -56,6 +56,18 @@ using a third party driver. More informa http://www-user.rhrk.uni-kl.de/~nissler/tuntap/ +Linux +----- + +Some Linux distributions (including Red Hat/Fedora/CentOS) include +headers and library links in the -devel RPMs rather than the main +binary RPMs. If you get an error about headers, or complaining about a +missing prerequisite then you may need to install the equivalent +development packages. On Redhat based distros these may be openssl-devel, +zlib-devel and pam-devel, on Debian based distros these may be +libssl-dev, libz-dev and libpam-dev. + + Solaris ------- If you enable BSM auditing on Solaris, you need to update audit_event(4) @@ -81,4 +93,4 @@ account stacks which will prevent authen return the output from pam_nologin to the client. -$Id: README.platform,v 1.9 2007/08/09 04:31:53 dtucker Exp $ +$Id: README.platform,v 1.10 2009/08/28 23:14:48 dtucker Exp $ Modified: head/crypto/openssh/auth-pam.c ============================================================================== --- head/crypto/openssh/auth-pam.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth-pam.c Thu Oct 1 17:12:52 2009 (r197679) @@ -602,16 +602,16 @@ sshpam_cleanup(void) return; debug("PAM: cleanup"); pam_set_item(sshpam_handle, PAM_CONV, (const void *)&null_conv); - if (sshpam_cred_established) { - debug("PAM: deleting credentials"); - pam_setcred(sshpam_handle, PAM_DELETE_CRED); - sshpam_cred_established = 0; - } if (sshpam_session_open) { debug("PAM: closing session"); pam_close_session(sshpam_handle, PAM_SILENT); sshpam_session_open = 0; } + if (sshpam_cred_established) { + debug("PAM: deleting credentials"); + pam_setcred(sshpam_handle, PAM_DELETE_CRED); + sshpam_cred_established = 0; + } sshpam_authenticated = 0; pam_end(sshpam_handle, sshpam_err); sshpam_handle = NULL; Modified: head/crypto/openssh/auth-passwd.c ============================================================================== --- head/crypto/openssh/auth-passwd.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth-passwd.c Thu Oct 1 17:12:52 2009 (r197679) @@ -102,7 +102,7 @@ auth_password(Authctxt *authctxt, const } #endif #ifdef HAVE_CYGWIN - if (is_winnt) { + { HANDLE hToken = cygwin_logon_user(pw, password); if (hToken == INVALID_HANDLE_VALUE) Modified: head/crypto/openssh/auth-sia.c ============================================================================== --- head/crypto/openssh/auth-sia.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth-sia.c Thu Oct 1 17:12:52 2009 (r197679) @@ -34,10 +34,6 @@ #include #include #include -#include -#include -#include -#include #include "ssh.h" #include "key.h" @@ -53,52 +49,6 @@ extern ServerOptions options; extern int saved_argc; extern char **saved_argv; -static int -sia_password_change_required(const char *user) -{ - struct es_passwd *acct; - time_t pw_life; - time_t pw_date; - - set_auth_parameters(saved_argc, saved_argv); - - if ((acct = getespwnam(user)) == NULL) { - error("Couldn't access protected database entry for %s", user); - endprpwent(); - return (0); - } - - /* If forced password change flag is set, honor it */ - if (acct->uflg->fg_psw_chg_reqd && acct->ufld->fd_psw_chg_reqd) { - endprpwent(); - return (1); - } - - /* Obtain password lifetime; if none, it can't have expired */ - if (acct->uflg->fg_expire) - pw_life = acct->ufld->fd_expire; - else if (acct->sflg->fg_expire) - pw_life = acct->sfld->fd_expire; - else { - endprpwent(); - return (0); - } - - /* Offset from last change; if none, it must be expired */ - if (acct->uflg->fg_schange) - pw_date = acct->ufld->fd_schange + pw_life; - else { - endprpwent(); - return (1); - } - - endprpwent(); - - /* If expiration date is prior to now, change password */ - - return (pw_date <= time((time_t *) NULL)); -} - int sys_auth_passwd(Authctxt *authctxt, const char *pass) { @@ -126,9 +76,6 @@ sys_auth_passwd(Authctxt *authctxt, cons sia_ses_release(&ent); - authctxt->force_pwchange = sia_password_change_required( - authctxt->user); - return (1); } Modified: head/crypto/openssh/auth1.c ============================================================================== --- head/crypto/openssh/auth1.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth1.c Thu Oct 1 17:12:52 2009 (r197679) @@ -318,15 +318,7 @@ do_authloop(Authctxt *authctxt) } #endif /* _UNICOS */ -#ifdef HAVE_CYGWIN - if (authenticated && - !check_nt_auth(type == SSH_CMSG_AUTH_PASSWORD, - authctxt->pw)) { - packet_disconnect("Authentication rejected for uid %d.", - authctxt->pw == NULL ? -1 : authctxt->pw->pw_uid); - authenticated = 0; - } -#else +#ifndef HAVE_CYGWIN /* Special handling for root */ if (authenticated && authctxt->pw->pw_uid == 0 && !auth_root_allowed(meth->name)) { Modified: head/crypto/openssh/auth2-jpake.c ============================================================================== --- head/crypto/openssh/auth2-jpake.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-jpake.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth2-jpake.c,v 1.2 2008/11/07 23:34:48 dtucker Exp $ */ +/* $OpenBSD: auth2-jpake.c,v 1.3 2009/03/05 07:18:19 djm Exp $ */ /* * Copyright (c) 2008 Damien Miller. All rights reserved. * @@ -42,8 +42,8 @@ #include "ssh2.h" #include "key.h" #include "hostfile.h" -#include "buffer.h" #include "auth.h" +#include "buffer.h" #include "packet.h" #include "dispatch.h" #include "log.h" @@ -55,6 +55,7 @@ #endif #include "monitor_wrap.h" +#include "schnorr.h" #include "jpake.h" /* @@ -359,7 +360,7 @@ auth2_jpake_get_pwdata(Authctxt *authctx } /* - * Being authentication attempt. + * Begin authentication attempt. * Note, sets authctxt->postponed while in subprotocol */ static int Modified: head/crypto/openssh/auth2-kbdint.c ============================================================================== --- head/crypto/openssh/auth2-kbdint.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-kbdint.c Thu Oct 1 17:12:52 2009 (r197679) @@ -58,10 +58,6 @@ userauth_kbdint(Authctxt *authctxt) xfree(devs); xfree(lang); -#ifdef HAVE_CYGWIN - if (check_nt_auth(0, authctxt->pw) == 0) - authenticated = 0; -#endif return authenticated; } Modified: head/crypto/openssh/auth2-none.c ============================================================================== --- head/crypto/openssh/auth2-none.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-none.c Thu Oct 1 17:12:52 2009 (r197679) @@ -61,10 +61,6 @@ userauth_none(Authctxt *authctxt) { none_enabled = 0; packet_check_eom(); -#ifdef HAVE_CYGWIN - if (check_nt_auth(1, authctxt->pw) == 0) - return (0); -#endif if (options.password_authentication) return (PRIVSEP(auth_password(authctxt, ""))); return (0); Modified: head/crypto/openssh/auth2-passwd.c ============================================================================== --- head/crypto/openssh/auth2-passwd.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-passwd.c Thu Oct 1 17:12:52 2009 (r197679) @@ -68,10 +68,6 @@ userauth_passwd(Authctxt *authctxt) logit("password change not supported"); else if (PRIVSEP(auth_password(authctxt, password)) == 1) authenticated = 1; -#ifdef HAVE_CYGWIN - if (check_nt_auth(1, authctxt->pw) == 0) - authenticated = 0; -#endif memset(password, 0, len); xfree(password); return authenticated; Modified: head/crypto/openssh/auth2-pubkey.c ============================================================================== --- head/crypto/openssh/auth2-pubkey.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2-pubkey.c Thu Oct 1 17:12:52 2009 (r197679) @@ -170,10 +170,6 @@ done: key_free(key); xfree(pkalg); xfree(pkblob); -#ifdef HAVE_CYGWIN - if (check_nt_auth(0, authctxt->pw) == 0) - authenticated = 0; -#endif return authenticated; } Modified: head/crypto/openssh/auth2.c ============================================================================== --- head/crypto/openssh/auth2.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/auth2.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth2.c,v 1.120 2008/11/04 08:22:12 djm Exp $ */ +/* $OpenBSD: auth2.c,v 1.121 2009/06/22 05:39:28 dtucker Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -36,8 +36,8 @@ __RCSID("$FreeBSD$"); #include #include -#include "xmalloc.h" #include "atomicio.h" +#include "xmalloc.h" #include "ssh2.h" #include "packet.h" #include "log.h" Modified: head/crypto/openssh/canohost.c ============================================================================== --- head/crypto/openssh/canohost.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/canohost.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: canohost.c,v 1.64 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: canohost.c,v 1.65 2009/05/27 06:31:25 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -35,6 +35,8 @@ #include "misc.h" static void check_ip_options(int, char *); +static char *canonical_host_ip = NULL; +static int cached_port = -1; /* * Return the canonical name of the host at the other end of the socket. The @@ -304,6 +306,16 @@ get_local_name(int sock) return get_socket_address(sock, 0, NI_NAMEREQD); } +void +clear_cached_addr(void) +{ + if (canonical_host_ip != NULL) { + xfree(canonical_host_ip); + canonical_host_ip = NULL; + } + cached_port = -1; +} + /* * Returns the IP-address of the remote host as a string. The returned * string must not be freed. @@ -312,8 +324,6 @@ get_local_name(int sock) const char * get_remote_ipaddr(void) { - static char *canonical_host_ip = NULL; - /* Check whether we have cached the ipaddr. */ if (canonical_host_ip == NULL) { if (packet_connection_is_on_socket()) { @@ -402,13 +412,11 @@ get_peer_port(int sock) int get_remote_port(void) { - static int port = -1; - /* Cache to avoid getpeername() on a dead connection */ - if (port == -1) - port = get_port(0); + if (cached_port == -1) + cached_port = get_port(0); - return port; + return cached_port; } int Modified: head/crypto/openssh/canohost.h ============================================================================== --- head/crypto/openssh/canohost.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/canohost.h Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: canohost.h,v 1.10 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: canohost.h,v 1.11 2009/05/27 06:31:25 andreas Exp $ */ /* * Author: Tatu Ylonen @@ -24,6 +24,6 @@ char *get_local_name(int); int get_remote_port(void); int get_local_port(void); int get_sock_port(int, int); - +void clear_cached_addr(void); void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *); Modified: head/crypto/openssh/channels.c ============================================================================== --- head/crypto/openssh/channels.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/channels.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.295 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.296 2009/05/25 06:48:00 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1653,6 +1653,7 @@ channel_handle_wfd(Channel *c, fd_set *r } return -1; } +#ifndef BROKEN_TCGETATTR_ICANON if (compat20 && c->isatty && dlen >= 1 && buf[0] != '\r') { if (tcgetattr(c->wfd, &tio) == 0 && !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { @@ -1666,6 +1667,7 @@ channel_handle_wfd(Channel *c, fd_set *r packet_send(); } } +#endif buffer_consume(&c->output, len); if (compat20 && len > 0) { c->local_consumed += len; @@ -2431,7 +2433,7 @@ channel_input_status_confirm(int type, u int id; /* Reset keepalive timeout */ - keep_alive_timeouts = 0; + packet_set_alive_timeouts(0); id = packet_get_int(); packet_check_eom(); Modified: head/crypto/openssh/clientloop.c ============================================================================== --- head/crypto/openssh/clientloop.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/clientloop.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.209 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.213 2009/07/05 19:28:33 stevesk Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -109,6 +109,7 @@ #include "misc.h" #include "match.h" #include "msg.h" +#include "roaming.h" /* import options */ extern Options options; @@ -491,13 +492,13 @@ client_global_request_reply(int type, u_ xfree(gc); } - keep_alive_timeouts = 0; + packet_set_alive_timeouts(0); } static void server_alive_check(void) { - if (++keep_alive_timeouts > options.server_alive_count_max) { + if (packet_inc_alive_timeouts() > options.server_alive_count_max) { logit("Timeout, server not responding."); cleanup_exit(255); } @@ -634,8 +635,8 @@ client_suspend_self(Buffer *bin, Buffer static void client_process_net_input(fd_set *readset) { - int len; - char buf[8192]; + int len, cont = 0; + char buf[SSH_IOBUFSZ]; /* * Read input from the server, and add any such data to the buffer of @@ -643,8 +644,8 @@ client_process_net_input(fd_set *readset */ if (FD_ISSET(connection_in, readset)) { /* Read as much as possible. */ - len = read(connection_in, buf, sizeof(buf)); - if (len == 0) { + len = roaming_read(connection_in, buf, sizeof(buf), &cont); + if (len == 0 && cont == 0) { /* * Received EOF. The remote host has closed the * connection. @@ -1128,7 +1129,7 @@ static void client_process_input(fd_set *readset) { int len; - char buf[8192]; + char buf[SSH_IOBUFSZ]; /* Read input from stdin. */ if (FD_ISSET(fileno(stdin), readset)) { @@ -1476,6 +1477,14 @@ client_loop(int have_pty, int escape_cha /* Stop watching for window change. */ signal(SIGWINCH, SIG_DFL); + if (compat20) { + packet_start(SSH2_MSG_DISCONNECT); + packet_put_int(SSH2_DISCONNECT_BY_APPLICATION); + packet_put_cstring("disconnected by user"); + packet_send(); + packet_write_wait(); + } + channel_free_all(); if (have_pty) Modified: head/crypto/openssh/config.h ============================================================================== --- head/crypto/openssh/config.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/config.h Thu Oct 1 17:12:52 2009 (r197679) @@ -69,6 +69,9 @@ /* Define if your snprintf is busted */ /* #undef BROKEN_SNPRINTF */ +/* tcgetattr with ICANON may hang */ +/* #undef BROKEN_TCGETATTR_ICANON */ + /* updwtmpx is broken (if present) */ /* #undef BROKEN_UPDWTMPX */ @@ -123,9 +126,12 @@ /* Builtin PRNG command timeout */ #define ENTROPY_TIMEOUT_MSEC 200 -/* f_fsid has members */ +/* fsid_t has member val */ /* #undef FSID_HAS_VAL */ +/* fsid_t has member __val */ +/* #undef FSID_HAS___VAL */ + /* Define to 1 if the `getpgrp' function requires zero arguments. */ #define GETPGRP_VOID 1 @@ -519,6 +525,9 @@ /* Define to 1 if the system has the type `in_addr_t'. */ #define HAVE_IN_ADDR_T 1 +/* Define to 1 if the system has the type `in_port_t'. */ +#define HAVE_IN_PORT_T 1 + /* Define to 1 if you have the header file. */ /* #undef HAVE_LASTLOG_H */ @@ -1227,6 +1236,9 @@ /* Define if X11 doesn't support AF_UNIX sockets on that system */ /* #undef NO_X11_UNIX_SOCKETS */ +/* Define if EVP_DigestUpdate returns void */ +/* #undef OPENSSL_EVP_DIGESTUPDATE_VOID */ + /* libcrypto is missing AES 192 and 256 bit functions */ /* #undef OPENSSL_LOBOTOMISED_AES */ @@ -1310,6 +1322,9 @@ /* Use audit debugging module */ /* #undef SSH_AUDIT_EVENTS */ +/* Windows is sensitive to read buffer size */ +/* #undef SSH_IOBUFSZ */ + /* non-privileged user for privilege separation */ #define SSH_PRIVSEP_USER "sshd" @@ -1398,9 +1413,13 @@ /* Define if you want SELinux support. */ /* #undef WITH_SELINUX */ -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +#elif ! defined __LITTLE_ENDIAN__ +/* # undef WORDS_BIGENDIAN */ +#endif /* Define if xauth is found in your path */ /* #undef XAUTH_PATH */ Modified: head/crypto/openssh/config.h.in ============================================================================== --- head/crypto/openssh/config.h.in Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/config.h.in Thu Oct 1 17:12:52 2009 (r197679) @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + /* Define if you have a getaddrinfo that fails for the all-zeros IPv6 address */ #undef AIX_GETNAMEINFO_HACK @@ -68,6 +71,9 @@ /* Define if your snprintf is busted */ #undef BROKEN_SNPRINTF +/* tcgetattr with ICANON may hang */ +#undef BROKEN_TCGETATTR_ICANON + /* updwtmpx is broken (if present) */ #undef BROKEN_UPDWTMPX @@ -122,9 +128,12 @@ /* Builtin PRNG command timeout */ #undef ENTROPY_TIMEOUT_MSEC -/* f_fsid has members */ +/* fsid_t has member val */ #undef FSID_HAS_VAL +/* fsid_t has member __val */ +#undef FSID_HAS___VAL + /* Define to 1 if the `getpgrp' function requires zero arguments. */ #undef GETPGRP_VOID @@ -518,6 +527,9 @@ /* Define to 1 if the system has the type `in_addr_t'. */ #undef HAVE_IN_ADDR_T +/* Define to 1 if the system has the type `in_port_t'. */ +#undef HAVE_IN_PORT_T + /* Define to 1 if you have the header file. */ #undef HAVE_LASTLOG_H @@ -1226,6 +1238,9 @@ /* Define if X11 doesn't support AF_UNIX sockets on that system */ #undef NO_X11_UNIX_SOCKETS +/* Define if EVP_DigestUpdate returns void */ +#undef OPENSSL_EVP_DIGESTUPDATE_VOID + /* libcrypto is missing AES 192 and 256 bit functions */ #undef OPENSSL_LOBOTOMISED_AES @@ -1309,6 +1324,9 @@ /* Use audit debugging module */ #undef SSH_AUDIT_EVENTS +/* Windows is sensitive to read buffer size */ +#undef SSH_IOBUFSZ + /* non-privileged user for privilege separation */ #undef SSH_PRIVSEP_USER @@ -1397,9 +1415,17 @@ /* Define if you want SELinux support. */ #undef WITH_SELINUX -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif /* Define if xauth is found in your path */ #undef XAUTH_PATH Modified: head/crypto/openssh/defines.h ============================================================================== --- head/crypto/openssh/defines.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/defines.h Thu Oct 1 17:12:52 2009 (r197679) @@ -25,7 +25,7 @@ #ifndef _DEFINES_H #define _DEFINES_H -/* $Id: defines.h,v 1.153 2009/02/01 11:19:54 dtucker Exp $ */ +/* $Id: defines.h,v 1.156 2009/08/28 01:21:07 dtucker Exp $ */ /* Constants */ @@ -300,6 +300,9 @@ struct sockaddr_un { #ifndef HAVE_IN_ADDR_T typedef u_int32_t in_addr_t; #endif +#ifndef HAVE_IN_PORT_T +typedef u_int16_t in_port_t; +#endif #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE) #define _STRUCT_WINSIZE @@ -591,6 +594,10 @@ struct winsize { #define FSID_TO_ULONG(f) \ ((((u_int64_t)(f).val[0] & 0xffffffffUL) << 32) | \ ((f).val[1] & 0xffffffffUL)) +#elif defined(FSID_HAS___VAL) +#define FSID_TO_ULONG(f) \ + ((((u_int64_t)(f).__val[0] & 0xffffffffUL) << 32) | \ + ((f).__val[1] & 0xffffffffUL)) #else # define FSID_TO_ULONG(f) ((f)) #endif @@ -742,4 +749,8 @@ struct winsize { #define INET6_ADDRSTRLEN 46 #endif +#ifndef SSH_IOBUFSZ +# define SSH_IOBUFSZ 8192 +#endif + #endif /* _DEFINES_H */ Modified: head/crypto/openssh/gss-genr.c ============================================================================== --- head/crypto/openssh/gss-genr.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/gss-genr.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: gss-genr.c,v 1.19 2007/06/12 11:56:15 dtucker Exp $ */ +/* $OpenBSD: gss-genr.c,v 1.20 2009/06/22 05:39:28 dtucker Exp $ */ /* * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. Modified: head/crypto/openssh/includes.h ============================================================================== --- head/crypto/openssh/includes.h Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/includes.h Thu Oct 1 17:12:52 2009 (r197679) @@ -31,7 +31,8 @@ #endif #if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \ defined(GLOB_HAS_GL_MATCHC) && \ - defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 + defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 && \ + !defined(BROKEN_GLOB) # include #endif #ifdef HAVE_ENDIAN_H Modified: head/crypto/openssh/jpake.c ============================================================================== --- head/crypto/openssh/jpake.c Thu Oct 1 16:25:35 2009 (r197678) +++ head/crypto/openssh/jpake.c Thu Oct 1 17:12:52 2009 (r197679) @@ -1,4 +1,4 @@ -/* $OpenBSD: jpake.c,v 1.1 2008/11/04 08:22:12 djm Exp $ */ +/* $OpenBSD: jpake.c,v 1.2 2009/03/05 07:18:19 djm Exp $ */ /* * Copyright (c) 2008 Damien Miller. All rights reserved. * @@ -47,6 +47,7 @@ #include "log.h" #include "jpake.h" +#include "schnorr.h" #ifdef JPAKE @@ -60,165 +61,10 @@ "98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB" \ "9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF" -struct jpake_group * +struct modp_group * jpake_default_group(void) { - struct jpake_group *ret; - - ret = xmalloc(sizeof(*ret)); - ret->p = ret->q = ret->g = NULL; - if (BN_hex2bn(&ret->p, JPAKE_GROUP_P) == 0 || - BN_hex2bn(&ret->g, JPAKE_GROUP_G) == 0) - fatal("%s: BN_hex2bn", __func__); - /* Subgroup order is p/2 (p is a safe prime) */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From trasz at FreeBSD.org Thu Oct 1 17:22:04 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Oct 1 17:22:11 2009 Subject: svn commit: r197680 - in head/sys: fs/fifofs kern sys Message-ID: <200910011722.n91HM4Kg058819@svn.freebsd.org> Author: trasz Date: Thu Oct 1 17:22:03 2009 New Revision: 197680 URL: http://svn.freebsd.org/changeset/base/197680 Log: Provide default implementation for VOP_ACCESS(9), so that filesystems which want to provide VOP_ACCESSX(9) don't have to implement both. Note that this commit makes implementation of either of these two mandatory. Reviewed by: kib Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/subr_acl_posix1e.c head/sys/kern/vfs_default.c head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/fs/fifofs/fifo_vnops.c Thu Oct 1 17:22:03 2009 (r197680) @@ -119,7 +119,6 @@ static struct filterops fifo_notsup_filt struct vop_vector fifo_specops = { .vop_default = &default_vnodeops, - .vop_access = VOP_EBADF, .vop_advlock = fifo_advlock, .vop_close = fifo_close, .vop_create = VOP_PANIC, Modified: head/sys/kern/subr_acl_posix1e.c ============================================================================== --- head/sys/kern/subr_acl_posix1e.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/subr_acl_posix1e.c Thu Oct 1 17:22:03 2009 (r197680) @@ -61,6 +61,9 @@ vaccess_acl_posix1e(enum vtype type, uid accmode_t acl_mask_granted; int group_matched, i; + KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, + ("invalid bit in accmode")); + /* * Look for a normal, non-privileged way to access the file/directory * as requested. If it exists, go with that. Otherwise, attempt to Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/vfs_default.c Thu Oct 1 17:22:03 2009 (r197680) @@ -83,12 +83,17 @@ static int dirent_exists(struct vnode *v * * If there is no specific entry here, we will return EOPNOTSUPP. * + * Note that every filesystem has to implement either vop_access + * or vop_accessx; failing to do so will result in immediate crash + * due to stack overflow, as vop_stdaccess() calls vop_stdaccessx(), + * which calls vop_stdaccess() etc. */ struct vop_vector default_vnodeops = { .vop_default = NULL, .vop_bypass = VOP_EOPNOTSUPP, + .vop_access = vop_stdaccess, .vop_accessx = vop_stdaccessx, .vop_advlock = vop_stdadvlock, .vop_advlockasync = vop_stdadvlockasync, @@ -326,6 +331,16 @@ out: } int +vop_stdaccess(struct vop_access_args *ap) +{ + + KASSERT((ap->a_accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | + VAPPEND)) == 0, ("invalid bit in accmode")); + + return (VOP_ACCESSX(ap->a_vp, ap->a_accmode, ap->a_cred, ap->a_td)); +} + +int vop_stdaccessx(struct vop_accessx_args *ap) { int error; Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/kern/vfs_subr.c Thu Oct 1 17:22:03 2009 (r197680) @@ -3520,6 +3520,9 @@ vaccess(enum vtype type, mode_t file_mod accmode_t dac_granted; accmode_t priv_granted; + KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0, + ("invalid bit in accmode")); + /* * Look for a normal, non-privileged way to access the file/directory * as requested. If it exists, go with that. Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Oct 1 17:12:52 2009 (r197679) +++ head/sys/sys/vnode.h Thu Oct 1 17:22:03 2009 (r197680) @@ -685,6 +685,7 @@ int vop_stdlock(struct vop_lock1_args *) int vop_stdputpages(struct vop_putpages_args *); int vop_stdunlock(struct vop_unlock_args *); int vop_nopoll(struct vop_poll_args *); +int vop_stdaccess(struct vop_access_args *ap); int vop_stdaccessx(struct vop_accessx_args *ap); int vop_stdadvlock(struct vop_advlock_args *ap); int vop_stdadvlockasync(struct vop_advlockasync_args *ap); From cokane at FreeBSD.org Thu Oct 1 17:33:06 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 17:33:12 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002002534.D21507@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> Message-ID: <1254418346.4255.31.camel@localhost> On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: > On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm?rgrav wrote: > > > Coleman Kane writes: > >> - if (sc->ndis_80211 && vap) > >> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > > > > sc->ndis_80211 is an int. NULL is a pointer. > > Also, the number of style bugs was doubled on (almost?) every changed line > by adding 2 sets of unnecessary parentheses. > > Bruce Re-read style(9) more closely. Yes... the extra parentheses are superfluous, and should therefore be removed. However, the current rev, which looks like this: if ((sc->ndis_80211 != 0) && (vap != NULL)) doesn't help the author shoot themselves in the foot as violating the "explicitly compare values to zero" rule did in the earlier revision. I'll heed the request of the second-to-last paragraph of style(9) on this particular change, not churning the SVN repo further, and make a mental note for later. -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091001/5b7166cd/attachment.pgp From brde at optusnet.com.au Thu Oct 1 18:20:31 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Thu Oct 1 18:20:42 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <1254418346.4255.31.camel@localhost> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> <1254418346.4255.31.camel@localhost> Message-ID: <20091002040903.U21917@delplex.bde.org> On Thu, 1 Oct 2009, Coleman Kane wrote: > On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: >> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Smørgrav wrote: >> >>> Coleman Kane writes: >>>> - if (sc->ndis_80211 && vap) >>>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) >>> >>> sc->ndis_80211 is an int. NULL is a pointer. >> >> Also, the number of style bugs was doubled on (almost?) every changed line >> by adding 2 sets of unnecessary parentheses. >> >> Bruce > > Re-read style(9) more closely. Do I need to read it at all :-). > Yes... the extra parentheses are superfluous, and should therefore be > removed. However, the current rev, which looks like this: > > if ((sc->ndis_80211 != 0) && (vap != NULL)) > > doesn't help the author shoot themselves in the foot as violating the > "explicitly compare values to zero" rule did in the earlier revision. Actually I needed to count the style bugs more carefully -- 2 implicit comparisons with 0 or NULL (unless the first one is really boolean), but I only counted 1, while I counted 2 for the extra parentheses. > I'll heed the request of the second-to-last paragraph of style(9) on > this particular change, not churning the SVN repo further, and make a > mental note for later. Thanks. I forgot about that paragraph being there. I think churning repos doesn't matter much now if it ever did, but churning sources makes their history hard to understand. Bruce From marcus at FreeBSD.org Thu Oct 1 18:23:51 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Thu Oct 1 18:24:02 2009 Subject: svn commit: r197681 - head/lib/libc/gen Message-ID: <200910011823.n91INoDU060562@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Thu Oct 1 18:23:50 2009 New Revision: 197681 URL: http://svn.freebsd.org/changeset/base/197681 Log: Correct the pthread stub prototype for pthread_mutexattr_settype to allow for the type argument. This is known to fix some pthread_mutexattr_settype() invocations, especially when it comes to pulseaudio. Approved by: kib deischen (threads) MFC after: 3 days Modified: head/lib/libc/gen/_pthread_stubs.c Modified: head/lib/libc/gen/_pthread_stubs.c ============================================================================== --- head/lib/libc/gen/_pthread_stubs.c Thu Oct 1 17:22:03 2009 (r197680) +++ head/lib/libc/gen/_pthread_stubs.c Thu Oct 1 18:23:50 2009 (r197681) @@ -222,7 +222,7 @@ STUB_FUNC1(pthread_mutex_trylock, PJT_MU STUB_FUNC1(pthread_mutex_unlock, PJT_MUTEX_UNLOCK, int, void *) STUB_FUNC1(pthread_mutexattr_destroy, PJT_MUTEXATTR_DESTROY, int, void *) STUB_FUNC1(pthread_mutexattr_init, PJT_MUTEXATTR_INIT, int, void *) -STUB_FUNC1(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *) +STUB_FUNC2(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *, int) STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *) STUB_FUNC1(pthread_rwlock_destroy, PJT_RWLOCK_DESTROY, int, void *) STUB_FUNC2(pthread_rwlock_init, PJT_RWLOCK_INIT, int, void *, void *) From thompsa at FreeBSD.org Thu Oct 1 18:37:17 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Thu Oct 1 18:37:23 2009 Subject: svn commit: r197682 - head/sys/dev/usb/controller Message-ID: <200910011837.n91IbGL4061002@svn.freebsd.org> Author: thompsa Date: Thu Oct 1 18:37:16 2009 New Revision: 197682 URL: http://svn.freebsd.org/changeset/base/197682 Log: EHCI Hardware BUG workaround The EHCI HW can use the qtd_next field instead of qtd_altnext when a short packet is received. This contradicts what is stated in the EHCI datasheet. Also the total-bytes field in the status field of the following TD gets corrupted upon reception of a short packet! We work this around in software by not queueing more than one job/TD at a time of up to 16Kbytes! The bug has been seen on multiple INTEL based EHCI chips. Other vendors have not been tested yet. - Applications using /dev/usb/X.Y.Z, where Z is non-zero are affected, but not applications using LibUSB v0.1, v1.2 and v2.0. - Mass Storage (umass) is affected. Submitted by: Hans Petter Selasky MFC after: 3 days Modified: head/sys/dev/usb/controller/ehci.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Thu Oct 1 18:23:50 2009 (r197681) +++ head/sys/dev/usb/controller/ehci.c Thu Oct 1 18:37:16 2009 (r197682) @@ -131,6 +131,7 @@ struct ehci_std_temp { uint8_t auto_data_toggle; uint8_t setup_alt_next; uint8_t last_frame; + uint8_t can_use_next; }; void @@ -1207,11 +1208,6 @@ ehci_non_isoc_done_sub(struct usb_xfer * xfer->td_transfer_cache = td; - /* update data toggle */ - - xfer->endpoint->toggle_next = - (status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0; - #if USB_DEBUG if (status & EHCI_QTD_STATERRS) { DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x" @@ -1235,6 +1231,9 @@ ehci_non_isoc_done_sub(struct usb_xfer * static void ehci_non_isoc_done(struct usb_xfer *xfer) { + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); + ehci_qh_t *qh; + uint32_t status; usb_error_t err = 0; DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n", @@ -1248,6 +1247,17 @@ ehci_non_isoc_done(struct usb_xfer *xfer } #endif + /* extract data toggle directly from the QH's overlay area */ + + qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; + + usb_pc_cpu_invalidate(qh->page_cache); + + status = hc32toh(sc, qh->qh_qtd.qtd_status); + + xfer->endpoint->toggle_next = + (status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0; + /* reset scanner */ xfer->td_transfer_cache = xfer->td_transfer_first; @@ -1348,6 +1358,7 @@ ehci_check_transfer(struct usb_xfer *xfe } } else { ehci_qtd_t *td; + ehci_qh_t *qh; /* non-isochronous transfer */ @@ -1357,16 +1368,35 @@ ehci_check_transfer(struct usb_xfer *xfe */ td = xfer->td_transfer_cache; + qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; + + usb_pc_cpu_invalidate(qh->page_cache); + + status = hc32toh(sc, qh->qh_qtd.qtd_status); + if (status & EHCI_QTD_ACTIVE) { + /* transfer is pending */ + goto done; + } + while (1) { usb_pc_cpu_invalidate(td->page_cache); status = hc32toh(sc, td->qtd_status); /* - * if there is an active TD the transfer isn't done + * Check if there is an active TD which + * indicates that the transfer isn't done. */ if (status & EHCI_QTD_ACTIVE) { /* update cache */ - xfer->td_transfer_cache = td; + if (xfer->td_transfer_cache != td) { + xfer->td_transfer_cache = td; + if (qh->qh_qtd.qtd_next & + htohc32(sc, EHCI_LINK_TERMINATE)) { + /* XXX - manually advance to next frame */ + qh->qh_qtd.qtd_next = td->qtd_self; + usb_pc_cpu_flush(td->page_cache); + } + } goto done; } /* @@ -1545,7 +1575,6 @@ ehci_setup_standard_chain_sub(struct ehc ehci_qtd_t *td; ehci_qtd_t *td_next; ehci_qtd_t *td_alt_next; - uint32_t qtd_altnext; uint32_t buf_offset; uint32_t average; uint32_t len_old; @@ -1554,7 +1583,6 @@ ehci_setup_standard_chain_sub(struct ehc uint8_t precompute; terminate = htohc32(temp->sc, EHCI_LINK_TERMINATE); - qtd_altnext = terminate; td_alt_next = NULL; buf_offset = 0; shortpkt_old = temp->shortpkt; @@ -1612,7 +1640,8 @@ restart: td->qtd_status = temp->qtd_status | - htohc32(temp->sc, EHCI_QTD_SET_BYTES(average)); + htohc32(temp->sc, EHCI_QTD_IOC | + EHCI_QTD_SET_BYTES(average)); if (average == 0) { @@ -1687,11 +1716,23 @@ restart: td->qtd_buffer_hi[x] = 0; } - if (td_next) { - /* link the current TD with the next one */ - td->qtd_next = td_next->qtd_self; + if (temp->can_use_next) { + if (td_next) { + /* link the current TD with the next one */ + td->qtd_next = td_next->qtd_self; + } + } else { + /* + * BUG WARNING: The EHCI HW can use the + * qtd_next field instead of qtd_altnext when + * a short packet is received! We work this + * around in software by not queueing more + * than one job/TD at a time! + */ + td->qtd_next = terminate; } - td->qtd_altnext = qtd_altnext; + + td->qtd_altnext = terminate; td->alt_next = td_alt_next; usb_pc_cpu_flush(td->page_cache); @@ -1703,15 +1744,9 @@ restart: /* setup alt next pointer, if any */ if (temp->last_frame) { td_alt_next = NULL; - qtd_altnext = terminate; } else { /* we use this field internally */ td_alt_next = td_next; - if (temp->setup_alt_next) { - qtd_altnext = td_next->qtd_self; - } else { - qtd_altnext = terminate; - } } /* restore */ @@ -1756,6 +1791,8 @@ ehci_setup_standard_chain(struct usb_xfe temp.qtd_status = 0; temp.last_frame = 0; temp.setup_alt_next = xfer->flags_int.short_frames_ok; + temp.can_use_next = (xfer->flags_int.control_xfr || + (UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT)); if (xfer->flags_int.control_xfr) { if (xfer->endpoint->toggle_next) { @@ -1889,7 +1926,6 @@ ehci_setup_standard_chain(struct usb_xfe /* the last TD terminates the transfer: */ td->qtd_next = htohc32(temp.sc, EHCI_LINK_TERMINATE); td->qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE); - td->qtd_status |= htohc32(temp.sc, EHCI_QTD_IOC); usb_pc_cpu_flush(td->page_cache); From cokane at FreeBSD.org Thu Oct 1 18:44:29 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 18:44:35 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002040903.U21917@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> <1254418346.4255.31.camel@localhost> <20091002040903.U21917@delplex.bde.org> Message-ID: <1254422625.4255.46.camel@localhost> On Fri, 2009-10-02 at 04:20 +1000, Bruce Evans wrote: > On Thu, 1 Oct 2009, Coleman Kane wrote: > > > On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: > >> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm?rgrav wrote: > >> > >>> Coleman Kane writes: > >>>> - if (sc->ndis_80211 && vap) > >>>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > >>> > >>> sc->ndis_80211 is an int. NULL is a pointer. > >> > >> Also, the number of style bugs was doubled on (almost?) every changed line > >> by adding 2 sets of unnecessary parentheses. > >> > >> Bruce > > > > Re-read style(9) more closely. > > Do I need to read it at all :-). I meant that in the past-tense first-person manner, sorry, not trying to tell anyone what to do. ;) Should have written "I re-read style(9)...". > > > Yes... the extra parentheses are superfluous, and should therefore be > > removed. However, the current rev, which looks like this: > > > > if ((sc->ndis_80211 != 0) && (vap != NULL)) > > > > doesn't help the author shoot themselves in the foot as violating the > > "explicitly compare values to zero" rule did in the earlier revision. > > Actually I needed to count the style bugs more carefully -- 2 implicit > comparisons with 0 or NULL (unless the first one is really boolean), > but I only counted 1, while I counted 2 for the extra parentheses. I think you're right about the ndis_80211. I got thrown off by the first usage of it in the file which reads: sc->ndis_80211++; But it looks like 1) It is tested elsewhere as a boolean, and 2) That statement really means sc->ndis_80211 = 1 (or = TRUE). > > > I'll heed the request of the second-to-last paragraph of style(9) on > > this particular change, not churning the SVN repo further, and make a > > mental note for later. > > Thanks. I forgot about that paragraph being there. I think churning > repos doesn't matter much now if it ever did, but churning sources makes > their history hard to understand. > > Bruce -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091001/22e9421d/attachment.pgp From cokane at FreeBSD.org Thu Oct 1 18:46:37 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Thu Oct 1 18:46:44 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002040903.U21917@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> <1254418346.4255.31.camel@localhost> <20091002040903.U21917@delplex.bde.org> Message-ID: <1254422625.4255.46.camel@localhost> On Fri, 2009-10-02 at 04:20 +1000, Bruce Evans wrote: > On Thu, 1 Oct 2009, Coleman Kane wrote: > > > On Fri, 2009-10-02 at 00:36 +1000, Bruce Evans wrote: > >> On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm?rgrav wrote: > >> > >>> Coleman Kane writes: > >>>> - if (sc->ndis_80211 && vap) > >>>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) > >>> > >>> sc->ndis_80211 is an int. NULL is a pointer. > >> > >> Also, the number of style bugs was doubled on (almost?) every changed line > >> by adding 2 sets of unnecessary parentheses. > >> > >> Bruce > > > > Re-read style(9) more closely. > > Do I need to read it at all :-). I meant that in the past-tense first-person manner, sorry, not trying to tell anyone what to do. ;) Should have written "I re-read style(9)...". > > > Yes... the extra parentheses are superfluous, and should therefore be > > removed. However, the current rev, which looks like this: > > > > if ((sc->ndis_80211 != 0) && (vap != NULL)) > > > > doesn't help the author shoot themselves in the foot as violating the > > "explicitly compare values to zero" rule did in the earlier revision. > > Actually I needed to count the style bugs more carefully -- 2 implicit > comparisons with 0 or NULL (unless the first one is really boolean), > but I only counted 1, while I counted 2 for the extra parentheses. I think you're right about the ndis_80211. I got thrown off by the first usage of it in the file which reads: sc->ndis_80211++; But it looks like 1) It is tested elsewhere as a boolean, and 2) That statement really means sc->ndis_80211 = 1 (or = TRUE). > > > I'll heed the request of the second-to-last paragraph of style(9) on > > this particular change, not churning the SVN repo further, and make a > > mental note for later. > > Thanks. I forgot about that paragraph being there. I think churning > repos doesn't matter much now if it ever did, but churning sources makes > their history hard to understand. > > Bruce -- Coleman Kane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091001/22e9421d/attachment-0001.pgp From delphij at FreeBSD.org Thu Oct 1 18:58:27 2009 From: delphij at FreeBSD.org (Xin LI) Date: Thu Oct 1 18:58:38 2009 Subject: svn commit: r197683 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910011858.n91IwQhM061711@svn.freebsd.org> Author: delphij Date: Thu Oct 1 18:58:26 2009 New Revision: 197683 URL: http://svn.freebsd.org/changeset/base/197683 Log: Return EOPNOTSUPP instead of EINVAL when doing chflags(2) over an old format ZFS, as defined in the manual page. Submitted by: pjd (response of my original patch but bugs are mine) MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 1 18:37:16 2009 (r197682) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 1 18:58:26 2009 (r197683) @@ -4180,8 +4180,12 @@ zfs_freebsd_setattr(ap) zflags = VTOZ(vp)->z_phys->zp_flags; if (vap->va_flags != VNOVAL) { + zfsvfs_t *zfsvfs = VTOZ(vp)->z_zfsvfs; int error; + if (zfsvfs->z_use_fuids == B_FALSE) + return (EOPNOTSUPP); + fflags = vap->va_flags; if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) return (EOPNOTSUPP); From jhb at FreeBSD.org Thu Oct 1 19:12:14 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Oct 1 19:12:20 2009 Subject: svn commit: r197684 - head/sys/ddb Message-ID: <200910011912.n91JCEoG062039@svn.freebsd.org> Author: jhb Date: Thu Oct 1 19:12:14 2009 New Revision: 197684 URL: http://svn.freebsd.org/changeset/base/197684 Log: Put square backets ([]) around process names for system processes to patch the behavior of ps(1). Modified: head/sys/ddb/db_ps.c Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Thu Oct 1 18:58:26 2009 (r197683) +++ head/sys/ddb/db_ps.c Thu Oct 1 19:12:14 2009 (r197684) @@ -189,13 +189,19 @@ db_ps(db_expr_t addr, boolean_t hasaddr, if (cred != NULL && jailed(cred)) strlcat(state, "J", sizeof(state)); db_printf(" %-6.6s ", state); - if (p->p_flag & P_HADTHREADS) + if (p->p_flag & P_HADTHREADS) { #ifdef __LP64__ - db_printf(" (threaded) %s\n", - p->p_comm); + db_printf(" (threaded) "); #else - db_printf(" (threaded) %s\n", p->p_comm); + db_printf(" (threaded) "); #endif + if (p->p_flag & P_SYSTEM) + db_printf("["); + db_printf("%s", p->p_comm); + if (p->p_flag & P_SYSTEM) + db_printf("]"); + db_printf("\n"); + } FOREACH_THREAD_IN_PROC(p, td) { dumpthread(p, td, p->p_flag & P_HADTHREADS); if (db_pager_quit) From qingli at FreeBSD.org Thu Oct 1 20:32:30 2009 From: qingli at FreeBSD.org (Qing Li) Date: Thu Oct 1 20:32:42 2009 Subject: svn commit: r197687 - head/sys/net Message-ID: <200910012032.n91KWTOa064111@svn.freebsd.org> Author: qingli Date: Thu Oct 1 20:32:29 2009 New Revision: 197687 URL: http://svn.freebsd.org/changeset/base/197687 Log: The flow-table associates TCP/UDP flows and IP destinations with specific routes. When the routing table changes, for example, when a new route with a more specific prefix is inserted into the routing table, the flow-table is not updated to reflect that change. As such existing connections cannot take advantage of the new path. In some cases the path is broken. This patch will update the affected flow-table entries when a more specific route is added. The route entry is properly marked when a route is deleted from the table. In this case, when the flow-table performs a search, the stale entry is updated automatically. Therefore this patch is not necessary for route deletion. Submitted by: simon, phk Reviewed by: bz, kmacy MFC after: 3 days Modified: head/sys/net/flowtable.c head/sys/net/flowtable.h head/sys/net/route.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Thu Oct 1 20:11:42 2009 (r197686) +++ head/sys/net/flowtable.c Thu Oct 1 20:32:29 2009 (r197687) @@ -830,7 +830,7 @@ fle_free(struct flentry *fle) } static void -flowtable_free_stale(struct flowtable *ft) +flowtable_free_stale(struct flowtable *ft, struct rtentry *rt) { int curbit = 0, count; struct flentry *fle, **flehead, *fleprev; @@ -866,8 +866,14 @@ flowtable_free_stale(struct flowtable *f curbit); } #endif - while (fle != NULL) { - if (!flow_stale(ft, fle)) { + while (fle != NULL) { + if (rt != NULL) { + if (__DEVOLATILE(struct rtentry *, fle->f_rt) != rt) { + fleprev = fle; + fle = fle->f_next; + continue; + } + } else if (!flow_stale(ft, fle)) { fleprev = fle; fle = fle->f_next; continue; @@ -916,6 +922,30 @@ flowtable_free_stale(struct flowtable *f log(LOG_DEBUG, "freed %d flow entries\n", count); } +void +flowtable_route_flush(struct flowtable *ft, struct rtentry *rt) +{ + int i; + if (ft->ft_flags & FL_PCPU) { + for (i = 0; i <= mp_maxid; i++) { + if (CPU_ABSENT(i)) + continue; + + thread_lock(curthread); + sched_bind(curthread, i); + thread_unlock(curthread); + + flowtable_free_stale(ft, rt); + + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); + } + } else { + flowtable_free_stale(ft, rt); + } +} + static void flowtable_clean_vnet(void) { @@ -933,14 +963,14 @@ flowtable_clean_vnet(void) sched_bind(curthread, i); thread_unlock(curthread); - flowtable_free_stale(ft); + flowtable_free_stale(ft, NULL); thread_lock(curthread); sched_unbind(curthread); thread_unlock(curthread); } } else { - flowtable_free_stale(ft); + flowtable_free_stale(ft, NULL); } ft = ft->ft_next; } Modified: head/sys/net/flowtable.h ============================================================================== --- head/sys/net/flowtable.h Thu Oct 1 20:11:42 2009 (r197686) +++ head/sys/net/flowtable.h Thu Oct 1 20:32:29 2009 (r197687) @@ -51,5 +51,7 @@ struct flowtable *flowtable_alloc(int ne int flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro, uint32_t fibnum); +void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt); + #endif /* _KERNEL */ #endif Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Thu Oct 1 20:11:42 2009 (r197686) +++ head/sys/net/route.c Thu Oct 1 20:32:29 2009 (r197687) @@ -56,6 +56,7 @@ #include #include #include +#include #ifdef RADIX_MPATH #include @@ -996,6 +997,9 @@ rtrequest1_fib(int req, struct rt_addrin { int error = 0, needlock = 0; register struct rtentry *rt; +#ifdef FLOWTABLE + register struct rtentry *rt0; +#endif register struct radix_node *rn; register struct radix_node_head *rnh; struct ifaddr *ifa; @@ -1153,6 +1157,53 @@ rtrequest1_fib(int req, struct rt_addrin } #endif +#ifdef FLOWTABLE + rt0 = NULL; + /* XXX + * "flow-table" only support IPv4 at the moment. + */ + if (dst->sa_family == AF_INET) { + rn = rnh->rnh_matchaddr(dst, rnh); + if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { + struct sockaddr *mask; + u_char *m, *n; + int len; + + /* + * compare mask to see if the new route is + * more specific than the existing one + */ + rt0 = RNTORT(rn); + RT_LOCK(rt0); + RT_ADDREF(rt0); + RT_UNLOCK(rt0); + /* + * A host route is already present, so + * leave the flow-table entries as is. + */ + if (rt0->rt_flags & RTF_HOST) { + RTFREE(rt0); + rt0 = NULL; + } else if (!(flags & RTF_HOST) && netmask) { + mask = rt_mask(rt0); + len = mask->sa_len; + m = (u_char *)mask; + n = (u_char *)netmask; + while (len-- > 0) { + if (*n != *m) + break; + n++; + m++; + } + if (len == 0 || (*n < *m)) { + RTFREE(rt0); + rt0 = NULL; + } + } + } + } +#endif + /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); /* @@ -1165,8 +1216,18 @@ rtrequest1_fib(int req, struct rt_addrin Free(rt_key(rt)); RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); +#ifdef FLOWTABLE + if (rt0 != NULL) + RTFREE(rt0); +#endif senderr(EEXIST); + } +#ifdef FLOWTABLE + else if (rt0 != NULL) { + flowtable_route_flush(V_ip_ft, rt0); + RTFREE(rt0); } +#endif /* * If this protocol has something to add to this then From jkim at FreeBSD.org Thu Oct 1 20:56:15 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Oct 1 20:56:26 2009 Subject: svn commit: r197688 - head/sys/modules/acpi/acpi Message-ID: <200910012056.n91KuFK4064968@svn.freebsd.org> Author: jkim Date: Thu Oct 1 20:56:15 2009 New Revision: 197688 URL: http://svn.freebsd.org/changeset/base/197688 Log: Compile ACPI debugger and disassembler for kernel modules unconditionally. These files will generate almost empty object files without ACPI_DEBUG/DDB options. As a result, size of acpi.ko will increase slightly. Modified: head/sys/modules/acpi/acpi/Makefile Modified: head/sys/modules/acpi/acpi/Makefile ============================================================================== --- head/sys/modules/acpi/acpi/Makefile Thu Oct 1 20:32:29 2009 (r197687) +++ head/sys/modules/acpi/acpi/Makefile Thu Oct 1 20:56:15 2009 (r197688) @@ -27,6 +27,10 @@ KMOD= acpi # ACPI CA sources +SRCS+= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c dbinput.c dbstats.c +SRCS+= dbutils.c dbxface.c +SRCS+= dmbuffer.c dmnames.c dmopcode.c dmobject.c dmresrc.c dmresrcl.c +SRCS+= dmresrcs.c dmutils.c dmwalk.c SRCS+= dsfield.c dsinit.c dsmethod.c dsmthdat.c dsobject.c dsopcode.c SRCS+= dsutils.c dswexec.c dswload.c dswscope.c dswstate.c SRCS+= evevent.c evgpe.c evgpeblk.c evmisc.c evregion.c evrgnini.c evsci.c @@ -69,12 +73,6 @@ SRCS+= cpufreq_if.h device_if.h isa_if.h # This obviously needs a better and more structural fix. SRCS+= opt_kstack_pages.h opt_nfs.h opt_apic.h opt_compat.h opt_hwpmc_hooks.h -# Debugging support -DBSRC= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c dbinput.c dbstats.c -DBSRC+= dbutils.c dbxface.c -DBSRC+= dmbuffer.c dmnames.c dmopcode.c dmobject.c dmresrc.c dmresrcl.c -DBSRC+= dmresrcs.c dmutils.c dmwalk.c - .if !defined(KERNBUILDDIR) .if KTR CFLAGS+=-DKTR @@ -87,7 +85,6 @@ CFLAGS+=-DACPI_MAX_THREADS=${ACPI_MAX_TH .endif .if ACPI_DEBUG CFLAGS+=-DACPI_DEBUG -SRCS+= ${DBSRC} opt_ddb.h: Makefile echo "#define DDB 1" > ${.TARGET} .else @@ -98,10 +95,12 @@ opt_ddb.h: Makefile # Machine-specific code such as sleep/wakeup SRCS+= acpi_machdep.c acpi_wakecode.h acpi_wakeup.c -.if ${MACHINE} == "i386" -SRCS+= madt.c assym.s +SRCS+= assym.s madt.c +CLEANFILES+= acpi_wakecode.bin acpi_wakecode.h acpi_wakecode.o +.if ${MACHINE_ARCH} == "amd64" +SRCS+= opt_global.h +CLEANFILES+= acpi_wakedata.h .endif -CLEANFILES+= acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin ${DBSRC:.c=.o} acpi_wakecode.h: acpi_wakecode.S assym.s ${MAKE} -f ${.CURDIR}/../../../${MACHINE_ARCH}/acpica/Makefile \ From jilles at FreeBSD.org Thu Oct 1 21:40:08 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Thu Oct 1 21:40:27 2009 Subject: svn commit: r197691 - in head: bin/sh tools/regression/bin/sh/errors Message-ID: <200910012140.n91Le8Kx071672@svn.freebsd.org> Author: jilles Date: Thu Oct 1 21:40:08 2009 New Revision: 197691 URL: http://svn.freebsd.org/changeset/base/197691 Log: sh: Disallow mismatched quotes in backticks (`...`). Due to the amount of code removed by this, it seems that allowing unmatched quotes was a deliberate imitation of System V sh and real ksh. Most other shells do not allow unmatched quotes (e.g. bash, zsh, pdksh, NetBSD /bin/sh, dash). PR: bin/137657 Added: head/tools/regression/bin/sh/errors/backquote-error2.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Thu Oct 1 21:14:40 2009 (r197690) +++ head/bin/sh/parser.c Thu Oct 1 21:40:08 2009 (r197691) @@ -82,7 +82,6 @@ struct heredoc { STATIC struct heredoc *heredoclist; /* list of here documents to read */ -STATIC int parsebackquote; /* nonzero if we are inside backquotes */ STATIC int doprompt; /* if set, prompt the user */ STATIC int needprompt; /* true if interactive and at start of line */ STATIC int lasttoken; /* last token read */ @@ -1043,7 +1042,7 @@ readtoken1(int firstc, char const *synta endword: if (syntax == ARISYNTAX) synerror("Missing '))'"); - if (syntax != BASESYNTAX && ! parsebackquote && eofmark == NULL) + if (syntax != BASESYNTAX && eofmark == NULL) synerror("Unterminated quoted string"); if (varnest != 0) { startlinno = plinno; @@ -1303,7 +1302,6 @@ parsesub: { parsebackq: { struct nodelist **nlpp; - int savepbq; union node *n; char *volatile str; struct jmploc jmploc; @@ -1311,11 +1309,9 @@ parsebackq: { int savelen; int saveprompt; - savepbq = parsebackquote; if (setjmp(jmploc.loc)) { if (str) ckfree(str); - parsebackquote = 0; handler = savehandler; longjmp(handler->loc, 1); } @@ -1397,7 +1393,6 @@ done: nlpp = &(*nlpp)->next; *nlpp = (struct nodelist *)stalloc(sizeof (struct nodelist)); (*nlpp)->next = NULL; - parsebackquote = oldstyle; if (oldstyle) { saveprompt = doprompt; @@ -1433,7 +1428,6 @@ done: str = NULL; INTON; } - parsebackquote = savepbq; handler = savehandler; if (arinest || dblquote) USTPUTC(CTLBACKQ | CTLQUOTE, out); Added: head/tools/regression/bin/sh/errors/backquote-error2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/errors/backquote-error2.0 Thu Oct 1 21:40:08 2009 (r197691) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +sh -c 'echo `echo .BA"DCODE.` +echo ".BAD"CODE.' 2>&1 | grep -q BADCODE && exit 1 +echo '`"`' | sh -n 2>/dev/null && exit 1 +echo '`'"'"'`' | sh -n 2>/dev/null && exit 1 +exit 0 From emaste at FreeBSD.org Thu Oct 1 21:44:31 2009 From: emaste at FreeBSD.org (Ed Maste) Date: Thu Oct 1 21:44:47 2009 Subject: svn commit: r197692 - head/sys/kern Message-ID: <200910012144.n91LiU4X072601@svn.freebsd.org> Author: emaste Date: Thu Oct 1 21:44:30 2009 New Revision: 197692 URL: http://svn.freebsd.org/changeset/base/197692 Log: In fill_kinfo_thread, copy the thread's name into struct kinfo_proc even if it is empty. Otherwise the previous thread's name would remain in the struct and then be reported for this thread. Submitted by: Ryan Stone MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Thu Oct 1 21:40:08 2009 (r197691) +++ head/sys/kern/kern_proc.c Thu Oct 1 21:44:30 2009 (r197692) @@ -847,8 +847,7 @@ fill_kinfo_thread(struct thread *td, str strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg)); else bzero(kp->ki_wmesg, sizeof(kp->ki_wmesg)); - if (td->td_name[0] != '\0') - strlcpy(kp->ki_ocomm, td->td_name, sizeof(kp->ki_ocomm)); + strlcpy(kp->ki_ocomm, td->td_name, sizeof(kp->ki_ocomm)); if (TD_ON_LOCK(td)) { kp->ki_kiflag |= KI_LOCKBLOCK; strlcpy(kp->ki_lockname, td->td_lockname, From jhb at freebsd.org Thu Oct 1 21:51:51 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Oct 1 21:52:02 2009 Subject: svn commit: r197684 - head/sys/ddb In-Reply-To: <200910011912.n91JCEoG062039@svn.freebsd.org> References: <200910011912.n91JCEoG062039@svn.freebsd.org> Message-ID: <200910011517.50276.jhb@freebsd.org> On Thursday 01 October 2009 3:12:14 pm John Baldwin wrote: > Author: jhb > Date: Thu Oct 1 19:12:14 2009 > New Revision: 197684 > URL: http://svn.freebsd.org/changeset/base/197684 > > Log: > Put square backets ([]) around process names for system processes to patch > the behavior of ps(1). Bah I should clarify that this just fixes the process name for multithreaded kernel processes. Single-threaded processes were already handled. -- John Baldwin From kmacy at FreeBSD.org Thu Oct 1 22:05:39 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Thu Oct 1 22:05:50 2009 Subject: svn commit: r197693 - in head/sys/i386: i386 include xen Message-ID: <200910012205.n91M5cTJ076251@svn.freebsd.org> Author: kmacy Date: Thu Oct 1 22:05:38 2009 New Revision: 197693 URL: http://svn.freebsd.org/changeset/base/197693 Log: make read_eflags and write_eflags accomplish the same effect on PVM as native, simplifying interrupt handling Modified: head/sys/i386/i386/vm_machdep.c head/sys/i386/include/cpufunc.h head/sys/i386/xen/xen_machdep.c Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Thu Oct 1 21:44:30 2009 (r197692) +++ head/sys/i386/i386/vm_machdep.c Thu Oct 1 22:05:38 2009 (r197693) @@ -270,11 +270,7 @@ cpu_fork(td1, p2, td2, flags) /* * XXX XEN need to check on PSL_USER is handled */ -#ifdef XEN - td2->td_md.md_saved_flags = 0; -#else td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; -#endif /* * Now, cpu_switch() can schedule the new process. * pcb_esp is loaded pointing to the cpu_switch() stack frame @@ -446,11 +442,7 @@ cpu_set_upcall(struct thread *td, struct /* Setup to release spin count in fork_exit(). */ td->td_md.md_spinlock_count = 1; -#ifdef XEN - td->td_md.md_saved_flags = 0; -#else td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; -#endif } /* Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Thu Oct 1 21:44:30 2009 (r197692) +++ head/sys/i386/include/cpufunc.h Thu Oct 1 22:05:38 2009 (r197693) @@ -49,8 +49,8 @@ extern u_int xen_rcr2(void); extern void xen_load_cr3(u_int data); extern void xen_tlb_flush(void); extern void xen_invlpg(u_int addr); -extern int xen_save_and_cli(void); -extern void xen_restore_flags(u_int eflags); +extern void write_eflags(u_int eflags); +extern u_int read_eflags(void); #endif struct region_descriptor; @@ -293,7 +293,11 @@ ia32_pause(void) } static __inline u_int +#ifdef XEN +_read_eflags(void) +#else read_eflags(void) +#endif { u_int ef; @@ -335,7 +339,11 @@ wbinvd(void) } static __inline void +#ifdef XEN +_write_eflags(u_int ef) +#else write_eflags(u_int ef) +#endif { __asm __volatile("pushl %0; popfl" : : "r" (ef)); } @@ -653,23 +661,15 @@ intr_disable(void) { register_t eflags; -#ifdef XEN - eflags = xen_save_and_cli(); -#else eflags = read_eflags(); disable_intr(); -#endif return (eflags); } static __inline void intr_restore(register_t eflags) { -#ifdef XEN - xen_restore_flags(eflags); -#else write_eflags(eflags); -#endif } #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ Modified: head/sys/i386/xen/xen_machdep.c ============================================================================== --- head/sys/i386/xen/xen_machdep.c Thu Oct 1 21:44:30 2009 (r197692) +++ head/sys/i386/xen/xen_machdep.c Thu Oct 1 22:05:38 2009 (r197693) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -101,6 +102,7 @@ void ni_sti(void); void ni_cli(void) { + CTR0(KTR_SPARE2, "ni_cli disabling interrupts"); __asm__("pushl %edx;" "pushl %eax;" ); @@ -345,33 +347,53 @@ xen_load_cr3(u_int val) PANIC_IF(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); } -void -xen_restore_flags(u_int eflags) +#ifdef KTR +static __inline u_int +rebp(void) { - if (eflags > 1) - eflags = ((eflags & PSL_I) == 0); + u_int data; - __restore_flags(eflags); + __asm __volatile("movl 4(%%ebp),%0" : "=r" (data)); + return (data); } +#endif -int -xen_save_and_cli(void) +u_int +read_eflags(void) { - int eflags; - - __save_and_cli(eflags); + vcpu_info_t *_vcpu; + u_int eflags; + + eflags = _read_eflags(); + _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; + if (_vcpu->evtchn_upcall_mask) + eflags &= ~PSL_I; + return (eflags); } void +write_eflags(u_int eflags) +{ + u_int intr; + + CTR2(KTR_SPARE2, "%x xen_restore_flags eflags %x", rebp(), eflags); + intr = ((eflags & PSL_I) == 0); + __restore_flags(intr); + _write_eflags(eflags); +} + +void xen_cli(void) { + CTR1(KTR_SPARE2, "%x xen_cli disabling interrupts", rebp()); __cli(); } void xen_sti(void) { + CTR1(KTR_SPARE2, "%x xen_sti enabling interrupts", rebp()); __sti(); } From delphij at delphij.net Fri Oct 2 00:42:53 2009 From: delphij at delphij.net (Xin LI) Date: Fri Oct 2 00:43:04 2009 Subject: svn commit: r197662 - head/sys/kern In-Reply-To: <200910011250.n91CoQ5G051511@svn.freebsd.org> References: <200910011250.n91CoQ5G051511@svn.freebsd.org> Message-ID: <4AC54C81.7030201@delphij.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Konstantin Belousov wrote: > Author: kib > Date: Thu Oct 1 12:50:26 2009 > New Revision: 197662 > URL: http://svn.freebsd.org/changeset/base/197662 > > Log: > Do not dereference vp->v_mount without holding vnode lock and checking > that the vnode is not reclaimed. > > Noted by: Igor Sysoev > MFC after: 1 week Thanks! > Modified: > head/sys/kern/uipc_syscalls.c > > Modified: head/sys/kern/uipc_syscalls.c > ============================================================================== > --- head/sys/kern/uipc_syscalls.c Thu Oct 1 12:48:35 2009 (r197661) > +++ head/sys/kern/uipc_syscalls.c Thu Oct 1 12:50:26 2009 (r197662) > @@ -2086,9 +2086,11 @@ retry_space: > /* > * Get the page from backing store. > */ > - bsize = vp->v_mount->mnt_stat.f_iosize; > vfslocked = VFS_LOCK_GIANT(vp->v_mount); > - vn_lock(vp, LK_SHARED | LK_RETRY); > + error = vn_lock(vp, LK_SHARED); > + if (error != 0) > + goto after_read; > + bsize = vp->v_mount->mnt_stat.f_iosize; > > /* > * XXXMAC: Because we don't have fp->f_cred > @@ -2101,6 +2103,7 @@ retry_space: > IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), > td->td_ucred, NOCRED, &resid, td); > VOP_UNLOCK(vp, 0); > + after_read: > VFS_UNLOCK_GIANT(vfslocked); > VM_OBJECT_LOCK(obj); > vm_page_io_finish(pg); > - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkrFTIAACgkQi+vbBBjt66DwFgCgn1DSEwLvKdf05bwSWqe3cKwl qZEAn28OF2G63pmKDzTB5mm2O9SaGuQB =7Ae1 -----END PGP SIGNATURE----- From qingli at freebsd.org Fri Oct 2 01:32:41 2009 From: qingli at freebsd.org (Qing Li) Date: Fri Oct 2 01:32:47 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <200910012032.n91KWTOa064111@svn.freebsd.org> References: <200910012032.n91KWTOa064111@svn.freebsd.org> Message-ID: <9ace436c0910011832q3fe6d273nbfd3c9a5d8d348ed@mail.gmail.com> I misinterpreted the "Submitted by:" field. I thought I put in the names of persons who reported the bug. Disregard the "Submitted by" field for this checkin. It's my code. Something breaks, my fault, email me ... -- Qing On Thu, Oct 1, 2009 at 1:32 PM, Qing Li wrote: > Author: qingli > Date: Thu Oct ?1 20:32:29 2009 > New Revision: 197687 > URL: http://svn.freebsd.org/changeset/base/197687 > > Log: > ?The flow-table associates TCP/UDP flows and IP destinations with > ?specific routes. When the routing table changes, for example, > ?when a new route with a more specific prefix is inserted into the > ?routing table, the flow-table is not updated to reflect that change. > ?As such existing connections cannot take advantage of the new path. > ?In some cases the path is broken. This patch will update the affected > ?flow-table entries when a more specific route is added. The route > ?entry is properly marked when a route is deleted from the table. > ?In this case, when the flow-table performs a search, the stale > ?entry is updated automatically. Therefore this patch is not > ?necessary for route deletion. > > ?Submitted by: simon, phk > ?Reviewed by: ?bz, kmacy > ?MFC after: ? ?3 days > > Modified: > ?head/sys/net/flowtable.c > ?head/sys/net/flowtable.h > ?head/sys/net/route.c > > Modified: head/sys/net/flowtable.c > ============================================================================== > --- head/sys/net/flowtable.c ? ?Thu Oct ?1 20:11:42 2009 ? ? ? ?(r197686) > +++ head/sys/net/flowtable.c ? ?Thu Oct ?1 20:32:29 2009 ? ? ? ?(r197687) > @@ -830,7 +830,7 @@ fle_free(struct flentry *fle) > ?} > > ?static void > -flowtable_free_stale(struct flowtable *ft) > +flowtable_free_stale(struct flowtable *ft, struct rtentry *rt) > ?{ > ? ? ? ?int curbit = 0, count; > ? ? ? ?struct flentry *fle, ?**flehead, *fleprev; > @@ -866,8 +866,14 @@ flowtable_free_stale(struct flowtable *f > ? ? ? ? ? ? ? ? ? ? ? ? ? ?curbit); > ? ? ? ? ? ? ? ?} > ?#endif > - ? ? ? ? ? ? ? while (fle != NULL) { > - ? ? ? ? ? ? ? ? ? ? ? if (!flow_stale(ft, fle)) { > + ? ? ? ? ? ? ? while (fle != NULL) { > + ? ? ? ? ? ? ? ? ? ? ? if (rt != NULL) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (__DEVOLATILE(struct rtentry *, fle->f_rt) != rt) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fleprev = fle; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? fle = fle->f_next; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? } else if (!flow_stale(ft, fle)) { > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fleprev = fle; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?fle = fle->f_next; > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?continue; > @@ -916,6 +922,30 @@ flowtable_free_stale(struct flowtable *f > ? ? ? ? ? ? ? ?log(LOG_DEBUG, "freed %d flow entries\n", count); > ?} > > +void > +flowtable_route_flush(struct flowtable *ft, struct rtentry *rt) > +{ > + ? ? ? int i; > + ? ? ? if (ft->ft_flags & FL_PCPU) { > + ? ? ? ? ? ? ? for (i = 0; i <= mp_maxid; i++) { > + ? ? ? ? ? ? ? ? ? ? ? if (CPU_ABSENT(i)) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue; > + > + ? ? ? ? ? ? ? ? ? ? ? thread_lock(curthread); > + ? ? ? ? ? ? ? ? ? ? ? sched_bind(curthread, i); > + ? ? ? ? ? ? ? ? ? ? ? thread_unlock(curthread); > + > + ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft, rt); > + > + ? ? ? ? ? ? ? ? ? ? ? thread_lock(curthread); > + ? ? ? ? ? ? ? ? ? ? ? sched_unbind(curthread); > + ? ? ? ? ? ? ? ? ? ? ? thread_unlock(curthread); > + ? ? ? ? ? ? ? } > + ? ? ? } else { > + ? ? ? ? ? ? ? flowtable_free_stale(ft, rt); > + ? ? ? } > +} > + > ?static void > ?flowtable_clean_vnet(void) > ?{ > @@ -933,14 +963,14 @@ flowtable_clean_vnet(void) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sched_bind(curthread, i); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?thread_unlock(curthread); > > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft, NULL); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?thread_lock(curthread); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sched_unbind(curthread); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?thread_unlock(curthread); > ? ? ? ? ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?} else { > - ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft); > + ? ? ? ? ? ? ? ? ? ? ? flowtable_free_stale(ft, NULL); > ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?ft = ft->ft_next; > ? ? ? ?} > > Modified: head/sys/net/flowtable.h > ============================================================================== > --- head/sys/net/flowtable.h ? ?Thu Oct ?1 20:11:42 2009 ? ? ? ?(r197686) > +++ head/sys/net/flowtable.h ? ?Thu Oct ?1 20:32:29 2009 ? ? ? ?(r197687) > @@ -51,5 +51,7 @@ struct flowtable *flowtable_alloc(int ne > ?int flowtable_lookup(struct flowtable *ft, struct mbuf *m, > ? ? struct route *ro, uint32_t fibnum); > > +void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt); > + > ?#endif /* _KERNEL */ > ?#endif > > Modified: head/sys/net/route.c > ============================================================================== > --- head/sys/net/route.c ? ? ? ?Thu Oct ?1 20:11:42 2009 ? ? ? ?(r197686) > +++ head/sys/net/route.c ? ? ? ?Thu Oct ?1 20:32:29 2009 ? ? ? ?(r197687) > @@ -56,6 +56,7 @@ > ?#include > ?#include > ?#include > +#include > > ?#ifdef RADIX_MPATH > ?#include > @@ -996,6 +997,9 @@ rtrequest1_fib(int req, struct rt_addrin > ?{ > ? ? ? ?int error = 0, needlock = 0; > ? ? ? ?register struct rtentry *rt; > +#ifdef FLOWTABLE > + ? ? ? register struct rtentry *rt0; > +#endif > ? ? ? ?register struct radix_node *rn; > ? ? ? ?register struct radix_node_head *rnh; > ? ? ? ?struct ifaddr *ifa; > @@ -1153,6 +1157,53 @@ rtrequest1_fib(int req, struct rt_addrin > ? ? ? ? ? ? ? ?} > ?#endif > > +#ifdef FLOWTABLE > + ? ? ? ? ? ? ? rt0 = NULL; > + ? ? ? ? ? ? ? /* XXX > + ? ? ? ? ? ? ? ?* "flow-table" only support IPv4 at the moment. > + ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? if (dst->sa_family == AF_INET) { > + ? ? ? ? ? ? ? ? ? ? ? rn = rnh->rnh_matchaddr(dst, rnh); > + ? ? ? ? ? ? ? ? ? ? ? if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct sockaddr *mask; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_char *m, *n; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int len; > + > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* compare mask to see if the new route is > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* more specific than the existing one > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rt0 = RNTORT(rn); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RT_LOCK(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RT_ADDREF(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RT_UNLOCK(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* A host route is already present, so > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?* leave the flow-table entries as is. > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (rt0->rt_flags & RTF_HOST) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rt0 = NULL; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } else if (!(flags & RTF_HOST) && netmask) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mask = rt_mask(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? len = mask->sa_len; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m = (u_char *)mask; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? n = (u_char *)netmask; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? while (len-- > 0) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (*n != *m) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? n++; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? m++; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (len == 0 || (*n < *m)) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rt0 = NULL; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? } > +#endif > + > ? ? ? ? ? ? ? ?/* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ > ? ? ? ? ? ? ? ?rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); > ? ? ? ? ? ? ? ?/* > @@ -1165,8 +1216,18 @@ rtrequest1_fib(int req, struct rt_addrin > ? ? ? ? ? ? ? ? ? ? ? ?Free(rt_key(rt)); > ? ? ? ? ? ? ? ? ? ? ? ?RT_LOCK_DESTROY(rt); > ? ? ? ? ? ? ? ? ? ? ? ?uma_zfree(V_rtzone, rt); > +#ifdef FLOWTABLE > + ? ? ? ? ? ? ? ? ? ? ? if (rt0 != NULL) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > +#endif > ? ? ? ? ? ? ? ? ? ? ? ?senderr(EEXIST); > + ? ? ? ? ? ? ? } > +#ifdef FLOWTABLE > + ? ? ? ? ? ? ? else if (rt0 != NULL) { > + ? ? ? ? ? ? ? ? ? ? ? flowtable_route_flush(V_ip_ft, rt0); > + ? ? ? ? ? ? ? ? ? ? ? RTFREE(rt0); > ? ? ? ? ? ? ? ?} > +#endif > > ? ? ? ? ? ? ? ?/* > ? ? ? ? ? ? ? ? * If this protocol has something to add to this then > From qingli at FreeBSD.org Fri Oct 2 01:34:55 2009 From: qingli at FreeBSD.org (Qing Li) Date: Fri Oct 2 01:35:02 2009 Subject: svn commit: r197695 - head/sys/netinet Message-ID: <200910020134.n921YtW8084991@svn.freebsd.org> Author: qingli Date: Fri Oct 2 01:34:55 2009 New Revision: 197695 URL: http://svn.freebsd.org/changeset/base/197695 Log: Previously, if an address alias is configured on an interface, and this address alias has a prefix matching that of another address configured on the same interface, then the ARP entry for the alias is not deleted from the ARP table when that address alias is removed. This patch fixes the aforementioned issue. PR: kern/139113 MFC after: 3 days Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Oct 2 01:07:28 2009 (r197694) +++ head/sys/netinet/in.c Fri Oct 2 01:34:55 2009 (r197695) @@ -1060,6 +1060,8 @@ in_scrubprefix(struct in_ifaddr *target) !(target->ia_ifp->if_flags & IFF_LOOPBACK)) { error = ifa_del_loopback_route((struct ifaddr *)target, (struct sockaddr *)&target->ia_addr); + /* remove arp cache */ + arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } if ((target->ia_flags & IFA_ROUTE) == 0) { @@ -1082,8 +1084,6 @@ in_scrubprefix(struct in_ifaddr *target) prefix = target->ia_addr.sin_addr; mask = target->ia_sockmask.sin_addr; prefix.s_addr &= mask.s_addr; - /* remove arp cache */ - arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } IN_IFADDR_RLOCK(); From qingli at FreeBSD.org Fri Oct 2 01:45:11 2009 From: qingli at FreeBSD.org (Qing Li) Date: Fri Oct 2 01:45:24 2009 Subject: svn commit: r197696 - head/sys/netinet Message-ID: <200910020145.n921jBwI085264@svn.freebsd.org> Author: qingli Date: Fri Oct 2 01:45:11 2009 New Revision: 197696 URL: http://svn.freebsd.org/changeset/base/197696 Log: Remove a log message from production code. This log message can be triggered by a misconfigured host that is sending out gratuious ARPs. This log message can also be triggered during a network renumbering event when multiple prefixes co-exist on a single network segment. MFC after: immediately Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Oct 2 01:34:55 2009 (r197695) +++ head/sys/netinet/in.c Fri Oct 2 01:45:11 2009 (r197696) @@ -1327,8 +1327,10 @@ in_lltable_rtcheck(struct ifnet *ifp, co /* XXX rtalloc1 should take a const param */ rt = rtalloc1(__DECONST(struct sockaddr *, l3addr), 0, 0); if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) || rt->rt_ifp != ifp) { +#ifdef DIAGNOSTICS log(LOG_INFO, "IPv4 address: \"%s\" is not on the network\n", inet_ntoa(((const struct sockaddr_in *)l3addr)->sin_addr)); +#endif if (rt != NULL) RTFREE_LOCKED(rt); return (EINVAL); From hrs at FreeBSD.org Fri Oct 2 02:24:26 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 02:24:33 2009 Subject: svn commit: r197697 - in head/etc: . rc.d Message-ID: <200910020224.n922OPcG086114@svn.freebsd.org> Author: hrs Date: Fri Oct 2 02:24:25 2009 New Revision: 197697 URL: http://svn.freebsd.org/changeset/base/197697 Log: - Add AF_IPX and AF_NATM to afexists(). - Add afexists() check to address family specific rc.d scripts. A script for an AF will be silently ignored if the kernel has no support for the AF. Modified: head/etc/network.subr head/etc/rc.d/defaultroute head/etc/rc.d/faith head/etc/rc.d/ip6addrctl head/etc/rc.d/static_arp head/etc/rc.d/stf Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/network.subr Fri Oct 2 02:24:25 2009 (r197697) @@ -356,6 +356,16 @@ afexists() inet6) ${SYSCTL_N} net.inet6 > /dev/null 2>&1 ;; + ipx) + ${SYSCTL_N} net.ipx > /dev/null 2>&1 + ;; + atm) + if [ -x /sbin/atmconfig ]; then + /sbin/atmconfig diag list > /dev/null 2>&1 + else + return 1 + fi + ;; *) err 1 "afexists(): Unsupported address family: $_af" ;; Modified: head/etc/rc.d/defaultroute ============================================================================== --- head/etc/rc.d/defaultroute Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/defaultroute Fri Oct 2 02:24:25 2009 (r197697) @@ -20,6 +20,8 @@ defaultroute_start() { local output carrier nocarrier nl + afexists inet || return 0 + # Return without waiting if we don't have dhcp interfaces or # if none of the dhcp interfaces is plugged in. dhcp_interfaces=`list_net_interfaces dhcp` Modified: head/etc/rc.d/faith ============================================================================== --- head/etc/rc.d/faith Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/faith Fri Oct 2 02:24:25 2009 (r197697) @@ -15,6 +15,8 @@ stop_cmd="faith_down" faith_up() { + afexists inet6 || return 0 + case ${ipv6_faith_prefix} in [Nn][Oo] | '') ;; @@ -48,6 +50,8 @@ faith_up() faith_down() { + afexists inet6 || return 0 + echo "Removing IPv6-to-IPv4 TCP relay capturing interface: faith0." ifconfig faith0 destroy ${SYSCTL_W} net.inet6.ip6.keepfaith=0 Modified: head/etc/rc.d/ip6addrctl ============================================================================== --- head/etc/rc.d/ip6addrctl Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/ip6addrctl Fri Oct 2 02:24:25 2009 (r197697) @@ -9,6 +9,7 @@ # KEYWORD: nojail . /etc/rc.subr +. /etc/network.subr name="ip6addrctl" rcvar=`set_rcvar` @@ -23,6 +24,8 @@ set_rcvar_obsolete ipv6_enable ipv6_pref ip6addrctl_prefer_ipv6() { + afexists inet6 || return 0 + ip6addrctl flush >/dev/null 2>&1 ip6addrctl add ::1/128 50 0 ip6addrctl add ::/0 40 1 @@ -34,6 +37,8 @@ ip6addrctl_prefer_ipv6() ip6addrctl_prefer_ipv4() { + afexists inet6 || return 0 + ip6addrctl flush >/dev/null 2>&1 ip6addrctl add ::ffff:0:0/96 50 0 ip6addrctl add ::1/128 40 1 @@ -45,30 +50,27 @@ ip6addrctl_prefer_ipv4() ip6addrctl_start() { - if ifconfig lo0 inet6 >/dev/null 2>&1; then - # We have IPv6 support in kernel. + afexists inet6 || return 0 - # install the policy of the address selection algorithm. - if [ -f /etc/ip6addrctl.conf ]; then - ip6addrctl flush >/dev/null 2>&1 - ip6addrctl install /etc/ip6addrctl.conf - checkyesno ip6addrctl_verbose && ip6addrctl + # install the policy of the address selection algorithm. + if [ -f /etc/ip6addrctl.conf ]; then + ip6addrctl flush >/dev/null 2>&1 + ip6addrctl install /etc/ip6addrctl.conf + checkyesno ip6addrctl_verbose && ip6addrctl + else + if checkyesno ipv6_prefer; then + ip6addrctl_prefer_ipv6 else - if checkyesno ipv6_prefer; then - ip6addrctl_prefer_ipv6 - else - ip6addrctl_prefer_ipv4 - fi + ip6addrctl_prefer_ipv4 fi fi } ip6addrctl_stop() { - if ifconfig lo0 inet6 >/dev/null 2>&1; then - # We have IPv6 support in kernel. - ip6addrctl flush >/dev/null 2>&1 - fi + afexists inet6 || return 0 + + ip6addrctl flush >/dev/null 2>&1 } load_rc_config $name Modified: head/etc/rc.d/static_arp ============================================================================== --- head/etc/rc.d/static_arp Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/static_arp Fri Oct 2 02:24:25 2009 (r197697) @@ -34,6 +34,7 @@ # KEYWORD: nojail . /etc/rc.subr +. /etc/network.subr name="static_arp" start_cmd="static_arp_start" @@ -43,6 +44,8 @@ static_arp_start() { local e arp_args + afexists inet || return 0 + if [ -n "${static_arp_pairs}" ]; then echo -n 'Binding static ARP pair(s):' for e in ${static_arp_pairs}; do @@ -58,6 +61,8 @@ static_arp_stop() { local e arp_args + afexists inet || return 0 + if [ -n "${static_arp_pairs}" ]; then echo -n 'Unbinding static ARP pair(s):' for e in ${static_arp_pairs}; do Modified: head/etc/rc.d/stf ============================================================================== --- head/etc/rc.d/stf Fri Oct 2 01:45:11 2009 (r197696) +++ head/etc/rc.d/stf Fri Oct 2 02:24:25 2009 (r197697) @@ -15,6 +15,8 @@ stop_cmd="stf_down" stf_up() { + afexists inet6 || return 0 + case ${stf_interface_ipv4addr} in [Nn][Oo] | '') ;; @@ -67,6 +69,8 @@ stf_up() stf_down() { + afexists inet6 || return 0 + echo "Removing 6to4 tunnel interface: stf0." ifconfig stf0 destroy route delete -inet6 2002:e000:: -prefixlen 20 ::1 From hrs at FreeBSD.org Fri Oct 2 02:27:50 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 02:28:01 2009 Subject: svn commit: r197698 - head/etc/rc.d Message-ID: <200910020227.n922RnBd086217@svn.freebsd.org> Author: hrs Date: Fri Oct 2 02:27:49 2009 New Revision: 197698 URL: http://svn.freebsd.org/changeset/base/197698 Log: - Fix logic inversion bug of net.inet.tcp.rfc1323[*]. - Split netoptions_start() to netoptions_AF() and add afexists() check for each address family. - Display a message only if the user sets a non-default value, and set a sysctl explicitly even if it is the default value. Spotted by: Pegasus Mc Cleaft[*] Modified: head/etc/rc.d/netoptions Modified: head/etc/rc.d/netoptions ============================================================================== --- head/etc/rc.d/netoptions Fri Oct 2 02:24:25 2009 (r197697) +++ head/etc/rc.d/netoptions Fri Oct 2 02:27:49 2009 (r197698) @@ -26,29 +26,48 @@ netoptions_init() netoptions_start() { + local _af + + for _af in inet inet6; do + afexists ${_af} && eval netoptions_${_af} + done + [ -n "${_netoptions_initdone}" ] && echo '.' +} + +netoptions_inet() +{ if checkyesno log_in_vain; then netoptions_init echo -n " log_in_vain=${log_in_vain}" - ${SYSCTL_W} net.inet.tcp.log_in_vain="${log_in_vain}" >/dev/null - ${SYSCTL_W} net.inet.udp.log_in_vain="${log_in_vain}" >/dev/null + ${SYSCTL_W} net.inet.tcp.log_in_vain=1 >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=1 >/dev/null + else + ${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=0 >/dev/null fi if checkyesno tcp_extensions; then + ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null + else netoptions_init - echo -n ' rfc1323 extensions=NO' + echo -n ' rfc1323 extensions=${tcp_extensions}' ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null fi - if ! checkyesno tcp_keepalive; then + if checkyesno tcp_keepalive; then + ${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null + else netoptions_init - echo -n ' TCP keepalive=NO' + echo -n ' TCP keepalive=${tcp_keepalive}' ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null fi if checkyesno tcp_drop_synfin; then netoptions_init - echo -n ' drop SYN+FIN packets=YES' + echo -n ' drop SYN+FIN packets=${tcp_drop_synfin}' ${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null + else + ${SYSCTL_W} net.inet.tcp.drop_synfin=0 >/dev/null fi case ${ip_portrange_first} in @@ -66,17 +85,17 @@ netoptions_start() ${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null ;; esac +} - if afexists inet6; then - if checkyesno ipv6_ipv4mapping; then - ${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null - else - echo -n " no-ipv4-mapped-ipv6" - ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null - fi +netoptions_inet6() +{ + if checkyesno ipv6_ipv4mapping; then + netoptions_init + echo -n " ipv4-mapped-ipv6=${ipv6_ipv4mapping}" + ${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null + else + ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null fi - - [ -n "${_netoptions_initdone}" ] && echo '.' } load_rc_config $name From hrs at FreeBSD.org Fri Oct 2 02:28:59 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 02:29:05 2009 Subject: svn commit: r197699 - head/etc/rc.d Message-ID: <200910020228.n922SxFT086277@svn.freebsd.org> Author: hrs Date: Fri Oct 2 02:28:59 2009 New Revision: 197699 URL: http://svn.freebsd.org/changeset/base/197699 Log: - Split routing_*() and option_*() to *_AF() and add afexists() check for each address family. Replace AF_static() with static_AF() for consistency. - Display a message only if the user sets a non-default value, and set a sysctl explicitly even if it is the default value. Modified: head/etc/rc.d/routing Modified: head/etc/rc.d/routing ============================================================================== --- head/etc/rc.d/routing Fri Oct 2 02:27:49 2009 (r197698) +++ head/etc/rc.d/routing Fri Oct 2 02:28:59 2009 (r197699) @@ -27,8 +27,24 @@ routing_start() routing_stop() { + local _af + static_stop "$@" - route -n flush + for _af in inet inet6; do + afexists ${_af} && eval routing_stop_${_af} + done +} + +routing_stop_inet() +{ + route -n flush -inet +} + +routing_stop_inet6() +{ + local i + + route -n flush -inet6 for i in ${ipv6_network_interfaces}; do ifconfig $i inet6 -defaultif done @@ -40,21 +56,11 @@ static_start() _af=$1 case ${_af} in - inet) - do_static inet add + inet|inet6|atm) + do_static add ${_af} ;; - inet6) - do_static inet6 add - ;; - atm) - do_static atm add - ;; - *) - do_static inet add - if afexists inet6; then - do_static inet6 add - fi - do_static atm add + "") + do_static add inet inet6 atm ;; esac } @@ -65,21 +71,11 @@ static_stop() _af=$1 case ${_af} in - inet) - do_static inet delete - ;; - inet6) - do_static inet6 delete + inet|inet6|atm) + do_static delete ${_af} ;; - atm) - do_static atm delete - ;; - *) - do_static inet delete - if afexists inet6; then - do_static inet6 delete - fi - do_static atm delete + "") + do_static delete inet inet6 atm ;; esac } @@ -87,13 +83,15 @@ static_stop() do_static() { local _af _action - _af=$1 - _action=$2 + _action=$1 - eval $1_static $2 + shift + for _af in "$@"; do + afexists ${_af} && eval static_${_af} ${_action} + done } -inet_static() +static_inet() { local _action _action=$1 @@ -115,7 +113,7 @@ inet_static() fi } -inet6_static() +static_inet6() { local _action i _action=$1 @@ -222,9 +220,9 @@ inet6_static() esac } -atm_static() +static_atm() { - local _action i + local _action i route_args _action=$1 if [ -n "${natm_static_routes}" ]; then @@ -246,61 +244,93 @@ ropts_init() options_start() { + local _af + + for _af in inet inet6 ipx; do + afexists ${_af} && eval options_${_af} + done + [ -n "${_ropts_initdone}" ] && echo '.' +} + +options_inet() +{ if checkyesno icmp_bmcastecho; then ropts_init echo -n ' broadcast ping responses=YES' - sysctl net.inet.icmp.bmcastecho=1 >/dev/null + ${SYSCTL_W} net.inet.icmp.bmcastecho=1 > /dev/null + else + ${SYSCTL_W} net.inet.icmp.bmcastecho=0 > /dev/null fi if checkyesno icmp_drop_redirect; then ropts_init echo -n ' ignore ICMP redirect=YES' - sysctl net.inet.icmp.drop_redirect=1 >/dev/null + ${SYSCTL_W} net.inet.icmp.drop_redirect=1 > /dev/null + else + ${SYSCTL_W} net.inet.icmp.drop_redirect=0 > /dev/null fi if checkyesno icmp_log_redirect; then ropts_init echo -n ' log ICMP redirect=YES' - sysctl net.inet.icmp.log_redirect=1 >/dev/null + ${SYSCTL_W} net.inet.icmp.log_redirect=1 > /dev/null + else + ${SYSCTL_W} net.inet.icmp.log_redirect=0 > /dev/null fi if checkyesno gateway_enable; then ropts_init echo -n ' IPv4 gateway=YES' - sysctl net.inet.ip.forwarding=1 >/dev/null - fi - - if checkyesno ipv6_gateway_enable; then - ropts_init - echo -n ' IPv6 gateway=YES' - sysctl net.inet6.ip6.forwarding=1 >/dev/null + ${SYSCTL_W} net.inet.ip.forwarding=1 > /dev/null + else + ${SYSCTL_W} net.inet.ip.forwarding=0 > /dev/null fi if checkyesno forward_sourceroute; then ropts_init echo -n ' do source routing=YES' - sysctl net.inet.ip.sourceroute=1 >/dev/null + ${SYSCTL_W} net.inet.ip.sourceroute=1 > /dev/null + else + ${SYSCTL_W} net.inet.ip.sourceroute=0 > /dev/null fi if checkyesno accept_sourceroute; then ropts_init echo -n ' accept source routing=YES' - sysctl net.inet.ip.accept_sourceroute=1 >/dev/null + ${SYSCTL_W} net.inet.ip.accept_sourceroute=1 > /dev/null + else + ${SYSCTL_W} net.inet.ip.accept_sourceroute=0 > /dev/null fi - if checkyesno ipxgateway_enable; then + if checkyesno arpproxy_all; then ropts_init - echo -n ' IPX gateway=YES' - sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null + echo -n ' ARP proxyall=YES' + ${SYSCTL_W} net.link.ether.inet.proxyall=1 > /dev/null + else + ${SYSCTL_W} net.link.ether.inet.proxyall=0 > /dev/null fi +} - if checkyesno arpproxy_all; then +options_inet6() +{ + if checkyesno ipv6_gateway_enable; then ropts_init - echo -n ' ARP proxyall=YES' - sysctl net.link.ether.inet.proxyall=1 >/dev/null + echo -n ' IPv6 gateway=YES' + ${SYSCTL_W} net.inet6.ip6.forwarding=1 > /dev/null + else + ${SYSCTL_W} net.inet6.ip6.forwarding=0 > /dev/null fi +} - [ -n "${_ropts_initdone}" ] && echo '.' +options_ipx() +{ + if checkyesno ipxgateway_enable; then + ropts_init + echo -n ' IPX gateway=YES' + ${SYSCTL_W} net.ipx.ipx.ipxforwarding=1 > /dev/null + else + ${SYSCTL_W} net.ipx.ipx.ipxforwarding=0 > /dev/null + fi } load_rc_config $name From sam at freebsd.org Fri Oct 2 03:02:02 2009 From: sam at freebsd.org (Sam Leffler) Date: Fri Oct 2 03:02:14 2009 Subject: svn commit: r197654 - head/sys/dev/if_ndis In-Reply-To: <20091002002534.D21507@delplex.bde.org> References: <200910010243.n912hpSM034846@svn.freebsd.org> <86eipno12p.fsf@ds4.des.no> <20091002002534.D21507@delplex.bde.org> Message-ID: <4AC56D26.4030500@freebsd.org> Bruce Evans wrote: > On Thu, 1 Oct 2009, [utf-8] Dag-Erling Sm??rgrav wrote: > >> Coleman Kane writes: >>> - if (sc->ndis_80211 && vap) >>> + if ((sc->ndis_80211 != NULL) && (vap != NULL)) >> >> sc->ndis_80211 is an int. NULL is a pointer. > > Also, the number of style bugs was doubled on (almost?) every changed line > by adding 2 sets of unnecessary parentheses. FWIW I simply asked he compare ptr's against NULL. The excessive paren's hurt my eyes too :-) Sam From alc at FreeBSD.org Fri Oct 2 05:11:46 2009 From: alc at FreeBSD.org (Alan Cox) Date: Fri Oct 2 05:14:42 2009 Subject: svn commit: r197700 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci Message-ID: <200910020511.n925BkKY090097@svn.freebsd.org> Author: alc Date: Fri Oct 2 05:11:46 2009 New Revision: 197700 URL: http://svn.freebsd.org/changeset/base/197700 Log: MFC r197580 Temporarily disable the use of 1GB page mappings by the direct map. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/amd64/pmap.c stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Fri Oct 2 02:28:59 2009 (r197699) +++ stable/8/sys/amd64/amd64/pmap.c Fri Oct 2 05:11:46 2009 (r197700) @@ -440,7 +440,7 @@ create_pagetables(vm_paddr_t *firstaddr) if (ndmpdp < 4) /* Minimum 4GB of dirmap */ ndmpdp = 4; DMPDPphys = allocpages(firstaddr, NDMPML4E); - if ((amd_feature & AMDID_PAGE1GB) == 0) + if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) DMPDphys = allocpages(firstaddr, ndmpdp); dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT; @@ -474,7 +474,7 @@ create_pagetables(vm_paddr_t *firstaddr) /* Now set up the direct map space using either 2MB or 1GB pages */ /* Preset PG_M and PG_A because demotion expects it */ - if ((amd_feature & AMDID_PAGE1GB) == 0) { + if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) { for (i = 0; i < NPDEPG * ndmpdp; i++) { ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT; ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | From hrs at FreeBSD.org Fri Oct 2 06:19:34 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 06:19:41 2009 Subject: svn commit: r197701 - head/etc/rc.d Message-ID: <200910020619.n926JYGK091501@svn.freebsd.org> Author: hrs Date: Fri Oct 2 06:19:34 2009 New Revision: 197701 URL: http://svn.freebsd.org/changeset/base/197701 Log: Revert the previous afexists() change. Knobs configured explicitly by the user should not be ignored if possible even if the kernel does not support the prerequisite feature. Discussed with: ume Modified: head/etc/rc.d/faith head/etc/rc.d/static_arp head/etc/rc.d/stf Modified: head/etc/rc.d/faith ============================================================================== --- head/etc/rc.d/faith Fri Oct 2 05:11:46 2009 (r197700) +++ head/etc/rc.d/faith Fri Oct 2 06:19:34 2009 (r197701) @@ -15,8 +15,6 @@ stop_cmd="faith_down" faith_up() { - afexists inet6 || return 0 - case ${ipv6_faith_prefix} in [Nn][Oo] | '') ;; @@ -50,8 +48,6 @@ faith_up() faith_down() { - afexists inet6 || return 0 - echo "Removing IPv6-to-IPv4 TCP relay capturing interface: faith0." ifconfig faith0 destroy ${SYSCTL_W} net.inet6.ip6.keepfaith=0 Modified: head/etc/rc.d/static_arp ============================================================================== --- head/etc/rc.d/static_arp Fri Oct 2 05:11:46 2009 (r197700) +++ head/etc/rc.d/static_arp Fri Oct 2 06:19:34 2009 (r197701) @@ -44,8 +44,6 @@ static_arp_start() { local e arp_args - afexists inet || return 0 - if [ -n "${static_arp_pairs}" ]; then echo -n 'Binding static ARP pair(s):' for e in ${static_arp_pairs}; do @@ -61,8 +59,6 @@ static_arp_stop() { local e arp_args - afexists inet || return 0 - if [ -n "${static_arp_pairs}" ]; then echo -n 'Unbinding static ARP pair(s):' for e in ${static_arp_pairs}; do Modified: head/etc/rc.d/stf ============================================================================== --- head/etc/rc.d/stf Fri Oct 2 05:11:46 2009 (r197700) +++ head/etc/rc.d/stf Fri Oct 2 06:19:34 2009 (r197701) @@ -15,8 +15,6 @@ stop_cmd="stf_down" stf_up() { - afexists inet6 || return 0 - case ${stf_interface_ipv4addr} in [Nn][Oo] | '') ;; @@ -69,8 +67,6 @@ stf_up() stf_down() { - afexists inet6 || return 0 - echo "Removing 6to4 tunnel interface: stf0." ifconfig stf0 destroy route delete -inet6 2002:e000:: -prefixlen 20 ::1 From tom at tomjudge.com Fri Oct 2 06:42:46 2009 From: tom at tomjudge.com (Tom Judge) Date: Fri Oct 2 06:42:52 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <200910012032.n91KWTOa064111@svn.freebsd.org> References: <200910012032.n91KWTOa064111@svn.freebsd.org> Message-ID: <4AC59C42.1030903@tomjudge.com> Qing Li wrote: > Author: qingli > Date: Thu Oct 1 20:32:29 2009 > New Revision: 197687 > URL: http://svn.freebsd.org/changeset/base/197687 > > Log: > The flow-table associates TCP/UDP flows and IP destinations with > specific routes. When the routing table changes, for example, > when a new route with a more specific prefix is inserted into the > routing table, the flow-table is not updated to reflect that change. > As such existing connections cannot take advantage of the new path. > In some cases the path is broken. This patch will update the affected > flow-table entries when a more specific route is added. The route > entry is properly marked when a route is deleted from the table. > In this case, when the flow-table performs a search, the stale > entry is updated automatically. Therefore this patch is not > necessary for route deletion. > Hi, Will this fix the issue that I see visualising its self as packet loss over a VPN tunnel? The tunnel is an openvpn (tun mode) tunnel providing a route to 192.168.201.0/24 however when I ping an address in this network with flowtable enabled I see 2-3 out of every 5-6 packets end up being sent out of bge0 (IP 172.17.XX.XX/23 GW 172.17.XX.1) to the default gateway (which responds with destination host unreachable) rather than down tun0. Thanks Tom From hrs at FreeBSD.org Fri Oct 2 06:51:39 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 06:51:45 2009 Subject: svn commit: r197702 - head/etc/rc.d Message-ID: <200910020651.n926pdFA092242@svn.freebsd.org> Author: hrs Date: Fri Oct 2 06:51:39 2009 New Revision: 197702 URL: http://svn.freebsd.org/changeset/base/197702 Log: The net.inet.tcp.log_in_vain accepts 0, 1 or 2, not Y/N. Modified: head/etc/rc.d/netoptions Modified: head/etc/rc.d/netoptions ============================================================================== --- head/etc/rc.d/netoptions Fri Oct 2 06:19:34 2009 (r197701) +++ head/etc/rc.d/netoptions Fri Oct 2 06:51:39 2009 (r197702) @@ -36,15 +36,18 @@ netoptions_start() netoptions_inet() { - if checkyesno log_in_vain; then + case ${log_in_vain} in + [12]) netoptions_init echo -n " log_in_vain=${log_in_vain}" - ${SYSCTL_W} net.inet.tcp.log_in_vain=1 >/dev/null - ${SYSCTL_W} net.inet.udp.log_in_vain=1 >/dev/null - else + ${SYSCTL_W} net.inet.tcp.log_in_vain=${log_in_vain} >/dev/null + ${SYSCTL_W} net.inet.udp.log_in_vain=${log_in_vain} >/dev/null + ;; + *) ${SYSCTL_W} net.inet.tcp.log_in_vain=0 >/dev/null ${SYSCTL_W} net.inet.udp.log_in_vain=0 >/dev/null - fi + ;; + esac if checkyesno tcp_extensions; then ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null From hrs at FreeBSD.org Fri Oct 2 07:00:20 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 07:00:26 2009 Subject: svn commit: r197703 - head/sys/netinet6 Message-ID: <200910020700.n9270KiU092488@svn.freebsd.org> Author: hrs Date: Fri Oct 2 07:00:20 2009 New Revision: 197703 URL: http://svn.freebsd.org/changeset/base/197703 Log: Enable adding a link-local address even if ND6_IFF_IFDISABLED. Note that when the interface has ND6_IFF_IFDISABLED, a newly-added address is always marked as IN6_IFF_TENTATIVE so that the interface can perform DAD after the ND6_IFF_IFDISABLED is cleared. Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Fri Oct 2 06:51:39 2009 (r197702) +++ head/sys/netinet6/in6_ifattach.c Fri Oct 2 07:00:20 2009 (r197703) @@ -751,7 +751,6 @@ in6_ifattach(struct ifnet *ifp, struct i * assign a link-local address, if there's none. */ if (ifp->if_type != IFT_BRIDGE && - !(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { int error; From qingli at freebsd.org Fri Oct 2 07:22:34 2009 From: qingli at freebsd.org (Qing Li) Date: Fri Oct 2 07:22:45 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <4AC59C42.1030903@tomjudge.com> References: <200910012032.n91KWTOa064111@svn.freebsd.org> <4AC59C42.1030903@tomjudge.com> Message-ID: <9ace436c0910020022mfcc1e9y3dd81796537c2a06@mail.gmail.com> I believe this patch will fix your issue. In fact two other users of openvpn reports the exact same problem symptom. Please give it a try and let me know how it works out for you. -- Qing On Thu, Oct 1, 2009 at 11:22 PM, Tom Judge wrote: > Qing Li wrote: >> >> Author: qingli >> Date: Thu Oct ?1 20:32:29 2009 >> New Revision: 197687 >> URL: http://svn.freebsd.org/changeset/base/197687 >> >> Log: >> ?The flow-table associates TCP/UDP flows and IP destinations with >> ?specific routes. When the routing table changes, for example, >> ?when a new route with a more specific prefix is inserted into the >> ?routing table, the flow-table is not updated to reflect that change. >> ?As such existing connections cannot take advantage of the new path. >> ?In some cases the path is broken. This patch will update the affected >> ?flow-table entries when a more specific route is added. The route >> ?entry is properly marked when a route is deleted from the table. >> ?In this case, when the flow-table performs a search, the stale >> ?entry is updated automatically. Therefore this patch is not >> ?necessary for route deletion. >> > > Hi, > > Will this fix the issue that I see visualising ?its self as packet loss over > a VPN tunnel? > > The tunnel is an openvpn (tun mode) tunnel providing a route to > 192.168.201.0/24 however when I ping an address in this network with > flowtable enabled I see 2-3 out of every 5-6 packets end up being sent out > of bge0 (IP 172.17.XX.XX/23 GW 172.17.XX.1) to the default gateway (which > responds with destination host unreachable) rather than down tun0. > > Thanks > > Tom > > From simon at FreeBSD.org Fri Oct 2 10:38:27 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 10:38:38 2009 Subject: svn commit: r197687 - head/sys/net In-Reply-To: <4AC59C42.1030903@tomjudge.com> References: <200910012032.n91KWTOa064111@svn.freebsd.org> <4AC59C42.1030903@tomjudge.com> Message-ID: <20091002103824.GA1653@zaphod.nitro.dk> On 2009.10.02 06:22:58 +0000, Tom Judge wrote: > Qing Li wrote: > > Author: qingli > > Date: Thu Oct 1 20:32:29 2009 > > New Revision: 197687 > > URL: http://svn.freebsd.org/changeset/base/197687 > > > > Log: > > The flow-table associates TCP/UDP flows and IP destinations with > > specific routes. When the routing table changes, for example, > > when a new route with a more specific prefix is inserted into the > > routing table, the flow-table is not updated to reflect that change. > > As such existing connections cannot take advantage of the new path. > > In some cases the path is broken. This patch will update the affected > > flow-table entries when a more specific route is added. The route > > entry is properly marked when a route is deleted from the table. > > In this case, when the flow-table performs a search, the stale > > entry is updated automatically. Therefore this patch is not > > necessary for route deletion. > > Hi, > > Will this fix the issue that I see visualising its self as packet loss > over a VPN tunnel? > > The tunnel is an openvpn (tun mode) tunnel providing a route to > 192.168.201.0/24 however when I ping an address in this network with > flowtable enabled I see 2-3 out of every 5-6 packets end up being sent > out of bge0 (IP 172.17.XX.XX/23 GW 172.17.XX.1) to the default gateway > (which responds with destination host unreachable) rather than down tun0. This sounds very similar to the problem I was seeing (also with OpenVPN), which was fixed by qingli's patch. The packet is most likely actually not lost, but routed to your default gateway instead (or whatever it would be sent before the VPN was created). -- Simon L. Nielsen From rpaulo at FreeBSD.org Fri Oct 2 11:10:06 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Fri Oct 2 11:10:13 2009 Subject: svn commit: r197704 - in head/sys/arm: arm xscale Message-ID: <200910021110.n92BA5fu099181@svn.freebsd.org> Author: rpaulo Date: Fri Oct 2 11:10:05 2009 New Revision: 197704 URL: http://svn.freebsd.org/changeset/base/197704 Log: Remove performance counter headers. This code came from NetBSD, but our hardware perf. counter support is different, so we don't need these files. Reviewed by: freebsd-arm (no comments) Deleted: head/sys/arm/xscale/xscalereg.h head/sys/arm/xscale/xscalevar.h Modified: head/sys/arm/arm/cpufunc.c Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Fri Oct 2 07:00:20 2009 (r197703) +++ head/sys/arm/arm/cpufunc.c Fri Oct 2 11:10:05 2009 (r197704) @@ -83,15 +83,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#if defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ - defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) -#include -#endif - -#if defined(PERFCTRS) -struct arm_pmc_funcs *arm_pmc; -#endif - /* PRIMARY CACHE VARIABLES */ int arm_picache_size; int arm_picache_line_size; @@ -1128,10 +1119,6 @@ set_cpufuncs() : "r" (BCUCTL_E0|BCUCTL_E1|BCUCTL_EV)); cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - /* * i80200 errata: Step-A0 and A1 have a bug where * D$ dirty bits are not cleared on "invalidate by @@ -1165,10 +1152,6 @@ set_cpufuncs() PMNC_CC_IF)); cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); @@ -1179,10 +1162,6 @@ set_cpufuncs() #if defined(CPU_XSCALE_81342) if (cputype == CPU_ID_81342) { cpufuncs = xscalec3_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); @@ -1196,10 +1175,6 @@ set_cpufuncs() (cputype & ~CPU_ID_XSCALE_COREREV_MASK) == CPU_ID_PXA210) { cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); @@ -1215,10 +1190,6 @@ set_cpufuncs() cputype == CPU_ID_IXP425_266 || cputype == CPU_ID_IXP435) { cpufuncs = xscale_cpufuncs; -#if defined(PERFCTRS) - xscale_pmu_init(); -#endif - cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); pmap_pte_init_xscale(); From rpaulo at FreeBSD.org Fri Oct 2 11:14:12 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Fri Oct 2 11:14:18 2009 Subject: svn commit: r197706 - head/sys/sys Message-ID: <200910021114.n92BECKI099344@svn.freebsd.org> Author: rpaulo Date: Fri Oct 2 11:14:12 2009 New Revision: 197706 URL: http://svn.freebsd.org/changeset/base/197706 Log: Reserve numbers for XScale. Reviewed by: jkoshy Modified: head/sys/sys/pmc.h Modified: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Fri Oct 2 11:10:51 2009 (r197705) +++ head/sys/sys/pmc.h Fri Oct 2 11:14:12 2009 (r197706) @@ -84,7 +84,8 @@ __PMC_CPU(INTEL_CORE2, 0x88, "Intel Core2") \ __PMC_CPU(INTEL_CORE2EXTREME, 0x89, "Intel Core2 Extreme") \ __PMC_CPU(INTEL_ATOM, 0x8A, "Intel Atom") \ - __PMC_CPU(INTEL_COREI7, 0x8B, "Intel Core i7") + __PMC_CPU(INTEL_COREI7, 0x8B, "Intel Core i7") \ + __PMC_CPU(INTEL_XSCALE, 0x100, "Intel XScale") enum pmc_cputype { #undef __PMC_CPU @@ -93,7 +94,7 @@ enum pmc_cputype { }; #define PMC_CPU_FIRST PMC_CPU_AMD_K7 -#define PMC_CPU_LAST PMC_CPU_INTEL_COREI7 +#define PMC_CPU_LAST PMC_CPU_INTEL_XSCALE /* * Classes of PMCs @@ -107,7 +108,8 @@ enum pmc_cputype { __PMC_CLASS(P6) /* Intel Pentium Pro counters */ \ __PMC_CLASS(P4) /* Intel Pentium-IV counters */ \ __PMC_CLASS(IAF) /* Intel Core2/Atom, fixed function */ \ - __PMC_CLASS(IAP) /* Intel Core...Atom, programmable */ + __PMC_CLASS(IAP) /* Intel Core...Atom, programmable */ \ + __PMC_CLASS(XSCALE) /* Intel XScale counters */ enum pmc_class { #undef __PMC_CLASS @@ -116,7 +118,7 @@ enum pmc_class { }; #define PMC_CLASS_FIRST PMC_CLASS_TSC -#define PMC_CLASS_LAST PMC_CLASS_IAP +#define PMC_CLASS_LAST PMC_CLASS_XSCALE /* * A PMC can be in the following states: From nyan at FreeBSD.org Fri Oct 2 12:47:01 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Fri Oct 2 12:47:08 2009 Subject: svn commit: r197709 - head/sys/conf Message-ID: <200910021247.n92Cl1tb001993@svn.freebsd.org> Author: nyan Date: Fri Oct 2 12:47:01 2009 New Revision: 197709 URL: http://svn.freebsd.org/changeset/base/197709 Log: Fix build nfscl and/or nfsd. MFC after: 3 days Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Oct 2 11:46:01 2009 (r197708) +++ head/sys/conf/files Fri Oct 2 12:47:01 2009 (r197709) @@ -2668,12 +2668,12 @@ vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard -xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd # gnu/fs/xfs/xfs_alloc.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" \ From trasz at FreeBSD.org Fri Oct 2 17:39:24 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Oct 2 17:39:31 2009 Subject: svn commit: r197710 - svnadmin/conf Message-ID: <200910021739.n92HdOPG008245@svn.freebsd.org> Author: trasz Date: Fri Oct 2 17:39:23 2009 New Revision: 197710 URL: http://svn.freebsd.org/changeset/base/197710 Log: Welcome Jaakko Heinonen (jh@) as a src committer. Jaakko will start with bugbusting, mostly in kern and bin categories. I'll be his mentor, with Robert Watson (rwatson@) as co-mentor. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Fri Oct 2 12:47:01 2009 (r197709) +++ svnadmin/conf/access Fri Oct 2 17:39:23 2009 (r197710) @@ -100,6 +100,7 @@ jasone jb jeff jfv +jh jhay jhb jilles Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Fri Oct 2 12:47:01 2009 (r197709) +++ svnadmin/conf/mentors Fri Oct 2 17:39:23 2009 (r197710) @@ -15,6 +15,7 @@ dchagin kib eri mlaier Co-mentor: thompsa fabient jkoshy ivoras gnn +jh trasz Co-mentor: rwatson jinmei gnn lstewart gnn neel imp From bz at FreeBSD.org Fri Oct 2 17:48:52 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Oct 2 17:49:04 2009 Subject: svn commit: r197711 - head/sys/kern Message-ID: <200910021748.n92Hmprd008488@svn.freebsd.org> Author: bz Date: Fri Oct 2 17:48:51 2009 New Revision: 197711 URL: http://svn.freebsd.org/changeset/base/197711 Log: Add a mitigation feature that will prevent user mappings at virtual address 0, limiting the ability to convert a kernel NULL pointer dereference into a privilege escalation attack. If the sysctl is set to 0 a newly started process will not be able to map anything in the address range of the first page (0 to PAGE_SIZE). This is the default. Already running processes are not affected by this. You can either change the sysctl or the tunable from loader in case you need to map at a virtual address of 0, for example when running any of the extinct species of a set of a.out binaries, vm86 emulation, .. In that case set security.bsd.map_at_zero="1". Superseeds: r197537 In collaboration with: jhb, kib, alc Modified: head/sys/kern/init_main.c head/sys/kern/kern_exec.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Fri Oct 2 17:39:23 2009 (r197710) +++ head/sys/kern/init_main.c Fri Oct 2 17:48:51 2009 (r197711) @@ -505,6 +505,11 @@ proc0_init(void *dummy __unused) pmap_pinit0(vmspace_pmap(&vmspace0)); p->p_vmspace = &vmspace0; vmspace0.vm_refcnt = 1; + + /* + * proc0 is not expected to enter usermode, so there is no special + * handling for sv_minuser here, like is done for exec_new_vmspace(). + */ vm_map_init(&vmspace0.vm_map, p->p_sysent->sv_minuser, p->p_sysent->sv_maxuser); vmspace0.vm_map.pmap = vmspace_pmap(&vmspace0); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Oct 2 17:39:23 2009 (r197710) +++ head/sys/kern/kern_exec.c Fri Oct 2 17:48:51 2009 (r197711) @@ -122,6 +122,11 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +static int map_at_zero = 0; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -999,7 +1004,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; u_long ssiz; @@ -1015,13 +1020,17 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - error = vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + error = vmspace_exec(p, sv_minuser, sv->sv_maxuser); if (error) return (error); vmspace = p->p_vmspace; From bz at FreeBSD.org Fri Oct 2 17:51:47 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Oct 2 17:51:54 2009 Subject: svn commit: r197712 - head/sys/vm Message-ID: <200910021751.n92Hpkrk008597@svn.freebsd.org> Author: bz Date: Fri Oct 2 17:51:46 2009 New Revision: 197712 URL: http://svn.freebsd.org/changeset/base/197712 Log: Back out the functional parts from r197537. After r197711, affecting all user mappings, mmap no longer needs special treatment. Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Fri Oct 2 17:48:51 2009 (r197711) +++ head/sys/vm/vm_mmap.c Fri Oct 2 17:51:46 2009 (r197712) @@ -97,14 +97,6 @@ SYSCTL_INT(_vm, OID_AUTO, max_proc_mmap, "Maximum number of memory-mapped files per process"); /* - * 'mmap_zero' determines whether or not MAP_FIXED mmap() requests for - * virtual address zero are permitted. - */ -static int mmap_zero; -SYSCTL_INT(_security_bsd, OID_AUTO, mmap_zero, CTLFLAG_RW, &mmap_zero, 0, - "Processes may map an object at virtual address zero"); - -/* * Set the maximum number of vm_map_entry structures per process. Roughly * speaking vm_map_entry structures are tiny, so allowing them to eat 1/100 * of our KVM malloc space still results in generous limits. We want a @@ -277,13 +269,6 @@ mmap(td, uap) if (addr & PAGE_MASK) return (EINVAL); - /* - * Mapping to address zero is only permitted if - * mmap_zero is enabled. - */ - if (addr == 0 && !mmap_zero) - return (EINVAL); - /* Address range must be all in user VM space. */ if (addr < vm_map_min(&vms->vm_map) || addr + size > vm_map_max(&vms->vm_map)) From bz at FreeBSD.org Fri Oct 2 17:53:49 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Oct 2 17:54:01 2009 Subject: svn commit: r197713 - head/tools/regression/mmap Message-ID: <200910021753.n92HrmUK008678@svn.freebsd.org> Author: bz Date: Fri Oct 2 17:53:48 2009 New Revision: 197713 URL: http://svn.freebsd.org/changeset/base/197713 Log: Replace the name of the sysctl to security.bsd.map_at_zero and to be consistent updated the name of the variable as well, after the change in r197711. Modified: head/tools/regression/mmap/mmap.c Modified: head/tools/regression/mmap/mmap.c ============================================================================== --- head/tools/regression/mmap/mmap.c Fri Oct 2 17:51:46 2009 (r197712) +++ head/tools/regression/mmap/mmap.c Fri Oct 2 17:53:48 2009 (r197713) @@ -36,7 +36,7 @@ const struct tests { void *addr; - int ok[2]; /* Depending on security.bsd.mmap_zero {0, !=0}. */ + int ok[2]; /* Depending on security.bsd.map_at_zero {0, !=0}. */ } tests[] = { { (void *)0, { 0, 1 } }, /* Test sysctl. */ { (void *)1, { 0, 0 } }, @@ -54,37 +54,37 @@ main(void) { void *p; size_t len; - int i, error, mib[3], mmap_zero; + int i, error, mib[3], map_at_zero; error = 0; - /* Get the current sysctl value of security.bsd.mmap_zero. */ + /* Get the current sysctl value of security.bsd.map_at_zero. */ len = sizeof(mib) / sizeof(*mib); - if (sysctlnametomib("security.bsd.mmap_zero", mib, &len) == -1) - err(1, "sysctlnametomib(security.bsd.mmap_zero)"); + if (sysctlnametomib("security.bsd.map_at_zero", mib, &len) == -1) + err(1, "sysctlnametomib(security.bsd.map_at_zero)"); - len = sizeof(mmap_zero); - if (sysctl(mib, 3, &mmap_zero, &len, NULL, 0) == -1) - err(1, "sysctl(security.bsd.mmap_zero)"); + len = sizeof(map_at_zero); + if (sysctl(mib, 3, &map_at_zero, &len, NULL, 0) == -1) + err(1, "sysctl(security.bsd.map_at_zero)"); /* Normalize to 0 or 1 for array access. */ - mmap_zero = !!mmap_zero; + map_at_zero = !!map_at_zero; for (i=0; i < (sizeof(tests) / sizeof(*tests)); i++) { p = mmap((void *)tests[i].addr, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_FIXED, -1, 0); if (p == MAP_FAILED) { - if (tests[i].ok[mmap_zero] != 0) + if (tests[i].ok[map_at_zero] != 0) error++; warnx("%s: mmap(%p, ...) failed.", - (tests[i].ok[mmap_zero] == 0) ? "OK " : "ERR", + (tests[i].ok[map_at_zero] == 0) ? "OK " : "ERR", tests[i].addr); } else { - if (tests[i].ok[mmap_zero] != 1) + if (tests[i].ok[map_at_zero] != 1) error++; warnx("%s: mmap(%p, ...) succeeded: p=%p", - (tests[i].ok[mmap_zero] == 1) ? "OK " : "ERR", + (tests[i].ok[map_at_zero] == 1) ? "OK " : "ERR", tests[i].addr, p); } } From simon at FreeBSD.org Fri Oct 2 17:58:49 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 17:59:00 2009 Subject: svn commit: r197714 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern Message-ID: <200910021758.n92HwmjA008816@svn.freebsd.org> Author: simon Date: Fri Oct 2 17:58:47 2009 New Revision: 197714 URL: http://svn.freebsd.org/changeset/base/197714 Log: MFC r197711: Add no zero mapping feature. NOTE: Unlike in the other branches where this change will be "merged" to, the 'no zero mapping' is enabled by default in stable/8. Errata: FreeBSD-EN-09:05.null Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/init_main.c stable/8/sys/kern/kern_exec.c Modified: stable/8/sys/kern/init_main.c ============================================================================== --- stable/8/sys/kern/init_main.c Fri Oct 2 17:53:48 2009 (r197713) +++ stable/8/sys/kern/init_main.c Fri Oct 2 17:58:47 2009 (r197714) @@ -492,6 +492,11 @@ proc0_init(void *dummy __unused) pmap_pinit0(vmspace_pmap(&vmspace0)); p->p_vmspace = &vmspace0; vmspace0.vm_refcnt = 1; + + /* + * proc0 is not expected to enter usermode, so there is no special + * handling for sv_minuser here, like is done for exec_new_vmspace(). + */ vm_map_init(&vmspace0.vm_map, p->p_sysent->sv_minuser, p->p_sysent->sv_maxuser); vmspace0.vm_map.pmap = vmspace_pmap(&vmspace0); Modified: stable/8/sys/kern/kern_exec.c ============================================================================== --- stable/8/sys/kern/kern_exec.c Fri Oct 2 17:53:48 2009 (r197713) +++ stable/8/sys/kern/kern_exec.c Fri Oct 2 17:58:47 2009 (r197714) @@ -122,6 +122,11 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +static int map_at_zero = 0; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -999,7 +1004,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; u_long ssiz; @@ -1015,13 +1020,17 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - error = vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + error = vmspace_exec(p, sv_minuser, sv->sv_maxuser); if (error) return (error); vmspace = p->p_vmspace; From simon at FreeBSD.org Fri Oct 2 18:09:57 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 18:10:20 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... Message-ID: <200910021809.n92I9u1r009085@svn.freebsd.org> Author: simon Date: Fri Oct 2 18:09:56 2009 New Revision: 197715 URL: http://svn.freebsd.org/changeset/base/197715 Log: MFC r197711 (partial) to 6.x and 7.x: - Add no zero mapping feature, disabled by default. [EN-09:05] MFC 178913,178914,179242,179243,180336,180340 to 6.x: - Fix kqueue pipe race conditions. [SA-09:13] MFC r192301 to 7.x; 6.x has slightly different fix: - Fix devfs / VFS NULL pointer race condition. [SA-09:14] Security: FreeBSD-SA-09:13.pipe Security: FreeBSD-SA-09:14.devfs Errata: FreeBSD-EN-09:05.null Submitted by: kib [SA-09:13] [SA-09:14] Submitted by: bz [EN-09:05] In collaboration with: jhb, kib, alc [EN-09:05] Approved by: so (simon) Modified: stable/7/sys/kern/kern_exec.c Changes in other areas also in this revision: Modified: releng/6.3/UPDATING releng/6.3/sys/conf/newvers.sh releng/6.3/sys/fs/devfs/devfs_vnops.c releng/6.3/sys/kern/kern_event.c releng/6.3/sys/kern/kern_exec.c releng/6.3/sys/kern/kern_fork.c releng/6.3/sys/kern/sys_pipe.c releng/6.3/sys/sys/event.h releng/6.3/sys/sys/pipe.h releng/6.4/UPDATING releng/6.4/sys/conf/newvers.sh releng/6.4/sys/fs/devfs/devfs_vnops.c releng/6.4/sys/kern/kern_event.c releng/6.4/sys/kern/kern_exec.c releng/6.4/sys/kern/kern_fork.c releng/6.4/sys/kern/sys_pipe.c releng/6.4/sys/sys/event.h releng/6.4/sys/sys/pipe.h releng/7.1/UPDATING releng/7.1/sys/conf/newvers.sh releng/7.1/sys/fs/devfs/devfs_vnops.c releng/7.1/sys/kern/kern_exec.c releng/7.2/UPDATING releng/7.2/sys/conf/newvers.sh releng/7.2/sys/fs/devfs/devfs_vnops.c releng/7.2/sys/kern/kern_exec.c stable/6/sys/fs/devfs/devfs_vnops.c stable/6/sys/kern/kern_event.c stable/6/sys/kern/kern_exec.c stable/6/sys/kern/kern_fork.c stable/6/sys/kern/sys_pipe.c stable/6/sys/sys/event.h stable/6/sys/sys/pipe.h Modified: stable/7/sys/kern/kern_exec.c ============================================================================== --- stable/7/sys/kern/kern_exec.c Fri Oct 2 17:58:47 2009 (r197714) +++ stable/7/sys/kern/kern_exec.c Fri Oct 2 18:09:56 2009 (r197715) @@ -122,6 +122,11 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +static int map_at_zero = 1; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -939,7 +944,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; u_long ssiz; @@ -955,13 +960,17 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - error = vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + error = vmspace_exec(p, sv_minuser, sv->sv_maxuser); if (error) return (error); vmspace = p->p_vmspace; From simon at FreeBSD.org Fri Oct 2 18:09:57 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 18:10:21 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... Message-ID: <200910021809.n92I9uOs009090@svn.freebsd.org> Author: simon Date: Fri Oct 2 18:09:56 2009 New Revision: 197715 URL: http://svn.freebsd.org/changeset/base/197715 Log: MFC r197711 (partial) to 6.x and 7.x: - Add no zero mapping feature, disabled by default. [EN-09:05] MFC 178913,178914,179242,179243,180336,180340 to 6.x: - Fix kqueue pipe race conditions. [SA-09:13] MFC r192301 to 7.x; 6.x has slightly different fix: - Fix devfs / VFS NULL pointer race condition. [SA-09:14] Security: FreeBSD-SA-09:13.pipe Security: FreeBSD-SA-09:14.devfs Errata: FreeBSD-EN-09:05.null Submitted by: kib [SA-09:13] [SA-09:14] Submitted by: bz [EN-09:05] In collaboration with: jhb, kib, alc [EN-09:05] Approved by: so (simon) Modified: releng/6.3/UPDATING releng/6.3/sys/conf/newvers.sh releng/6.3/sys/fs/devfs/devfs_vnops.c releng/6.3/sys/kern/kern_event.c releng/6.3/sys/kern/kern_exec.c releng/6.3/sys/kern/kern_fork.c releng/6.3/sys/kern/sys_pipe.c releng/6.3/sys/sys/event.h releng/6.3/sys/sys/pipe.h releng/6.4/UPDATING releng/6.4/sys/conf/newvers.sh releng/6.4/sys/fs/devfs/devfs_vnops.c releng/6.4/sys/kern/kern_event.c releng/6.4/sys/kern/kern_exec.c releng/6.4/sys/kern/kern_fork.c releng/6.4/sys/kern/sys_pipe.c releng/6.4/sys/sys/event.h releng/6.4/sys/sys/pipe.h releng/7.1/UPDATING releng/7.1/sys/conf/newvers.sh releng/7.1/sys/fs/devfs/devfs_vnops.c releng/7.1/sys/kern/kern_exec.c releng/7.2/UPDATING releng/7.2/sys/conf/newvers.sh releng/7.2/sys/fs/devfs/devfs_vnops.c releng/7.2/sys/kern/kern_exec.c Changes in other areas also in this revision: Modified: stable/6/sys/fs/devfs/devfs_vnops.c stable/6/sys/kern/kern_event.c stable/6/sys/kern/kern_exec.c stable/6/sys/kern/kern_fork.c stable/6/sys/kern/sys_pipe.c stable/6/sys/sys/event.h stable/6/sys/sys/pipe.h stable/7/sys/kern/kern_exec.c Modified: releng/6.3/UPDATING ============================================================================== --- releng/6.3/UPDATING Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/UPDATING Fri Oct 2 18:09:56 2009 (r197715) @@ -8,6 +8,14 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20091002: p13 FreeBSD-SA-09:13.pipe, FreeBSD-SA-09:14.devfs, + FreeBSD-EN-09:05.null + Fix kqueue pipe race conditions. [SA-09:13] + + Fix devfs / VFS NULL pointer race condition. [SA-09:14] + + Add no zero mapping feature. [EN-09:05] + 20090729: p12 FreeBSD-SA-09:12.bind Fix BIND named(8) dynamic update message remote DoS. Modified: releng/6.3/sys/conf/newvers.sh ============================================================================== --- releng/6.3/sys/conf/newvers.sh Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/conf/newvers.sh Fri Oct 2 18:09:56 2009 (r197715) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.3" -BRANCH="RELEASE-p12" +BRANCH="RELEASE-p13" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/6.3/sys/fs/devfs/devfs_vnops.c ============================================================================== --- releng/6.3/sys/fs/devfs/devfs_vnops.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/fs/devfs/devfs_vnops.c Fri Oct 2 18:09:56 2009 (r197715) @@ -759,6 +759,9 @@ devfs_open(struct vop_open_args *ap) VOP_UNLOCK(vp, 0, td); + if (ap->a_fdidx >= 0) + ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]->f_vnode = vp; + if(!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); if (dsw->d_fdopen != NULL) Modified: releng/6.3/sys/kern/kern_event.c ============================================================================== --- releng/6.3/sys/kern/kern_event.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/kern/kern_event.c Fri Oct 2 18:09:56 2009 (r197715) @@ -392,30 +392,82 @@ filt_proc(struct knote *kn, long hint) return (1); } - /* - * process forked, and user wants to track the new process, - * so attach a new knote to it, and immediately report an - * event with the parent's pid. - */ - if ((event == NOTE_FORK) && (kn->kn_sfflags & NOTE_TRACK)) { - struct kevent kev; - int error; + return (kn->kn_fflags != 0); +} + +/* + * Called when the process forked. It mostly does the same as the + * knote(), activating all knotes registered to be activated when the + * process forked. Additionally, for each knote attached to the + * parent, check whether user wants to track the new process. If so + * attach a new knote to it, and immediately report an event with the + * child's pid. + */ +void +knote_fork(struct knlist *list, int pid) +{ + struct kqueue *kq; + struct knote *kn; + struct kevent kev; + int error; + + if (list == NULL) + return; + list->kl_lock(list->kl_lockarg); + + SLIST_FOREACH(kn, &list->kl_list, kn_selnext) { + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) + continue; + kq = kn->kn_kq; + KQ_LOCK(kq); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_UNLOCK(kq); + continue; + } /* - * register knote with new process. + * The same as knote(), activate the event. */ - kev.ident = hint & NOTE_PDATAMASK; /* pid */ + if ((kn->kn_sfflags & NOTE_TRACK) == 0) { + kn->kn_status |= KN_HASKQLOCK; + if (kn->kn_fop->f_event(kn, NOTE_FORK | pid)) + KNOTE_ACTIVATE(kn, 1); + kn->kn_status &= ~KN_HASKQLOCK; + KQ_UNLOCK(kq); + continue; + } + + /* + * The NOTE_TRACK case. In addition to the activation + * of the event, we need to register new event to + * track the child. Drop the locks in preparation for + * the call to kqueue_register(). + */ + kn->kn_status |= KN_INFLUX; + KQ_UNLOCK(kq); + list->kl_unlock(list->kl_lockarg); + + /* + * Activate existing knote and register a knote with + * new process. + */ + kev.ident = pid; kev.filter = kn->kn_filter; kev.flags = kn->kn_flags | EV_ADD | EV_ENABLE | EV_FLAG1; kev.fflags = kn->kn_sfflags; - kev.data = kn->kn_id; /* parent */ - kev.udata = kn->kn_kevent.udata; /* preserve udata */ - error = kqueue_register(kn->kn_kq, &kev, NULL, 0); + kev.data = kn->kn_id; /* parent */ + kev.udata = kn->kn_kevent.udata;/* preserve udata */ + error = kqueue_register(kq, &kev, NULL, 0); + if (kn->kn_fop->f_event(kn, NOTE_FORK | pid)) + KNOTE_ACTIVATE(kn, 0); if (error) kn->kn_fflags |= NOTE_TRACKERR; + KQ_LOCK(kq); + kn->kn_status &= ~KN_INFLUX; + KQ_UNLOCK_FLUX(kq); + list->kl_lock(list->kl_lockarg); } - - return (kn->kn_fflags != 0); + list->kl_unlock(list->kl_lockarg); } static int @@ -1123,7 +1175,7 @@ kqueue_scan(struct kqueue *kq, int maxev struct kevent *kevp; struct timeval atv, rtv, ttv; struct knote *kn, *marker; - int count, timeout, nkev, error; + int count, timeout, nkev, error, influx; int haskqglobal; count = maxevents; @@ -1193,12 +1245,17 @@ start: } TAILQ_INSERT_TAIL(&kq->kq_head, marker, kn_tqe); + influx = 0; while (count) { KQ_OWNED(kq); kn = TAILQ_FIRST(&kq->kq_head); if ((kn->kn_status == KN_MARKER && kn != marker) || (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (influx) { + influx = 0; + KQ_FLUX_WAKEUP(kq); + } kq->kq_state |= KQ_FLUXWAIT; error = msleep(kq, &kq->kq_lock, PSOCK, "kqflxwt", 0); @@ -1248,6 +1305,7 @@ start: ~(KN_QUEUED | KN_ACTIVE | KN_INFLUX); kq->kq_count--; KN_LIST_UNLOCK(kn); + influx = 1; continue; } *kevp = kn->kn_kevent; @@ -1263,6 +1321,7 @@ start: kn->kn_status &= ~(KN_INFLUX); KN_LIST_UNLOCK(kn); + influx = 1; } /* we are returning a copy to the user */ @@ -1271,6 +1330,7 @@ start: count--; if (nkev == KQ_NEVENTS) { + influx = 0; KQ_UNLOCK_FLUX(kq); error = k_ops->k_copyout(k_ops->arg, keva, nkev); nkev = 0; @@ -1434,8 +1494,11 @@ kqueue_close(struct file *fp, struct thr for (i = 0; i < kq->kq_knlistsize; i++) { while ((kn = SLIST_FIRST(&kq->kq_knlist[i])) != NULL) { - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK, "kqclo1", 0); + continue; + } kn->kn_status |= KN_INFLUX; KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) @@ -1447,8 +1510,12 @@ kqueue_close(struct file *fp, struct thr if (kq->kq_knhashmask != 0) { for (i = 0; i <= kq->kq_knhashmask; i++) { while ((kn = SLIST_FIRST(&kq->kq_knhash[i])) != NULL) { - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK, + "kqclo2", 0); + continue; + } kn->kn_status |= KN_INFLUX; KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) Modified: releng/6.3/sys/kern/kern_exec.c ============================================================================== --- releng/6.3/sys/kern/kern_exec.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/kern/kern_exec.c Fri Oct 2 18:09:56 2009 (r197715) @@ -104,6 +104,13 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +SYSCTL_DECL(_security_bsd); + +static int map_at_zero = 1; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -914,7 +921,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; imgp->vmspace_destroyed = 1; @@ -928,14 +935,18 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace), vm_map_min(map), vm_map_max(map)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + vmspace_exec(p, sv_minuser, sv->sv_maxuser); vmspace = p->p_vmspace; map = &vmspace->vm_map; } Modified: releng/6.3/sys/kern/kern_fork.c ============================================================================== --- releng/6.3/sys/kern/kern_fork.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/kern/kern_fork.c Fri Oct 2 18:09:56 2009 (r197715) @@ -699,14 +699,12 @@ again: */ PROC_LOCK(p1); _PRELE(p1); + PROC_UNLOCK(p1); /* * Tell any interested parties about the new process. */ - KNOTE_LOCKED(&p1->p_klist, NOTE_FORK | p2->p_pid); - - PROC_UNLOCK(p1); - + knote_fork(&p1->p_klist, p2->p_pid); /* * Preserve synchronization semantics of vfork. If waiting for * child to exec or exit, set P_PPWAIT on child, and sleep on our Modified: releng/6.3/sys/kern/sys_pipe.c ============================================================================== --- releng/6.3/sys/kern/sys_pipe.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/kern/sys_pipe.c Fri Oct 2 18:09:56 2009 (r197715) @@ -268,8 +268,8 @@ pipe_zone_ctor(void *mem, int size, void * one at a time. When both are free'd, then the whole pair * is released. */ - rpipe->pipe_present = 1; - wpipe->pipe_present = 1; + rpipe->pipe_present = PIPE_ACTIVE; + wpipe->pipe_present = PIPE_ACTIVE; /* * Eventually, the MAC Framework may initialize the label @@ -1003,7 +1003,8 @@ pipe_write(fp, uio, active_cred, flags, /* * detect loss of pipe read side, issue SIGPIPE if lost. */ - if ((!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { pipeunlock(wpipe); PIPE_UNLOCK(rpipe); return (EPIPE); @@ -1361,13 +1362,14 @@ pipe_poll(fp, events, active_cred, td) revents |= events & (POLLIN | POLLRDNORM); if (events & (POLLOUT | POLLWRNORM)) - if (!wpipe->pipe_present || (wpipe->pipe_state & PIPE_EOF) || + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF) || (((wpipe->pipe_state & PIPE_DIRECTW) == 0) && (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)) revents |= events & (POLLOUT | POLLWRNORM); if ((rpipe->pipe_state & PIPE_EOF) || - (!wpipe->pipe_present) || + wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) revents |= POLLHUP; @@ -1506,7 +1508,7 @@ pipeclose(cpipe) * Disconnect from peer, if any. */ ppipe = cpipe->pipe_peer; - if (ppipe->pipe_present != 0) { + if (ppipe->pipe_present == PIPE_ACTIVE) { pipeselwakeup(ppipe); ppipe->pipe_state |= PIPE_EOF; @@ -1523,16 +1525,23 @@ pipeclose(cpipe) PIPE_UNLOCK(cpipe); pipe_free_kmem(cpipe); PIPE_LOCK(cpipe); - cpipe->pipe_present = 0; + cpipe->pipe_present = PIPE_CLOSING; pipeunlock(cpipe); + + /* + * knlist_clear() may sleep dropping the PIPE_MTX. Set the + * PIPE_FINALIZED, that allows other end to free the + * pipe_pair, only after the knotes are completely dismantled. + */ knlist_clear(&cpipe->pipe_sel.si_note, 1); + cpipe->pipe_present = PIPE_FINALIZED; knlist_destroy(&cpipe->pipe_sel.si_note); /* * If both endpoints are now closed, release the memory for the * pipe pair. If not, unlock. */ - if (ppipe->pipe_present == 0) { + if (ppipe->pipe_present == PIPE_FINALIZED) { PIPE_UNLOCK(cpipe); #ifdef MAC mac_destroy_pipe(pp); @@ -1556,7 +1565,7 @@ pipe_kqfilter(struct file *fp, struct kn break; case EVFILT_WRITE: kn->kn_fop = &pipe_wfiltops; - if (!cpipe->pipe_peer->pipe_present) { + if (cpipe->pipe_peer->pipe_present != PIPE_ACTIVE) { /* other end of pipe has been closed */ PIPE_UNLOCK(cpipe); return (EPIPE); @@ -1579,13 +1588,8 @@ filt_pipedetach(struct knote *kn) struct pipe *cpipe = (struct pipe *)kn->kn_fp->f_data; PIPE_LOCK(cpipe); - if (kn->kn_filter == EVFILT_WRITE) { - if (!cpipe->pipe_peer->pipe_present) { - PIPE_UNLOCK(cpipe); - return; - } + if (kn->kn_filter == EVFILT_WRITE) cpipe = cpipe->pipe_peer; - } knlist_remove(&cpipe->pipe_sel.si_note, kn, 1); PIPE_UNLOCK(cpipe); } @@ -1604,7 +1608,8 @@ filt_piperead(struct knote *kn, long hin kn->kn_data = rpipe->pipe_map.cnt; if ((rpipe->pipe_state & PIPE_EOF) || - (!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { kn->kn_flags |= EV_EOF; PIPE_UNLOCK(rpipe); return (1); @@ -1622,7 +1627,8 @@ filt_pipewrite(struct knote *kn, long hi struct pipe *wpipe = rpipe->pipe_peer; PIPE_LOCK(rpipe); - if ((!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { kn->kn_data = 0; kn->kn_flags |= EV_EOF; PIPE_UNLOCK(rpipe); Modified: releng/6.3/sys/sys/event.h ============================================================================== --- releng/6.3/sys/sys/event.h Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/sys/event.h Fri Oct 2 18:09:56 2009 (r197715) @@ -208,6 +208,7 @@ struct proc; struct knlist; extern void knote(struct knlist *list, long hint, int islocked); +extern void knote_fork(struct knlist *list, int pid); extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove_inevent(struct knlist *knl, struct knote *kn); Modified: releng/6.3/sys/sys/pipe.h ============================================================================== --- releng/6.3/sys/sys/pipe.h Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.3/sys/sys/pipe.h Fri Oct 2 18:09:56 2009 (r197715) @@ -115,6 +115,13 @@ struct pipe { }; /* + * Values for the pipe_present. + */ +#define PIPE_ACTIVE 1 +#define PIPE_CLOSING 2 +#define PIPE_FINALIZED 3 + +/* * Container structure to hold the two pipe endpoints, mutex, and label * pointer. */ Modified: releng/6.4/UPDATING ============================================================================== --- releng/6.4/UPDATING Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/UPDATING Fri Oct 2 18:09:56 2009 (r197715) @@ -8,6 +8,14 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20091002: p7 FreeBSD-SA-09:13.pipe, FreeBSD-SA-09:14.devfs, + FreeBSD-EN-09:05.null + Fix kqueue pipe race conditions. [SA-09:13] + + Fix devfs / VFS NULL pointer race condition. [SA-09:14] + + Add no zero mapping feature. [EN-09:05] + 20090729: p6 FreeBSD-SA-09:12.bind Fix BIND named(8) dynamic update message remote DoS. Modified: releng/6.4/sys/conf/newvers.sh ============================================================================== --- releng/6.4/sys/conf/newvers.sh Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/conf/newvers.sh Fri Oct 2 18:09:56 2009 (r197715) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.4" -BRANCH="RELEASE-p6" +BRANCH="RELEASE-p7" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/6.4/sys/fs/devfs/devfs_vnops.c ============================================================================== --- releng/6.4/sys/fs/devfs/devfs_vnops.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/fs/devfs/devfs_vnops.c Fri Oct 2 18:09:56 2009 (r197715) @@ -759,6 +759,9 @@ devfs_open(struct vop_open_args *ap) VOP_UNLOCK(vp, 0, td); + if (ap->a_fdidx >= 0) + ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]->f_vnode = vp; + if(!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); if (dsw->d_fdopen != NULL) Modified: releng/6.4/sys/kern/kern_event.c ============================================================================== --- releng/6.4/sys/kern/kern_event.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/kern/kern_event.c Fri Oct 2 18:09:56 2009 (r197715) @@ -392,30 +392,82 @@ filt_proc(struct knote *kn, long hint) return (1); } - /* - * process forked, and user wants to track the new process, - * so attach a new knote to it, and immediately report an - * event with the parent's pid. - */ - if ((event == NOTE_FORK) && (kn->kn_sfflags & NOTE_TRACK)) { - struct kevent kev; - int error; + return (kn->kn_fflags != 0); +} + +/* + * Called when the process forked. It mostly does the same as the + * knote(), activating all knotes registered to be activated when the + * process forked. Additionally, for each knote attached to the + * parent, check whether user wants to track the new process. If so + * attach a new knote to it, and immediately report an event with the + * child's pid. + */ +void +knote_fork(struct knlist *list, int pid) +{ + struct kqueue *kq; + struct knote *kn; + struct kevent kev; + int error; + + if (list == NULL) + return; + list->kl_lock(list->kl_lockarg); + + SLIST_FOREACH(kn, &list->kl_list, kn_selnext) { + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) + continue; + kq = kn->kn_kq; + KQ_LOCK(kq); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_UNLOCK(kq); + continue; + } /* - * register knote with new process. + * The same as knote(), activate the event. */ - kev.ident = hint & NOTE_PDATAMASK; /* pid */ + if ((kn->kn_sfflags & NOTE_TRACK) == 0) { + kn->kn_status |= KN_HASKQLOCK; + if (kn->kn_fop->f_event(kn, NOTE_FORK | pid)) + KNOTE_ACTIVATE(kn, 1); + kn->kn_status &= ~KN_HASKQLOCK; + KQ_UNLOCK(kq); + continue; + } + + /* + * The NOTE_TRACK case. In addition to the activation + * of the event, we need to register new event to + * track the child. Drop the locks in preparation for + * the call to kqueue_register(). + */ + kn->kn_status |= KN_INFLUX; + KQ_UNLOCK(kq); + list->kl_unlock(list->kl_lockarg); + + /* + * Activate existing knote and register a knote with + * new process. + */ + kev.ident = pid; kev.filter = kn->kn_filter; kev.flags = kn->kn_flags | EV_ADD | EV_ENABLE | EV_FLAG1; kev.fflags = kn->kn_sfflags; - kev.data = kn->kn_id; /* parent */ - kev.udata = kn->kn_kevent.udata; /* preserve udata */ - error = kqueue_register(kn->kn_kq, &kev, NULL, 0); + kev.data = kn->kn_id; /* parent */ + kev.udata = kn->kn_kevent.udata;/* preserve udata */ + error = kqueue_register(kq, &kev, NULL, 0); + if (kn->kn_fop->f_event(kn, NOTE_FORK | pid)) + KNOTE_ACTIVATE(kn, 0); if (error) kn->kn_fflags |= NOTE_TRACKERR; + KQ_LOCK(kq); + kn->kn_status &= ~KN_INFLUX; + KQ_UNLOCK_FLUX(kq); + list->kl_lock(list->kl_lockarg); } - - return (kn->kn_fflags != 0); + list->kl_unlock(list->kl_lockarg); } static int @@ -1123,7 +1175,7 @@ kqueue_scan(struct kqueue *kq, int maxev struct kevent *kevp; struct timeval atv, rtv, ttv; struct knote *kn, *marker; - int count, timeout, nkev, error; + int count, timeout, nkev, error, influx; int haskqglobal; count = maxevents; @@ -1193,12 +1245,17 @@ start: } TAILQ_INSERT_TAIL(&kq->kq_head, marker, kn_tqe); + influx = 0; while (count) { KQ_OWNED(kq); kn = TAILQ_FIRST(&kq->kq_head); if ((kn->kn_status == KN_MARKER && kn != marker) || (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (influx) { + influx = 0; + KQ_FLUX_WAKEUP(kq); + } kq->kq_state |= KQ_FLUXWAIT; error = msleep(kq, &kq->kq_lock, PSOCK, "kqflxwt", 0); @@ -1248,6 +1305,7 @@ start: ~(KN_QUEUED | KN_ACTIVE | KN_INFLUX); kq->kq_count--; KN_LIST_UNLOCK(kn); + influx = 1; continue; } *kevp = kn->kn_kevent; @@ -1263,6 +1321,7 @@ start: kn->kn_status &= ~(KN_INFLUX); KN_LIST_UNLOCK(kn); + influx = 1; } /* we are returning a copy to the user */ @@ -1271,6 +1330,7 @@ start: count--; if (nkev == KQ_NEVENTS) { + influx = 0; KQ_UNLOCK_FLUX(kq); error = k_ops->k_copyout(k_ops->arg, keva, nkev); nkev = 0; @@ -1434,8 +1494,11 @@ kqueue_close(struct file *fp, struct thr for (i = 0; i < kq->kq_knlistsize; i++) { while ((kn = SLIST_FIRST(&kq->kq_knlist[i])) != NULL) { - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK, "kqclo1", 0); + continue; + } kn->kn_status |= KN_INFLUX; KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) @@ -1447,8 +1510,12 @@ kqueue_close(struct file *fp, struct thr if (kq->kq_knhashmask != 0) { for (i = 0; i <= kq->kq_knhashmask; i++) { while ((kn = SLIST_FIRST(&kq->kq_knhash[i])) != NULL) { - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK, + "kqclo2", 0); + continue; + } kn->kn_status |= KN_INFLUX; KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) Modified: releng/6.4/sys/kern/kern_exec.c ============================================================================== --- releng/6.4/sys/kern/kern_exec.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/kern/kern_exec.c Fri Oct 2 18:09:56 2009 (r197715) @@ -104,6 +104,13 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +SYSCTL_DECL(_security_bsd); + +static int map_at_zero = 1; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -914,7 +921,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; imgp->vmspace_destroyed = 1; @@ -928,14 +935,18 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace), vm_map_min(map), vm_map_max(map)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + vmspace_exec(p, sv_minuser, sv->sv_maxuser); vmspace = p->p_vmspace; map = &vmspace->vm_map; } Modified: releng/6.4/sys/kern/kern_fork.c ============================================================================== --- releng/6.4/sys/kern/kern_fork.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/kern/kern_fork.c Fri Oct 2 18:09:56 2009 (r197715) @@ -699,14 +699,12 @@ again: */ PROC_LOCK(p1); _PRELE(p1); + PROC_UNLOCK(p1); /* * Tell any interested parties about the new process. */ - KNOTE_LOCKED(&p1->p_klist, NOTE_FORK | p2->p_pid); - - PROC_UNLOCK(p1); - + knote_fork(&p1->p_klist, p2->p_pid); /* * Preserve synchronization semantics of vfork. If waiting for * child to exec or exit, set P_PPWAIT on child, and sleep on our Modified: releng/6.4/sys/kern/sys_pipe.c ============================================================================== --- releng/6.4/sys/kern/sys_pipe.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/kern/sys_pipe.c Fri Oct 2 18:09:56 2009 (r197715) @@ -268,8 +268,8 @@ pipe_zone_ctor(void *mem, int size, void * one at a time. When both are free'd, then the whole pair * is released. */ - rpipe->pipe_present = 1; - wpipe->pipe_present = 1; + rpipe->pipe_present = PIPE_ACTIVE; + wpipe->pipe_present = PIPE_ACTIVE; /* * Eventually, the MAC Framework may initialize the label @@ -1003,7 +1003,8 @@ pipe_write(fp, uio, active_cred, flags, /* * detect loss of pipe read side, issue SIGPIPE if lost. */ - if ((!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { pipeunlock(wpipe); PIPE_UNLOCK(rpipe); return (EPIPE); @@ -1361,13 +1362,14 @@ pipe_poll(fp, events, active_cred, td) revents |= events & (POLLIN | POLLRDNORM); if (events & (POLLOUT | POLLWRNORM)) - if (!wpipe->pipe_present || (wpipe->pipe_state & PIPE_EOF) || + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF) || (((wpipe->pipe_state & PIPE_DIRECTW) == 0) && (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)) revents |= events & (POLLOUT | POLLWRNORM); if ((rpipe->pipe_state & PIPE_EOF) || - (!wpipe->pipe_present) || + wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) revents |= POLLHUP; @@ -1506,7 +1508,7 @@ pipeclose(cpipe) * Disconnect from peer, if any. */ ppipe = cpipe->pipe_peer; - if (ppipe->pipe_present != 0) { + if (ppipe->pipe_present == PIPE_ACTIVE) { pipeselwakeup(ppipe); ppipe->pipe_state |= PIPE_EOF; @@ -1523,16 +1525,23 @@ pipeclose(cpipe) PIPE_UNLOCK(cpipe); pipe_free_kmem(cpipe); PIPE_LOCK(cpipe); - cpipe->pipe_present = 0; + cpipe->pipe_present = PIPE_CLOSING; pipeunlock(cpipe); + + /* + * knlist_clear() may sleep dropping the PIPE_MTX. Set the + * PIPE_FINALIZED, that allows other end to free the + * pipe_pair, only after the knotes are completely dismantled. + */ knlist_clear(&cpipe->pipe_sel.si_note, 1); + cpipe->pipe_present = PIPE_FINALIZED; knlist_destroy(&cpipe->pipe_sel.si_note); /* * If both endpoints are now closed, release the memory for the * pipe pair. If not, unlock. */ - if (ppipe->pipe_present == 0) { + if (ppipe->pipe_present == PIPE_FINALIZED) { PIPE_UNLOCK(cpipe); #ifdef MAC mac_destroy_pipe(pp); @@ -1556,7 +1565,7 @@ pipe_kqfilter(struct file *fp, struct kn break; case EVFILT_WRITE: kn->kn_fop = &pipe_wfiltops; - if (!cpipe->pipe_peer->pipe_present) { + if (cpipe->pipe_peer->pipe_present != PIPE_ACTIVE) { /* other end of pipe has been closed */ PIPE_UNLOCK(cpipe); return (EPIPE); @@ -1579,13 +1588,8 @@ filt_pipedetach(struct knote *kn) struct pipe *cpipe = (struct pipe *)kn->kn_fp->f_data; PIPE_LOCK(cpipe); - if (kn->kn_filter == EVFILT_WRITE) { - if (!cpipe->pipe_peer->pipe_present) { - PIPE_UNLOCK(cpipe); - return; - } + if (kn->kn_filter == EVFILT_WRITE) cpipe = cpipe->pipe_peer; - } knlist_remove(&cpipe->pipe_sel.si_note, kn, 1); PIPE_UNLOCK(cpipe); } @@ -1604,7 +1608,8 @@ filt_piperead(struct knote *kn, long hin kn->kn_data = rpipe->pipe_map.cnt; if ((rpipe->pipe_state & PIPE_EOF) || - (!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { kn->kn_flags |= EV_EOF; PIPE_UNLOCK(rpipe); return (1); @@ -1622,7 +1627,8 @@ filt_pipewrite(struct knote *kn, long hi struct pipe *wpipe = rpipe->pipe_peer; PIPE_LOCK(rpipe); - if ((!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { kn->kn_data = 0; kn->kn_flags |= EV_EOF; PIPE_UNLOCK(rpipe); Modified: releng/6.4/sys/sys/event.h ============================================================================== --- releng/6.4/sys/sys/event.h Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/sys/event.h Fri Oct 2 18:09:56 2009 (r197715) @@ -208,6 +208,7 @@ struct proc; struct knlist; extern void knote(struct knlist *list, long hint, int islocked); +extern void knote_fork(struct knlist *list, int pid); extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove_inevent(struct knlist *knl, struct knote *kn); Modified: releng/6.4/sys/sys/pipe.h ============================================================================== --- releng/6.4/sys/sys/pipe.h Fri Oct 2 17:58:47 2009 (r197714) +++ releng/6.4/sys/sys/pipe.h Fri Oct 2 18:09:56 2009 (r197715) @@ -115,6 +115,13 @@ struct pipe { }; /* + * Values for the pipe_present. + */ +#define PIPE_ACTIVE 1 +#define PIPE_CLOSING 2 +#define PIPE_FINALIZED 3 + +/* * Container structure to hold the two pipe endpoints, mutex, and label * pointer. */ Modified: releng/7.1/UPDATING ============================================================================== --- releng/7.1/UPDATING Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.1/UPDATING Fri Oct 2 18:09:56 2009 (r197715) @@ -8,6 +8,11 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20091002: p8 FreeBSD-SA-09:14.devfs, FreeBSD-EN-09:05.null + Fix devfs / VFS NULL pointer race condition. [SA-09:14] + + Add no zero mapping feature. [EN-09:05] + 20090729: p7 FreeBSD-SA-09:12.bind Fix BIND named(8) dynamic update message remote DoS. Modified: releng/7.1/sys/conf/newvers.sh ============================================================================== --- releng/7.1/sys/conf/newvers.sh Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.1/sys/conf/newvers.sh Fri Oct 2 18:09:56 2009 (r197715) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.1" -BRANCH="RELEASE-p7" +BRANCH="RELEASE-p8" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/7.1/sys/fs/devfs/devfs_vnops.c ============================================================================== --- releng/7.1/sys/fs/devfs/devfs_vnops.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.1/sys/fs/devfs/devfs_vnops.c Fri Oct 2 18:09:56 2009 (r197715) @@ -883,6 +883,7 @@ devfs_open(struct vop_open_args *ap) if (fp != NULL) { FILE_LOCK(fp); fp->f_data = dev; + fp->f_vnode = vp; FILE_UNLOCK(fp); } fpop = td->td_fpop; Modified: releng/7.1/sys/kern/kern_exec.c ============================================================================== --- releng/7.1/sys/kern/kern_exec.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.1/sys/kern/kern_exec.c Fri Oct 2 18:09:56 2009 (r197715) @@ -121,6 +121,11 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +static int map_at_zero = 1; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -933,7 +938,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; u_long ssiz; @@ -949,13 +954,17 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - error = vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + error = vmspace_exec(p, sv_minuser, sv->sv_maxuser); if (error) return (error); vmspace = p->p_vmspace; Modified: releng/7.2/UPDATING ============================================================================== --- releng/7.2/UPDATING Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.2/UPDATING Fri Oct 2 18:09:56 2009 (r197715) @@ -8,6 +8,11 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20091002: p4 FreeBSD-SA-09:14.devfs FreeBSD-EN-09:05.null + Fix devfs / VFS NULL pointer race condition. [SA-09:14] + + Add no zero mapping feature. [EN-09:05] + 20090729: p3 FreeBSD-SA-09:12.bind Fix BIND named(8) dynamic update message remote DoS. Modified: releng/7.2/sys/conf/newvers.sh ============================================================================== --- releng/7.2/sys/conf/newvers.sh Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.2/sys/conf/newvers.sh Fri Oct 2 18:09:56 2009 (r197715) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.2" -BRANCH="RELEASE-p3" +BRANCH="RELEASE-p4" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/7.2/sys/fs/devfs/devfs_vnops.c ============================================================================== --- releng/7.2/sys/fs/devfs/devfs_vnops.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.2/sys/fs/devfs/devfs_vnops.c Fri Oct 2 18:09:56 2009 (r197715) @@ -890,6 +890,7 @@ devfs_open(struct vop_open_args *ap) if (fp != NULL) { FILE_LOCK(fp); fp->f_data = dev; + fp->f_vnode = vp; FILE_UNLOCK(fp); } fpop = td->td_fpop; Modified: releng/7.2/sys/kern/kern_exec.c ============================================================================== --- releng/7.2/sys/kern/kern_exec.c Fri Oct 2 17:58:47 2009 (r197714) +++ releng/7.2/sys/kern/kern_exec.c Fri Oct 2 18:09:56 2009 (r197715) @@ -122,6 +122,11 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +static int map_at_zero = 1; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -939,7 +944,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; u_long ssiz; @@ -955,13 +960,17 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From simon at FreeBSD.org Fri Oct 2 18:09:57 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 18:10:43 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... Message-ID: <200910021809.n92I9v0c009121@svn.freebsd.org> Author: simon Date: Fri Oct 2 18:09:56 2009 New Revision: 197715 URL: http://svn.freebsd.org/changeset/base/197715 Log: MFC r197711 (partial) to 6.x and 7.x: - Add no zero mapping feature, disabled by default. [EN-09:05] MFC 178913,178914,179242,179243,180336,180340 to 6.x: - Fix kqueue pipe race conditions. [SA-09:13] MFC r192301 to 7.x; 6.x has slightly different fix: - Fix devfs / VFS NULL pointer race condition. [SA-09:14] Security: FreeBSD-SA-09:13.pipe Security: FreeBSD-SA-09:14.devfs Errata: FreeBSD-EN-09:05.null Submitted by: kib [SA-09:13] [SA-09:14] Submitted by: bz [EN-09:05] In collaboration with: jhb, kib, alc [EN-09:05] Approved by: so (simon) Modified: stable/6/sys/fs/devfs/devfs_vnops.c stable/6/sys/kern/kern_event.c stable/6/sys/kern/kern_exec.c stable/6/sys/kern/kern_fork.c stable/6/sys/kern/sys_pipe.c stable/6/sys/sys/event.h stable/6/sys/sys/pipe.h Changes in other areas also in this revision: Modified: releng/6.3/UPDATING releng/6.3/sys/conf/newvers.sh releng/6.3/sys/fs/devfs/devfs_vnops.c releng/6.3/sys/kern/kern_event.c releng/6.3/sys/kern/kern_exec.c releng/6.3/sys/kern/kern_fork.c releng/6.3/sys/kern/sys_pipe.c releng/6.3/sys/sys/event.h releng/6.3/sys/sys/pipe.h releng/6.4/UPDATING releng/6.4/sys/conf/newvers.sh releng/6.4/sys/fs/devfs/devfs_vnops.c releng/6.4/sys/kern/kern_event.c releng/6.4/sys/kern/kern_exec.c releng/6.4/sys/kern/kern_fork.c releng/6.4/sys/kern/sys_pipe.c releng/6.4/sys/sys/event.h releng/6.4/sys/sys/pipe.h releng/7.1/UPDATING releng/7.1/sys/conf/newvers.sh releng/7.1/sys/fs/devfs/devfs_vnops.c releng/7.1/sys/kern/kern_exec.c releng/7.2/UPDATING releng/7.2/sys/conf/newvers.sh releng/7.2/sys/fs/devfs/devfs_vnops.c releng/7.2/sys/kern/kern_exec.c stable/7/sys/kern/kern_exec.c Modified: stable/6/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/6/sys/fs/devfs/devfs_vnops.c Fri Oct 2 17:58:47 2009 (r197714) +++ stable/6/sys/fs/devfs/devfs_vnops.c Fri Oct 2 18:09:56 2009 (r197715) @@ -759,6 +759,9 @@ devfs_open(struct vop_open_args *ap) VOP_UNLOCK(vp, 0, td); + if (ap->a_fdidx >= 0) + ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]->f_vnode = vp; + if(!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); if (dsw->d_fdopen != NULL) Modified: stable/6/sys/kern/kern_event.c ============================================================================== --- stable/6/sys/kern/kern_event.c Fri Oct 2 17:58:47 2009 (r197714) +++ stable/6/sys/kern/kern_event.c Fri Oct 2 18:09:56 2009 (r197715) @@ -392,30 +392,82 @@ filt_proc(struct knote *kn, long hint) return (1); } - /* - * process forked, and user wants to track the new process, - * so attach a new knote to it, and immediately report an - * event with the parent's pid. - */ - if ((event == NOTE_FORK) && (kn->kn_sfflags & NOTE_TRACK)) { - struct kevent kev; - int error; + return (kn->kn_fflags != 0); +} + +/* + * Called when the process forked. It mostly does the same as the + * knote(), activating all knotes registered to be activated when the + * process forked. Additionally, for each knote attached to the + * parent, check whether user wants to track the new process. If so + * attach a new knote to it, and immediately report an event with the + * child's pid. + */ +void +knote_fork(struct knlist *list, int pid) +{ + struct kqueue *kq; + struct knote *kn; + struct kevent kev; + int error; + + if (list == NULL) + return; + list->kl_lock(list->kl_lockarg); + + SLIST_FOREACH(kn, &list->kl_list, kn_selnext) { + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) + continue; + kq = kn->kn_kq; + KQ_LOCK(kq); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_UNLOCK(kq); + continue; + } /* - * register knote with new process. + * The same as knote(), activate the event. */ - kev.ident = hint & NOTE_PDATAMASK; /* pid */ + if ((kn->kn_sfflags & NOTE_TRACK) == 0) { + kn->kn_status |= KN_HASKQLOCK; + if (kn->kn_fop->f_event(kn, NOTE_FORK | pid)) + KNOTE_ACTIVATE(kn, 1); + kn->kn_status &= ~KN_HASKQLOCK; + KQ_UNLOCK(kq); + continue; + } + + /* + * The NOTE_TRACK case. In addition to the activation + * of the event, we need to register new event to + * track the child. Drop the locks in preparation for + * the call to kqueue_register(). + */ + kn->kn_status |= KN_INFLUX; + KQ_UNLOCK(kq); + list->kl_unlock(list->kl_lockarg); + + /* + * Activate existing knote and register a knote with + * new process. + */ + kev.ident = pid; kev.filter = kn->kn_filter; kev.flags = kn->kn_flags | EV_ADD | EV_ENABLE | EV_FLAG1; kev.fflags = kn->kn_sfflags; - kev.data = kn->kn_id; /* parent */ - kev.udata = kn->kn_kevent.udata; /* preserve udata */ - error = kqueue_register(kn->kn_kq, &kev, NULL, 0); + kev.data = kn->kn_id; /* parent */ + kev.udata = kn->kn_kevent.udata;/* preserve udata */ + error = kqueue_register(kq, &kev, NULL, 0); + if (kn->kn_fop->f_event(kn, NOTE_FORK | pid)) + KNOTE_ACTIVATE(kn, 0); if (error) kn->kn_fflags |= NOTE_TRACKERR; + KQ_LOCK(kq); + kn->kn_status &= ~KN_INFLUX; + KQ_UNLOCK_FLUX(kq); + list->kl_lock(list->kl_lockarg); } - - return (kn->kn_fflags != 0); + list->kl_unlock(list->kl_lockarg); } static int @@ -1123,7 +1175,7 @@ kqueue_scan(struct kqueue *kq, int maxev struct kevent *kevp; struct timeval atv, rtv, ttv; struct knote *kn, *marker; - int count, timeout, nkev, error; + int count, timeout, nkev, error, influx; int haskqglobal; count = maxevents; @@ -1193,12 +1245,17 @@ start: } TAILQ_INSERT_TAIL(&kq->kq_head, marker, kn_tqe); + influx = 0; while (count) { KQ_OWNED(kq); kn = TAILQ_FIRST(&kq->kq_head); if ((kn->kn_status == KN_MARKER && kn != marker) || (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + if (influx) { + influx = 0; + KQ_FLUX_WAKEUP(kq); + } kq->kq_state |= KQ_FLUXWAIT; error = msleep(kq, &kq->kq_lock, PSOCK, "kqflxwt", 0); @@ -1248,6 +1305,7 @@ start: ~(KN_QUEUED | KN_ACTIVE | KN_INFLUX); kq->kq_count--; KN_LIST_UNLOCK(kn); + influx = 1; continue; } *kevp = kn->kn_kevent; @@ -1263,6 +1321,7 @@ start: kn->kn_status &= ~(KN_INFLUX); KN_LIST_UNLOCK(kn); + influx = 1; } /* we are returning a copy to the user */ @@ -1271,6 +1330,7 @@ start: count--; if (nkev == KQ_NEVENTS) { + influx = 0; KQ_UNLOCK_FLUX(kq); error = k_ops->k_copyout(k_ops->arg, keva, nkev); nkev = 0; @@ -1434,8 +1494,11 @@ kqueue_close(struct file *fp, struct thr for (i = 0; i < kq->kq_knlistsize; i++) { while ((kn = SLIST_FIRST(&kq->kq_knlist[i])) != NULL) { - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK, "kqclo1", 0); + continue; + } kn->kn_status |= KN_INFLUX; KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) @@ -1447,8 +1510,12 @@ kqueue_close(struct file *fp, struct thr if (kq->kq_knhashmask != 0) { for (i = 0; i <= kq->kq_knhashmask; i++) { while ((kn = SLIST_FIRST(&kq->kq_knhash[i])) != NULL) { - KASSERT((kn->kn_status & KN_INFLUX) == 0, - ("KN_INFLUX set when not suppose to be")); + if ((kn->kn_status & KN_INFLUX) == KN_INFLUX) { + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK, + "kqclo2", 0); + continue; + } kn->kn_status |= KN_INFLUX; KQ_UNLOCK(kq); if (!(kn->kn_status & KN_DETACHED)) Modified: stable/6/sys/kern/kern_exec.c ============================================================================== --- stable/6/sys/kern/kern_exec.c Fri Oct 2 17:58:47 2009 (r197714) +++ stable/6/sys/kern/kern_exec.c Fri Oct 2 18:09:56 2009 (r197715) @@ -104,6 +104,13 @@ u_long ps_arg_cache_limit = PAGE_SIZE / SYSCTL_ULONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, &ps_arg_cache_limit, 0, ""); +SYSCTL_DECL(_security_bsd); + +static int map_at_zero = 1; +TUNABLE_INT("security.bsd.map_at_zero", &map_at_zero); +SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RW, &map_at_zero, 0, + "Permit processes to map an object at virtual address 0."); + static int sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS) { @@ -914,7 +921,7 @@ exec_new_vmspace(imgp, sv) int error; struct proc *p = imgp->proc; struct vmspace *vmspace = p->p_vmspace; - vm_offset_t stack_addr; + vm_offset_t sv_minuser, stack_addr; vm_map_t map; imgp->vmspace_destroyed = 1; @@ -928,14 +935,18 @@ exec_new_vmspace(imgp, sv) * not disrupted */ map = &vmspace->vm_map; - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv->sv_minuser && + if (map_at_zero) + sv_minuser = sv->sv_minuser; + else + sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); + if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser) { shmexit(vmspace); pmap_remove_pages(vmspace_pmap(vmspace), vm_map_min(map), vm_map_max(map)); vm_map_remove(map, vm_map_min(map), vm_map_max(map)); } else { - vmspace_exec(p, sv->sv_minuser, sv->sv_maxuser); + vmspace_exec(p, sv_minuser, sv->sv_maxuser); vmspace = p->p_vmspace; map = &vmspace->vm_map; } Modified: stable/6/sys/kern/kern_fork.c ============================================================================== --- stable/6/sys/kern/kern_fork.c Fri Oct 2 17:58:47 2009 (r197714) +++ stable/6/sys/kern/kern_fork.c Fri Oct 2 18:09:56 2009 (r197715) @@ -699,14 +699,12 @@ again: */ PROC_LOCK(p1); _PRELE(p1); + PROC_UNLOCK(p1); /* * Tell any interested parties about the new process. */ - KNOTE_LOCKED(&p1->p_klist, NOTE_FORK | p2->p_pid); - - PROC_UNLOCK(p1); - + knote_fork(&p1->p_klist, p2->p_pid); /* * Preserve synchronization semantics of vfork. If waiting for * child to exec or exit, set P_PPWAIT on child, and sleep on our Modified: stable/6/sys/kern/sys_pipe.c ============================================================================== --- stable/6/sys/kern/sys_pipe.c Fri Oct 2 17:58:47 2009 (r197714) +++ stable/6/sys/kern/sys_pipe.c Fri Oct 2 18:09:56 2009 (r197715) @@ -268,8 +268,8 @@ pipe_zone_ctor(void *mem, int size, void * one at a time. When both are free'd, then the whole pair * is released. */ - rpipe->pipe_present = 1; - wpipe->pipe_present = 1; + rpipe->pipe_present = PIPE_ACTIVE; + wpipe->pipe_present = PIPE_ACTIVE; /* * Eventually, the MAC Framework may initialize the label @@ -1003,7 +1003,8 @@ pipe_write(fp, uio, active_cred, flags, /* * detect loss of pipe read side, issue SIGPIPE if lost. */ - if ((!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { pipeunlock(wpipe); PIPE_UNLOCK(rpipe); return (EPIPE); @@ -1361,13 +1362,14 @@ pipe_poll(fp, events, active_cred, td) revents |= events & (POLLIN | POLLRDNORM); if (events & (POLLOUT | POLLWRNORM)) - if (!wpipe->pipe_present || (wpipe->pipe_state & PIPE_EOF) || + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF) || (((wpipe->pipe_state & PIPE_DIRECTW) == 0) && (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)) revents |= events & (POLLOUT | POLLWRNORM); if ((rpipe->pipe_state & PIPE_EOF) || - (!wpipe->pipe_present) || + wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) revents |= POLLHUP; @@ -1506,7 +1508,7 @@ pipeclose(cpipe) * Disconnect from peer, if any. */ ppipe = cpipe->pipe_peer; - if (ppipe->pipe_present != 0) { + if (ppipe->pipe_present == PIPE_ACTIVE) { pipeselwakeup(ppipe); ppipe->pipe_state |= PIPE_EOF; @@ -1523,16 +1525,23 @@ pipeclose(cpipe) PIPE_UNLOCK(cpipe); pipe_free_kmem(cpipe); PIPE_LOCK(cpipe); - cpipe->pipe_present = 0; + cpipe->pipe_present = PIPE_CLOSING; pipeunlock(cpipe); + + /* + * knlist_clear() may sleep dropping the PIPE_MTX. Set the + * PIPE_FINALIZED, that allows other end to free the + * pipe_pair, only after the knotes are completely dismantled. + */ knlist_clear(&cpipe->pipe_sel.si_note, 1); + cpipe->pipe_present = PIPE_FINALIZED; knlist_destroy(&cpipe->pipe_sel.si_note); /* * If both endpoints are now closed, release the memory for the * pipe pair. If not, unlock. */ - if (ppipe->pipe_present == 0) { + if (ppipe->pipe_present == PIPE_FINALIZED) { PIPE_UNLOCK(cpipe); #ifdef MAC mac_destroy_pipe(pp); @@ -1556,7 +1565,7 @@ pipe_kqfilter(struct file *fp, struct kn break; case EVFILT_WRITE: kn->kn_fop = &pipe_wfiltops; - if (!cpipe->pipe_peer->pipe_present) { + if (cpipe->pipe_peer->pipe_present != PIPE_ACTIVE) { /* other end of pipe has been closed */ PIPE_UNLOCK(cpipe); return (EPIPE); @@ -1579,13 +1588,8 @@ filt_pipedetach(struct knote *kn) struct pipe *cpipe = (struct pipe *)kn->kn_fp->f_data; PIPE_LOCK(cpipe); - if (kn->kn_filter == EVFILT_WRITE) { - if (!cpipe->pipe_peer->pipe_present) { - PIPE_UNLOCK(cpipe); - return; - } + if (kn->kn_filter == EVFILT_WRITE) cpipe = cpipe->pipe_peer; - } knlist_remove(&cpipe->pipe_sel.si_note, kn, 1); PIPE_UNLOCK(cpipe); } @@ -1604,7 +1608,8 @@ filt_piperead(struct knote *kn, long hin kn->kn_data = rpipe->pipe_map.cnt; if ((rpipe->pipe_state & PIPE_EOF) || - (!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { kn->kn_flags |= EV_EOF; PIPE_UNLOCK(rpipe); return (1); @@ -1622,7 +1627,8 @@ filt_pipewrite(struct knote *kn, long hi struct pipe *wpipe = rpipe->pipe_peer; PIPE_LOCK(rpipe); - if ((!wpipe->pipe_present) || (wpipe->pipe_state & PIPE_EOF)) { + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) { kn->kn_data = 0; kn->kn_flags |= EV_EOF; PIPE_UNLOCK(rpipe); Modified: stable/6/sys/sys/event.h ============================================================================== --- stable/6/sys/sys/event.h Fri Oct 2 17:58:47 2009 (r197714) +++ stable/6/sys/sys/event.h Fri Oct 2 18:09:56 2009 (r197715) @@ -208,6 +208,7 @@ struct proc; struct knlist; extern void knote(struct knlist *list, long hint, int islocked); +extern void knote_fork(struct knlist *list, int pid); extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove_inevent(struct knlist *knl, struct knote *kn); Modified: stable/6/sys/sys/pipe.h ============================================================================== --- stable/6/sys/sys/pipe.h Fri Oct 2 17:58:47 2009 (r197714) +++ stable/6/sys/sys/pipe.h Fri Oct 2 18:09:56 2009 (r197715) @@ -115,6 +115,13 @@ struct pipe { }; /* + * Values for the pipe_present. + */ +#define PIPE_ACTIVE 1 +#define PIPE_CLOSING 2 +#define PIPE_FINALIZED 3 + +/* * Container structure to hold the two pipe endpoints, mutex, and label * pointer. */ From simon at FreeBSD.org Fri Oct 2 18:13:19 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 18:13:30 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... In-Reply-To: <200910021809.n92I9u1r009085@svn.freebsd.org> References: <200910021809.n92I9u1r009085@svn.freebsd.org> Message-ID: <20091002181317.GD1227@arthur.nitro.dk> On 2009.10.02 18:09:56 +0000, Simon L. Nielsen wrote: > Author: simon > Date: Fri Oct 2 18:09:56 2009 > New Revision: 197715 > URL: http://svn.freebsd.org/changeset/base/197715 > > Log: > MFC r197711 (partial) to 6.x and 7.x: > > - Add no zero mapping feature, disabled by default. [EN-09:05] > > MFC 178913,178914,179242,179243,180336,180340 to 6.x: > > - Fix kqueue pipe race conditions. [SA-09:13] > > MFC r192301 to 7.x; 6.x has slightly different fix: > > - Fix devfs / VFS NULL pointer race condition. [SA-09:14] > > Security: FreeBSD-SA-09:13.pipe > Security: FreeBSD-SA-09:14.devfs > Errata: FreeBSD-EN-09:05.null > Submitted by: kib [SA-09:13] [SA-09:14] > Submitted by: bz [EN-09:05] > In collaboration with: jhb, kib, alc [EN-09:05] > Approved by: so (simon) Just FYI, I plan to fix up the merge info for the stable/[67] branches, but I probably won't get to it until Saturday or Sunday. -- Simon L. Nielsen From marius at FreeBSD.org Fri Oct 2 18:33:41 2009 From: marius at FreeBSD.org (Marius Strobl) Date: Fri Oct 2 18:33:57 2009 Subject: svn commit: r197716 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci sparc64/conf Message-ID: <200910021833.n92IXfAb009681@svn.freebsd.org> Author: marius Date: Fri Oct 2 18:33:40 2009 New Revision: 197716 URL: http://svn.freebsd.org/changeset/base/197716 Log: MFC: r197490 Merge r194204 from amd64/i386: Enable PRINTF_BUFR_SIZE by default. PR: 139134 Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/sparc64/conf/GENERIC Modified: stable/8/sys/sparc64/conf/GENERIC ============================================================================== --- stable/8/sys/sparc64/conf/GENERIC Fri Oct 2 18:09:56 2009 (r197715) +++ stable/8/sys/sparc64/conf/GENERIC Fri Oct 2 18:33:40 2009 (r197716) @@ -68,6 +68,7 @@ options SYSVMSG # SYSV-style message options SYSVSEM # SYSV-style semaphores options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework From simon at FreeBSD.org Fri Oct 2 20:10:29 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Oct 2 20:10:35 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... In-Reply-To: <200910021809.n92I9u1r009085@svn.freebsd.org> References: <200910021809.n92I9u1r009085@svn.freebsd.org> Message-ID: <20091002201027.GE1227@arthur.nitro.dk> On 2009.10.02 18:09:56 +0000, Simon L. Nielsen wrote: > Author: simon > Date: Fri Oct 2 18:09:56 2009 > New Revision: 197715 > URL: http://svn.freebsd.org/changeset/base/197715 > > Log: > MFC r197711 (partial) to 6.x and 7.x: > > - Add no zero mapping feature, disabled by default. [EN-09:05] > > MFC 178913,178914,179242,179243,180336,180340 to 6.x: > > - Fix kqueue pipe race conditions. [SA-09:13] > > MFC r192301 to 7.x; 6.x has slightly different fix: > > - Fix devfs / VFS NULL pointer race condition. [SA-09:14] > > Security: FreeBSD-SA-09:13.pipe > Security: FreeBSD-SA-09:14.devfs > Errata: FreeBSD-EN-09:05.null > Submitted by: kib [SA-09:13] [SA-09:14] > Submitted by: bz [EN-09:05] > In collaboration with: jhb, kib, alc [EN-09:05] > Approved by: so (simon) Oh, and I initially forgot: Tested by: pho (and that was testing both reproducing the problems in the first place and helping in testing that the patches actually closes the races etc. - so thanks to pho as well as the other people mentioned above! :-) ) -- Simon L. Nielsen From hrs at FreeBSD.org Fri Oct 2 20:19:53 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Fri Oct 2 20:19:59 2009 Subject: svn commit: r197719 - head/etc/rc.d Message-ID: <200910022019.n92KJrRo012165@svn.freebsd.org> Author: hrs Date: Fri Oct 2 20:19:53 2009 New Revision: 197719 URL: http://svn.freebsd.org/changeset/base/197719 Log: - Enable an afexists() check only when no AF argument is specified. - Simplify helper functions. Discussed with: ume Modified: head/etc/rc.d/routing Modified: head/etc/rc.d/routing ============================================================================== --- head/etc/rc.d/routing Fri Oct 2 20:15:47 2009 (r197718) +++ head/etc/rc.d/routing Fri Oct 2 20:19:53 2009 (r197719) @@ -13,26 +13,80 @@ . /etc/network.subr name="routing" -start_cmd="routing_start" +start_cmd="routing_start doall" stop_cmd="routing_stop" extra_commands="options static" -static_cmd="static_start" -options_cmd="options_start" +static_cmd="routing_start static" +options_cmd="routing_start options" + +afcheck() +{ + case $_af in + ""|inet|inet6|ipx|atm) + ;; + *) + err 1 "Unsupported address family: $_af." + ;; + esac +} routing_start() { - static_start "$@" - options_start "$@" + local _cmd _af _a + _cmd=$1 + _af=$2 + + afcheck + + case $_af in + inet|inet6|ipx|atm) + setroutes $_cmd $_af + ;; + "") + for _a in inet inet6 ipx atm; do + afexists $_a && setroutes $_cmd $_a + done + ;; + esac + [ -n "${_ropts_initdone}" ] && echo '.' } routing_stop() { - local _af + local _af _a + _af=$1 - static_stop "$@" - for _af in inet inet6; do - afexists ${_af} && eval routing_stop_${_af} - done + afcheck + + case $_af in + inet|inet6|ipx|atm) + eval static_${_af} delete + eval routing_stop_${_af} + ;; + "") + for _a in inet inet6 ipx atm; do + afexists $_a || continue + eval static_${_a} delete + eval routing_stop_${_a} + done + ;; + esac +} + +setroutes() +{ + case $1 in + static) + static_$2 add + ;; + options) + options_$2 + ;; + doall) + static_$2 add + options_$2 + ;; + esac } routing_stop_inet() @@ -50,45 +104,14 @@ routing_stop_inet6() done } -static_start() -{ - local _af - _af=$1 - - case ${_af} in - inet|inet6|atm) - do_static add ${_af} - ;; - "") - do_static add inet inet6 atm - ;; - esac -} - -static_stop() +routing_stop_atm() { - local _af - _af=$1 - - case ${_af} in - inet|inet6|atm) - do_static delete ${_af} - ;; - "") - do_static delete inet inet6 atm - ;; - esac + return 0 } -do_static() +routing_stop_ipx() { - local _af _action - _action=$1 - - shift - for _af in "$@"; do - afexists ${_af} && eval static_${_af} ${_action} - done + return 0 } static_inet() @@ -233,6 +256,10 @@ static_atm() fi } +static_ipx() +{ +} + _ropts_initdone= ropts_init() { @@ -242,16 +269,6 @@ ropts_init() fi } -options_start() -{ - local _af - - for _af in inet inet6 ipx; do - afexists ${_af} && eval options_${_af} - done - [ -n "${_ropts_initdone}" ] && echo '.' -} - options_inet() { if checkyesno icmp_bmcastecho; then @@ -322,6 +339,10 @@ options_inet6() fi } +options_atm() +{ +} + options_ipx() { if checkyesno ipxgateway_enable; then From oliver.pntr at gmail.com Fri Oct 2 20:31:15 2009 From: oliver.pntr at gmail.com (Oliver Pinter) Date: Fri Oct 2 20:31:25 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... In-Reply-To: <20091002201027.GE1227@arthur.nitro.dk> References: <200910021809.n92I9u1r009085@svn.freebsd.org> <20091002201027.GE1227@arthur.nitro.dk> Message-ID: <6101e8c40910021331g3747f4e1g2b7c2dbfe504712@mail.gmail.com> Hi! And what's the status of these exploits fix: http://hup.hu/cikkek/200909/freebsd_6.4_es_7.2_local_root_0day-ek ? On 10/2/09, Simon L. Nielsen wrote: > On 2009.10.02 18:09:56 +0000, Simon L. Nielsen wrote: >> Author: simon >> Date: Fri Oct 2 18:09:56 2009 >> New Revision: 197715 >> URL: http://svn.freebsd.org/changeset/base/197715 >> >> Log: >> MFC r197711 (partial) to 6.x and 7.x: >> >> - Add no zero mapping feature, disabled by default. [EN-09:05] >> >> MFC 178913,178914,179242,179243,180336,180340 to 6.x: >> >> - Fix kqueue pipe race conditions. [SA-09:13] >> >> MFC r192301 to 7.x; 6.x has slightly different fix: >> >> - Fix devfs / VFS NULL pointer race condition. [SA-09:14] >> >> Security: FreeBSD-SA-09:13.pipe >> Security: FreeBSD-SA-09:14.devfs >> Errata: FreeBSD-EN-09:05.null >> Submitted by: kib [SA-09:13] [SA-09:14] >> Submitted by: bz [EN-09:05] >> In collaboration with: jhb, kib, alc [EN-09:05] >> Approved by: so (simon) > > Oh, and I initially forgot: > > Tested by: pho > > (and that was testing both reproducing the problems in the first place > and helping in testing that the patches actually closes the races > etc. - so thanks to pho as well as the other people mentioned above! > :-) ) > > -- > Simon L. Nielsen > _______________________________________________ > svn-src-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable > To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org" > From remko at elvandar.org Fri Oct 2 20:41:38 2009 From: remko at elvandar.org (Remko Lodder) Date: Fri Oct 2 20:41:54 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... In-Reply-To: <6101e8c40910021331g3747f4e1g2b7c2dbfe504712@mail.gmail.com> References: <200910021809.n92I9u1r009085@svn.freebsd.org> <20091002201027.GE1227@arthur.nitro.dk> <6101e8c40910021331g3747f4e1g2b7c2dbfe504712@mail.gmail.com> Message-ID: Please wait for the advisories to popup and see whether these match the question you have. Thanks, Remko On Oct 2, 2009, at 10:31 PM, Oliver Pinter wrote: > Hi! > > And what's the status of these exploits fix: > http://hup.hu/cikkek/200909/freebsd_6.4_es_7.2_local_root_0day-ek > > ? > > On 10/2/09, Simon L. Nielsen wrote: >> On 2009.10.02 18:09:56 +0000, Simon L. Nielsen wrote: >>> Author: simon >>> Date: Fri Oct 2 18:09:56 2009 >>> New Revision: 197715 >>> URL: http://svn.freebsd.org/changeset/base/197715 >>> >>> Log: >>> MFC r197711 (partial) to 6.x and 7.x: >>> >>> - Add no zero mapping feature, disabled by default. [EN-09:05] >>> >>> MFC 178913,178914,179242,179243,180336,180340 to 6.x: >>> >>> - Fix kqueue pipe race conditions. [SA-09:13] >>> >>> MFC r192301 to 7.x; 6.x has slightly different fix: >>> >>> - Fix devfs / VFS NULL pointer race condition. [SA-09:14] >>> >>> Security: FreeBSD-SA-09:13.pipe >>> Security: FreeBSD-SA-09:14.devfs >>> Errata: FreeBSD-EN-09:05.null >>> Submitted by: kib [SA-09:13] [SA-09:14] >>> Submitted by: bz [EN-09:05] >>> In collaboration with: jhb, kib, alc [EN-09:05] >>> Approved by: so (simon) >> >> Oh, and I initially forgot: >> >> Tested by: pho >> >> (and that was testing both reproducing the problems in the first >> place >> and helping in testing that the patches actually closes the races >> etc. - so thanks to pho as well as the other people mentioned above! >> :-) ) >> >> -- >> Simon L. Nielsen >> _______________________________________________ >> svn-src-stable@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/svn-src-stable >> To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org >> " >> -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From oliver.pntr at gmail.com Fri Oct 2 20:44:46 2009 From: oliver.pntr at gmail.com (Oliver Pinter) Date: Fri Oct 2 20:44:53 2009 Subject: svn commit: r197715 - releng/6.3 releng/6.3/sys/conf releng/6.3/sys/fs/devfs releng/6.3/sys/kern releng/6.3/sys/sys releng/6.4 releng/6.4/sys/conf releng/6.4/sys/fs/devfs releng/6.4/sys/kern releng... In-Reply-To: References: <200910021809.n92I9u1r009085@svn.freebsd.org> <20091002201027.GE1227@arthur.nitro.dk> <6101e8c40910021331g3747f4e1g2b7c2dbfe504712@mail.gmail.com> Message-ID: <6101e8c40910021344s514ea9fdg24e1e391efbbf956@mail.gmail.com> After I send the previous mail, see the advisories. On 10/2/09, Remko Lodder wrote: > > Please wait for the advisories to popup and see whether these match > the question you have. > > Thanks, > Remko > > On Oct 2, 2009, at 10:31 PM, Oliver Pinter wrote: > >> Hi! >> >> And what's the status of these exploits fix: >> http://hup.hu/cikkek/200909/freebsd_6.4_es_7.2_local_root_0day-ek >> >> ? >> >> On 10/2/09, Simon L. Nielsen wrote: >>> On 2009.10.02 18:09:56 +0000, Simon L. Nielsen wrote: >>>> Author: simon >>>> Date: Fri Oct 2 18:09:56 2009 >>>> New Revision: 197715 >>>> URL: http://svn.freebsd.org/changeset/base/197715 >>>> >>>> Log: >>>> MFC r197711 (partial) to 6.x and 7.x: >>>> >>>> - Add no zero mapping feature, disabled by default. [EN-09:05] >>>> >>>> MFC 178913,178914,179242,179243,180336,180340 to 6.x: >>>> >>>> - Fix kqueue pipe race conditions. [SA-09:13] >>>> >>>> MFC r192301 to 7.x; 6.x has slightly different fix: >>>> >>>> - Fix devfs / VFS NULL pointer race condition. [SA-09:14] >>>> >>>> Security: FreeBSD-SA-09:13.pipe >>>> Security: FreeBSD-SA-09:14.devfs >>>> Errata: FreeBSD-EN-09:05.null >>>> Submitted by: kib [SA-09:13] [SA-09:14] >>>> Submitted by: bz [EN-09:05] >>>> In collaboration with: jhb, kib, alc [EN-09:05] >>>> Approved by: so (simon) >>> >>> Oh, and I initially forgot: >>> >>> Tested by: pho >>> >>> (and that was testing both reproducing the problems in the first >>> place >>> and helping in testing that the patches actually closes the races >>> etc. - so thanks to pho as well as the other people mentioned above! >>> :-) ) >>> >>> -- >>> Simon L. Nielsen >>> _______________________________________________ >>> svn-src-stable@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/svn-src-stable >>> To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org >>> " >>> > > -- > /"\ Best regards, | remko@FreeBSD.org > \ / Remko Lodder | remko@EFnet > X http://www.evilcoder.org/ | > / \ ASCII Ribbon Campaign | Against HTML Mail and News > > From swell.k at gmail.com Fri Oct 2 21:11:35 2009 From: swell.k at gmail.com (Anonymous) Date: Fri Oct 2 21:11:47 2009 Subject: svn commit: r197698 - head/etc/rc.d In-Reply-To: <200910020227.n922RnBd086217__26713.9191426852$1254450512$gmane$org@svn.freebsd.org> (Hiroki Sato's message of "Fri, 2 Oct 2009 02:27:49 +0000 (UTC)") References: <200910020227.n922RnBd086217__26713.9191426852$1254450512$gmane$org@svn.freebsd.org> Message-ID: <86tyyh4i4o.fsf@gmail.com> Hiroki Sato writes: > Modified: head/etc/rc.d/netoptions [...] > > if checkyesno tcp_extensions; then > + ${SYSCTL_W} net.inet.tcp.rfc1323=1 >/dev/null > + else > netoptions_init > - echo -n ' rfc1323 extensions=NO' > + echo -n ' rfc1323 extensions=${tcp_extensions}' ^^^^^^^^^^^^^^^^^ Here. > ${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null > fi > > - if ! checkyesno tcp_keepalive; then > + if checkyesno tcp_keepalive; then > + ${SYSCTL_W} net.inet.tcp.always_keepalive=1 >/dev/null > + else > netoptions_init > - echo -n ' TCP keepalive=NO' > + echo -n ' TCP keepalive=${tcp_keepalive}' ^^^^^^^^^^^^^^^^ Here. > ${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null > fi > > if checkyesno tcp_drop_synfin; then > netoptions_init > - echo -n ' drop SYN+FIN packets=YES' > + echo -n ' drop SYN+FIN packets=${tcp_drop_synfin}' ^^^^^^^^^^^^^^^^^^ And here. These are *single* quotes, no parameter expansion can occur. I keep getting following in `dmesg -a' Additional TCP/IP options: drop SYN+FIN packets=${tcp_drop_synfin} . From rwatson at FreeBSD.org Fri Oct 2 21:31:16 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Fri Oct 2 21:31:22 2009 Subject: svn commit: r197720 - head/sys/kern Message-ID: <200910022131.n92LVFXO014114@svn.freebsd.org> Author: rwatson Date: Fri Oct 2 21:31:15 2009 New Revision: 197720 URL: http://svn.freebsd.org/changeset/base/197720 Log: Don't comment on stream socket handling in sosend_dgram, since that's not handled. MFC after: 3 weeks Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Fri Oct 2 20:19:53 2009 (r197719) +++ head/sys/kern/uipc_socket.c Fri Oct 2 21:31:15 2009 (r197720) @@ -970,9 +970,6 @@ sosend_dgram(struct socket *so, struct s * must use a signed comparison of space and resid. On the other * hand, a negative resid causes us to loop sending 0-length * segments to the protocol. - * - * Also check to make sure that MSG_EOR isn't used on SOCK_STREAM - * type sockets since that's an error. */ if (resid < 0) { error = EINVAL; From marcel at FreeBSD.org Fri Oct 2 22:30:45 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Fri Oct 2 22:30:52 2009 Subject: svn commit: r197721 - head/sys/dev/uart Message-ID: <200910022230.n92MUjZR015619@svn.freebsd.org> Author: marcel Date: Fri Oct 2 22:30:44 2009 New Revision: 197721 URL: http://svn.freebsd.org/changeset/base/197721 Log: Fix RTS/CTS flow control, broken by the TTY overhaul. The new TTY interface is fairly simple WRT dealing with flow control, but needed 2 new RX buffer functions with "get-char-from-buf" separated from "advance-buf-pointer" so that the pointer could be advanced only when ttydisc_rint() succeeded. MFC after: 1 week Modified: head/sys/dev/uart/uart_bus.h head/sys/dev/uart/uart_core.c head/sys/dev/uart/uart_tty.c Modified: head/sys/dev/uart/uart_bus.h ============================================================================== --- head/sys/dev/uart/uart_bus.h Fri Oct 2 21:31:15 2009 (r197720) +++ head/sys/dev/uart/uart_bus.h Fri Oct 2 22:30:44 2009 (r197721) @@ -96,6 +96,7 @@ struct uart_softc { int sc_opened:1; /* This UART is open for business. */ int sc_polled:1; /* This UART has no interrupts. */ int sc_txbusy:1; /* This UART is transmitting. */ + int sc_isquelch:1; /* This UART has input squelched. */ struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ @@ -141,6 +142,8 @@ int uart_bus_ipend(device_t dev); int uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan); int uart_bus_sysdev(device_t dev); +void uart_sched_softih(struct uart_softc *, uint32_t); + int uart_tty_attach(struct uart_softc *); int uart_tty_detach(struct uart_softc *); void uart_tty_intr(void *arg); @@ -175,6 +178,28 @@ uart_rx_get(struct uart_softc *sc) } static __inline int +uart_rx_next(struct uart_softc *sc) +{ + int ptr; + + ptr = sc->sc_rxget; + if (ptr == sc->sc_rxput) + return (-1); + ptr += 1; + sc->sc_rxget = (ptr < sc->sc_rxbufsz) ? ptr : 0; + return (0); +} + +static __inline int +uart_rx_peek(struct uart_softc *sc) +{ + int ptr; + + ptr = sc->sc_rxget; + return ((ptr == sc->sc_rxput) ? -1 : sc->sc_rxbuf[ptr]); +} + +static __inline int uart_rx_put(struct uart_softc *sc, int xc) { int ptr; Modified: head/sys/dev/uart/uart_core.c ============================================================================== --- head/sys/dev/uart/uart_core.c Fri Oct 2 21:31:15 2009 (r197720) +++ head/sys/dev/uart/uart_core.c Fri Oct 2 22:30:44 2009 (r197721) @@ -91,7 +91,7 @@ uart_getrange(struct uart_class *uc) * Schedule a soft interrupt. We do this on the 0 to !0 transition * of the TTY pending interrupt status. */ -static void +void uart_sched_softih(struct uart_softc *sc, uint32_t ipend) { uint32_t new, old; Modified: head/sys/dev/uart/uart_tty.c ============================================================================== --- head/sys/dev/uart/uart_tty.c Fri Oct 2 21:31:15 2009 (r197720) +++ head/sys/dev/uart/uart_tty.c Fri Oct 2 22:30:44 2009 (r197721) @@ -166,27 +166,6 @@ uart_tty_outwakeup(struct tty *tp) if (sc == NULL || sc->sc_leaving) return; - /* - * Handle input flow control. Note that if we have hardware support, - * we don't do anything here. We continue to receive until our buffer - * is full. At that time we cannot empty the UART itself and it will - * de-assert RTS for us. In that situation we're completely stuffed. - * Without hardware support, we need to toggle RTS ourselves. - */ - if ((tp->t_termios.c_cflag & CRTS_IFLOW) && !sc->sc_hwiflow) { -#if 0 - /*if ((tp->t_state & TS_TBLOCK) && - (sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS); - else */ if (/*!(tp->t_state & TS_TBLOCK) &&*/ - !(sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS|SER_RTS); -#endif - /* XXX: we should use inwakeup to implement this! */ - if (!(sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS|SER_RTS); - } - if (sc->sc_txbusy) return; @@ -195,6 +174,23 @@ uart_tty_outwakeup(struct tty *tp) UART_TRANSMIT(sc); } +static void +uart_tty_inwakeup(struct tty *tp) +{ + struct uart_softc *sc; + + sc = tty_softc(tp); + if (sc == NULL || sc->sc_leaving) + return; + + if (sc->sc_isquelch) { + if ((tp->t_termios.c_cflag & CRTS_IFLOW) && !sc->sc_hwiflow) + UART_SETSIG(sc, SER_DRTS|SER_RTS); + sc->sc_isquelch = 0; + uart_sched_softih(sc, SER_INT_RXREADY); + } +} + static int uart_tty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) { @@ -252,9 +248,9 @@ uart_tty_param(struct tty *tp, struct te UART_SETSIG(sc, SER_DDTR | SER_DTR); /* Set input flow control state. */ if (!sc->sc_hwiflow) { - /* if ((t->c_cflag & CRTS_IFLOW) && (tp->t_state & TS_TBLOCK)) + if ((t->c_cflag & CRTS_IFLOW) && sc->sc_isquelch) UART_SETSIG(sc, SER_DRTS); - else */ + else UART_SETSIG(sc, SER_DRTS | SER_RTS); } else UART_IOCTL(sc, UART_IOCTL_IFLOW, (t->c_cflag & CRTS_IFLOW)); @@ -294,8 +290,8 @@ uart_tty_intr(void *arg) tty_lock(tp); if (pend & SER_INT_RXREADY) { - while (!uart_rx_empty(sc) /* && !(tp->t_state & TS_TBLOCK)*/) { - xc = uart_rx_get(sc); + while (!uart_rx_empty(sc) && !sc->sc_isquelch) { + xc = uart_rx_peek(sc); c = xc & 0xff; if (xc & UART_STAT_FRAMERR) err |= TRE_FRAMING; @@ -303,7 +299,13 @@ uart_tty_intr(void *arg) err |= TRE_OVERRUN; if (xc & UART_STAT_PARERR) err |= TRE_PARITY; - ttydisc_rint(tp, c, err); + if (ttydisc_rint(tp, c, err) != 0) { + sc->sc_isquelch = 1; + if ((tp->t_termios.c_cflag & CRTS_IFLOW) && + !sc->sc_hwiflow) + UART_SETSIG(sc, SER_DRTS); + } else + uart_rx_next(sc); } } @@ -344,6 +346,7 @@ static struct ttydevsw uart_tty_class = .tsw_open = uart_tty_open, .tsw_close = uart_tty_close, .tsw_outwakeup = uart_tty_outwakeup, + .tsw_inwakeup = uart_tty_inwakeup, .tsw_ioctl = uart_tty_ioctl, .tsw_param = uart_tty_param, .tsw_modem = uart_tty_modem, From weongyo at FreeBSD.org Sat Oct 3 02:28:29 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Sat Oct 3 02:28:41 2009 Subject: svn commit: r197724 - head/share/man/man4 Message-ID: <200910030228.n932SSBs026599@svn.freebsd.org> Author: weongyo Date: Sat Oct 3 02:28:28 2009 New Revision: 197724 URL: http://svn.freebsd.org/changeset/base/197724 Log: TRENDnet TEW-424UB has multiple revisions so clarify zyd(4) man page and adds a device to urtw(4). The revision informations are as follows: rev A ZD1211 V2 SiS163U V2.1R SiS163U V3.xR RTL8187B and bump date. Obtained from: OpenBSD Reported by: Albert Shih Modified: head/share/man/man4/urtw.4 head/share/man/man4/zyd.4 Modified: head/share/man/man4/urtw.4 ============================================================================== --- head/share/man/man4/urtw.4 Fri Oct 2 23:48:42 2009 (r197723) +++ head/share/man/man4/urtw.4 Sat Oct 3 02:28:28 2009 (r197724) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2009 +.Dd October 2, 2009 .Dt URTW 4 .Os .Sh NAME @@ -73,6 +73,7 @@ driver supports Realtek RTL8187B/L based .It "Netgear WG111v2 RTL8225 USB" .It "Safehome WLG-1500SMA5 RTL8225 USB" .It "Shuttle XPC Accessory PN20 RTL8225 USB" +.It "TRENDnet TEW-424UB V3.xR RTL8225 USB" .El .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): Modified: head/share/man/man4/zyd.4 ============================================================================== --- head/share/man/man4/zyd.4 Fri Oct 2 23:48:42 2009 (r197723) +++ head/share/man/man4/zyd.4 Sat Oct 3 02:28:28 2009 (r197724) @@ -32,7 +32,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 1, 2008 +.Dd October 2, 2009 .Dt ZYD 4 .Os .Sh NAME @@ -113,7 +113,7 @@ driver: .It Sweex wireless USB 54 Mbps .It Tekram/Siemens USB adapter .It Telegent TG54USB -.It Trendnet TEW-424UB +.It Trendnet TEW-424UB rev A .It Trendnet TEW-429UB .It TwinMOS G240 .It Unicorn WL-54G From dougb at FreeBSD.org Sat Oct 3 02:37:22 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sat Oct 3 02:37:29 2009 Subject: svn commit: r197725 - head/usr.bin/whois Message-ID: <200910030237.n932bMnY026802@svn.freebsd.org> Author: dougb Date: Sat Oct 3 02:37:21 2009 New Revision: 197725 URL: http://svn.freebsd.org/changeset/base/197725 Log: The 6bone was decommissioned on 6/6/06, so remove references to it. Modified: head/usr.bin/whois/whois.1 head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.1 ============================================================================== --- head/usr.bin/whois/whois.1 Sat Oct 3 02:28:28 2009 (r197724) +++ head/usr.bin/whois/whois.1 Sat Oct 3 02:37:21 2009 (r197725) @@ -32,7 +32,7 @@ .\" From: @(#)whois.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd January 23, 2006 +.Dd October 2, 2009 .Dt WHOIS 1 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd "Internet domain name and network number directory service" .Sh SYNOPSIS .Nm -.Op Fl aAbdfgiIklmQrR6 +.Op Fl aAbdfgiIklmQrR .Op Fl c Ar country-code | Fl h Ar host .Op Fl p Ar port .Ar name ... @@ -212,17 +212,14 @@ This option is deprecated; use the option with an argument of .Qq Li RU instead. -.It Fl 6 -Use the IPv6 Resource Center -.Pq Tn 6bone -database. -It contains network names and addresses for the IPv6 network. -.El .Pp The operands specified to .Nm are treated independently and may be used as queries on different whois servers. +.El +.Sh EXIT STATUS +.Ex -std .Sh EXAMPLES Most types of data, such as domain names and .Tn IP @@ -255,15 +252,6 @@ but other .Tn TLDs can be queried by using a similar syntax.) .Pp -The following example demonstrates how to obtain information about an -.Tn IPv6 -address or hostname using the -.Fl 6 -option, which directs the query to -.Tn 6bone . -.Pp -.Dl "whois -6 IPv6-IP-Address" -.Pp The following example demonstrates how to query a whois server using a non-standard port, where .Dq Li query-data Modified: head/usr.bin/whois/whois.c ============================================================================== --- head/usr.bin/whois/whois.c Sat Oct 3 02:28:28 2009 (r197724) +++ head/usr.bin/whois/whois.c Sat Oct 3 02:37:21 2009 (r197725) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #define PNICHOST "whois.apnic.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" -#define SNICHOST "whois.6bone.net" #define BNICHOST "whois.registro.br" #define NORIDHOST "whois.norid.no" #define IANAHOST "whois.iana.org" @@ -164,8 +163,10 @@ main(int argc, char *argv[]) warnx("-R is deprecated; use '-c ru' instead"); country = "ru"; break; + /* Remove in FreeBSD 10 */ case '6': - host = SNICHOST; + errx(EX_USAGE, + "-6 is deprecated; use -[aAflr] instead"); break; case '?': default: From tom at tomjudge.com Sat Oct 3 04:27:25 2009 From: tom at tomjudge.com (Tom Judge) Date: Sat Oct 3 04:27:37 2009 Subject: svn commit: r197704 - in head/sys/arm: arm xscale In-Reply-To: <200910021110.n92BA5fu099181@svn.freebsd.org> References: <200910021110.n92BA5fu099181@svn.freebsd.org> Message-ID: <4AC6D283.2080706@tomjudge.com> Hi Rui, This broke the arm i80219 build. I hav attached a patch which fixes the build. Tom Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 2 11:10:05 2009 > New Revision: 197704 > URL: http://svn.freebsd.org/changeset/base/197704 > > Log: > Remove performance counter headers. This code came from NetBSD, but our > hardware perf. counter support is different, so we don't need these > files. > > Reviewed by: freebsd-arm (no comments) > > Deleted: > head/sys/arm/xscale/xscalereg.h > head/sys/arm/xscale/xscalevar.h > Modified: > head/sys/arm/arm/cpufunc.c > > -------------- next part -------------- Index: arm/cpufunc.c =================================================================== --- arm/cpufunc.c (revision 197725) +++ arm/cpufunc.c (working copy) @@ -1139,17 +1139,6 @@ if (cputype == CPU_ID_80321_400 || cputype == CPU_ID_80321_600 || cputype == CPU_ID_80321_400_B0 || cputype == CPU_ID_80321_600_B0 || cputype == CPU_ID_80219_400 || cputype == CPU_ID_80219_600) { - /* - * Reset the Performance Monitoring Unit to a - * pristine state: - * - CCNT, PMN0, PMN1 reset to 0 - * - overflow indications cleared - * - all counters disabled - */ - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" - : - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| - PMNC_CC_IF)); cpufuncs = xscale_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ Index: xscale/i80321/i80321_timer.c =================================================================== --- xscale/i80321/i80321_timer.c (revision 197725) +++ xscale/i80321/i80321_timer.c (working copy) @@ -66,7 +66,7 @@ definitions overrides the ones from i80321reg.h */ #endif -#include +//#include #include "opt_timer.h" From bz at FreeBSD.org Sat Oct 3 10:50:01 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 3 10:50:58 2009 Subject: svn commit: r197726 - head/sys/kern Message-ID: <200910031050.n93Ao0th038513@svn.freebsd.org> Author: bz Date: Sat Oct 3 10:50:00 2009 New Revision: 197726 URL: http://svn.freebsd.org/changeset/base/197726 Log: Print a warning in case we cannot add more brandinfo because we would overflow the MAX_BRANDS sized array. Reviewed by: kib MFC After: 1 month Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Oct 3 02:37:21 2009 (r197725) +++ head/sys/kern/imgact_elf.c Sat Oct 3 10:50:00 2009 (r197726) @@ -180,8 +180,11 @@ __elfN(insert_brand_entry)(Elf_Brandinfo break; } } - if (i == MAX_BRANDS) + if (i == MAX_BRANDS) { + printf("WARNING: %s: could not insert brandinfo entry: %p\n", + __func__, entry); return (-1); + } return (0); } From bz at FreeBSD.org Sat Oct 3 10:56:04 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 3 10:56:09 2009 Subject: svn commit: r197727 - head/sys/net Message-ID: <200910031056.n93Au3Zs038682@svn.freebsd.org> Author: bz Date: Sat Oct 3 10:56:03 2009 New Revision: 197727 URL: http://svn.freebsd.org/changeset/base/197727 Log: Put #ifdef INET around parts of the FLOWTABLE code, to unbreak nooptions INET kernel builds. MFC after: 3 days X-MFC: with r197687 Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sat Oct 3 10:50:00 2009 (r197726) +++ head/sys/net/route.c Sat Oct 3 10:56:03 2009 (r197727) @@ -1162,6 +1162,7 @@ rtrequest1_fib(int req, struct rt_addrin /* XXX * "flow-table" only support IPv4 at the moment. */ +#ifdef INET if (dst->sa_family == AF_INET) { rn = rnh->rnh_matchaddr(dst, rnh); if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { @@ -1203,6 +1204,7 @@ rtrequest1_fib(int req, struct rt_addrin } } #endif +#endif /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); @@ -1224,7 +1226,9 @@ rtrequest1_fib(int req, struct rt_addrin } #ifdef FLOWTABLE else if (rt0 != NULL) { +#ifdef INET flowtable_route_flush(V_ip_ft, rt0); +#endif RTFREE(rt0); } #endif From rpaulo at FreeBSD.org Sat Oct 3 11:02:37 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sat Oct 3 11:02:48 2009 Subject: svn commit: r197728 - head/etc Message-ID: <200910031102.n93B2arF038856@svn.freebsd.org> Author: rpaulo Date: Sat Oct 3 11:02:36 2009 New Revision: 197728 URL: http://svn.freebsd.org/changeset/base/197728 Log: Add OpenVPN IANA assigned port number. Modified: head/etc/services Modified: head/etc/services ============================================================================== --- head/etc/services Sat Oct 3 10:56:03 2009 (r197727) +++ head/etc/services Sat Oct 3 11:02:36 2009 (r197728) @@ -1521,6 +1521,8 @@ nfa 1155/tcp #Network File Access nfa 1155/udp #Network File Access phone 1167/udp #conference calling skkserv 1178/tcp #SKK (kanji input) +openvpn 1194/tcp #OpenVPN +openvpn 1194/udp #OpenVPN lupa 1212/tcp lupa 1212/udp nerv 1222/tcp #SNI R&D network From bz at FreeBSD.org Sat Oct 3 11:57:22 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 3 11:57:34 2009 Subject: svn commit: r197729 - in head/sys: amd64/amd64 arm/arm compat/ia32 i386/i386 ia64/ia64 mips/mips powerpc/powerpc sparc64/sparc64 Message-ID: <200910031157.n93BvLhS039965@svn.freebsd.org> Author: bz Date: Sat Oct 3 11:57:21 2009 New Revision: 197729 URL: http://svn.freebsd.org/changeset/base/197729 Log: Make sure that the primary native brandinfo always gets added first and the native ia32 compat as middle (before other things). o(ld)brandinfo as well as third party like linux, kfreebsd, etc. stays on SI_ORDER_ANY coming last. The reason for this is only to make sure that even in case we would overflow the MAX_BRANDS sized array, the native FreeBSD brandinfo would still be there and the system would be operational. Reviewed by: kib MFC after: 1 month Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/compat/ia32/ia32_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/ia64/ia64/elf_machdep.c head/sys/mips/mips/elf64_machdep.c head/sys/mips/mips/elf_machdep.c head/sys/powerpc/powerpc/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/amd64/amd64/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -89,7 +89,7 @@ static Elf64_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf64_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/arm/arm/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -88,7 +88,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/compat/ia32/ia32_sysvec.c Sat Oct 3 11:57:21 2009 (r197729) @@ -152,7 +152,7 @@ static Elf32_Brandinfo ia32_brand_info = .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_MIDDLE, (sysinit_cfunc_t) elf32_insert_brand_entry, &ia32_brand_info); Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/i386/i386/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -88,7 +88,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/ia64/ia64/elf_machdep.c ============================================================================== --- head/sys/ia64/ia64/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/ia64/ia64/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -95,7 +95,7 @@ static Elf64_Brandinfo freebsd_brand_inf .brand_note = &elf64_freebsd_brandnote, .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info); static Elf64_Brandinfo freebsd_brand_oinfo = { Modified: head/sys/mips/mips/elf64_machdep.c ============================================================================== --- head/sys/mips/mips/elf64_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/mips/mips/elf64_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -108,7 +108,7 @@ static Elf64_Brandinfo freebsd_brand_inf .flags = BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf64_insert_brand_entry, &freebsd_brand_info64); Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/mips/mips/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -90,7 +90,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/powerpc/powerpc/elf_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/powerpc/powerpc/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -91,7 +91,7 @@ static Elf32_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_info); Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Sat Oct 3 11:02:36 2009 (r197728) +++ head/sys/sparc64/sparc64/elf_machdep.c Sat Oct 3 11:57:21 2009 (r197729) @@ -103,7 +103,7 @@ static Elf64_Brandinfo freebsd_brand_inf .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t) elf64_insert_brand_entry, &freebsd_brand_info); From nyan at FreeBSD.org Sat Oct 3 12:22:13 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Sat Oct 3 12:22:19 2009 Subject: svn commit: r197730 - in head/sys: modules/nfslockd nlm Message-ID: <200910031222.n93CMDnp040558@svn.freebsd.org> Author: nyan Date: Sat Oct 3 12:22:12 2009 New Revision: 197730 URL: http://svn.freebsd.org/changeset/base/197730 Log: unifdef NFSCLIENT because the nlm depends on the nfsclient even if NFSCLIENT is not defined. Now the nfslockd module works with the nfsclient module. Reviewed by: kib MFC after: 3 days Modified: head/sys/modules/nfslockd/Makefile head/sys/nlm/nlm_prot_impl.c Modified: head/sys/modules/nfslockd/Makefile ============================================================================== --- head/sys/modules/nfslockd/Makefile Sat Oct 3 11:57:21 2009 (r197729) +++ head/sys/modules/nfslockd/Makefile Sat Oct 3 12:22:12 2009 (r197730) @@ -14,18 +14,12 @@ SRCS+= opt_inet6.h opt_nfs.h .if !defined(KERNBUILDDIR) NFS_INET6?= 1 # 0/1 - requires INET6 to be configured in kernel -NFSCLIENT?= 1 # 0/1 - requires NFSCLIENT to be configured in kernel .if ${NFS_INET6} > 0 opt_inet6.h: echo "#define INET6 1" > ${.TARGET} .endif -.if ${NFSCLIENT} > 0 -opt_nfs.h: - echo "#define NFSCLIENT 1" > ${.TARGET} -.endif - .endif .include Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Sat Oct 3 11:57:21 2009 (r197729) +++ head/sys/nlm/nlm_prot_impl.c Sat Oct 3 12:22:12 2009 (r197730) @@ -26,7 +26,6 @@ */ #include "opt_inet6.h" -#include "opt_nfs.h" #include __FBSDID("$FreeBSD$"); @@ -671,8 +670,6 @@ nlm_host_destroy(struct nlm_host *host) free(host, M_NLM); } -#ifdef NFSCLIENT - /* * Thread start callback for client lock recovery */ @@ -695,8 +692,6 @@ nlm_client_recovery_start(void *arg) kthread_exit(); } -#endif - /* * This is called when we receive a host state change notification. We * unlock any active locks owned by the host. When rpc.lockd is @@ -735,7 +730,6 @@ nlm_host_notify(struct nlm_host *host, i lf_clearremotesys(host->nh_sysid); host->nh_state = newstate; -#ifdef NFSCLIENT /* * If we have any remote locks for this host (i.e. it * represents a remote NFS server that our local NFS client @@ -750,7 +744,6 @@ nlm_host_notify(struct nlm_host *host, i kthread_add(nlm_client_recovery_start, host, curproc, &td, 0, 0, "NFS lock recovery for %s", host->nh_caller_name); } -#endif } /* @@ -1479,10 +1472,8 @@ nlm_server_main(int addr_count, char **a enum clnt_stat stat; struct nlm_host *host, *nhost; struct nlm_waiting_lock *nw; -#ifdef NFSCLIENT vop_advlock_t *old_nfs_advlock; vop_reclaim_t *old_nfs_reclaim; -#endif int v4_used; #ifdef INET6 int v6_used; @@ -1583,20 +1574,16 @@ nlm_server_main(int addr_count, char **a NLM_DEBUG(1, "NLM: local NSM state is %d\n", smstat.state); nlm_nsm_state = smstat.state; -#ifdef NFSCLIENT old_nfs_advlock = nfs_advlock_p; nfs_advlock_p = nlm_advlock; old_nfs_reclaim = nfs_reclaim_p; nfs_reclaim_p = nlm_reclaim; -#endif svc_run(pool); error = 0; -#ifdef NFSCLIENT nfs_advlock_p = old_nfs_advlock; nfs_reclaim_p = old_nfs_reclaim; -#endif out: if (pool) From rpaulo at FreeBSD.org Sat Oct 3 13:59:15 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sat Oct 3 13:59:27 2009 Subject: svn commit: r197733 - in head/sys/arm: arm xscale/i80321 Message-ID: <200910031359.n93DxFtm042595@svn.freebsd.org> Author: rpaulo Date: Sat Oct 3 13:59:15 2009 New Revision: 197733 URL: http://svn.freebsd.org/changeset/base/197733 Log: Remove remaining bits of performance counter support. Submitted by: Tom Judge Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/xscale/i80321/i80321_timer.c Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Sat Oct 3 13:17:21 2009 (r197732) +++ head/sys/arm/arm/cpufunc.c Sat Oct 3 13:59:15 2009 (r197733) @@ -1088,18 +1088,6 @@ set_cpufuncs() i80200_icu_init(); - /* - * Reset the Performance Monitoring Unit to a - * pristine state: - * - CCNT, PMN0, PMN1 reset to 0 - * - overflow indications cleared - * - all counters disabled - */ - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" - : - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| - PMNC_CC_IF)); - #if defined(XSCALE_CCLKCFG) /* * Crank CCLKCFG to maximum legal value. @@ -1139,18 +1127,6 @@ set_cpufuncs() if (cputype == CPU_ID_80321_400 || cputype == CPU_ID_80321_600 || cputype == CPU_ID_80321_400_B0 || cputype == CPU_ID_80321_600_B0 || cputype == CPU_ID_80219_400 || cputype == CPU_ID_80219_600) { - /* - * Reset the Performance Monitoring Unit to a - * pristine state: - * - CCNT, PMN0, PMN1 reset to 0 - * - overflow indications cleared - * - all counters disabled - */ - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" - : - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| - PMNC_CC_IF)); - cpufuncs = xscale_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ get_cachetype_cp15(); Modified: head/sys/arm/xscale/i80321/i80321_timer.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321_timer.c Sat Oct 3 13:17:21 2009 (r197732) +++ head/sys/arm/xscale/i80321/i80321_timer.c Sat Oct 3 13:59:15 2009 (r197733) @@ -66,8 +66,6 @@ __FBSDID("$FreeBSD$"); definitions overrides the ones from i80321reg.h */ #endif -#include - #include "opt_timer.h" void (*i80321_hardclock_hook)(void) = NULL; From rpaulo at gmail.com Sat Oct 3 13:59:25 2009 From: rpaulo at gmail.com (Rui Paulo) Date: Sat Oct 3 13:59:38 2009 Subject: svn commit: r197704 - in head/sys/arm: arm xscale In-Reply-To: <4AC6D283.2080706@tomjudge.com> References: <200910021110.n92BA5fu099181@svn.freebsd.org> <4AC6D283.2080706@tomjudge.com> Message-ID: Fixed, thanks. On 3 Oct 2009, at 05:26, Tom Judge wrote: > Hi Rui, > > This broke the arm i80219 build. > > I hav attached a patch which fixes the build. > > Tom > > Rui Paulo wrote: >> Author: rpaulo >> Date: Fri Oct 2 11:10:05 2009 >> New Revision: 197704 >> URL: http://svn.freebsd.org/changeset/base/197704 >> >> Log: >> Remove performance counter headers. This code came from NetBSD, >> but our >> hardware perf. counter support is different, so we don't need these >> files. >> Reviewed by: freebsd-arm (no comments) >> >> Deleted: >> head/sys/arm/xscale/xscalereg.h >> head/sys/arm/xscale/xscalevar.h >> Modified: >> head/sys/arm/arm/cpufunc.c >> >> > > Index: arm/cpufunc.c > =================================================================== > --- arm/cpufunc.c (revision 197725) > +++ arm/cpufunc.c (working copy) > @@ -1139,17 +1139,6 @@ > if (cputype == CPU_ID_80321_400 || cputype == CPU_ID_80321_600 || > cputype == CPU_ID_80321_400_B0 || cputype == > CPU_ID_80321_600_B0 || > cputype == CPU_ID_80219_400 || cputype == CPU_ID_80219_600) { > - /* > - * Reset the Performance Monitoring Unit to a > - * pristine state: > - * - CCNT, PMN0, PMN1 reset to 0 > - * - overflow indications cleared > - * - all counters disabled > - */ > - __asm __volatile("mcr p14, 0, %0, c0, c0, 0" > - : > - : "r" (PMNC_P|PMNC_C|PMNC_PMN0_IF|PMNC_PMN1_IF| > - PMNC_CC_IF)); > > cpufuncs = xscale_cpufuncs; > cpu_reset_needs_v4_MMU_disable = 1; /* XScale needs it */ > Index: xscale/i80321/i80321_timer.c > =================================================================== > --- xscale/i80321/i80321_timer.c (revision 197725) > +++ xscale/i80321/i80321_timer.c (working copy) > @@ -66,7 +66,7 @@ > definitions overrides the ones from i80321reg.h > */ > #endif > -#include > +//#include > > #include "opt_timer.h" > -- Rui Paulo From nyan at FreeBSD.org Sat Oct 3 14:38:22 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Sat Oct 3 14:43:14 2009 Subject: svn commit: r197734 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci pc98/conf Message-ID: <200910031438.n93EcMFE043460@svn.freebsd.org> Author: nyan Date: Sat Oct 3 14:38:22 2009 New Revision: 197734 URL: http://svn.freebsd.org/changeset/base/197734 Log: MFC: revision 197657 MFi386: revision 197653 Improve 802.11s comment. Approved by: re (bz) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/pc98/conf/GENERIC Modified: stable/8/sys/pc98/conf/GENERIC ============================================================================== --- stable/8/sys/pc98/conf/GENERIC Sat Oct 3 13:59:15 2009 (r197733) +++ stable/8/sys/pc98/conf/GENERIC Sat Oct 3 14:38:22 2009 (r197734) @@ -214,7 +214,7 @@ device xe # Xircom pccard Ethernet #device wlan # 802.11 support #options IEEE80211_DEBUG # enable debug msgs #options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -#options IEEE80211_SUPPORT_MESH # enable 802.11s D3.0 support +#options IEEE80211_SUPPORT_MESH # enable 802.11s draft support #device wlan_wep # 802.11 WEP support #device wlan_ccmp # 802.11 CCMP support #device wlan_tkip # 802.11 TKIP support From attilio at FreeBSD.org Sat Oct 3 15:02:55 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Sat Oct 3 15:03:01 2009 Subject: svn commit: r197735 - head/sys/kern Message-ID: <200910031502.n93F2tOp043967@svn.freebsd.org> Author: attilio Date: Sat Oct 3 15:02:55 2009 New Revision: 197735 URL: http://svn.freebsd.org/changeset/base/197735 Log: When releasing a lockmgr held in shared way we need to use a write memory barrier in order to avoid, on architectures which doesn't have strong ordered writes, CPU instructions reordering. Diagnosed by: fabio Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Sat Oct 3 14:38:22 2009 (r197734) +++ head/sys/kern/kern_lock.c Sat Oct 3 15:02:55 2009 (r197735) @@ -241,7 +241,7 @@ wakeupshlk(struct lock *lk, const char * * and return. */ if (LK_SHARERS(x) > 1) { - if (atomic_cmpset_ptr(&lk->lk_lock, x, + if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, x - LK_ONE_SHARER)) break; continue; @@ -254,7 +254,7 @@ wakeupshlk(struct lock *lk, const char * if ((x & LK_ALL_WAITERS) == 0) { MPASS((x & ~LK_EXCLUSIVE_SPINNERS) == LK_SHARERS_LOCK(1)); - if (atomic_cmpset_ptr(&lk->lk_lock, x, LK_UNLOCKED)) + if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, LK_UNLOCKED)) break; continue; } @@ -280,7 +280,7 @@ wakeupshlk(struct lock *lk, const char * queue = SQ_SHARED_QUEUE; } - if (!atomic_cmpset_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x, + if (!atomic_cmpset_rel_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x, v)) { sleepq_release(&lk->lock_object); continue; From nwhitehorn at FreeBSD.org Sat Oct 3 16:13:57 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sat Oct 3 16:14:09 2009 Subject: svn commit: r197736 - stable/6/lib/libthread_db/arch/alpha Message-ID: <200910031613.n93GDucb045406@svn.freebsd.org> Author: nwhitehorn Date: Sat Oct 3 16:13:56 2009 New Revision: 197736 URL: http://svn.freebsd.org/changeset/base/197736 Log: Fix world build on alpha, by adding an include now required but only added on other platforms. Note: this is not an MFC due to removal of alpha support in head. Modified: stable/6/lib/libthread_db/arch/alpha/libpthread_md.c Modified: stable/6/lib/libthread_db/arch/alpha/libpthread_md.c ============================================================================== --- stable/6/lib/libthread_db/arch/alpha/libpthread_md.c Sat Oct 3 15:02:55 2009 (r197735) +++ stable/6/lib/libthread_db/arch/alpha/libpthread_md.c Sat Oct 3 16:13:56 2009 (r197736) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include "libpthread_db.h" From delphij at FreeBSD.org Sun Oct 4 09:07:30 2009 From: delphij at FreeBSD.org (Xin LI) Date: Sun Oct 4 09:07:42 2009 Subject: svn commit: r197738 - in stable/8/sys: . cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910040907.n9497UuL068278@svn.freebsd.org> Author: delphij Date: Sun Oct 4 09:07:29 2009 New Revision: 197738 URL: http://svn.freebsd.org/changeset/base/197738 Log: MFC revision 197683: Return EOPNOTSUPP instead of EINVAL when doing chflags(2) over an old format ZFS, as defined in the manual page. Submitted by: pjd (response of my original patch but bugs are mine) Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Oct 3 17:49:44 2009 (r197737) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Oct 4 09:07:29 2009 (r197738) @@ -4172,8 +4172,12 @@ zfs_freebsd_setattr(ap) zflags = VTOZ(vp)->z_phys->zp_flags; if (vap->va_flags != VNOVAL) { + zfsvfs_t *zfsvfs = VTOZ(vp)->z_zfsvfs; int error; + if (zfsvfs->z_use_fuids == B_FALSE) + return (EOPNOTSUPP); + fflags = vap->va_flags; if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) return (EOPNOTSUPP); From delphij at FreeBSD.org Sun Oct 4 09:57:40 2009 From: delphij at FreeBSD.org (Xin LI) Date: Sun Oct 4 09:57:46 2009 Subject: svn commit: r197739 - in stable/8/sys: amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci Message-ID: <200910040957.n949veVx069457@svn.freebsd.org> Author: delphij Date: Sun Oct 4 09:57:39 2009 New Revision: 197739 URL: http://svn.freebsd.org/changeset/base/197739 Log: This commit adds subdirectory mergeinfo which was intentionally ommitted from previous changeset. Requested by: kib Approved by: re (kib) Modified: stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) From delphij at FreeBSD.org Sun Oct 4 10:38:05 2009 From: delphij at FreeBSD.org (Xin LI) Date: Sun Oct 4 10:38:16 2009 Subject: svn commit: r197740 - head/sys/fs/tmpfs Message-ID: <200910041038.n94Ac5U7070347@svn.freebsd.org> Author: delphij Date: Sun Oct 4 10:38:04 2009 New Revision: 197740 URL: http://svn.freebsd.org/changeset/base/197740 Log: Fix a bug that causes the fsx test case of mmap'ed page being out of sync of read/write, inspired by ZFS's counterpart. PR: kern/139312 Submitted by: gk@ MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 4 09:57:39 2009 (r197739) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 4 10:38:04 2009 (r197740) @@ -444,7 +444,8 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob offset = addr & PAGE_MASK; tlen = MIN(PAGE_SIZE - offset, len); - if ((vobj == NULL) || (vobj->resident_page_count == 0)) + if ((vobj == NULL) || + (vobj->resident_page_count == 0 && vobj->cache == NULL)) goto nocache; VM_OBJECT_LOCK(vobj); @@ -555,7 +556,8 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o offset = addr & PAGE_MASK; tlen = MIN(PAGE_SIZE - offset, len); - if ((vobj == NULL) || (vobj->resident_page_count == 0)) { + if ((vobj == NULL) || + (vobj->resident_page_count == 0 && vobj->cache == NULL)) { vpg = NULL; goto nocache; } @@ -573,6 +575,8 @@ lookupvpg: VM_OBJECT_UNLOCK(vobj); error = uiomove_fromphys(&vpg, offset, tlen, uio); } else { + if (__predict_false(vobj->cache != NULL)) + vm_page_cache_free(vobj, idx, idx + 1); VM_OBJECT_UNLOCK(vobj); vpg = NULL; } From rpaulo at FreeBSD.org Sun Oct 4 10:54:20 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sun Oct 4 10:54:34 2009 Subject: svn commit: r197741 - head/lib/libpmc Message-ID: <200910041054.n94AsKTI071707@svn.freebsd.org> Author: rpaulo Date: Sun Oct 4 10:54:20 2009 New Revision: 197741 URL: http://svn.freebsd.org/changeset/base/197741 Log: Install x86 related man pages on x86 systems only. Reviewed by: jkoshy Modified: head/lib/libpmc/Makefile Modified: head/lib/libpmc/Makefile ============================================================================== --- head/lib/libpmc/Makefile Sun Oct 4 10:38:04 2009 (r197740) +++ head/lib/libpmc/Makefile Sun Oct 4 10:54:20 2009 (r197741) @@ -24,6 +24,7 @@ MAN+= pmc_start.3 MAN+= pmclog.3 # PMC-dependent manual pages +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" MAN+= pmc.atom.3 MAN+= pmc.core.3 MAN+= pmc.core2.3 @@ -34,6 +35,7 @@ MAN+= pmc.p4.3 MAN+= pmc.p5.3 MAN+= pmc.p6.3 MAN+= pmc.tsc.3 +.endif MLINKS+= \ pmc_allocate.3 pmc_release.3 \ From kib at FreeBSD.org Sun Oct 4 12:11:45 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 4 12:11:51 2009 Subject: svn commit: r197742 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern Message-ID: <200910041211.n94CBiNF073358@svn.freebsd.org> Author: kib Date: Sun Oct 4 12:11:44 2009 New Revision: 197742 URL: http://svn.freebsd.org/changeset/base/197742 Log: MFC r197660: Fix typo. Approved by: re (bz, kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/kern_sig.c Modified: stable/8/sys/kern/kern_sig.c ============================================================================== --- stable/8/sys/kern/kern_sig.c Sun Oct 4 10:54:20 2009 (r197741) +++ stable/8/sys/kern/kern_sig.c Sun Oct 4 12:11:44 2009 (r197742) @@ -1888,7 +1888,7 @@ sigtd(struct proc *p, int sig, int prop) /* * Check if current thread can handle the signal without - * switching conetxt to another thread. + * switching context to another thread. */ if (curproc == p && !SIGISMEMBER(curthread->td_sigmask, sig)) return (curthread); From kib at FreeBSD.org Sun Oct 4 12:14:49 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 4 12:14:56 2009 Subject: svn commit: r197743 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci vm Message-ID: <200910041214.n94CEnMA073466@svn.freebsd.org> Author: kib Date: Sun Oct 4 12:14:49 2009 New Revision: 197743 URL: http://svn.freebsd.org/changeset/base/197743 Log: MFC r197661: Move the annotation for vm_map_startup() immediately before the function. Approved by: re (bz, kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/vm/vm_map.c Modified: stable/8/sys/vm/vm_map.c ============================================================================== --- stable/8/sys/vm/vm_map.c Sun Oct 4 12:11:44 2009 (r197742) +++ stable/8/sys/vm/vm_map.c Sun Oct 4 12:14:49 2009 (r197743) @@ -116,22 +116,6 @@ __FBSDID("$FreeBSD$"); * another, and then marking both regions as copy-on-write. */ -/* - * vm_map_startup: - * - * Initialize the vm_map module. Must be called before - * any other vm_map routines. - * - * Map and entry structures are allocated from the general - * purpose memory pool with some exceptions: - * - * - The kernel map and kmem submap are allocated statically. - * - Kernel map entries are allocated out of a static pool. - * - * These restrictions are necessary since malloc() uses the - * maps and requires map entries. - */ - static struct mtx map_sleep_mtx; static uma_zone_t mapentzone; static uma_zone_t kmapentzone; @@ -176,6 +160,22 @@ static void vmspace_zdtor(void *mem, int start = end; \ } +/* + * vm_map_startup: + * + * Initialize the vm_map module. Must be called before + * any other vm_map routines. + * + * Map and entry structures are allocated from the general + * purpose memory pool with some exceptions: + * + * - The kernel map and kmem submap are allocated statically. + * - Kernel map entries are allocated out of a static pool. + * + * These restrictions are necessary since malloc() uses the + * maps and requires map entries. + */ + void vm_map_startup(void) { From kib at FreeBSD.org Sun Oct 4 12:21:00 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 4 12:21:14 2009 Subject: svn commit: r197744 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 Message-ID: <200910041220.n94CKxTH073639@svn.freebsd.org> Author: kib Date: Sun Oct 4 12:20:59 2009 New Revision: 197744 URL: http://svn.freebsd.org/changeset/base/197744 Log: MFC r197663: As a workaround, for Intel CPUs, do not use CLFLUSH in pmap_invalidate_cache_range() when self-snoop is apparently not reported in cpu features. Approved by: re (bz, kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/amd64/initcpu.c stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/i386/i386/initcpu.c Modified: stable/8/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/8/sys/amd64/amd64/initcpu.c Sun Oct 4 12:14:49 2009 (r197743) +++ stable/8/sys/amd64/amd64/initcpu.c Sun Oct 4 12:20:59 2009 (r197744) @@ -165,4 +165,10 @@ initializecpu(void) */ if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; + /* + * XXXKIB: (temporary) hack to work around traps generated when + * CLFLUSHing APIC registers window. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + cpu_feature &= ~CPUID_CLFSH; } Modified: stable/8/sys/i386/i386/initcpu.c ============================================================================== --- stable/8/sys/i386/i386/initcpu.c Sun Oct 4 12:14:49 2009 (r197743) +++ stable/8/sys/i386/i386/initcpu.c Sun Oct 4 12:20:59 2009 (r197744) @@ -717,6 +717,12 @@ initializecpu(void) */ if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; + /* + * XXXKIB: (temporary) hack to work around traps generated when + * CLFLUSHing APIC registers window. + */ + if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + cpu_feature &= ~CPUID_CLFSH; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) /* From kib at FreeBSD.org Sun Oct 4 13:00:28 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 4 13:00:34 2009 Subject: svn commit: r197745 - in stable/7/sys: . contrib/pf kern Message-ID: <200910041300.n94D0Rfj074540@svn.freebsd.org> Author: kib Date: Sun Oct 4 13:00:27 2009 New Revision: 197745 URL: http://svn.freebsd.org/changeset/base/197745 Log: MFC r197660: Fix typo. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_sig.c Modified: stable/7/sys/kern/kern_sig.c ============================================================================== --- stable/7/sys/kern/kern_sig.c Sun Oct 4 12:20:59 2009 (r197744) +++ stable/7/sys/kern/kern_sig.c Sun Oct 4 13:00:27 2009 (r197745) @@ -1953,7 +1953,7 @@ sigtd(struct proc *p, int sig, int prop) /* * Check if current thread can handle the signal without - * switching conetxt to another thread. + * switching context to another thread. */ if (curproc == p && !SIGISMEMBER(curthread->td_sigmask, sig)) return (curthread); From kib at FreeBSD.org Sun Oct 4 13:03:08 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 4 13:03:19 2009 Subject: svn commit: r197746 - in stable/7/sys: . contrib/pf vm Message-ID: <200910041303.n94D37MK074647@svn.freebsd.org> Author: kib Date: Sun Oct 4 13:03:07 2009 New Revision: 197746 URL: http://svn.freebsd.org/changeset/base/197746 Log: MFC r197661: Move the annotation for vm_map_startup() immediately before the function. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/vm/vm_map.c Modified: stable/7/sys/vm/vm_map.c ============================================================================== --- stable/7/sys/vm/vm_map.c Sun Oct 4 13:00:27 2009 (r197745) +++ stable/7/sys/vm/vm_map.c Sun Oct 4 13:03:07 2009 (r197746) @@ -115,22 +115,6 @@ __FBSDID("$FreeBSD$"); * another, and then marking both regions as copy-on-write. */ -/* - * vm_map_startup: - * - * Initialize the vm_map module. Must be called before - * any other vm_map routines. - * - * Map and entry structures are allocated from the general - * purpose memory pool with some exceptions: - * - * - The kernel map and kmem submap are allocated statically. - * - Kernel map entries are allocated out of a static pool. - * - * These restrictions are necessary since malloc() uses the - * maps and requires map entries. - */ - static struct mtx map_sleep_mtx; static uma_zone_t mapentzone; static uma_zone_t kmapentzone; @@ -171,6 +155,22 @@ static void vmspace_zdtor(void *mem, int start = end; \ } +/* + * vm_map_startup: + * + * Initialize the vm_map module. Must be called before + * any other vm_map routines. + * + * Map and entry structures are allocated from the general + * purpose memory pool with some exceptions: + * + * - The kernel map and kmem submap are allocated statically. + * - Kernel map entries are allocated out of a static pool. + * + * These restrictions are necessary since malloc() uses the + * maps and requires map entries. + */ + void vm_map_startup(void) { From michio.jinbo at gmail.com Sun Oct 4 16:20:42 2009 From: michio.jinbo at gmail.com (Michio "Karl" Jinbo) Date: Sun Oct 4 16:20:54 2009 Subject: svn commit: r197744 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 In-Reply-To: <200910041220.n94CKxTH073639@svn.freebsd.org> References: <200910041220.n94CKxTH073639@svn.freebsd.org> Message-ID: <20091005004923.4086.22FF24F1@gmail.com> On Sun, 4 Oct 2009 12:20:59 +0000 (UTC) Konstantin Belousov wrote: > Log: > MFC r197663: > As a workaround, for Intel CPUs, do not use CLFLUSH in > pmap_invalidate_cache_range() when self-snoop is apparently not reported > in cpu features. > > Approved by: re (bz, kensmith) I was tested r197663/r197744, but kernel panic again on Citrix Xen Server. using 8.0-RC1 install cd, results are 1. INTEL SU9400+HYPER-V(Windows2008 R2) -> boot OK. 2. AMD Athlon X2 TK-55+HYPER-V(Windows2008 R2) -> boot NG. 3. AMD PhenomII 940BK+Citrix Xen Server -> boot NG. I think INTEL CPUs are no problem, but AMD CPUs appear the problem. So I tested the following patch, kernel boot was successed on recent 9-CURRENT and environment 3. sorry, poor English. --- sys/i386/i386/initcpu.c.original 2009-10-01 21:52:48.000000000 +0900 +++ sys/i386/i386/initcpu.c 2009-10-05 08:29:45.000000000 +0900 @@ -721,7 +721,7 @@ * XXXKIB: (temporary) hack to work around traps generated when * CLFLUSHing APIC registers window. */ - if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + if (cpu_vendor_id == CPU_VENDOR_AMD && !(cpu_feature & CPUID_SS)) cpu_feature &= ~CPUID_CLFSH; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) -- Michio Jinbo From simon at FreeBSD.org Sun Oct 4 16:30:34 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Sun Oct 4 16:30:45 2009 Subject: svn commit: r197747 - head/release/doc/share/misc Message-ID: <200910041630.n94GUXIn079213@svn.freebsd.org> Author: simon Date: Sun Oct 4 16:30:33 2009 New Revision: 197747 URL: http://svn.freebsd.org/changeset/base/197747 Log: In lists, if there is a Li command remove it. This fixes markup for uath(4). MFC after: 3 days Reported by: Warren Block Modified: head/release/doc/share/misc/man2hwnotes.pl Modified: head/release/doc/share/misc/man2hwnotes.pl ============================================================================== --- head/release/doc/share/misc/man2hwnotes.pl Sun Oct 4 13:03:07 2009 (r197746) +++ head/release/doc/share/misc/man2hwnotes.pl Sun Oct 4 16:30:33 2009 (r197747) @@ -252,6 +252,10 @@ sub parse { $txt =~ s/ Ta /\t/g; $txt =~ s/([^\t]+)\t.*/$1/; } + + # Remove Li commands + $txt =~ s/^Li //g; + parabuf_addline(\%mdocvars, normalize($txt)); } elsif (/^Bl/) { $mdocvars{isin_list} = 1; From jilles at FreeBSD.org Sun Oct 4 17:16:12 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Sun Oct 4 17:16:18 2009 Subject: svn commit: r197748 - stable/7/bin/sh Message-ID: <200910041716.n94HGBGk080191@svn.freebsd.org> Author: jilles Date: Sun Oct 4 17:16:11 2009 New Revision: 197748 URL: http://svn.freebsd.org/changeset/base/197748 Log: MFC r197371: Mention that NUL characters are not allowed in sh(1) input. I do not consider this a bug because POSIX permits it and argument strings and environment variables cannot contain '\0' anyway. PR: bin/25542 Modified: stable/7/bin/sh/ (props changed) stable/7/bin/sh/sh.1 Modified: stable/7/bin/sh/sh.1 ============================================================================== --- stable/7/bin/sh/sh.1 Sun Oct 4 16:30:33 2009 (r197747) +++ stable/7/bin/sh/sh.1 Sun Oct 4 17:16:11 2009 (r197748) @@ -375,6 +375,10 @@ introduces a comment if used at the begi The word starting with .Ql # and the rest of the line are ignored. +.Pp +.Tn ASCII +.Dv NUL +characters (character code 0) are not allowed in shell input. .Ss Quoting Quoting is used to remove the special meaning of certain characters or words to the shell, such as operators, whitespace, keywords, From jilles at FreeBSD.org Sun Oct 4 17:22:52 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Sun Oct 4 17:22:58 2009 Subject: svn commit: r197749 - stable/7/usr.bin/find Message-ID: <200910041722.n94HMpq7080378@svn.freebsd.org> Author: jilles Date: Sun Oct 4 17:22:51 2009 New Revision: 197749 URL: http://svn.freebsd.org/changeset/base/197749 Log: MFC r197363: Update find(1) man page for -L/-delete interaction. It is a bit unfortunate that the example to delete broken symlinks now uses rm(1), but allowing this with -delete would require fixing fts(3) to not imply FTS_NOCHDIR if FTS_LOGICAL is given (or hacks in the -delete option). PR: bin/90687 Modified: stable/7/usr.bin/find/ (props changed) stable/7/usr.bin/find/find.1 Modified: stable/7/usr.bin/find/find.1 ============================================================================== --- stable/7/usr.bin/find/find.1 Sun Oct 4 17:16:11 2009 (r197748) +++ stable/7/usr.bin/find/find.1 Sun Oct 4 17:22:51 2009 (r197749) @@ -306,6 +306,7 @@ character in its pathname relative to .Dq Pa \&. for security reasons. Depth-first traversal processing is implied by this option. +Following symlinks is incompatible with this option. .It Ic -depth Always true; same as the @@ -843,7 +844,7 @@ recent than the current time minus one m Use the .Xr echo 1 command to print out a list of all the files. -.It Li "find -L /usr/ports/packages -type l -delete" +.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +" Delete all broken symbolic links in .Pa /usr/ports/packages . .It Li "find /usr/src -name CVS -prune -o -depth +6 -print" From alc at FreeBSD.org Sun Oct 4 18:53:10 2009 From: alc at FreeBSD.org (Alan Cox) Date: Sun Oct 4 18:53:17 2009 Subject: svn commit: r197750 - head/sys/vm Message-ID: <200910041853.n94IrAf7082338@svn.freebsd.org> Author: alc Date: Sun Oct 4 18:53:10 2009 New Revision: 197750 URL: http://svn.freebsd.org/changeset/base/197750 Log: Align and pad the page queue and free page queue locks so that the linker can't possibly place them together within the same cache line. MFC after: 3 weeks Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); */ struct vpgqueues vm_page_queues[PQ_COUNT]; -struct mtx vm_page_queue_mtx; -struct mtx vm_page_queue_free_mtx; +struct vpglocks vm_page_queue_lock; +struct vpglocks vm_page_queue_free_lock; vm_page_t vm_page_array = 0; int vm_page_array_size = 0; Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sun Oct 4 17:22:51 2009 (r197749) +++ head/sys/vm/vm_page.h Sun Oct 4 18:53:10 2009 (r197750) @@ -170,7 +170,15 @@ struct vpgqueues { }; extern struct vpgqueues vm_page_queues[PQ_COUNT]; -extern struct mtx vm_page_queue_free_mtx; + +struct vpglocks { + struct mtx data; + char pad[CACHE_LINE_SIZE - sizeof(struct mtx)]; +} __aligned(CACHE_LINE_SIZE); + +extern struct vpglocks vm_page_queue_free_lock; + +#define vm_page_queue_free_mtx vm_page_queue_free_lock.data /* * These are the flags defined for vm_page. @@ -258,7 +266,9 @@ PHYS_TO_VM_PAGE(vm_paddr_t pa) #endif } -extern struct mtx vm_page_queue_mtx; +extern struct vpglocks vm_page_queue_lock; + +#define vm_page_queue_mtx vm_page_queue_lock.data #define vm_page_lock_queues() mtx_lock(&vm_page_queue_mtx) #define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx) From thompsa at FreeBSD.org Sun Oct 4 19:03:33 2009 From: thompsa at FreeBSD.org (Andrew Thompson) Date: Sun Oct 4 19:03:50 2009 Subject: svn commit: r197751 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb/controller dev/xen/xenpci Message-ID: <200910041903.n94J3Wq8082685@svn.freebsd.org> Author: thompsa Date: Sun Oct 4 19:03:32 2009 New Revision: 197751 URL: http://svn.freebsd.org/changeset/base/197751 Log: MFC r197682 EHCI Hardware BUG workaround The EHCI HW can use the qtd_next field instead of qtd_altnext when a short packet is received. This contradicts what is stated in the EHCI datasheet. Also the total-bytes field in the status field of the following TD gets corrupted upon reception of a short packet! We work this around in software by not queueing more than one job/TD at a time of up to 16Kbytes! The bug has been seen on multiple INTEL based EHCI chips. Other vendors have not been tested yet. - Applications using /dev/usb/X.Y.Z, where Z is non-zero are affected, but not applications using LibUSB v0.1, v1.2 and v2.0. - Mass Storage (umass) is affected. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Sun Oct 4 18:53:10 2009 (r197750) +++ stable/8/sys/dev/usb/controller/ehci.c Sun Oct 4 19:03:32 2009 (r197751) @@ -131,6 +131,7 @@ struct ehci_std_temp { uint8_t auto_data_toggle; uint8_t setup_alt_next; uint8_t last_frame; + uint8_t can_use_next; }; void @@ -1207,11 +1208,6 @@ ehci_non_isoc_done_sub(struct usb_xfer * xfer->td_transfer_cache = td; - /* update data toggle */ - - xfer->endpoint->toggle_next = - (status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0; - #if USB_DEBUG if (status & EHCI_QTD_STATERRS) { DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x" @@ -1235,6 +1231,9 @@ ehci_non_isoc_done_sub(struct usb_xfer * static void ehci_non_isoc_done(struct usb_xfer *xfer) { + ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); + ehci_qh_t *qh; + uint32_t status; usb_error_t err = 0; DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n", @@ -1248,6 +1247,17 @@ ehci_non_isoc_done(struct usb_xfer *xfer } #endif + /* extract data toggle directly from the QH's overlay area */ + + qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; + + usb_pc_cpu_invalidate(qh->page_cache); + + status = hc32toh(sc, qh->qh_qtd.qtd_status); + + xfer->endpoint->toggle_next = + (status & EHCI_QTD_TOGGLE_MASK) ? 1 : 0; + /* reset scanner */ xfer->td_transfer_cache = xfer->td_transfer_first; @@ -1348,6 +1358,7 @@ ehci_check_transfer(struct usb_xfer *xfe } } else { ehci_qtd_t *td; + ehci_qh_t *qh; /* non-isochronous transfer */ @@ -1357,16 +1368,35 @@ ehci_check_transfer(struct usb_xfer *xfe */ td = xfer->td_transfer_cache; + qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; + + usb_pc_cpu_invalidate(qh->page_cache); + + status = hc32toh(sc, qh->qh_qtd.qtd_status); + if (status & EHCI_QTD_ACTIVE) { + /* transfer is pending */ + goto done; + } + while (1) { usb_pc_cpu_invalidate(td->page_cache); status = hc32toh(sc, td->qtd_status); /* - * if there is an active TD the transfer isn't done + * Check if there is an active TD which + * indicates that the transfer isn't done. */ if (status & EHCI_QTD_ACTIVE) { /* update cache */ - xfer->td_transfer_cache = td; + if (xfer->td_transfer_cache != td) { + xfer->td_transfer_cache = td; + if (qh->qh_qtd.qtd_next & + htohc32(sc, EHCI_LINK_TERMINATE)) { + /* XXX - manually advance to next frame */ + qh->qh_qtd.qtd_next = td->qtd_self; + usb_pc_cpu_flush(td->page_cache); + } + } goto done; } /* @@ -1545,7 +1575,6 @@ ehci_setup_standard_chain_sub(struct ehc ehci_qtd_t *td; ehci_qtd_t *td_next; ehci_qtd_t *td_alt_next; - uint32_t qtd_altnext; uint32_t buf_offset; uint32_t average; uint32_t len_old; @@ -1554,7 +1583,6 @@ ehci_setup_standard_chain_sub(struct ehc uint8_t precompute; terminate = htohc32(temp->sc, EHCI_LINK_TERMINATE); - qtd_altnext = terminate; td_alt_next = NULL; buf_offset = 0; shortpkt_old = temp->shortpkt; @@ -1612,7 +1640,8 @@ restart: td->qtd_status = temp->qtd_status | - htohc32(temp->sc, EHCI_QTD_SET_BYTES(average)); + htohc32(temp->sc, EHCI_QTD_IOC | + EHCI_QTD_SET_BYTES(average)); if (average == 0) { @@ -1687,11 +1716,23 @@ restart: td->qtd_buffer_hi[x] = 0; } - if (td_next) { - /* link the current TD with the next one */ - td->qtd_next = td_next->qtd_self; + if (temp->can_use_next) { + if (td_next) { + /* link the current TD with the next one */ + td->qtd_next = td_next->qtd_self; + } + } else { + /* + * BUG WARNING: The EHCI HW can use the + * qtd_next field instead of qtd_altnext when + * a short packet is received! We work this + * around in software by not queueing more + * than one job/TD at a time! + */ + td->qtd_next = terminate; } - td->qtd_altnext = qtd_altnext; + + td->qtd_altnext = terminate; td->alt_next = td_alt_next; usb_pc_cpu_flush(td->page_cache); @@ -1703,15 +1744,9 @@ restart: /* setup alt next pointer, if any */ if (temp->last_frame) { td_alt_next = NULL; - qtd_altnext = terminate; } else { /* we use this field internally */ td_alt_next = td_next; - if (temp->setup_alt_next) { - qtd_altnext = td_next->qtd_self; - } else { - qtd_altnext = terminate; - } } /* restore */ @@ -1756,6 +1791,8 @@ ehci_setup_standard_chain(struct usb_xfe temp.qtd_status = 0; temp.last_frame = 0; temp.setup_alt_next = xfer->flags_int.short_frames_ok; + temp.can_use_next = (xfer->flags_int.control_xfr || + (UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT)); if (xfer->flags_int.control_xfr) { if (xfer->endpoint->toggle_next) { @@ -1889,7 +1926,6 @@ ehci_setup_standard_chain(struct usb_xfe /* the last TD terminates the transfer: */ td->qtd_next = htohc32(temp.sc, EHCI_LINK_TERMINATE); td->qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE); - td->qtd_status |= htohc32(temp.sc, EHCI_QTD_IOC); usb_pc_cpu_flush(td->page_cache); From das at FreeBSD.org Sun Oct 4 19:43:38 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Oct 4 19:43:49 2009 Subject: svn commit: r197752 - head/lib/libc/stdio Message-ID: <200910041943.n94JhaDg083487@svn.freebsd.org> Author: das Date: Sun Oct 4 19:43:36 2009 New Revision: 197752 URL: http://svn.freebsd.org/changeset/base/197752 Log: Better glibc compatibility for getline/getdelim: - Tolerate applications that pass a NULL pointer for the buffer and claim that the capacity of the buffer is nonzero. - If an application passes in a non-NULL buffer pointer and claims the buffer has zero capacity, we should free (well, realloc) it anyway. It could have been obtained from malloc(0), so failing to free it would be a small memory leak. MFC After: 2 weeks Reported by: naddy PR: ports/138320 Modified: head/lib/libc/stdio/getdelim.c Modified: head/lib/libc/stdio/getdelim.c ============================================================================== --- head/lib/libc/stdio/getdelim.c Sun Oct 4 19:03:32 2009 (r197751) +++ head/lib/libc/stdio/getdelim.c Sun Oct 4 19:43:36 2009 (r197752) @@ -120,8 +120,8 @@ getdelim(char ** __restrict linep, size_ goto error; } - if (*linecapp == 0) - *linep = NULL; + if (*linep == NULL) + *linecapp = 0; if (fp->_r <= 0 && __srefill(fp)) { /* If fp is at EOF already, we just need space for the NUL. */ From das at FreeBSD.org Sun Oct 4 19:44:42 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Oct 4 19:44:48 2009 Subject: svn commit: r197753 - head/tools/regression/lib/libc/stdio Message-ID: <200910041944.n94JifN8083557@svn.freebsd.org> Author: das Date: Sun Oct 4 19:44:41 2009 New Revision: 197753 URL: http://svn.freebsd.org/changeset/base/197753 Log: Regression tests for r197752 (handling of empty/NULL buffers). Modified: head/tools/regression/lib/libc/stdio/test-getdelim.c Modified: head/tools/regression/lib/libc/stdio/test-getdelim.c ============================================================================== --- head/tools/regression/lib/libc/stdio/test-getdelim.c Sun Oct 4 19:43:36 2009 (r197752) +++ head/tools/regression/lib/libc/stdio/test-getdelim.c Sun Oct 4 19:44:41 2009 (r197753) @@ -80,7 +80,7 @@ main(int argc, char *argv[]) srandom(0); - printf("1..5\n"); + printf("1..6\n"); /* * Test multiple times with different buffer sizes @@ -103,6 +103,7 @@ main(int argc, char *argv[]) assert(getline(&line, &linecap, fp) == -1); assert(line[0] == '\0'); free(line); + line = NULL; assert(feof(fp)); assert(!ferror(fp)); fclose(fp); @@ -164,5 +165,23 @@ main(int argc, char *argv[]) fclose(fp); printf("ok 5 - nul\n"); + /* Make sure NULL *linep and zero *linecapp are handled. */ + fp = mkfilebuf(); + free(line); + line = NULL; + linecap = 42; + assert(getline(&line, &linecap, fp) == sizeof(apothegm) - 1); + assert(memcmp(line, apothegm, sizeof(apothegm)) == 0); + fp = mkfilebuf(); + free(line); + line = malloc(100); + linecap = 0; + assert(getline(&line, &linecap, fp) == sizeof(apothegm) - 1); + assert(memcmp(line, apothegm, sizeof(apothegm)) == 0); + free(line); + assert(!ferror(fp)); + fclose(fp); + printf("ok 6 - empty/NULL initial buffer\n"); + exit(0); } From marcus at FreeBSD.org Sun Oct 4 21:46:44 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Sun Oct 4 21:47:01 2009 Subject: svn commit: r197758 - stable/8/lib/libc/gen Message-ID: <200910042146.n94LkiAH086317@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Sun Oct 4 21:46:43 2009 New Revision: 197758 URL: http://svn.freebsd.org/changeset/base/197758 Log: MFC: rev. 197681 Correct the pthread stub prototype for pthread_mutexattr_settype to allow for the type argument. This is known to fix some pthread_mutexattr_settype() invocations, especially when it comes to pulseaudio. Approved by: re (kib) Modified: stable/8/lib/libc/gen/_pthread_stubs.c Modified: stable/8/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/8/lib/libc/gen/_pthread_stubs.c Sun Oct 4 21:22:19 2009 (r197757) +++ stable/8/lib/libc/gen/_pthread_stubs.c Sun Oct 4 21:46:43 2009 (r197758) @@ -222,7 +222,7 @@ STUB_FUNC1(pthread_mutex_trylock, PJT_MU STUB_FUNC1(pthread_mutex_unlock, PJT_MUTEX_UNLOCK, int, void *) STUB_FUNC1(pthread_mutexattr_destroy, PJT_MUTEXATTR_DESTROY, int, void *) STUB_FUNC1(pthread_mutexattr_init, PJT_MUTEXATTR_INIT, int, void *) -STUB_FUNC1(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *) +STUB_FUNC2(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *, int) STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *) STUB_FUNC1(pthread_rwlock_destroy, PJT_RWLOCK_DESTROY, int, void *) STUB_FUNC2(pthread_rwlock_init, PJT_RWLOCK_INIT, int, void *, void *) From marcus at FreeBSD.org Sun Oct 4 21:48:17 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Sun Oct 4 21:48:29 2009 Subject: svn commit: r197759 - stable/7/lib/libc/gen Message-ID: <200910042148.n94LmHCD086389@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Sun Oct 4 21:48:17 2009 New Revision: 197759 URL: http://svn.freebsd.org/changeset/base/197759 Log: MFC: rev. 197681 Correct the pthread stub prototype for pthread_mutexattr_settype to allow for the type argument. This is known to fix some pthread_mutexattr_settype() invocations, especially when it comes to pulseaudio. Approved by: kib Modified: stable/7/lib/libc/gen/_pthread_stubs.c Modified: stable/7/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/7/lib/libc/gen/_pthread_stubs.c Sun Oct 4 21:46:43 2009 (r197758) +++ stable/7/lib/libc/gen/_pthread_stubs.c Sun Oct 4 21:48:17 2009 (r197759) @@ -222,7 +222,7 @@ STUB_FUNC1(pthread_mutex_trylock, PJT_MU STUB_FUNC1(pthread_mutex_unlock, PJT_MUTEX_UNLOCK, int, void *) STUB_FUNC1(pthread_mutexattr_destroy, PJT_MUTEXATTR_DESTROY, int, void *) STUB_FUNC1(pthread_mutexattr_init, PJT_MUTEXATTR_INIT, int, void *) -STUB_FUNC1(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *) +STUB_FUNC2(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *, int) STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *) STUB_FUNC1(pthread_rwlock_destroy, PJT_RWLOCK_DESTROY, int, void *) STUB_FUNC2(pthread_rwlock_init, PJT_RWLOCK_INIT, int, void *, void *) From marcus at FreeBSD.org Sun Oct 4 21:50:30 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Sun Oct 4 21:50:42 2009 Subject: svn commit: r197760 - stable/6/lib/libc/gen Message-ID: <200910042150.n94LoUtM086489@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Sun Oct 4 21:50:29 2009 New Revision: 197760 URL: http://svn.freebsd.org/changeset/base/197760 Log: MFC: rev. 197681 Correct the pthread stub prototype for pthread_mutexattr_settype to allow for the type argument. This is known to fix some pthread_mutexattr_settype() invocations, especially when it comes to pulseaudio. Approved by: kib Modified: stable/6/lib/libc/gen/_pthread_stubs.c Modified: stable/6/lib/libc/gen/_pthread_stubs.c ============================================================================== --- stable/6/lib/libc/gen/_pthread_stubs.c Sun Oct 4 21:48:17 2009 (r197759) +++ stable/6/lib/libc/gen/_pthread_stubs.c Sun Oct 4 21:50:29 2009 (r197760) @@ -188,7 +188,7 @@ STUB_FUNC1(pthread_mutex_trylock, PJT_MU STUB_FUNC1(pthread_mutex_unlock, PJT_MUTEX_UNLOCK, int, void *) STUB_FUNC1(pthread_mutexattr_destroy, PJT_MUTEXATTR_DESTROY, int, void *) STUB_FUNC1(pthread_mutexattr_init, PJT_MUTEXATTR_INIT, int, void *) -STUB_FUNC1(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *) +STUB_FUNC2(pthread_mutexattr_settype, PJT_MUTEXATTR_SETTYPE, int, void *, int) STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *) STUB_FUNC1(pthread_rwlock_destroy, PJT_RWLOCK_DESTROY, int, void *) STUB_FUNC2(pthread_rwlock_init, PJT_RWLOCK_INIT, int, void *, void *) From weongyo at FreeBSD.org Sun Oct 4 23:30:08 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Sun Oct 4 23:30:15 2009 Subject: svn commit: r197761 - in head/sys/dev/usb: . wlan Message-ID: <200910042330.n94NU8sr088627@svn.freebsd.org> Author: weongyo Date: Sun Oct 4 23:30:08 2009 New Revision: 197761 URL: http://svn.freebsd.org/changeset/base/197761 Log: updates device entries supported with the product name not magic numbers and sorts entries. WUSB54GCV2 is added. Obtained from: OpenBSD Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Oct 4 21:50:29 2009 (r197760) +++ head/sys/dev/usb/usbdevs Sun Oct 4 23:30:08 2009 (r197761) @@ -908,6 +908,7 @@ product ASIX AX88772 0x7720 AX88772 product ASUS WL167G 0x1707 WL-167g Wireless Adapter product ASUS WL159G 0x170c WL-159g product ASUS A9T_WIFI 0x171b A9T wireless +product ASUS P5B_WIFI 0x171d P5B wireless product ASUS RT2573_1 0x1723 RT2573 product ASUS RT2573_2 0x1724 RT2573 product ASUS LCM 0x1726 LCM display @@ -975,6 +976,7 @@ product BELKIN F5D7051 0x7051 F5D7051 5 product BELKIN F5D7050A 0x705a F5D7050A Wireless Adapter /* Also sold as 'Ativa 802.11g wireless card' */ product BELKIN F5D7050_V4000 0x705c F5D7050 v4000 Wireless Adapter +product BELKIN F5D7050E 0x705e F5D7050E Wireless Adapter product BELKIN F5D9050V3 0x905b F5D9050 ver 3 Wireless Adapter product BELKIN2 F5U002 0x0002 F5U002 Parallel printer @@ -1656,6 +1658,7 @@ product LINKSYS2 WUSB11 0x2219 WUSB11 W product LINKSYS2 USB200M 0x2226 USB 2.0 10/100 Ethernet product LINKSYS3 WUSB11v28 0x2233 WUSB11 v2.8 Wireless Adapter product LINKSYS4 USB1000 0x0039 USB1000 +product LINKSYS4 WUSB54GCV2 0x0073 WUSB54GC v2 /* Logitech products */ product LOGITECH M2452 0x0203 M2452 keyboard @@ -1876,6 +1879,7 @@ product NETGEAR EA101X 0x1002 Ethernet product NETGEAR FA101 0x1020 Ethernet 10/100, USB1.1 product NETGEAR FA120 0x1040 USB 2.0 Ethernet product NETGEAR WG111V2_2 0x4240 PrismGT USB 2.0 WLAN +product NETGEAR WG111V3 0x4260 WG111v3 product NETGEAR WG111U 0x4300 WG111U product NETGEAR WG111U_NF 0x4301 WG111U (no firmware) product NETGEAR WG111V2 0x6a00 WG111V2 @@ -2101,6 +2105,9 @@ product RALINK RT2573_2 0x9021 RT2501US /* Green House and CompUSA OEM this part */ product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL8187 0x8187 RTL8187 Wireless Adapter +product REALTEK RTL8187B_0 0x8189 RTL8187B Wireless Adapter +product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter +product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter /* Ricoh products */ product RICOH VGPVCC2 0x1830 VGP-VCC2 Camera @@ -2270,6 +2277,8 @@ product SITECOM SERIAL 0x2068 USB to se product SITECOM2 WL022 0x182d WL-022 /* Sitecom Europe products */ +product SITECOMEU WL168V1 0x000d WL-168 v1 +product SITECOMEU WL168V4 0x0028 WL-168 v4 product SITECOMEU LN028 0x061c LN-028 product SITECOMEU WL113 0x9071 WL-113 product SITECOMEU ZD1211B 0x9075 ZD1211B @@ -2375,6 +2384,7 @@ product DIAMOND2 RIO600USB 0x5001 Rio 60 product DIAMOND2 RIO800USB 0x5002 Rio 800 USB /* Surecom Technology products */ +product SURECOM EP9001G2A 0x11f2 EP-9001-G rev 2A product SURECOM RT2570 0x11f3 RT2570 product SURECOM RT2573 0x31f3 RT2573 Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Sun Oct 4 21:50:29 2009 (r197760) +++ head/sys/dev/usb/wlan/if_urtw.c Sun Oct 4 23:30:08 2009 (r197761) @@ -102,23 +102,24 @@ TUNABLE_INT("hw.usb.urtw.preamble_mode", #define URTW_REV_RTL8187B 0 #define URTW_REV_RTL8187L 1 static const struct usb_device_id urtw_devs[] = { - { USB_VPI(USB_VENDOR_BELKIN, 0x705e, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8189, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8197, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_REALTEK, 0x8198, URTW_REV_RTL8187B) }, - { USB_VPI(USB_VENDOR_NETGEAR, 0x4260, URTW_REV_RTL8187B) }, + URTW_DEV_B(NETGEAR, WG111V3), + URTW_DEV_B(REALTEK, RTL8187B_0), + URTW_DEV_B(REALTEK, RTL8187B_1), + URTW_DEV_B(REALTEK, RTL8187B_2), + URTW_DEV_B(SITECOMEU, WL168V4), + URTW_DEV_L(ASUS, P5B_WIFI), + URTW_DEV_L(BELKIN, F5D7050E), + URTW_DEV_L(LINKSYS4, WUSB54GCV2), + URTW_DEV_L(NETGEAR, WG111V2), + URTW_DEV_L(REALTEK, RTL8187), + URTW_DEV_L(SITECOMEU, WL168V1), + URTW_DEV_L(SURECOM, EP9001G2A), { USB_VPI(0x1b75, 0x8187, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_ASUS, 0x171d, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_DICKSMITH, 0x9401, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_HP, 0xca02, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_LOGITEC, 0x010c, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_NETGEAR, 0x6100, URTW_REV_RTL8187L) }, - URTW_DEV_L(NETGEAR, WG111V2), - URTW_DEV_L(REALTEK, RTL8187), - { USB_VPI(USB_VENDOR_SITECOMEU, 0x000d, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_SITECOMEU, 0x0028, URTW_REV_RTL8187B) }, { USB_VPI(USB_VENDOR_SPHAIRON, 0x0150, URTW_REV_RTL8187L) }, - { USB_VPI(USB_VENDOR_SURECOM, 0x11f2, URTW_REV_RTL8187L) }, { USB_VPI(USB_VENDOR_QCOM, 0x6232, URTW_REV_RTL8187L) }, #undef URTW_DEV_L #undef URTW_DEV_B From mjacob at FreeBSD.org Mon Oct 5 01:31:16 2009 From: mjacob at FreeBSD.org (Matt Jacob) Date: Mon Oct 5 01:31:23 2009 Subject: svn commit: r197763 - head/sbin/growfs Message-ID: <200910050131.n951VGW9091208@svn.freebsd.org> Author: mjacob Date: Mon Oct 5 01:31:16 2009 New Revision: 197763 URL: http://svn.freebsd.org/changeset/base/197763 Log: The cylinder group tag cg_initediblk needs to match the number of inodes actually initialized. In the growfs case for UFS2, no inodes were actually being initialized and the number of inodes noted as initialized was the number of inodes per group. This created a filesystem that was deemed corrupted because the inodes thus added were full of garbage. MFC after: 1 month Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Mon Oct 5 00:28:47 2009 (r197762) +++ head/sbin/growfs/growfs.c Mon Oct 5 01:31:16 2009 (r197763) @@ -397,11 +397,17 @@ initcg(int cylno, time_t utime, int fso, dupper += howmany(sblock.fs_cssize, sblock.fs_fsize); cs = &fscs[cylno]; memset(&acg, 0, sblock.fs_cgsize); + /* + * Note that we do not set cg_initediblk at all. + * In this extension of a previous filesystem + * we have no inodes initialized for the cylinder + * group at all. The first access to that cylinder + * group will do the correct initialization. + */ acg.cg_time = utime; acg.cg_magic = CG_MAGIC; acg.cg_cgx = cylno; acg.cg_niblk = sblock.fs_ipg; - acg.cg_initediblk = sblock.fs_ipg; acg.cg_ndblk = dmax - cbase; if (sblock.fs_contigsumsize > 0) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; @@ -414,7 +420,6 @@ initcg(int cylno, time_t utime, int fso, acg.cg_time = 0; acg.cg_old_niblk = acg.cg_niblk; acg.cg_niblk = 0; - acg.cg_initediblk = 0; acg.cg_old_btotoff = start; acg.cg_old_boff = acg.cg_old_btotoff + sblock.fs_old_cpg * sizeof(int32_t); @@ -2217,6 +2222,7 @@ main(int argc, char **argv) printf("Warning: %jd sector(s) cannot be allocated.\n", (intmax_t)fsbtodb(&sblock, sblock.fs_size % sblock.fs_fpg)); sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg; + maxino -= sblock.fs_ipg; } /* From edwin at FreeBSD.org Mon Oct 5 07:11:20 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Mon Oct 5 07:11:26 2009 Subject: svn commit: r197764 - in head: include usr.bin/locale Message-ID: <200910050711.n957BJnS003574@svn.freebsd.org> Author: edwin Date: Mon Oct 5 07:11:19 2009 New Revision: 197764 URL: http://svn.freebsd.org/changeset/base/197764 Log: Modified locale(1) to be able to show the altmon_X fields and the [cxX]_fmt's. Also modify the "-k list" option to display only fields with a certain prefix. MFC after: 1 week Modified: head/include/langinfo.h head/usr.bin/locale/locale.1 head/usr.bin/locale/locale.c Modified: head/include/langinfo.h ============================================================================== --- head/include/langinfo.h Mon Oct 5 01:31:16 2009 (r197763) +++ head/include/langinfo.h Mon Oct 5 07:11:19 2009 (r197764) @@ -114,6 +114,20 @@ typedef __nl_item nl_item; #define D_MD_ORDER 57 /* month/day order (local extension) */ #endif +/* standalone months forms for %OB */ +#define ALTMON_1 58 +#define ALTMON_2 59 +#define ALTMON_3 60 +#define ALTMON_4 61 +#define ALTMON_5 62 +#define ALTMON_6 63 +#define ALTMON_7 64 +#define ALTMON_8 65 +#define ALTMON_9 66 +#define ALTMON_10 67 +#define ALTMON_11 68 +#define ALTMON_12 69 + __BEGIN_DECLS char *nl_langinfo(nl_item); __END_DECLS Modified: head/usr.bin/locale/locale.1 ============================================================================== --- head/usr.bin/locale/locale.1 Mon Oct 5 01:31:16 2009 (r197763) +++ head/usr.bin/locale/locale.1 Mon Oct 5 07:11:19 2009 (r197764) @@ -35,8 +35,12 @@ .Nm .Op Fl a | m .Nm -.Op Fl ck -.Op Ar keyword ... +.Fl k +.Ic list +.Op Ar prefix +.Nm +.Op Fl ck +.Ar keyword ... .Sh DESCRIPTION The .Nm @@ -79,6 +83,8 @@ The special specific) keyword .Cm list can be used to retrieve the human readable list of all available keywords. +If so, +a prefix string can be defined to limit the amount of keywords returned. .Sh EXIT STATUS .Ex -std .Sh SEE ALSO Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Mon Oct 5 01:31:16 2009 (r197763) +++ head/usr.bin/locale/locale.c Mon Oct 5 07:11:19 2009 (r197764) @@ -55,7 +55,7 @@ const char *lookup_localecat(int); char *kwval_lconv(int); int kwval_lookup(char *, char **, int *, int *); void showdetails(char *); -void showkeywordslist(void); +void showkeywordslist(char *substring); void showlocale(void); void usage(void); @@ -149,6 +149,9 @@ struct _kwinfo { { "d_t_fmt", 1, LC_TIME, D_T_FMT, "" }, { "d_fmt", 1, LC_TIME, D_FMT, "" }, { "t_fmt", 1, LC_TIME, T_FMT, "" }, + { "c_fmt", 1, LC_TIME, C_FMT, "" }, + { "x_fmt", 1, LC_TIME, X_FMT, "" }, + { "X_fmt", 1, LC_TIME, CAPITALX_FMT, "" }, { "am_str", 1, LC_TIME, AM_STR, "" }, { "pm_str", 1, LC_TIME, PM_STR, "" }, { "t_fmt_ampm", 1, LC_TIME, T_FMT_AMPM, "" }, @@ -190,6 +193,18 @@ struct _kwinfo { { "abmon_10", 1, LC_TIME, ABMON_10, "" }, { "abmon_11", 1, LC_TIME, ABMON_11, "" }, { "abmon_12", 1, LC_TIME, ABMON_12, "" }, + { "altmon_1", 1, LC_TIME, ALTMON_1, "" }, + { "altmon_2", 1, LC_TIME, ALTMON_2, "" }, + { "altmon_3", 1, LC_TIME, ALTMON_3, "" }, + { "altmon_4", 1, LC_TIME, ALTMON_4, "" }, + { "altmon_5", 1, LC_TIME, ALTMON_5, "" }, + { "altmon_6", 1, LC_TIME, ALTMON_6, "" }, + { "altmon_7", 1, LC_TIME, ALTMON_7, "" }, + { "altmon_8", 1, LC_TIME, ALTMON_8, "" }, + { "altmon_9", 1, LC_TIME, ALTMON_9, "" }, + { "altmon_10", 1, LC_TIME, ALTMON_10, "" }, + { "altmon_11", 1, LC_TIME, ALTMON_11, "" }, + { "altmon_12", 1, LC_TIME, ALTMON_12, "" }, { "era", 1, LC_TIME, ERA, "(unavailable)" }, { "era_d_fmt", 1, LC_TIME, ERA_D_FMT, "(unavailable)" }, { "era_d_t_fmt", 1, LC_TIME, ERA_D_T_FMT, "(unavailable)" }, @@ -217,7 +232,7 @@ main(int argc, char *argv[]) int ch; int tmp; - while ((ch = getopt(argc, argv, "ackm")) != -1) { + while ((ch = getopt(argc, argv, "ackms:")) != -1) { switch (ch) { case 'a': all_locales = 1; @@ -265,7 +280,7 @@ main(int argc, char *argv[]) if (prt_keywords && argc > 0) while (tmp < argc) if (strcasecmp(argv[tmp++], "list") == 0) { - showkeywordslist(); + showkeywordslist(argv[tmp]); exit(0); } @@ -290,7 +305,8 @@ void usage(void) { printf("Usage: locale [ -a | -m ]\n" - " locale [ -ck ] name ...\n"); + " locale -k list [prefix]\n" + " locale [ -ck ] keyword ...\n"); exit(1); } @@ -594,6 +610,7 @@ showdetails(char *kw) * invalid keyword specified. * XXX: any actions? */ + fprintf(stderr, "Unknown keyword: `%s'\n", kw); return; } @@ -639,16 +656,25 @@ lookup_localecat(int cat) * Show list of keywords */ void -showkeywordslist(void) +showkeywordslist(char *substring) { size_t i; #define FMT "%-20s %-12s %-7s %-20s\n" - printf("List of available keywords\n\n"); + if (substring == NULL) + printf("List of available keywords\n\n"); + else + printf("List of available keywords starting with '%s'\n\n", + substring); printf(FMT, "Keyword", "Category", "Type", "Comment"); printf("-------------------- ------------ ------- --------------------\n"); for (i = 0; i < NKWINFO; i++) { + if (substring != NULL) { + if (strncmp(kwinfo[i].name, substring, + strlen(substring)) != 0) + continue; + } printf(FMT, kwinfo[i].name, lookup_localecat(kwinfo[i].catid), From edwin at FreeBSD.org Mon Oct 5 07:13:16 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Mon Oct 5 07:13:27 2009 Subject: svn commit: r197765 - head/lib/libc/locale Message-ID: <200910050713.n957DGvV003647@svn.freebsd.org> Author: edwin Date: Mon Oct 5 07:13:15 2009 New Revision: 197765 URL: http://svn.freebsd.org/changeset/base/197765 Log: Modified locale(1) to be able to show the altmon_X fields and the [cxX]_fmt's. Also modify the "-k list" option to display only fields with a certain prefix. MFC after: 1 week Modified: head/lib/libc/locale/nl_langinfo.c Modified: head/lib/libc/locale/nl_langinfo.c ============================================================================== --- head/lib/libc/locale/nl_langinfo.c Mon Oct 5 07:11:19 2009 (r197764) +++ head/lib/libc/locale/nl_langinfo.c Mon Oct 5 07:13:15 2009 (r197765) @@ -93,6 +93,12 @@ nl_langinfo(nl_item item) case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12: ret = (char*) __get_current_time_locale()->mon[_REL(ABMON_1)]; break; + case ALTMON_1: case ALTMON_2: case ALTMON_3: case ALTMON_4: + case ALTMON_5: case ALTMON_6: case ALTMON_7: case ALTMON_8: + case ALTMON_9: case ALTMON_10: case ALTMON_11: case ALTMON_12: + ret = (char*) + __get_current_time_locale()->alt_month[_REL(ALTMON_1)]; + break; case ERA: /* XXX: need to be implemented */ ret = ""; From edwin at FreeBSD.org Mon Oct 5 07:21:22 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Mon Oct 5 07:21:28 2009 Subject: svn commit: r197766 - head/usr.bin/locale Message-ID: <200910050721.n957LMcB003847@svn.freebsd.org> Author: edwin Date: Mon Oct 5 07:21:21 2009 New Revision: 197766 URL: http://svn.freebsd.org/changeset/base/197766 Log: Backout changes for c_fmt, x_fmt and X_fmt, they were coming from the wrong patches. Apologies. Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Mon Oct 5 07:13:15 2009 (r197765) +++ head/usr.bin/locale/locale.c Mon Oct 5 07:21:21 2009 (r197766) @@ -149,9 +149,6 @@ struct _kwinfo { { "d_t_fmt", 1, LC_TIME, D_T_FMT, "" }, { "d_fmt", 1, LC_TIME, D_FMT, "" }, { "t_fmt", 1, LC_TIME, T_FMT, "" }, - { "c_fmt", 1, LC_TIME, C_FMT, "" }, - { "x_fmt", 1, LC_TIME, X_FMT, "" }, - { "X_fmt", 1, LC_TIME, CAPITALX_FMT, "" }, { "am_str", 1, LC_TIME, AM_STR, "" }, { "pm_str", 1, LC_TIME, PM_STR, "" }, { "t_fmt_ampm", 1, LC_TIME, T_FMT_AMPM, "" }, From lulf at FreeBSD.org Mon Oct 5 08:44:32 2009 From: lulf at FreeBSD.org (Ulf Lilleengen) Date: Mon Oct 5 08:44:40 2009 Subject: svn commit: r197767 - head/sys/geom/vinum Message-ID: <200910050844.n958iVWv005562@svn.freebsd.org> Author: lulf Date: Mon Oct 5 08:44:31 2009 New Revision: 197767 URL: http://svn.freebsd.org/changeset/base/197767 Log: - Improve error message consistency and wording. Modified: head/sys/geom/vinum/geom_vinum_create.c head/sys/geom/vinum/geom_vinum_events.c head/sys/geom/vinum/geom_vinum_init.c head/sys/geom/vinum/geom_vinum_move.c head/sys/geom/vinum/geom_vinum_rm.c head/sys/geom/vinum/geom_vinum_subr.c Modified: head/sys/geom/vinum/geom_vinum_create.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_create.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_create.c Mon Oct 5 08:44:31 2009 (r197767) @@ -94,7 +94,7 @@ gv_create_drive(struct gv_softc *sc, str if (g_attach(cp, pp) != 0) { g_destroy_consumer(cp); g_topology_unlock(); - G_VINUM_DEBUG(0, "create drive '%s': couldn't attach", + G_VINUM_DEBUG(0, "create drive '%s': unable to attach", d->name); g_free(d); return (GV_ERR_CREATE); @@ -135,7 +135,7 @@ gv_create_drive(struct gv_softc *sc, str g_detach(cp); g_destroy_consumer(cp); g_topology_unlock(); - G_VINUM_DEBUG(0, "create drive '%s': couldn't update " + G_VINUM_DEBUG(0, "create drive '%s': unable to update " "access counts", d->name); if (d->hdr != NULL) g_free(d->hdr); @@ -320,7 +320,7 @@ gv_concat(struct g_geom *gp, struct gctl dcount = 0; vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume names not given"); + gctl_error(req, "volume name not given"); return; } @@ -388,7 +388,7 @@ gv_mirror(struct g_geom *gp, struct gctl pcount = 0; vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume's not given"); + gctl_error(req, "volume name not given"); return; } @@ -396,7 +396,7 @@ gv_mirror(struct g_geom *gp, struct gctl drives = gctl_get_paraml(req, "drives", sizeof(*drives)); if (drives == NULL) { - gctl_error(req, "drives not given"); + gctl_error(req, "drive names not given"); return; } @@ -480,7 +480,7 @@ gv_raid5(struct g_geom *gp, struct gctl_ vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume's not given"); + gctl_error(req, "volume name not given"); return; } flags = gctl_get_paraml(req, "flags", sizeof(*flags)); @@ -493,7 +493,7 @@ gv_raid5(struct g_geom *gp, struct gctl_ } if (drives == NULL) { - gctl_error(req, "drives not given"); + gctl_error(req, "drive names not given"); return; } @@ -558,14 +558,14 @@ gv_stripe(struct g_geom *gp, struct gctl pcount = 0; vol = gctl_get_param(req, "name", NULL); if (vol == NULL) { - gctl_error(req, "volume's not given"); + gctl_error(req, "volume name not given"); return; } flags = gctl_get_paraml(req, "flags", sizeof(*flags)); drives = gctl_get_paraml(req, "drives", sizeof(*drives)); if (drives == NULL) { - gctl_error(req, "drives not given"); + gctl_error(req, "drive names not given"); return; } Modified: head/sys/geom/vinum/geom_vinum_events.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_events.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_events.c Mon Oct 5 08:44:31 2009 (r197767) @@ -193,7 +193,7 @@ gv_drive_lost(struct gv_softc *sc, struc if (cp != NULL) { if (cp->nstart != cp->nend) { G_VINUM_DEBUG(0, "dead drive '%s' has still active " - "requests, can't detach consumer", d->name); + "requests, unable to detach consumer", d->name); gv_post_event(sc, GV_EVENT_DRIVE_LOST, d, NULL, 0, 0); return; } Modified: head/sys/geom/vinum/geom_vinum_init.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_init.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_init.c Mon Oct 5 08:44:31 2009 (r197767) @@ -87,7 +87,7 @@ gv_start_obj(struct g_geom *gp, struct g case GV_TYPE_SD: case GV_TYPE_DRIVE: /* XXX Not implemented, but what is the use? */ - gctl_error(req, "cannot start '%s' - not yet supported", + gctl_error(req, "unable to start '%s' - not yet supported", argv); return; default: @@ -279,8 +279,8 @@ gv_rebuild_plex(struct gv_plex *p) LIST_FOREACH(s, &p->subdisks, in_plex) { d = s->drive_sc; if (d == NULL || (d->flags & GV_DRIVE_REFERENCED)) { - G_VINUM_DEBUG(0, "can't rebuild %s, subdisk(s) have no " - "drives", p->name); + G_VINUM_DEBUG(0, "unable to rebuild %s, subdisk(s) have" + " no drives", p->name); return (ENXIO); } } Modified: head/sys/geom/vinum/geom_vinum_move.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_move.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_move.c Mon Oct 5 08:44:31 2009 (r197767) @@ -84,7 +84,7 @@ gv_move(struct g_geom *gp, struct gctl_r type = gv_object_type(sc, object); if (type != GV_TYPE_SD) { gctl_error(req, "you can only move subdisks; " - "'%s' isn't one", object); + "'%s' is not a subdisk", object); return; } @@ -145,7 +145,7 @@ gv_move_sd(struct gv_softc *sc, struct g err = gv_set_sd_state(cursd, GV_SD_STALE, GV_SETSTATE_FORCE | GV_SETSTATE_CONFIG); if (err) { - G_VINUM_DEBUG(0, "could not set the subdisk '%s' to state " + G_VINUM_DEBUG(0, "unable to set the subdisk '%s' to state " "'stale'", cursd->name); return (err); } Modified: head/sys/geom/vinum/geom_vinum_rm.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_rm.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_rm.c Mon Oct 5 08:44:31 2009 (r197767) @@ -207,7 +207,7 @@ gv_rm_vol(struct gv_softc *sc, struct gv /* Check if any of our consumers is open. */ if (gv_provider_is_open(pp)) { - G_VINUM_DEBUG(0, "Unable to remove %s: volume still in use", + G_VINUM_DEBUG(0, "unable to remove %s: volume still in use", v->name); return; } @@ -241,7 +241,7 @@ gv_rm_plex(struct gv_softc *sc, struct g /* Check if any of our consumers is open. */ if (v != NULL && gv_provider_is_open(v->provider) && v->plexcount < 2) { - G_VINUM_DEBUG(0, "Unable to remove %s: volume still in use", + G_VINUM_DEBUG(0, "unable to remove %s: volume still in use", p->name); return; } @@ -318,7 +318,7 @@ gv_rm_drive(struct gv_softc *sc, struct g_topology_unlock(); if (err) { - G_VINUM_DEBUG(0, "%s: couldn't access '%s', " + G_VINUM_DEBUG(0, "%s: unable to access '%s', " "errno: %d", __func__, cp->provider->name, err); return; } @@ -327,7 +327,7 @@ gv_rm_drive(struct gv_softc *sc, struct d->hdr->magic = GV_NOMAGIC; err = gv_write_header(cp, d->hdr); if (err) - G_VINUM_DEBUG(0, "gv_rm_drive: couldn't write header to" + G_VINUM_DEBUG(0, "gv_rm_drive: error writing header to" " '%s', errno: %d", cp->provider->name, err); g_topology_lock(); Modified: head/sys/geom/vinum/geom_vinum_subr.c ============================================================================== --- head/sys/geom/vinum/geom_vinum_subr.c Mon Oct 5 07:21:21 2009 (r197766) +++ head/sys/geom/vinum/geom_vinum_subr.c Mon Oct 5 08:44:31 2009 (r197767) @@ -585,7 +585,7 @@ gv_sd_to_drive(struct gv_sd *s, struct g return (0); } } else { - G_VINUM_DEBUG(0, "can't give sd '%s' to '%s' " + G_VINUM_DEBUG(0, "error giving subdisk '%s' to '%s' " "(already on '%s')", s->name, d->name, s->drive_sc->name); return (GV_ERR_ISATTACHED); @@ -612,7 +612,7 @@ gv_sd_to_drive(struct gv_sd *s, struct g /* No good slot found? */ if (s->size == -1) { - G_VINUM_DEBUG(0, "couldn't autosize '%s' on '%s'", + G_VINUM_DEBUG(0, "unable to autosize '%s' on '%s'", s->name, d->name); return (GV_ERR_BADSIZE); } From des at FreeBSD.org Mon Oct 5 09:26:23 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 09:26:35 2009 Subject: svn commit: r197768 - head/etc/pam.d Message-ID: <200910050926.n959QMSG006510@svn.freebsd.org> Author: des Date: Mon Oct 5 09:26:22 2009 New Revision: 197768 URL: http://svn.freebsd.org/changeset/base/197768 Log: Change the pam_ssh examples: if you use it, you probably want want_agent. MFC after: 3 weeks Modified: head/etc/pam.d/kde head/etc/pam.d/other head/etc/pam.d/sshd head/etc/pam.d/system head/etc/pam.d/telnetd Modified: head/etc/pam.d/kde ============================================================================== --- head/etc/pam.d/kde Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/kde Mon Oct 5 09:26:22 2009 (r197768) @@ -15,5 +15,5 @@ account required pam_nologin.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_permit.so Modified: head/etc/pam.d/other ============================================================================== --- head/etc/pam.d/other Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/other Mon Oct 5 09:26:22 2009 (r197768) @@ -18,7 +18,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/sshd ============================================================================== --- head/etc/pam.d/sshd Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/sshd Mon Oct 5 09:26:22 2009 (r197768) @@ -18,7 +18,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/system ============================================================================== --- head/etc/pam.d/system Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/system Mon Oct 5 09:26:22 2009 (r197768) @@ -17,7 +17,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password Modified: head/etc/pam.d/telnetd ============================================================================== --- head/etc/pam.d/telnetd Mon Oct 5 08:44:31 2009 (r197767) +++ head/etc/pam.d/telnetd Mon Oct 5 09:26:22 2009 (r197768) @@ -18,7 +18,7 @@ account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password From des at FreeBSD.org Mon Oct 5 09:28:55 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 09:29:07 2009 Subject: svn commit: r197769 - head/etc/pam.d Message-ID: <200910050928.n959StEr006603@svn.freebsd.org> Author: des Date: Mon Oct 5 09:28:54 2009 New Revision: 197769 URL: http://svn.freebsd.org/changeset/base/197769 Log: tabify MFC after: 3 weeks Modified: head/etc/pam.d/ftpd head/etc/pam.d/kde head/etc/pam.d/other head/etc/pam.d/sshd head/etc/pam.d/system head/etc/pam.d/telnetd head/etc/pam.d/xdm Modified: head/etc/pam.d/ftpd ============================================================================== --- head/etc/pam.d/ftpd Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/ftpd Mon Oct 5 09:28:54 2009 (r197769) @@ -8,12 +8,12 @@ auth sufficient pam_opie.so no_warn no_fake_prompts auth requisite pam_opieaccess.so no_warn allow_local #auth sufficient pam_krb5.so no_warn -#auth sufficient pam_ssh.so no_warn try_first_pass +#auth sufficient pam_ssh.so no_warn try_first_pass auth required pam_unix.so no_warn try_first_pass # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_unix.so # session Modified: head/etc/pam.d/kde ============================================================================== --- head/etc/pam.d/kde Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/kde Mon Oct 5 09:28:54 2009 (r197769) @@ -11,9 +11,9 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_permit.so Modified: head/etc/pam.d/other ============================================================================== --- head/etc/pam.d/other Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/other Mon Oct 5 09:28:54 2009 (r197769) @@ -13,12 +13,12 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/sshd ============================================================================== --- head/etc/pam.d/sshd Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/sshd Mon Oct 5 09:28:54 2009 (r197769) @@ -13,12 +13,12 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_permit.so # password Modified: head/etc/pam.d/system ============================================================================== --- head/etc/pam.d/system Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/system Mon Oct 5 09:28:54 2009 (r197769) @@ -12,12 +12,12 @@ auth requisite pam_opieaccess.so no_war auth required pam_unix.so no_warn try_first_pass nullok # account -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password Modified: head/etc/pam.d/telnetd ============================================================================== --- head/etc/pam.d/telnetd Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/telnetd Mon Oct 5 09:28:54 2009 (r197769) @@ -13,12 +13,12 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_login_access.so account required pam_unix.so # session -#session optional pam_ssh.so want_agent +#session optional pam_ssh.so want_agent session required pam_lastlog.so no_fail # password Modified: head/etc/pam.d/xdm ============================================================================== --- head/etc/pam.d/xdm Mon Oct 5 09:26:22 2009 (r197768) +++ head/etc/pam.d/xdm Mon Oct 5 09:28:54 2009 (r197769) @@ -11,11 +11,11 @@ auth required pam_unix.so no_warn try_ # account account required pam_nologin.so -#account required pam_krb5.so +#account required pam_krb5.so account required pam_unix.so # session -#session required pam_ssh.so want_agent +#session required pam_ssh.so want_agent session required pam_lastlog.so no_fail # password From stas at FreeBSD.org Mon Oct 5 10:08:59 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Mon Oct 5 10:09:11 2009 Subject: svn commit: r197770 - head/sys/arm/arm Message-ID: <200910051008.n95A8wII007645@svn.freebsd.org> Author: stas Date: Mon Oct 5 10:08:58 2009 New Revision: 197770 URL: http://svn.freebsd.org/changeset/base/197770 Log: - Drop unused pmap_use_l1 function and comment out currently unused pmap_dcache_wbinv_all/pmap_copy_page functions which we might want to take advatage of later. This fixes the build with PMAP_DEBUG defined. Discussed with: cognet Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Mon Oct 5 09:28:54 2009 (r197769) +++ head/sys/arm/arm/pmap.c Mon Oct 5 10:08:58 2009 (r197770) @@ -203,7 +203,6 @@ static void pmap_enter_locked(pmap_t, v static void pmap_fix_cache(struct vm_page *, pmap_t, vm_offset_t); static void pmap_alloc_l1(pmap_t); static void pmap_free_l1(pmap_t); -static void pmap_use_l1(pmap_t); static int pmap_clearbit(struct vm_page *, u_int); @@ -829,47 +828,6 @@ pmap_free_l1(pmap_t pm) mtx_unlock(&l1_lru_lock); } -static PMAP_INLINE void -pmap_use_l1(pmap_t pm) -{ - struct l1_ttable *l1; - - /* - * Do nothing if we're in interrupt context. - * Access to an L1 by the kernel pmap must not affect - * the LRU list. - */ - if (pm == pmap_kernel()) - return; - - l1 = pm->pm_l1; - - /* - * If the L1 is not currently on the LRU list, just return - */ - if (l1->l1_domain_use_count == PMAP_DOMAINS) - return; - - mtx_lock(&l1_lru_lock); - - /* - * Check the use count again, now that we've acquired the lock - */ - if (l1->l1_domain_use_count == PMAP_DOMAINS) { - mtx_unlock(&l1_lru_lock); - return; - } - - /* - * Move the L1 to the back of the LRU list - */ - TAILQ_REMOVE(&l1_lru_list, l1, l1_lru); - TAILQ_INSERT_TAIL(&l1_lru_list, l1, l1_lru); - - mtx_unlock(&l1_lru_lock); -} - - /* * Returns a pointer to the L2 bucket associated with the specified pmap * and VA, or NULL if no L2 bucket exists for the address. @@ -1311,6 +1269,7 @@ pmap_idcache_wbinv_all(pmap_t pm) } } +#ifdef notyet static PMAP_INLINE void pmap_dcache_wbinv_all(pmap_t pm) { @@ -1320,6 +1279,7 @@ pmap_dcache_wbinv_all(pmap_t pm) cpu_l2cache_wbinv_all(); } } +#endif /* * PTE_SYNC_CURRENT: @@ -1914,7 +1874,7 @@ pmap_init(void) { int shpgperproc = PMAP_SHPGPERPROC; - PDEBUG(1, printf("pmap_init: phys_start = %08x\n")); + PDEBUG(1, printf("pmap_init: phys_start = %08x\n", PHYSADDR)); /* * init the pv free list @@ -2373,8 +2333,8 @@ pmap_bootstrap(vm_offset_t firstaddr, vm vm_size_t size; int l1idx, l2idx, l2next = 0; - PDEBUG(1, printf("firstaddr = %08x, loadaddr = %08x\n", - firstaddr, loadaddr)); + PDEBUG(1, printf("firstaddr = %08x, lastaddr = %08x\n", + firstaddr, lastaddr)); virtual_avail = firstaddr; kernel_pmap->pm_l1 = l1; @@ -4251,7 +4211,7 @@ pmap_zero_page_idle(vm_page_t m) * pmap_clean_page() * * This is a local function used to work out the best strategy to clean - * a single page referenced by its entry in the PV table. It's used by + * a single page referenced by its entry in the PV table. It should be used by * pmap_copy_page, pmap_zero page and maybe some others later on. * * Its policy is effectively: @@ -4266,6 +4226,8 @@ pmap_zero_page_idle(vm_page_t m) * mapped at 0x00000000 a whole cache clean will be performed rather than * just the 1 page. Since this should not occur in everyday use and if it does * it will just result in not the most efficient clean for the page. + * + * We don't yet use this function but may want to. */ static int pmap_clean_page(struct pv_entry *pv, boolean_t is_src) From michio.jinbo at gmail.com Mon Oct 5 11:39:24 2009 From: michio.jinbo at gmail.com (Michio "Karl" Jinbo) Date: Mon Oct 5 11:39:31 2009 Subject: svn commit: r197744 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 In-Reply-To: <200910041220.n94CKxTH073639@svn.freebsd.org> References: <200910041220.n94CKxTH073639@svn.freebsd.org> Message-ID: <20091005203920.1278.22FF24F1@gmail.com> On Sun, 4 Oct 2009 12:20:59 +0000 (UTC) Konstantin Belousov wrote: > Log: > MFC r197663: > As a workaround, for Intel CPUs, do not use CLFLUSH in > pmap_invalidate_cache_range() when self-snoop is apparently not reported > in cpu features. > > Approved by: re (bz, kensmith) I was tested r197663/r197744, but kernel panic again on Citrix Xen Server. using 8.0-RC1 install cd, results are 1. INTEL SU9400+HYPER-V(Windows2008 R2) -> boot OK. 2. AMD Athlon X2 TK-55+HYPER-V(Windows2008 R2) -> boot NG. 3. AMD PhenomII 940BK+Citrix Xen Server -> boot NG. I think INTEL CPUs are no problem, but AMD CPUs appear the problem. So I tested the following patch, kernel boot was successed on recent 9-CURRENT and environment 3. sorry, poor English. --- sys/i386/i386/initcpu.c.original 2009-10-01 21:52:48.000000000 +0900 +++ sys/i386/i386/initcpu.c 2009-10-05 08:29:45.000000000 +0900 @@ -721,7 +721,7 @@ * XXXKIB: (temporary) hack to work around traps generated when * CLFLUSHing APIC registers window. */ - if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS)) + if (cpu_vendor_id == CPU_VENDOR_AMD && !(cpu_feature & CPUID_SS)) cpu_feature &= ~CPUID_CLFSH; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) -- Michio "Karl" Jinbo From jhb at FreeBSD.org Mon Oct 5 13:30:31 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Oct 5 13:30:44 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <200910041853.n94IrAf7082338@svn.freebsd.org> References: <200910041853.n94IrAf7082338@svn.freebsd.org> Message-ID: <4AC9F4F4.4030008@FreeBSD.org> Alan Cox wrote: > Author: alc > Date: Sun Oct 4 18:53:10 2009 > New Revision: 197750 > URL: http://svn.freebsd.org/changeset/base/197750 > > Log: > Align and pad the page queue and free page queue locks so that the linker > can't possibly place them together within the same cache line. > > MFC after: 3 weeks > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) > +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) > @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); > */ > > struct vpgqueues vm_page_queues[PQ_COUNT]; > -struct mtx vm_page_queue_mtx; > -struct mtx vm_page_queue_free_mtx; > +struct vpglocks vm_page_queue_lock; > +struct vpglocks vm_page_queue_free_lock; I think you can do this by just: struct mtx vm_page_queue_mtx __aligned(CACHE_LINE_SIZE); without the need for a wrapper structure. -- John Baldwin From nyan at FreeBSD.org Mon Oct 5 14:03:27 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Mon Oct 5 14:03:33 2009 Subject: svn commit: r197771 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf dev/xen/xenpci Message-ID: <200910051403.n95E3QSJ014412@svn.freebsd.org> Author: nyan Date: Mon Oct 5 14:03:26 2009 New Revision: 197771 URL: http://svn.freebsd.org/changeset/base/197771 Log: MFC: revision 197709 Fix build nfscl and/or nfsd. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/files stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Mon Oct 5 10:08:58 2009 (r197770) +++ stable/8/sys/conf/files Mon Oct 5 14:03:26 2009 (r197771) @@ -2660,12 +2660,12 @@ vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard vm/vnode_pager.c standard -xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver -xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver +xdr/xdr.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_array.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_mbuf.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_mem.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_reference.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +xdr/xdr_sizeof.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd # gnu/fs/xfs/xfs_alloc.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" \ From jhb at FreeBSD.org Mon Oct 5 14:13:17 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Oct 5 14:13:23 2009 Subject: svn commit: r197772 - head/sys/dev/ppbus Message-ID: <200910051413.n95EDGXN014646@svn.freebsd.org> Author: jhb Date: Mon Oct 5 14:13:16 2009 New Revision: 197772 URL: http://svn.freebsd.org/changeset/base/197772 Log: When the timeout backoff hits the maximum value, leave it capped at the maximum value rather than setting it to the result of a boolean expression that is always true. Submitted by: Joseph Kong MFC after: 1 month Modified: head/sys/dev/ppbus/lpt.c Modified: head/sys/dev/ppbus/lpt.c ============================================================================== --- head/sys/dev/ppbus/lpt.c Mon Oct 5 14:03:26 2009 (r197771) +++ head/sys/dev/ppbus/lpt.c Mon Oct 5 14:13:16 2009 (r197772) @@ -456,7 +456,7 @@ lptout(void *arg) if (sc->sc_state & OPEN) { sc->sc_backoff++; if (sc->sc_backoff > hz/LPTOUTMAX) - sc->sc_backoff = sc->sc_backoff > hz/LPTOUTMAX; + sc->sc_backoff = hz/LPTOUTMAX; callout_reset(&sc->sc_timer, sc->sc_backoff, lptout, sc); } else sc->sc_state &= ~TOUT; From alc at cs.rice.edu Mon Oct 5 14:17:46 2009 From: alc at cs.rice.edu (Alan Cox) Date: Mon Oct 5 14:17:58 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4AC9F4F4.4030008@FreeBSD.org> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4AC9F4F4.4030008@FreeBSD.org> Message-ID: <4ACA0000.2080005@cs.rice.edu> John Baldwin wrote: > Alan Cox wrote: >> Author: alc >> Date: Sun Oct 4 18:53:10 2009 >> New Revision: 197750 >> URL: http://svn.freebsd.org/changeset/base/197750 >> >> Log: >> Align and pad the page queue and free page queue locks so that the >> linker >> can't possibly place them together within the same cache line. >> MFC after: 3 weeks >> >> Modified: >> head/sys/vm/vm_page.c >> head/sys/vm/vm_page.h >> >> Modified: head/sys/vm/vm_page.c >> ============================================================================== >> >> --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) >> +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) >> @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); >> */ >> >> struct vpgqueues vm_page_queues[PQ_COUNT]; >> -struct mtx vm_page_queue_mtx; >> -struct mtx vm_page_queue_free_mtx; >> +struct vpglocks vm_page_queue_lock; >> +struct vpglocks vm_page_queue_free_lock; > > I think you can do this by just: > > struct mtx vm_page_queue_mtx __aligned(CACHE_LINE_SIZE); > > without the need for a wrapper structure. > Unfortunately, no. When I compile the following example: int a; int b __attribute__((aligned(16))); int x; int y; int z; int main(void) { return (0); } I get the following: 080495b4 A __bss_start 080495b4 A _edata 080495c0 b completed.4860 080495c4 B environ 080495d0 B b 080495d4 B x 080495d8 B z 080495dc B y 080495e0 B a 080495e4 A _end Thus, "b" is aligned as specified, but not padded to 16 bytes. Alan From gallatin at FreeBSD.org Mon Oct 5 14:28:24 2009 From: gallatin at FreeBSD.org (Andrew Gallatin) Date: Mon Oct 5 14:28:34 2009 Subject: svn commit: r197773 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mxge dev/xen/xenpci Message-ID: <200910051428.n95ESNhM015041@svn.freebsd.org> Author: gallatin Date: Mon Oct 5 14:28:23 2009 New Revision: 197773 URL: http://svn.freebsd.org/changeset/base/197773 Log: MFC:197645 Two more mxge watchdog fixes 1) Restore the PCI Express control register after a watchdog reset. This is required because the device will come out of watchdog reset with the pectl reg at its default state, and important BIOS configuration (like max payload size) could be lost. 2) Call mxge_start_locked() for every tx queue before dropping the lock in the watchdog handler. This is required, as the queue's buf ring may have filled during the reset. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/mxge/if_mxge.c stable/8/sys/dev/mxge/if_mxge_var.h stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Mon Oct 5 14:13:16 2009 (r197772) +++ stable/8/sys/dev/mxge/if_mxge.c Mon Oct 5 14:28:23 2009 (r197773) @@ -3653,10 +3653,16 @@ mxge_setup_cfg_space(mxge_softc_t *sc) if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { lnk = pci_read_config(dev, reg + 0x12, 2); sc->link_width = (lnk >> 4) & 0x3f; - - pectl = pci_read_config(dev, reg + 0x8, 2); - pectl = (pectl & ~0x7000) | (5 << 12); - pci_write_config(dev, reg + 0x8, pectl, 2); + + if (sc->pectl == 0) { + pectl = pci_read_config(dev, reg + 0x8, 2); + pectl = (pectl & ~0x7000) | (5 << 12); + pci_write_config(dev, reg + 0x8, pectl, 2); + sc->pectl = pectl; + } else { + /* restore saved pectl after watchdog reset */ + pci_write_config(dev, reg + 0x8, sc->pectl, 2); + } } /* Enable DMA and Memory space access */ @@ -3768,6 +3774,9 @@ mxge_watchdog_reset(mxge_softc_t *sc, in /* release all TX locks */ for (s = 0; s < num_tx_slices; s++) { ss = &sc->ss[s]; +#ifdef IFNET_BUF_RING + mxge_start_locked(ss); +#endif mtx_unlock(&ss->tx.mtx); } } Modified: stable/8/sys/dev/mxge/if_mxge_var.h ============================================================================== --- stable/8/sys/dev/mxge/if_mxge_var.h Mon Oct 5 14:13:16 2009 (r197772) +++ stable/8/sys/dev/mxge/if_mxge_var.h Mon Oct 5 14:28:23 2009 (r197773) @@ -273,6 +273,7 @@ struct mxge_softc { struct sysctl_ctx_list slice_sysctl_ctx; char *mac_addr_string; uint8_t mac_addr[6]; /* eeprom mac address */ + uint16_t pectl; /* save PCIe CTL state */ char product_code_string[64]; char serial_number_string[64]; char cmd_mtx_name[16]; From rwatson at FreeBSD.org Mon Oct 5 14:49:17 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 14:49:23 2009 Subject: svn commit: r197775 - head/sys/kern Message-ID: <200910051449.n95EnGof015525@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 14:49:16 2009 New Revision: 197775 URL: http://svn.freebsd.org/changeset/base/197775 Log: First cut at implementing SOCK_SEQPACKET support for UNIX (local) domain sockets. This allows for reliable bi-directional datagram communication over UNIX domain sockets, in contrast to SOCK_DGRAM (M:N, unreliable) or SOCK_STERAM (bi-directional bytestream). Largely, this reuses existing UNIX domain socket code. This allows applications requiring record- oriented semantics to do so reliably via local IPC. Some implementation notes (also present in XXX comments): - Currently we lack an sbappend variant able to do datagrams and control data without doing addresses, so we mark SOCK_SEQPACKET as PR_ADDR. Adding a new variant will solve this problem. - UNIX domain sockets on FreeBSD provide back-pressure/flow control notification for stream sockets by manipulating the send socket buffer's size during pru_send and pru_rcvd. This trick works less well for SOCK_SEQPACKET as sosend_generic() uses sb_hiwat not just to manage blocking, but also to determine maximum datagram size. Fixing this requires rethinking how back-pressure is done for SOCK_SEQPACKET; in the mean time, it's possible to get EMSGSIZE when buffers fill, instead of blocking. Discussed with: benl Reviewed by: bz, rpaulo MFC after: 3 months Sponsored by: Google Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Mon Oct 5 14:46:56 2009 (r197774) +++ head/sys/kern/uipc_usrreq.c Mon Oct 5 14:49:16 2009 (r197775) @@ -50,7 +50,8 @@ * garbage collector to find and tear down cycles of disconnected sockets. * * TODO: - * SEQPACKET, RDM + * RDM + * distinguish datagram size limits from flow control limits in SEQPACKET * rethink name space problems * need a proper out-of-band */ @@ -112,6 +113,7 @@ static ino_t unp_ino; /* Prototype for static int unp_rights; /* (g) File descriptors in flight. */ static struct unp_head unp_shead; /* (l) List of stream sockets. */ static struct unp_head unp_dhead; /* (l) List of datagram sockets. */ +static struct unp_head unp_sphead; /* (l) List of seqpacket sockets. */ static const struct sockaddr sun_noname = { sizeof(sun_noname), AF_LOCAL }; @@ -139,10 +141,14 @@ static u_long unpst_sendspace = PIPSIZ; static u_long unpst_recvspace = PIPSIZ; static u_long unpdg_sendspace = 2*1024; /* really max datagram size */ static u_long unpdg_recvspace = 4*1024; +static u_long unpsp_sendspace = PIPSIZ; /* really max datagram size */ +static u_long unpsp_recvspace = PIPSIZ; SYSCTL_NODE(_net, PF_LOCAL, local, CTLFLAG_RW, 0, "Local domain"); SYSCTL_NODE(_net_local, SOCK_STREAM, stream, CTLFLAG_RW, 0, "SOCK_STREAM"); SYSCTL_NODE(_net_local, SOCK_DGRAM, dgram, CTLFLAG_RW, 0, "SOCK_DGRAM"); +SYSCTL_NODE(_net_local, SOCK_SEQPACKET, seqpacket, CTLFLAG_RW, 0, + "SOCK_SEQPACKET"); SYSCTL_ULONG(_net_local_stream, OID_AUTO, sendspace, CTLFLAG_RW, &unpst_sendspace, 0, "Default stream send space."); @@ -152,6 +158,10 @@ SYSCTL_ULONG(_net_local_dgram, OID_AUTO, &unpdg_sendspace, 0, "Default datagram send space."); SYSCTL_ULONG(_net_local_dgram, OID_AUTO, recvspace, CTLFLAG_RW, &unpdg_recvspace, 0, "Default datagram receive space."); +SYSCTL_ULONG(_net_local_seqpacket, OID_AUTO, maxseqpacket, CTLFLAG_RW, + &unpsp_sendspace, 0, "Default seqpacket send space."); +SYSCTL_ULONG(_net_local_seqpacket, OID_AUTO, recvspace, CTLFLAG_RW, + &unpsp_recvspace, 0, "Default seqpacket receive space."); SYSCTL_INT(_net_local, OID_AUTO, inflight, CTLFLAG_RD, &unp_rights, 0, "File descriptors in flight."); @@ -257,6 +267,7 @@ static struct mbuf *unp_addsockcred(stru */ static struct domain localdomain; static struct pr_usrreqs uipc_usrreqs_dgram, uipc_usrreqs_stream; +static struct pr_usrreqs uipc_usrreqs_seqpacket; static struct protosw localsw[] = { { .pr_type = SOCK_STREAM, @@ -271,6 +282,19 @@ static struct protosw localsw[] = { .pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS, .pr_usrreqs = &uipc_usrreqs_dgram }, +{ + .pr_type = SOCK_SEQPACKET, + .pr_domain = &localdomain, + + /* + * XXXRW: For now, PR_ADDR because soreceive will bump into them + * due to our use of sbappendaddr. A new sbappend variants is needed + * that supports both atomic record writes and control data. + */ + .pr_flags = PR_ADDR|PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD| + PR_RIGHTS, + .pr_usrreqs = &uipc_usrreqs_seqpacket, +}, }; static struct domain localdomain = { @@ -353,6 +377,11 @@ uipc_attach(struct socket *so, int proto recvspace = unpdg_recvspace; break; + case SOCK_SEQPACKET: + sendspace = unpsp_sendspace; + recvspace = unpsp_recvspace; + break; + default: panic("uipc_attach"); } @@ -372,8 +401,22 @@ uipc_attach(struct socket *so, int proto UNP_LIST_LOCK(); unp->unp_gencnt = ++unp_gencnt; unp_count++; - LIST_INSERT_HEAD(so->so_type == SOCK_DGRAM ? &unp_dhead : &unp_shead, - unp, unp_link); + switch (so->so_type) { + case SOCK_STREAM: + LIST_INSERT_HEAD(&unp_shead, unp, unp_link); + break; + + case SOCK_DGRAM: + LIST_INSERT_HEAD(&unp_dhead, unp, unp_link); + break; + + case SOCK_SEQPACKET: + LIST_INSERT_HEAD(&unp_sphead, unp, unp_link); + break; + + default: + panic("uipc_attach"); + } UNP_LIST_UNLOCK(); return (0); @@ -705,11 +748,8 @@ uipc_rcvd(struct socket *so, int flags) unp = sotounpcb(so); KASSERT(unp != NULL, ("uipc_rcvd: unp == NULL")); - if (so->so_type == SOCK_DGRAM) - panic("uipc_rcvd DGRAM?"); - - if (so->so_type != SOCK_STREAM) - panic("uipc_rcvd unknown socktype"); + if (so->so_type != SOCK_STREAM && so->so_type != SOCK_SEQPACKET) + panic("uipc_rcvd socktype %d", so->so_type); /* * Adjust backpressure on sender and wakeup any waiting to write. @@ -824,6 +864,7 @@ uipc_send(struct socket *so, int flags, break; } + case SOCK_SEQPACKET: case SOCK_STREAM: if ((so->so_state & SS_ISCONNECTED) == 0) { if (nam != NULL) { @@ -875,11 +916,33 @@ uipc_send(struct socket *so, int flags, * Send to paired receive port, and then reduce send buffer * hiwater marks to maintain backpressure. Wake up readers. */ - if (control != NULL) { - if (sbappendcontrol_locked(&so2->so_rcv, m, control)) + switch (so->so_type) { + case SOCK_STREAM: + if (control != NULL) { + if (sbappendcontrol_locked(&so2->so_rcv, m, + control)) + control = NULL; + } else + sbappend_locked(&so2->so_rcv, m); + break; + + case SOCK_SEQPACKET: { + const struct sockaddr *from; + + from = &sun_noname; + if (sbappendaddr_locked(&so2->so_rcv, from, m, + control)) control = NULL; - } else - sbappend_locked(&so2->so_rcv, m); + break; + } + } + + /* + * XXXRW: While fine for SOCK_STREAM, this conflates maximum + * datagram size and back-pressure for SOCK_SEQPACKET, which + * can lead to undesired return of EMSGSIZE on send instead + * of more desirable blocking. + */ mbcnt_delta = so2->so_rcv.sb_mbcnt - unp2->unp_mbcnt; unp2->unp_mbcnt = so2->so_rcv.sb_mbcnt; sbcc = so2->so_rcv.sb_cc; @@ -939,7 +1002,8 @@ uipc_sense(struct socket *so, struct sta UNP_LINK_RLOCK(); UNP_PCB_LOCK(unp); unp2 = unp->unp_conn; - if (so->so_type == SOCK_STREAM && unp2 != NULL) { + if ((so->so_type == SOCK_STREAM || so->so_type == SOCK_SEQPACKET) && + unp2 != NULL) { so2 = unp2->unp_socket; sb->st_blksize += so2->so_rcv.sb_cc; } @@ -1009,6 +1073,26 @@ static struct pr_usrreqs uipc_usrreqs_dg .pru_close = uipc_close, }; +static struct pr_usrreqs uipc_usrreqs_seqpacket = { + .pru_abort = uipc_abort, + .pru_accept = uipc_accept, + .pru_attach = uipc_attach, + .pru_bind = uipc_bind, + .pru_connect = uipc_connect, + .pru_connect2 = uipc_connect2, + .pru_detach = uipc_detach, + .pru_disconnect = uipc_disconnect, + .pru_listen = uipc_listen, + .pru_peeraddr = uipc_peeraddr, + .pru_rcvd = uipc_rcvd, + .pru_send = uipc_send, + .pru_sense = uipc_sense, + .pru_shutdown = uipc_shutdown, + .pru_sockaddr = uipc_sockaddr, + .pru_soreceive = soreceive_generic, /* XXX: or...? */ + .pru_close = uipc_close, +}; + static struct pr_usrreqs uipc_usrreqs_stream = { .pru_abort = uipc_abort, .pru_accept = uipc_accept, @@ -1306,6 +1390,7 @@ unp_connect2(struct socket *so, struct s break; case SOCK_STREAM: + case SOCK_SEQPACKET: unp2->unp_conn = unp; if (req == PRU_CONNECT && ((unp->unp_flags | unp2->unp_flags) & UNP_CONNWAIT)) @@ -1343,6 +1428,7 @@ unp_disconnect(struct unpcb *unp, struct break; case SOCK_STREAM: + case SOCK_SEQPACKET: soisdisconnected(unp->unp_socket); unp2->unp_conn = NULL; soisdisconnected(unp2->unp_socket); @@ -1368,7 +1454,22 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) struct unp_head *head; struct xunpcb *xu; - head = ((intptr_t)arg1 == SOCK_DGRAM ? &unp_dhead : &unp_shead); + switch ((intptr_t)arg1) { + case SOCK_STREAM: + head = &unp_shead; + break; + + case SOCK_DGRAM: + head = &unp_dhead; + break; + + case SOCK_SEQPACKET: + head = &unp_sphead; + break; + + default: + panic("unp_pcblist: arg1 %d", (intptr_t)arg1); + } /* * The process of preparing the PCB list is too time-consuming and @@ -1481,6 +1582,9 @@ SYSCTL_PROC(_net_local_dgram, OID_AUTO, SYSCTL_PROC(_net_local_stream, OID_AUTO, pcblist, CTLFLAG_RD, (caddr_t)(long)SOCK_STREAM, 0, unp_pcblist, "S,xunpcb", "List of active local stream sockets"); +SYSCTL_PROC(_net_local_seqpacket, OID_AUTO, pcblist, CTLFLAG_RD, + (caddr_t)(long)SOCK_SEQPACKET, 0, unp_pcblist, "S,xunpcb", + "List of active local seqpacket sockets"); static void unp_shutdown(struct unpcb *unp) @@ -1492,7 +1596,8 @@ unp_shutdown(struct unpcb *unp) UNP_PCB_LOCK_ASSERT(unp); unp2 = unp->unp_conn; - if (unp->unp_socket->so_type == SOCK_STREAM && unp2 != NULL) { + if ((unp->unp_socket->so_type == SOCK_STREAM || + (unp->unp_socket->so_type == SOCK_SEQPACKET)) && unp2 != NULL) { so = unp2->unp_socket; if (so != NULL) socantrcvmore(so); @@ -1658,6 +1763,7 @@ unp_init(void) NULL, EVENTHANDLER_PRI_ANY); LIST_INIT(&unp_dhead); LIST_INIT(&unp_shead); + LIST_INIT(&unp_sphead); TASK_INIT(&unp_gc_task, 0, unp_gc, NULL); UNP_LINK_LOCK_INIT(); UNP_LIST_LOCK_INIT(); @@ -1974,7 +2080,8 @@ SYSCTL_INT(_net_local, OID_AUTO, taskcou static void unp_gc(__unused void *arg, int pending) { - struct unp_head *heads[] = { &unp_dhead, &unp_shead, NULL }; + struct unp_head *heads[] = { &unp_dhead, &unp_shead, &unp_sphead, + NULL }; struct unp_head **head; struct file **unref; struct unpcb *unp; From stas at FreeBSD.org Mon Oct 5 15:05:10 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Mon Oct 5 15:05:17 2009 Subject: svn commit: r197741 - head/lib/libpmc In-Reply-To: <200910041054.n94AsKTI071707@svn.freebsd.org> References: <200910041054.n94AsKTI071707@svn.freebsd.org> Message-ID: <20091005190502.7976ef3e.stas@FreeBSD.org> On Sun, 4 Oct 2009 10:54:20 +0000 (UTC) Rui Paulo mentioned: > Author: rpaulo > Date: Sun Oct 4 10:54:20 2009 > New Revision: 197741 > URL: http://svn.freebsd.org/changeset/base/197741 > > Log: > Install x86 related man pages on x86 systems only. > > Reviewed by: jkoshy > > Modified: > head/lib/libpmc/Makefile > > Modified: head/lib/libpmc/Makefile > ============================================================================== > --- head/lib/libpmc/Makefile Sun Oct 4 10:38:04 2009 (r197740) > +++ head/lib/libpmc/Makefile Sun Oct 4 10:54:20 2009 (r197741) > @@ -24,6 +24,7 @@ MAN+= pmc_start.3 > MAN+= pmclog.3 > > # PMC-dependent manual pages > +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" > MAN+= pmc.atom.3 > MAN+= pmc.core.3 > MAN+= pmc.core2.3 > @@ -34,6 +35,7 @@ MAN+= pmc.p4.3 > MAN+= pmc.p5.3 > MAN+= pmc.p6.3 > MAN+= pmc.tsc.3 > +.endif > You probably don't want to install i386-only man pages on amd64 as well (pmc.atom, pmc.k7, pmc.p5). -- Stanislav Sedov ST4096-RIPE -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091005/5413b0da/attachment.pgp From jh at FreeBSD.org Mon Oct 5 15:05:44 2009 From: jh at FreeBSD.org (Jaakko Heinonen) Date: Mon Oct 5 15:05:56 2009 Subject: svn commit: r197776 - head/share/misc Message-ID: <200910051505.n95F5iQH015898@svn.freebsd.org> Author: jh Date: Mon Oct 5 15:05:43 2009 New Revision: 197776 URL: http://svn.freebsd.org/changeset/base/197776 Log: Add myself. Approved by: trasz (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Mon Oct 5 14:49:16 2009 (r197775) +++ head/share/misc/committers-src.dot Mon Oct 5 15:05:43 2009 (r197776) @@ -106,6 +106,7 @@ ivoras [label="Ivan Voras\nivoras@FreeBS jake [label="Jake Burkholder\njake@FreeBSD.org\n2000/05/16"] jamie [label="Jamie Gritton\njamie@FreeBSD.org\n2009/01/28"] jayanth [label="Jayanth Vijayaraghavan\njayanth@FreeBSD.org\n2000/05/08"] +jh [label="Jaakko Heinonen\njh@FreeBSD.org\n2009/10/02"] jilles [label="Jilles Tjoelker\njilles@FreeBSD.org\n2009/05/22"] jinmei [label="JINMEI Tatuya\njinmei@FreeBSD.org\n2007/03/17"] jdp [label="John Polstra\njdp@FreeBSD.org\n????/??/??"] @@ -406,6 +407,7 @@ rwatson -> bz rwatson -> cperciva rwatson -> emaste rwatson -> gnn +rwatson -> jh rwatson -> kensmith rwatson -> kmacy rwatson -> linimon @@ -435,6 +437,8 @@ sos -> marcel thompsa -> weongyo thompsa -> eri +trasz -> jh + ume -> jinmei ume -> suz ume -> tshiozak From rwatson at FreeBSD.org Mon Oct 5 15:06:15 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:06:27 2009 Subject: svn commit: r197777 - head/usr.bin/netstat Message-ID: <200910051506.n95F6FWb015948@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:06:14 2009 New Revision: 197777 URL: http://svn.freebsd.org/changeset/base/197777 Log: netstat(1) support for UNIX SOCK_SEQPACKET sockets -- changes were required only for the kvm case, as we supported SOCK_SEQPACKET via sysctl already. Sponsored by: Google MFC after: 3 months Modified: head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.h head/usr.bin/netstat/unix.c Modified: head/usr.bin/netstat/main.c ============================================================================== --- head/usr.bin/netstat/main.c Mon Oct 5 15:05:43 2009 (r197776) +++ head/usr.bin/netstat/main.c Mon Oct 5 15:06:14 2009 (r197777) @@ -186,6 +186,8 @@ static struct nlist nl[] = { { .n_name = "_mfctablesize" }, #define N_ARPSTAT 55 { .n_name = "_arpstat" }, +#define N_UNP_SPHEAD 56 + { .n_name = "unp_sphead" }, { .n_name = NULL }, }; @@ -601,7 +603,8 @@ main(int argc, char *argv[]) #endif /* NETGRAPH */ if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag) unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value, - nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value); + nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value, + nl[N_UNP_SPHEAD].n_value); exit(0); } Modified: head/usr.bin/netstat/netstat.h ============================================================================== --- head/usr.bin/netstat/netstat.h Mon Oct 5 15:05:43 2009 (r197776) +++ head/usr.bin/netstat/netstat.h Mon Oct 5 15:06:14 2009 (r197777) @@ -150,7 +150,7 @@ void ddp_stats(u_long, const char *, int void netgraphprotopr(u_long, const char *, int, int); #endif -void unixpr(u_long, u_long, u_long, u_long); +void unixpr(u_long, u_long, u_long, u_long, u_long); void esis_stats(u_long, const char *, int, int); void clnp_stats(u_long, const char *, int, int); Modified: head/usr.bin/netstat/unix.c ============================================================================== --- head/usr.bin/netstat/unix.c Mon Oct 5 15:05:43 2009 (r197776) +++ head/usr.bin/netstat/unix.c Mon Oct 5 15:06:14 2009 (r197777) @@ -193,21 +193,37 @@ fail: } void -unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off) +unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off, + u_long sphead_off) { char *buf; int ret, type; struct xsocket *so; struct xunpgen *xug, *oxug; struct xunpcb *xunp; + u_long head_off; for (type = SOCK_STREAM; type <= SOCK_SEQPACKET; type++) { if (live) ret = pcblist_sysctl(type, &buf); - else - ret = pcblist_kvm(count_off, gencnt_off, - type == SOCK_STREAM ? shead_off : - (type == SOCK_DGRAM ? dhead_off : 0), &buf); + else { + head_off = 0; + switch (type) { + case SOCK_STREAM: + head_off = shead_off; + break; + + case SOCK_DGRAM: + head_off = dhead_off; + break; + + case SOCK_SEQPACKET: + head_off = sphead_off; + break; + } + ret = pcblist_kvm(count_off, gencnt_off, head_off, + &buf); + } if (ret == -1) continue; if (ret < 0) From rwatson at FreeBSD.org Mon Oct 5 15:07:44 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:07:51 2009 Subject: svn commit: r197778 - head/share/man/man4 Message-ID: <200910051507.n95F7isb016016@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:07:44 2009 New Revision: 197778 URL: http://svn.freebsd.org/changeset/base/197778 Log: SOCK_SEQPACKET is now supported on UNIX domain sockets. Sponsored by: Google MFC after: 3 months Modified: head/share/man/man4/unix.4 Modified: head/share/man/man4/unix.4 ============================================================================== --- head/share/man/man4/unix.4 Mon Oct 5 15:06:14 2009 (r197777) +++ head/share/man/man4/unix.4 Mon Oct 5 15:07:44 2009 (r197778) @@ -52,7 +52,8 @@ mechanisms. The .Ux Ns -domain family supports the -.Dv SOCK_STREAM +.Dv SOCK_STREAM , +.Dv SOCK_SEQPACKET , and .Dv SOCK_DGRAM socket types and uses @@ -127,11 +128,14 @@ The .Ux Ns -domain protocol family is comprised of simple transport protocols that support the -.Dv SOCK_STREAM +.Dv SOCK_STREAM , +.Dv SOCK_SEQPACKET , and .Dv SOCK_DGRAM abstractions. .Dv SOCK_STREAM +and +.Dv SOCK_SEQPACKET sockets also support the communication of .Ux file descriptors through the use of the @@ -206,8 +210,9 @@ and tested with .Xr getsockopt 2 : .Bl -tag -width ".Dv LOCAL_CONNWAIT" .It Dv LOCAL_CREDS -This option may be enabled on a -.Dv SOCK_DGRAM +This option may be enabled on +.Dv SOCK_DGRAM , +.Dv SOCK_SEQPACKET , or a .Dv SOCK_STREAM socket. From rwatson at FreeBSD.org Mon Oct 5 15:15:14 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:16:07 2009 Subject: svn commit: r197779 - head/share/man/man4 Message-ID: <200910051515.n95FFDub016209@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:15:13 2009 New Revision: 197779 URL: http://svn.freebsd.org/changeset/base/197779 Log: Bump unix(4) man page date for SOCK_SEQPACKET. Suggested by: bz MFC after: 3 months Modified: head/share/man/man4/unix.4 Modified: head/share/man/man4/unix.4 ============================================================================== --- head/share/man/man4/unix.4 Mon Oct 5 15:07:44 2009 (r197778) +++ head/share/man/man4/unix.4 Mon Oct 5 15:15:13 2009 (r197779) @@ -32,7 +32,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd July 15, 2001 +.Dd October 5, 2009 .Dt UNIX 4 .Os .Sh NAME From trasz at FreeBSD.org Mon Oct 5 15:16:28 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Oct 5 15:17:39 2009 Subject: svn commit: r197780 - head/share/man/man9 Message-ID: <200910051516.n95FGS6p016270@svn.freebsd.org> Author: trasz Date: Mon Oct 5 15:16:28 2009 New Revision: 197780 URL: http://svn.freebsd.org/changeset/base/197780 Log: Make fetch(9) and store(9) manual pages closer to reality. Modified: head/share/man/man9/Makefile head/share/man/man9/fetch.9 head/share/man/man9/store.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Oct 5 15:15:13 2009 (r197779) +++ head/share/man/man9/Makefile Mon Oct 5 15:16:28 2009 (r197780) @@ -606,8 +606,10 @@ MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECL EVENTHANDLER.9 eventhandler_register.9 MLINKS+=fetch.9 fubyte.9 \ fetch.9 fuswintr.9 \ - fetch.9 fusword.9 \ - fetch.9 fuword.9 + fetch.9 fuword.9 \ + fetch.9 fuword16.9 \ + fetch.9 fuword32.9 \ + fetch.9 fuword64.9 MLINKS+=g_attach.9 g_detach.9 MLINKS+=g_bio.9 g_clone_bio.9 \ g_bio.9 g_destroy_bio.9 \ @@ -1142,8 +1144,10 @@ MLINKS+=stack.9 stack_copy.9 \ stack.9 stack_zero.9 MLINKS+=store.9 subyte.9 \ store.9 suswintr.9 \ - store.9 susword.9 \ - store.9 suword.9 + store.9 suword.9 \ + store.9 suword16.9 \ + store.9 suword32.9 \ + store.9 suword64.9 MLINKS+=swi.9 swi_add.9 \ swi.9 swi_sched.9 MLINKS+=sx.9 sx_assert.9 \ Modified: head/share/man/man9/fetch.9 ============================================================================== --- head/share/man/man9/fetch.9 Mon Oct 5 15:15:13 2009 (r197779) +++ head/share/man/man9/fetch.9 Mon Oct 5 15:16:28 2009 (r197780) @@ -34,29 +34,35 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 1996 +.Dd October 5, 2009 .Dt FETCH 9 .Os .Sh NAME .Nm fetch , .Nm fubyte , -.Nm fusword , .Nm fuswintr , -.Nm fuword +.Nm fuword , +.Nm fuword16 , +.Nm fuword32 , +.Nm fuword64 .Nd fetch data from user-space .Sh SYNOPSIS .In sys/types.h .In sys/time.h .In sys/systm.h -.In sys/resourcevar.h .Ft int .Fn fubyte "const void *base" +.Ft long +.Fn fuword "const void *base" .Ft int -.Fn fusword "void *base" +.Fn fuword16 "void *base" +.Ft int32_t +.Fn fuword32 "const void *base" +.Ft int64_t +.Fn fuword64 "const void *base" +.In sys/resourcevar.h .Ft int .Fn fuswintr "void *base" -.Ft long -.Fn fuword "const void *base" .Sh DESCRIPTION The .Nm @@ -69,16 +75,22 @@ routines provide the following functiona .It Fn fubyte Fetches a byte of data from the user-space address .Pa base . -.It Fn fusword -Fetches a short word of data from the user-space address +.It Fn fuword +Fetches a word of data from the user-space address +.Pa base . +.It Fn fuword16 +Fetches 16 bits of data from the user-space address +.Pa base . +.It Fn fuword32 +Fetches 32 bits of data from the user-space address +.Pa base . +.It Fn fuword64 +Fetches 64 bits of data from the user-space address .Pa base . .It Fn fuswintr Fetches a short word of data from the user-space address .Pa base . This function is safe to call during an interrupt context. -.It Fn fuword -Fetches a word of data from the user-space address -.Pa base . .El .Sh RETURN VALUES The Modified: head/share/man/man9/store.9 ============================================================================== --- head/share/man/man9/store.9 Mon Oct 5 15:15:13 2009 (r197779) +++ head/share/man/man9/store.9 Mon Oct 5 15:16:28 2009 (r197780) @@ -34,13 +34,12 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 1996 +.Dd October 5, 2009 .Dt STORE 9 .Os .Sh NAME .Nm store , .Nm subyte , -.Nm susword , .Nm suswintr , .Nm suword .Nd store data to user-space @@ -48,15 +47,19 @@ .In sys/types.h .In sys/time.h .In sys/systm.h -.In sys/resourcevar.h .Ft int .Fn subyte "void *base" "int byte" .Ft int -.Fn susword "void *base" "int word" +.Fn suword "void *base" "long word" .Ft int -.Fn suswintr "void *base" "int word" +.Fn suword16 "void *base" "int word" .Ft int -.Fn suword "void *base" "long word" +.Fn suword32 "void *base" "int32_t word" +.Ft int +.Fn suword64 "void *base" "int64_t word" +.In sys/resourcevar.h +.Ft int +.Fn suswintr "void *base" "int word" .Sh DESCRIPTION The .Nm @@ -69,16 +72,22 @@ routines provide the following functiona .It Fn subyte Stores a byte of data to the user-space address .Pa base . -.It Fn susword -Stores a short word of data to the user-space address +.It Fn suword +Stores a word of data to the user-space address +.Pa base . +.It Fn suword16 +Stores 16 bits of of data to the user-space address +.Pa base . +.It Fn suword32 +Stores 32 bits of of data to the user-space address +.Pa base . +.It Fn suword64 +Stores 64 bits of of data to the user-space address .Pa base . .It Fn suswintr Stores a short word of data to the user-space address .Pa base . This function is safe to call during an interrupt context. -.It Fn suword -Stores a word of data to the user-space address -.Pa base . .El .Sh RETURN VALUES The From jhb at FreeBSD.org Mon Oct 5 15:21:48 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Mon Oct 5 15:22:01 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4ACA0000.2080005@cs.rice.edu> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4AC9F4F4.4030008@FreeBSD.org> <4ACA0000.2080005@cs.rice.edu> Message-ID: <4ACA0F09.2010808@FreeBSD.org> Alan Cox wrote: > John Baldwin wrote: >> Alan Cox wrote: >>> Author: alc >>> Date: Sun Oct 4 18:53:10 2009 >>> New Revision: 197750 >>> URL: http://svn.freebsd.org/changeset/base/197750 >>> >>> Log: >>> Align and pad the page queue and free page queue locks so that the >>> linker >>> can't possibly place them together within the same cache line. >>> MFC after: 3 weeks >>> >>> Modified: >>> head/sys/vm/vm_page.c >>> head/sys/vm/vm_page.h >>> >>> Modified: head/sys/vm/vm_page.c >>> ============================================================================== >>> >>> --- head/sys/vm/vm_page.c Sun Oct 4 17:22:51 2009 (r197749) >>> +++ head/sys/vm/vm_page.c Sun Oct 4 18:53:10 2009 (r197750) >>> @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); >>> */ >>> >>> struct vpgqueues vm_page_queues[PQ_COUNT]; >>> -struct mtx vm_page_queue_mtx; >>> -struct mtx vm_page_queue_free_mtx; >>> +struct vpglocks vm_page_queue_lock; >>> +struct vpglocks vm_page_queue_free_lock; >> >> I think you can do this by just: >> >> struct mtx vm_page_queue_mtx __aligned(CACHE_LINE_SIZE); >> >> without the need for a wrapper structure. >> > > Unfortunately, no. When I compile the following example: > > int a; > int b __attribute__((aligned(16))); > int x; > int y; > int z; > > int > main(void) > { > > return (0); > } > > I get the following: > > 080495b4 A __bss_start > 080495b4 A _edata > 080495c0 b completed.4860 > 080495c4 B environ > 080495d0 B b > 080495d4 B x > 080495d8 B z > 080495dc B y > 080495e0 B a > 080495e4 A _end > > Thus, "b" is aligned as specified, but not padded to 16 bytes. Do you care what is in the padding in this case or more about just having each mutex on a separate cache line? __aligned() is fine if you don't mind the padding getting reused for something else. -- John Baldwin From rwatson at FreeBSD.org Mon Oct 5 15:27:01 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 15:27:08 2009 Subject: svn commit: r197781 - in head/tools/regression/sockets: unix_seqpacket unix_seqpacket_exercise Message-ID: <200910051527.n95FR1Je016540@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 15:27:01 2009 New Revision: 197781 URL: http://svn.freebsd.org/changeset/base/197781 Log: A few regression tests for SOCK_SEQPACKET UNIX domain sockets. Sponsored by: Google Added: head/tools/regression/sockets/unix_seqpacket/ head/tools/regression/sockets/unix_seqpacket/Makefile (contents, props changed) head/tools/regression/sockets/unix_seqpacket/unix_seqpacket.c (contents, props changed) head/tools/regression/sockets/unix_seqpacket_exercise/ head/tools/regression/sockets/unix_seqpacket_exercise/Makefile (contents, props changed) head/tools/regression/sockets/unix_seqpacket_exercise/unix_seqpacket_exercise.c (contents, props changed) Added: head/tools/regression/sockets/unix_seqpacket/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket/Makefile Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,9 @@ +# +# $FreeBSD$ +# + +PROG= unix_seqpacket +CFLAGS+= -Wall -Werror +NO_MAN= + +.include Added: head/tools/regression/sockets/unix_seqpacket/unix_seqpacket.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket/unix_seqpacket.c Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,140 @@ +/*- + * 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. + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include + +#define FAILERR(str) err(-1, "%s: %s", __func__, str) +#define FAILERRX(str) errx(-1, "%s: %s", __func__, str) + +static void +test_socket(void) +{ + int s; + + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + (void)close(s); +} + +static void +test_socketpair(void) +{ + int sv[2]; + + if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sv) < 0) + FAILERR("socketpair"); + (void)close(sv[0]); + (void)close(sv[1]); +} + +static void +test_listen_unbound(void) +{ + int s; + + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + if (listen(s, -1) == 0) + FAILERRX("listen"); + (void)close(s); +} + +static void +test_bind(void) +{ + struct sockaddr_un sun; + char path[PATH_MAX]; + int s; + + snprintf(path, sizeof(path), "/tmp/lds.XXXXXXXXX"); + if (mktemp(path) == NULL) + FAILERR("mktemp"); + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + bzero(&sun, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) + FAILERR("bind"); + close(s); + (void)unlink(path); +} + +static void +test_listen_bound(void) +{ + struct sockaddr_un sun; + char path[PATH_MAX]; + int s; + + snprintf(path, sizeof(path), "/tmp/lds.XXXXXXXXX"); + if (mktemp(path) == NULL) + FAILERR("mktemp"); + s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s < 0) + FAILERR("socket"); + bzero(&sun, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) + FAILERR("bind"); + if (listen(s, -1)) { + (void)unlink(path); + FAILERR("bind"); + } + close(s); + (void)unlink(path); +} + +int +main(int argc, char *argv[]) +{ + + test_socket(); + test_socketpair(); + test_listen_unbound(); + test_bind(); + test_listen_bound(); +} Added: head/tools/regression/sockets/unix_seqpacket_exercise/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket_exercise/Makefile Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,9 @@ +# +# $FreeBSD$ +# + +PROG=unix_seqpacket_exercise +CFLAGS+=-Wall -Werror +NO_MAN= + +.include Added: head/tools/regression/sockets/unix_seqpacket_exercise/unix_seqpacket_exercise.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sockets/unix_seqpacket_exercise/unix_seqpacket_exercise.c Mon Oct 5 15:27:01 2009 (r197781) @@ -0,0 +1,435 @@ +/*- + * 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. + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define min(x, y) (x < y ? x : y) + +#define BUFLEN 32768 + +#define SEQPACKET_RCVBUF (131072-16) +#define SEQPACKET_SNDBUF (131072-16) + +#define FAILERR(str) err(-1, "%s: %s", __func__, str) +#define FAILNERR(str, n) err(-1, "%s %d: %s", __func__, n, str) +#define FAILNMERR(str, n, m) err(-1, "%s %d %d: %s", __func__, n, m, str) +#define FAILERRX(str) errx(-1, "%s: %s", __func__, str) +#define FAILNERRX(str, n) errx(-1, "%s %d: %s", __func__, n, str) +#define FAILNMERRX(str, n, m) errx(-1, "%s %d %d: %s", __func__, n, m, str) + +static int ann = 0; + +#define ANN() (ann ? warnx("%s: start", __func__) : 0) +#define ANNN(n) (ann ? warnx("%s %d: start", __func__, (n)) : 0) +#define ANNNM(n, m) (ann ? warnx("%s %d %d: start", __func__, (n), (m)) : 0) + +#define OK() warnx("%s: ok", __func__) +#define OKN(n) warnx("%s %d: ok", __func__, (n)) +#define OKNM(n, m) warnx("%s %d %d: ok", __func__, (n), (m)) + +#ifdef SO_NOSIGPIPE +#define NEW_SOCKET(s) do { \ + int i; \ + \ + (s) = socket(PF_LOCAL, SOCK_SEQPACKET, 0); \ + if ((s) < 0) \ + FAILERR("socket"); \ + \ + i = 1; \ + if (setsockopt((s), SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_NOSIGPIPE"); \ + \ + i = SEQPACKET_RCVBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_RCVBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_RCVBUF"); \ + \ + i = SEQPACKET_SNDBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_SNDBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_SNDBUF"); \ +} while (0) +#else +#define NEW_SOCKET(s) do { \ + int i; \ + \ + (s) = socket(PF_LOCAL, SOCK_SEQPACKET, 0); \ + if ((s) < 0) \ + FAILERR("socket"); \ + \ + i = SEQPACKET_RCVBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_RCVBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_RCVBUF"); \ + \ + i = SEQPACKET_SNDBUF; \ + if (setsockopt((s), SOL_SOCKET, SO_SNDBUF, &i, sizeof(i)) < 0) \ + FAILERR("setsockopt SO_SNDBUF"); \ +} while (0) +#endif + +static void +server(int s_listen) +{ + char buffer[BUFLEN]; + ssize_t ssize_recv, ssize_send; + socklen_t socklen; + int i, s_accept; + + while (1) { + s_accept = accept(s_listen, NULL, 0); + if (s_accept >= 0) { + i = SEQPACKET_RCVBUF; + if (setsockopt(s_accept, SOL_SOCKET, SO_RCVBUF, &i, + sizeof(i)) < 0) { + warn("server: setsockopt SO_RCVBUF"); + close(s_accept); + continue; + } + + if (getsockopt(s_accept, SOL_SOCKET, SO_RCVBUF, &i, + &socklen) < 0) { + warn("server: getsockopt SO_RCVBUF"); + close(s_accept); + continue; + } + if (i != SEQPACKET_RCVBUF) { + warnx("server: getsockopt SO_RCVBUF wrong %d", + i); + close(s_accept); + continue; + } + + socklen = sizeof(i); + if (getsockopt(s_accept, SOL_SOCKET, SO_SNDBUF, &i, + &socklen) < 0) { + warn("server: getsockopt SO_SNDBUF"); + close(s_accept); + continue; + } + if (i != SEQPACKET_SNDBUF) { + warnx("server: getsockopt SO_SNDBUF wrong %d", + i); + close(s_accept); + continue; + } + + do { + ssize_recv = recv(s_accept, buffer, + sizeof(buffer), 0); + if (ssize_recv == 0) + break; + if (ssize_recv < 0) { + warn("server: recv"); + break; + } + ssize_send = send(s_accept, buffer, + ssize_recv, 0); + if (ssize_send == 0) + break; + if (ssize_send < 0) { + warn("server: send"); + break; + } + if (ssize_send != ssize_recv) + warnx("server: recv %d sent %d", + ssize_recv, ssize_send); + } while (1); + close(s_accept); + } else + warn("server: accept"); + } +} + +static void +test_connect(struct sockaddr_un *sun) +{ + int s; + + ANN(); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILERR("connect"); + (void)close(s); + OK(); +} + +static void +test_connect_send(struct sockaddr_un *sun) +{ + ssize_t ssize; + char ch; + int s; + + ANN(); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILERR("connect"); + ssize = send(s, &ch, sizeof(ch), 0); + if (ssize < 0) + FAILERR("send"); + if (ssize != sizeof(ch)) + FAILERRX("send wrong size"); + (void)close(s); + OK(); +} + +static void +test_connect_shutdown_send(struct sockaddr_un *sun) +{ + ssize_t ssize; + char ch; + int s; + + ANN(); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILERR("connect"); + if (shutdown(s, SHUT_RDWR) < 0) + FAILERR("shutdown SHUT_RDWR"); + ssize = send(s, &ch, sizeof(ch), 0); + if (ssize >= 0) + FAILERRX("send"); + if (errno != EPIPE) + FAILERR("send unexpected error"); + (void)close(s); + OK(); +} + +static void +test_connect_send_recv(struct sockaddr_un *sun, size_t size) +{ + char buf[size + 4]; /* Detect extra bytes. */ + size_t truncsize; + ssize_t ssize; + int s; + + ANNN(size); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILNERR("connect", size); + ssize = send(s, buf, size, 0); + if (ssize < 0 && size >= SEQPACKET_RCVBUF) + goto out; + if (ssize < 0) + FAILNERR("send", size); + if (ssize == 0) + FAILNERR("send eof", size); + if (ssize != size) + FAILNERRX("send size", size); + + truncsize = min(size, BUFLEN); + ssize = recv(s, buf, sizeof(buf), 0); + if (ssize < 0) + FAILNERR("recv", size); + if (ssize == 0) + FAILNERRX("recv eof", size); + if (ssize < truncsize) + FAILNERRX("recv too few bytes", size); + if (ssize > truncsize) + FAILNERRX("recv too many bytes", size); +out: + (void)close(s); + OKN(size); +} + +static void +test_connect_send_recv_count(struct sockaddr_un *sun, int count, size_t size) +{ + char buf[size + 4]; /* Detect extra bytes and coalescing. */ + size_t truncsize; + ssize_t ssize; + int i, s; + + ANNNM(size, count); + NEW_SOCKET(s); + if (connect(s, (struct sockaddr *)sun, sizeof(*sun)) < 0) + FAILNMERR("connect", size, count); + for (i = 0; i < count; i++) { + usleep(5000); + ssize = send(s, buf, size, 0); + if (ssize < 0 && size >= SEQPACKET_RCVBUF) + goto out; + if (ssize < 0) + FAILNMERR("send", size, count); + if (ssize == 0) + FAILNMERRX("send eof", size, count); + if (ssize != size) + FAILNMERRX("send size", size, count); + } + + truncsize = min(size, BUFLEN); + for (i = 0; i < count; i++) { + ssize = recv(s, buf, sizeof(buf), 0); + if (ssize < 0) + FAILNMERR("recv", size, count); + if (ssize == 0) + FAILNMERRX("recv eof", size, count); + if (ssize < truncsize) + FAILNMERRX("recv too few bytes", size, count); + if (ssize > truncsize) + FAILNMERRX("recv too many bytes", size, count); + } +out: + (void)close(s); + OKNM(size, count); +} + +static void +test_sendto(struct sockaddr_un *sun) +{ + ssize_t ssize; + char ch; + int s; + + ANN(); + NEW_SOCKET(s); + ssize = sendto(s, &ch, sizeof(ch), 0, (struct sockaddr *)sun, + sizeof(*sun)); + if (ssize < 0) + FAILERR("sendto"); + (void)close(s); + OK(); +} + +static void +client(struct sockaddr_un *sun) +{ + size_t sizes[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, + 4096, 8192, 16384, 32768, 65536 /*, 131072 */}; + int c, i; + + test_connect(sun); + test_connect_send(sun); + test_connect_shutdown_send(sun); + + /* + * Try a range of sizes and packet counts. + */ + for (i = 0; i < sizeof(sizes) / sizeof(sizes[0]); i++) + test_connect_send_recv(sun, sizes[i]); + for (c = 1; c <= 8; c++) { + for (i = 0; i < sizeof(sizes) / sizeof(sizes[0]); i++) + test_connect_send_recv_count(sun, c, sizes[i]); + } + test_sendto(sun); + printf("client done\n"); +} + +int +main(int argc, char *argv[]) +{ + struct sockaddr_un sun; + char path[PATH_MAX]; + pid_t pid_client, pid_server; + int i, s_listen; + + snprintf(path, sizeof(path), "/tmp/lds_exercise.XXXXXXXXX"); + if (mktemp(path) == NULL) + FAILERR("mktemp"); + + s_listen = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + if (s_listen < 0) { + (void)unlink(path); + FAILERR("socket"); + } + + i = SEQPACKET_RCVBUF; + if (setsockopt(s_listen, SOL_SOCKET, SO_RCVBUF, &i, sizeof(i)) < 0) { + (void)unlink(path); + FAILERR("setsockopt SO_RCVBUF"); + } + + i = SEQPACKET_SNDBUF; + if (setsockopt(s_listen, SOL_SOCKET, SO_SNDBUF, &i, sizeof(i)) < 0) { + (void)unlink(path); + FAILERR("setsockopt SO_SNDBUF"); + } + + i = 1; + if (setsockopt(s_listen, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i)) + < 0) { + (void)unlink(path); + FAILERR("setsockopt SO_NOSIGPIPE"); + } + + bzero(&sun, sizeof(sun)); + sun.sun_len = sizeof(sun); + sun.sun_family = AF_LOCAL; + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + + if (bind(s_listen, (struct sockaddr *)&sun, sizeof(sun)) < 0) { + (void)unlink(path); + FAILERR("bind"); + } + + if (listen(s_listen, -1) < 0) { + (void)unlink(path); + FAILERR("listen"); + } + + pid_server = fork(); + if (pid_server < 0) { + (void)unlink(path); + FAILERR("fork"); + } + if (pid_server == 0) { + server(s_listen); + return (0); + } + + pid_client = fork(); + if (pid_client < 0) { + (void)kill(pid_server, SIGKILL); + (void)unlink(path); + FAILERR("fork"); + } + if (pid_client == 0) { + client(&sun); + return (0); + } + + /* + * When the client is done, kill the server and clean up. + */ + (void)waitpid(pid_client, NULL, 0); + (void)kill(pid_server, SIGKILL); + (void)unlink(path); + return (0); +} From jkim at FreeBSD.org Mon Oct 5 16:26:55 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Mon Oct 5 16:27:01 2009 Subject: svn commit: r197783 - head/sys/dev/ata/chipsets Message-ID: <200910051626.n95GQs3T018031@svn.freebsd.org> Author: jkim Date: Mon Oct 5 16:26:54 2009 New Revision: 197783 URL: http://svn.freebsd.org/changeset/base/197783 Log: - Revert r191568 partially. Forcing AHCI mode by changing device subclass and progif is evil. It doesn't work reliably[1] and we should honor BIOS configuration by the user. - If the SATA controller is enbled but combined mode is disabled, mask off the emulated IDE channel on the legacy IDE controller. Pointed out by: mav[1] Modified: head/sys/dev/ata/chipsets/ata-ati.c Modified: head/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ati.c Mon Oct 5 15:45:25 2009 (r197782) +++ head/sys/dev/ata/chipsets/ata-ati.c Mon Oct 5 16:26:54 2009 (r197783) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -55,9 +54,6 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_ati_chipinit(device_t dev); static void ata_ati_setmode(device_t dev, int mode); -static void ata_ati_ahci_enable(device_t dev); -static int ata_ati_ahci_chipinit(device_t dev); -static int ata_ati_ahci_resume(device_t dev); /* misc defines */ #define ATI_PATA 0x01 @@ -66,13 +62,6 @@ static int ata_ati_ahci_resume(device_t #define SII_MEMIO 1 #define SII_BUG 0x04 -/* Misc Control Register */ -#define ATI_PCI_MISC_CTRL 0x40 -#define ATI_PCI_MISCCTRL_ENABLE_WR 0x00000001 - -/* Watchdog Control/Status Register */ -#define ATI_PCI_WD_CTRL 0x44 -#define ATI_PCI_WDCTRL_ENABLE 0x0001 /* * ATI chipset support functions @@ -121,19 +110,7 @@ ata_ati_probe(device_t dev) ctlr->chipinit = ata_sii_chipinit; break; case ATI_AHCI: - /* - * Force AHCI mode if IDE mode is set from BIOS. - */ - if ((ctlr->chip->chipid == ATA_ATI_IXP600_S1 || - ctlr->chip->chipid == ATA_ATI_IXP700_S1) && - pci_get_subclass(dev) == PCIS_STORAGE_IDE) { - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - cfg->subclass = PCIS_STORAGE_SATA; - cfg->progif = PCIP_STORAGE_SATA_AHCI_1_0; - ata_ati_ahci_enable(dev); - } - ctlr->chipinit = ata_ati_ahci_chipinit; + ctlr->chipinit = ata_ahci_chipinit; break; } return (BUS_PROBE_DEFAULT); @@ -143,13 +120,41 @@ static int ata_ati_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); + device_t smbdev; + int satacfg; if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; - /* IXP600 only has 1 PATA channel */ - if (ctlr->chip->chipid == ATA_ATI_IXP600) + switch (ctlr->chip->chipid) { + case ATA_ATI_IXP600: + /* IXP600 only has 1 PATA channel */ ctlr->channels = 1; + break; + case ATA_ATI_IXP700: + /* + * When "combined mode" is enabled, an additional PATA channel is + * emulated with two SATA ports and appears on this device. + * This mode can only be detected via SMB controller. + */ + smbdev = pci_find_device(ATA_ATI_ID, 0x4385); + if (smbdev != NULL) { + satacfg = pci_read_config(smbdev, 0xad, 1); + if (bootverbose) + device_printf(dev, "SATA controller %s (%s%s channel)\n", + (satacfg & 0x01) == 0 ? "disabled" : "enabled", + (satacfg & 0x08) == 0 ? "" : "combined mode, ", + (satacfg & 0x10) == 0 ? "primary" : "secondary"); + + /* + * If SATA controller is enabled but combined mode is disabled, + * we have only one PATA channel. Ignore a non-existent channel. + */ + if ((satacfg & 0x09) == 0x01) + ctlr->ichannels &= ~(1 << ((satacfg & 0x10) >> 4)); + } + break; + } ctlr->setmode = ata_ati_setmode; return 0; @@ -219,43 +224,6 @@ ata_ati_setmode(device_t dev, int mode) } } -static void -ata_ati_ahci_enable(device_t dev) -{ - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - uint32_t ctrl; - - ctrl = pci_read_config(dev, ATI_PCI_MISC_CTRL, 4); - pci_write_config(dev, ATI_PCI_MISC_CTRL, - ctrl | ATI_PCI_MISCCTRL_ENABLE_WR, 4); - pci_write_config(dev, PCIR_SUBCLASS, cfg->subclass, 1); - pci_write_config(dev, PCIR_PROGIF, cfg->progif, 1); - pci_write_config(dev, ATI_PCI_WD_CTRL, - pci_read_config(dev, ATI_PCI_WD_CTRL, 2) | ATI_PCI_WDCTRL_ENABLE, 2); - pci_write_config(dev, ATI_PCI_MISC_CTRL, - ctrl & ~ATI_PCI_MISCCTRL_ENABLE_WR, 4); -} - -static int -ata_ati_ahci_chipinit(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(dev); - int error; - - error = ata_ahci_chipinit(dev); - ctlr->resume = ata_ati_ahci_resume; - return (error); -} - -static int -ata_ati_ahci_resume(device_t dev) -{ - - ata_ati_ahci_enable(dev); - return (ata_ahci_ctlr_reset(dev)); -} - ATA_DECLARE_DRIVER(ata_ati); MODULE_DEPEND(ata_ati, ata_ahci, 1, 1, 1); MODULE_DEPEND(ata_ati, ata_sii, 1, 1, 1); From gnn at FreeBSD.org Mon Oct 5 18:20:37 2009 From: gnn at FreeBSD.org (George V. Neville-Neil) Date: Mon Oct 5 18:20:49 2009 Subject: svn commit: r197784 - svnadmin/conf Message-ID: <200910051820.n95IKbVE021052@svn.freebsd.org> Author: gnn Date: Mon Oct 5 18:20:36 2009 New Revision: 197784 URL: http://svn.freebsd.org/changeset/base/197784 Log: Free Navdeep from membership and promote him to project status. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Oct 5 16:26:54 2009 (r197783) +++ svnadmin/conf/mentors Mon Oct 5 18:20:36 2009 (r197784) @@ -20,7 +20,6 @@ jinmei gnn lstewart gnn neel imp nork imp -np gnn rdivacky ed remko imp rmacklem rwatson Co-mentor: kib From des at FreeBSD.org Mon Oct 5 18:55:14 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 18:55:26 2009 Subject: svn commit: r197785 - head/crypto/openssh Message-ID: <200910051855.n95ItDOj021922@svn.freebsd.org> Author: des Date: Mon Oct 5 18:55:13 2009 New Revision: 197785 URL: http://svn.freebsd.org/changeset/base/197785 Log: Add more symbols that need to be masked: - initialized and uninitialized data - symbols from roaming_dummy.c which end up in pam_ssh Update the command line used to generate the #defines. Modified: head/crypto/openssh/ssh_namespace.h Modified: head/crypto/openssh/ssh_namespace.h ============================================================================== --- head/crypto/openssh/ssh_namespace.h Mon Oct 5 18:20:36 2009 (r197784) +++ head/crypto/openssh/ssh_namespace.h Mon Oct 5 18:55:13 2009 (r197785) @@ -7,7 +7,7 @@ * * A list of symbols which need munging is obtained as follows: * - * nm libssh.a | awk '$2 == "T" && $3 !~ /^ssh_/ { print "#define", $3, "ssh_" $3 }' + * nm libssh.a | awk '/[0-9a-z] [A-Z] / && $3 !~ /^ssh_/ { print "#define", $3, "ssh_" $3 }' * * $FreeBSD$ */ @@ -18,6 +18,7 @@ #define acss_setkey ssh_acss_setkey #define acss_setsubkey ssh_acss_setsubkey #define add_host_to_hostfile ssh_add_host_to_hostfile +#define add_recv_bytes ssh_add_recv_bytes #define addargs ssh_addargs #define addr_match_list ssh_addr_match_list #define ask_permission ssh_ask_permission @@ -111,6 +112,8 @@ #define channel_open_message ssh_channel_open_message #define channel_output_poll ssh_channel_output_poll #define channel_permit_all_opens ssh_channel_permit_all_opens +#define channel_post ssh_channel_post +#define channel_pre ssh_channel_pre #define channel_prepare_select ssh_channel_prepare_select #define channel_print_adm_permitted_opens ssh_channel_print_adm_permitted_opens #define channel_register_cleanup ssh_channel_register_cleanup @@ -150,14 +153,19 @@ #define cipher_set_key_string ssh_cipher_set_key_string #define cipher_set_keycontext ssh_cipher_set_keycontext #define cipher_set_keyiv ssh_cipher_set_keyiv +#define ciphers ssh_ciphers #define ciphers_valid ssh_ciphers_valid #define cleanhostname ssh_cleanhostname #define cleanup_exit ssh_cleanup_exit #define clear_cached_addr ssh_clear_cached_addr #define colon ssh_colon +#define compat13 ssh_compat13 +#define compat20 ssh_compat20 #define compat_cipher_proposal ssh_compat_cipher_proposal #define compat_datafellows ssh_compat_datafellows #define convtime ssh_convtime +#define current_keys ssh_current_keys +#define datafellows ssh_datafellows #define debug ssh_debug #define debug ssh_debug #define debug2 ssh_debug2 @@ -175,6 +183,7 @@ #define dh_new_group14 ssh_dh_new_group14 #define dh_new_group_asc ssh_dh_new_group_asc #define dh_pub_is_valid ssh_dh_pub_is_valid +#define dispatch ssh_dispatch #define dispatch_init ssh_dispatch_init #define dispatch_protocol_error ssh_dispatch_protocol_error #define dispatch_protocol_ignore ssh_dispatch_protocol_ignore @@ -205,6 +214,7 @@ #define get_local_port ssh_get_local_port #define get_peer_ipaddr ssh_get_peer_ipaddr #define get_peer_port ssh_get_peer_port +#define get_recv_bytes ssh_get_recv_bytes #define get_remote_ipaddr ssh_get_remote_ipaddr #define get_remote_name_or_ip ssh_get_remote_name_or_ip #define get_remote_port ssh_get_remote_port @@ -216,6 +226,7 @@ #define host_hash ssh_host_hash #define hostfile_read_key ssh_hostfile_read_key #define hpdelim ssh_hpdelim +#define incoming_stream ssh_incoming_stream #define init_rng ssh_init_rng #define ipv64_normalise_mapped ssh_ipv64_normalise_mapped #define kex_derive_keys ssh_kex_derive_keys @@ -268,6 +279,7 @@ #define mac_init ssh_mac_init #define mac_setup ssh_mac_setup #define mac_valid ssh_mac_valid +#define macs ssh_macs #define match_host_and_ip ssh_match_host_and_ip #define match_hostname ssh_match_hostname #define match_list ssh_match_list @@ -279,6 +291,7 @@ #define ms_subtract_diff ssh_ms_subtract_diff #define ms_to_timeval ssh_ms_to_timeval #define mysignal ssh_mysignal +#define outgoing_stream ssh_outgoing_stream #define packet_add_padding ssh_packet_add_padding #define packet_backup_state ssh_packet_backup_state #define packet_close ssh_packet_close @@ -363,9 +376,13 @@ #define refresh_progress_meter ssh_refresh_progress_meter #define replacearg ssh_replacearg #define restore_uid ssh_restore_uid +#define resume_in_progress ssh_resume_in_progress +#define resume_kex ssh_resume_kex #define rijndael_decrypt ssh_rijndael_decrypt #define rijndael_encrypt ssh_rijndael_encrypt #define rijndael_set_key ssh_rijndael_set_key +#define roaming_read ssh_roaming_read +#define roaming_write ssh_roaming_write #define rsa_generate_additional_parameters ssh_rsa_generate_additional_parameters #define rsa_private_decrypt ssh_rsa_private_decrypt #define rsa_public_encrypt ssh_rsa_public_encrypt @@ -393,6 +410,7 @@ #define tty_make_modes ssh_tty_make_modes #define tty_parse_modes ssh_tty_parse_modes #define tun_open ssh_tun_open +#define umac_ctx ssh_umac_ctx #define umac_delete ssh_umac_delete #define umac_final ssh_umac_final #define umac_new ssh_umac_new From des at FreeBSD.org Mon Oct 5 18:56:18 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Mon Oct 5 18:56:29 2009 Subject: svn commit: r197786 - head/lib/libpam/modules/pam_ssh Message-ID: <200910051856.n95IuIow021985@svn.freebsd.org> Author: des Date: Mon Oct 5 18:56:18 2009 New Revision: 197786 URL: http://svn.freebsd.org/changeset/base/197786 Log: pam_ssh needs roaming_dummy to link correctly against libssh. Modified: head/lib/libpam/modules/pam_ssh/Makefile Modified: head/lib/libpam/modules/pam_ssh/Makefile ============================================================================== --- head/lib/libpam/modules/pam_ssh/Makefile Mon Oct 5 18:55:13 2009 (r197785) +++ head/lib/libpam/modules/pam_ssh/Makefile Mon Oct 5 18:56:18 2009 (r197786) @@ -7,6 +7,9 @@ LIB= pam_ssh MAN= pam_ssh.8 SRCS= pam_ssh.c +# required when linking with a dynamic libssh +SRCS+= roaming_dummy.c + WARNS?= 0 CFLAGS+= -I${SSHDIR} -include ssh_namespace.h From yongari at FreeBSD.org Mon Oct 5 19:29:26 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Mon Oct 5 19:29:42 2009 Subject: svn commit: r197787 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/de dev/xen/xenpci Message-ID: <200910051929.n95JTPDg022869@svn.freebsd.org> Author: yongari Date: Mon Oct 5 19:29:25 2009 New Revision: 197787 URL: http://svn.freebsd.org/changeset/base/197787 Log: MFC r197461: Use __NO_STRICT_ALIGNMENT to determine whether de(4) have to apply alignment fixup code for received frames on strict alignment architectures. MFC r197463: Consistently use bus_addr_t. MFC r197464: Destroy dmamap in dma cleanup. MFC r197465: Align Tx/Rx descriptors on 32 bytes boundary instead of PAGE_SIZE. Also align setup descriptor on 32 bytes boundary. Tx buffer have no alignment limitation so create dmamap without alignment restriction[1]. Rx buffer still seems to require 4 bytes alignment limitation but we can simply use MCLBYTES for size to map the buffer instead of TULIP_DATA_PER_DESC as the buffer is allocated with m_getcl(9). de(4) supports up to TULIP_MAX_TXSEG segments for Tx buffers, increase maximum dma segment size to TULIP_MAX_TXSEG * MCLBYTES. While I'm here remove TULIP_DATA_PER_DESC as it is not used anymore. This should fix de(4) breakage introduced after r176206. Submitted by: jhb [1] Reported by: WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp > Tested by: WATANABE Kazuhiro < CQG00620 <> nifty dot ne dot jp >, Takahashi Yoshihiro < nyan <> jp dot freebsd dot org > Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/de/if_de.c stable/8/sys/dev/de/if_devar.h stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/de/if_de.c ============================================================================== --- stable/8/sys/dev/de/if_de.c Mon Oct 5 18:56:18 2009 (r197786) +++ stable/8/sys/dev/de/if_de.c Mon Oct 5 19:29:25 2009 (r197787) @@ -160,7 +160,7 @@ static void tulip_dma_map_rxbuf(void *, static void tulip_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - u_int32_t *paddr; + bus_addr_t *paddr; if (error) return; @@ -182,7 +182,7 @@ tulip_dma_map_rxbuf(void *arg, bus_dma_s KASSERT(nseg == 1, ("too many DMA segments")); KASSERT(segs[0].ds_len >= TULIP_RX_BUFLEN, ("receive buffer too small")); - desc->d_addr1 = segs[0].ds_addr; + desc->d_addr1 = segs[0].ds_addr & 0xffffffff; desc->d_length1 = TULIP_RX_BUFLEN; #ifdef not_needed /* These should already always be zero. */ @@ -3171,8 +3171,8 @@ tulip_reset(tulip_softc_t * const sc) sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } - TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr); - TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr); + TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr & 0xffffffff); + TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr & 0xffffffff); TULIP_CSR_WRITE(sc, csr_busmode, (1 << (3 /*pci_max_burst_len*/ + 8)) |TULIP_BUSMODE_CACHE_ALIGN8 @@ -3488,7 +3488,7 @@ tulip_rx_intr(tulip_softc_t * const sc) struct mbuf *m0; KASSERT(ms != NULL, ("no packet to accept")); -#if defined(TULIP_COPY_RXDATA) +#ifndef __NO_STRICT_ALIGNMENT /* * Copy the data into a new mbuf that is properly aligned. If * we fail to allocate a new mbuf, then drop the packet. We will @@ -3527,7 +3527,7 @@ tulip_rx_intr(tulip_softc_t * const sc) */ ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); -#if defined(TULIP_COPY_RXDATA) +#ifndef __NO_STRICT_ALIGNMENT skip_input: #endif if (ms == NULL) { @@ -4016,9 +4016,9 @@ tulip_txput(tulip_softc_t * const sc, st eop = nextout; eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; eop->di_desc->d_status = d_status; - eop->di_desc->d_addr1 = segs[segcnt].ds_addr; + eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff; eop->di_desc->d_length1 = segs[segcnt].ds_len; - eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr; + eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr & 0xffffffff; eop->di_desc->d_length2 = segs[segcnt+1].ds_len; d_status = TULIP_DSTS_OWNER; if (++nextout == ri->ri_last) @@ -4028,7 +4028,7 @@ tulip_txput(tulip_softc_t * const sc, st eop = nextout; eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN; eop->di_desc->d_status = d_status; - eop->di_desc->d_addr1 = segs[segcnt].ds_addr; + eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff; eop->di_desc->d_length1 = segs[segcnt].ds_len; eop->di_desc->d_addr2 = 0; eop->di_desc->d_length2 = 0; @@ -4194,7 +4194,7 @@ tulip_txput_setup(tulip_softc_t * const nextout->d_length2 = 0; nextout->d_addr2 = 0; nextout->d_length1 = sizeof(sc->tulip_setupdata); - nextout->d_addr1 = sc->tulip_setup_dma_addr; + nextout->d_addr1 = sc->tulip_setup_dma_addr & 0xffffffff; bus_dmamap_sync(sc->tulip_setup_tag, sc->tulip_setup_map, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); TULIP_TXDESC_PRESYNC(ri); @@ -4491,7 +4491,7 @@ tulip_busdma_freering(tulip_ringinfo_t * /* Allocate memory for a single descriptor ring. */ static int tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count, - bus_size_t maxsize, int nsegs, tulip_ringinfo_t *ri, const char *name) + bus_size_t align, int nsegs, tulip_ringinfo_t *ri, const char *name) { size_t size; int error, i; @@ -4499,7 +4499,7 @@ tulip_busdma_allocring(device_t dev, tul /* First, setup a tag. */ ri->ri_max = count; size = count * sizeof(tulip_desc_t); - error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT, + error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL, &ri->ri_ring_tag); if (error) { @@ -4527,9 +4527,9 @@ tulip_busdma_allocring(device_t dev, tul } /* Allocate a tag for the data buffers. */ - error = bus_dma_tag_create(NULL, 4, 0, + error = bus_dma_tag_create(NULL, align, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - maxsize, nsegs, TULIP_DATA_PER_DESC, 0, NULL, NULL, &ri->ri_data_tag); + MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag); if (error) { device_printf(dev, "failed to allocate %s buffer dma tag\n", name); return (error); @@ -4563,6 +4563,7 @@ tulip_busdma_cleanup(tulip_softc_t * con if (sc->tulip_setupbuf != NULL) { bus_dmamem_free(sc->tulip_setup_tag, sc->tulip_setupbuf, sc->tulip_setup_map); + bus_dmamap_destroy(sc->tulip_setup_tag, sc->tulip_setup_map); sc->tulip_setup_map = NULL; sc->tulip_setupbuf = NULL; } @@ -4586,8 +4587,8 @@ tulip_busdma_init(device_t dev, tulip_so /* * Allocate space and dmamap for transmit ring. */ - error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, TULIP_DATA_PER_DESC, - TULIP_MAX_TXSEG, &sc->tulip_txinfo, "transmit"); + error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, 1, TULIP_MAX_TXSEG, + &sc->tulip_txinfo, "transmit"); if (error) return (error); @@ -4598,7 +4599,7 @@ tulip_busdma_init(device_t dev, tulip_so * a waste in practice though as an ethernet frame can easily fit * in TULIP_RX_BUFLEN bytes. */ - error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, MCLBYTES, 1, + error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, 4, 1, &sc->tulip_rxinfo, "receive"); if (error) return (error); @@ -4606,7 +4607,7 @@ tulip_busdma_init(device_t dev, tulip_so /* * Allocate a DMA tag, memory, and map for setup descriptor */ - error = bus_dma_tag_create(NULL, 4, 0, + error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0, NULL, NULL, &sc->tulip_setup_tag); Modified: stable/8/sys/dev/de/if_devar.h ============================================================================== --- stable/8/sys/dev/de/if_devar.h Mon Oct 5 18:56:18 2009 (r197786) +++ stable/8/sys/dev/de/if_devar.h Mon Oct 5 19:29:25 2009 (r197787) @@ -104,7 +104,7 @@ typedef struct { tulip_descinfo_t *ri_descinfo; bus_dma_tag_t ri_ring_tag; bus_dmamap_t ri_ring_map; - uint32_t ri_dma_addr; + bus_addr_t ri_dma_addr; bus_dma_tag_t ri_data_tag; bus_dmamap_t *ri_data_maps; } tulip_ringinfo_t; @@ -134,11 +134,7 @@ typedef struct { * architecture which can't handle unaligned accesses) because with * 100Mb/s cards the copying is just too much of a hit. */ -#if !defined(__i386__) -#define TULIP_COPY_RXDATA 1 -#endif -#define TULIP_DATA_PER_DESC 2032 #define TULIP_TXTIMER 4 #define TULIP_RXDESCS 48 #define TULIP_TXDESCS 128 @@ -560,7 +556,7 @@ struct tulip_softc { */ bus_dma_tag_t tulip_setup_tag; bus_dmamap_t tulip_setup_map; - uint32_t tulip_setup_dma_addr; + bus_addr_t tulip_setup_dma_addr; u_int32_t *tulip_setupbuf; u_int32_t tulip_setupdata[192 / sizeof(u_int32_t)]; char tulip_boardid[24]; From bcr at FreeBSD.org Mon Oct 5 19:29:49 2009 From: bcr at FreeBSD.org (Benedict Reuschling) Date: Mon Oct 5 19:29:58 2009 Subject: svn commit: r197788 - head/usr.bin/calendar/calendars Message-ID: <200910051929.n95JTnbD022940@svn.freebsd.org> Author: bcr (doc committer) Date: Mon Oct 5 19:29:49 2009 New Revision: 197788 URL: http://svn.freebsd.org/changeset/base/197788 Log: Belatedly add my calendar entry. Discussed with: remko Approved by: remko, jkois (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Oct 5 19:29:25 2009 (r197787) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Oct 5 19:29:49 2009 (r197788) @@ -244,6 +244,7 @@ 09/10 Wesley R. Peters born in Hartford, Alabama, United States, 1961 09/12 Weongyo Jeong born in Haman, Korea, 1980 09/12 William C. Fumerola II born in Detroit, Michigan, United States, 1981 +09/12 Benedict Christopher Reuschling born in Darmstadt, Germany, 1981 09/15 Dima Panov born in Khabarovsk, Russian Federation, 1978 09/17 Maxim Bolotin born in Rostov-on-Don, Russian Federation, 1976 09/20 Kevin Lo born in Taipei, Taiwan, Republic of China, 1972 From trasz at FreeBSD.org Mon Oct 5 19:56:57 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Oct 5 19:57:03 2009 Subject: svn commit: r197789 - head/sys/kern Message-ID: <200910051956.n95Juu6T023638@svn.freebsd.org> Author: trasz Date: Mon Oct 5 19:56:56 2009 New Revision: 197789 URL: http://svn.freebsd.org/changeset/base/197789 Log: Fix NFSv4 ACLs on sparc64. Turns out that fuword(9) fetches 64 bits instead of sizeof(int), and on sparc64 that resulted in fetching wrong value for acl_maxcnt, which in turn caused __acl_get_link(2) to fail with EINVAL. PR: sparc64/139304 Submitted by: Dmitry Afanasiev Modified: head/sys/kern/vfs_acl.c Modified: head/sys/kern/vfs_acl.c ============================================================================== --- head/sys/kern/vfs_acl.c Mon Oct 5 19:29:49 2009 (r197788) +++ head/sys/kern/vfs_acl.c Mon Oct 5 19:56:56 2009 (r197789) @@ -161,7 +161,7 @@ acl_copyout(struct acl *kernel_acl, void break; default: - if (fuword((char *)user_acl + + if (fuword32((char *)user_acl + offsetof(struct acl, acl_maxcnt)) != ACL_MAX_ENTRIES) return (EINVAL); From hrs at FreeBSD.org Mon Oct 5 20:11:33 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Oct 5 20:11:40 2009 Subject: svn commit: r197790 - head/etc Message-ID: <200910052011.n95KBXdS024044@svn.freebsd.org> Author: hrs Date: Mon Oct 5 20:11:33 2009 New Revision: 197790 URL: http://svn.freebsd.org/changeset/base/197790 Log: Fix a case when both ${name}_program and ${command} are defined. Spotted by: Michio "Karl" Jinbo Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Mon Oct 5 19:56:56 2009 (r197789) +++ head/etc/rc.subr Mon Oct 5 20:11:33 2009 (r197790) @@ -602,7 +602,7 @@ run_rc_command() esac eval _override_command=\$${name}_program - command=${command:-${_override_command}} + command=${command:+${_override_command:-$command}} _keywords="start stop restart rcvar $extra_commands" rc_pid= From np at FreeBSD.org Mon Oct 5 20:21:41 2009 From: np at FreeBSD.org (Navdeep Parhar) Date: Mon Oct 5 20:21:54 2009 Subject: svn commit: r197791 - in head/sys: conf dev/cxgb dev/cxgb/common modules/cxgb/cxgb Message-ID: <200910052021.n95KLfDJ024351@svn.freebsd.org> Author: np Date: Mon Oct 5 20:21:41 2009 New Revision: 197791 URL: http://svn.freebsd.org/changeset/base/197791 Log: cxgb(4) updates, including: - support for the new Gen-2, BT, and LP-CR cards. - T3 firmware 7.7.0 - shared "common code" updates. Approved by: gnn (mentor) Obtained from: Chelsio MFC after: 1 month Added: head/sys/dev/cxgb/common/cxgb_aq100x.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgb/common/cxgb_ael1002.c head/sys/dev/cxgb/common/cxgb_common.h head/sys/dev/cxgb/common/cxgb_mv88e1xxx.c head/sys/dev/cxgb/common/cxgb_regs.h head/sys/dev/cxgb/common/cxgb_t3_hw.c head/sys/dev/cxgb/common/cxgb_tn1010.c head/sys/dev/cxgb/common/cxgb_vsc8211.c head/sys/dev/cxgb/common/cxgb_xgmac.c head/sys/dev/cxgb/cxgb_adapter.h head/sys/dev/cxgb/cxgb_main.c head/sys/dev/cxgb/cxgb_osdep.h head/sys/dev/cxgb/cxgb_t3fw.h head/sys/modules/cxgb/cxgb/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Oct 5 20:11:33 2009 (r197790) +++ head/sys/conf/files Mon Oct 5 20:21:41 2009 (r197791) @@ -774,6 +774,8 @@ dev/cxgb/common/cxgb_vsc8211.c optional compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_ael1002.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" +dev/cxgb/common/cxgb_aq100x.c optional cxgb pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_mv88e1xxx.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/common/cxgb_xgmac.c optional cxgb pci \ Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_ael1002.c Mon Oct 5 20:11:33 2009 (r197790) +++ head/sys/dev/cxgb/common/cxgb_ael1002.c Mon Oct 5 20:21:41 2009 (r197791) @@ -45,16 +45,30 @@ enum { enum { AEL100X_TX_DISABLE = 9, AEL100X_TX_CONFIG1 = 0xc002, + AEL1002_PWR_DOWN_HI = 0xc011, AEL1002_PWR_DOWN_LO = 0xc012, AEL1002_XFI_EQL = 0xc015, AEL1002_LB_EN = 0xc017, + AEL_OPT_SETTINGS = 0xc017, AEL_I2C_CTRL = 0xc30a, AEL_I2C_DATA = 0xc30b, AEL_I2C_STAT = 0xc30c, + AEL2005_GPIO_CTRL = 0xc214, AEL2005_GPIO_STAT = 0xc215, + + AEL2020_GPIO_INTR = 0xc103, + AEL2020_GPIO_CTRL = 0xc108, + AEL2020_GPIO_STAT = 0xc10c, + AEL2020_GPIO_CFG = 0xc110, + + AEL2020_GPIO_SDA = 0, + AEL2020_GPIO_MODDET = 1, + AEL2020_GPIO_0 = 3, + AEL2020_GPIO_1 = 2, + AEL2020_GPIO_LSTAT = AEL2020_GPIO_1, }; enum { edc_none, edc_sr, edc_twinax }; @@ -81,7 +95,7 @@ struct reg_val { unsigned short set_bits; }; -static int get_module_type(struct cphy *phy); +static int ael2xxx_get_module_type(struct cphy *phy, int delay_ms); static int set_phy_regs(struct cphy *phy, const struct reg_val *rv) { @@ -108,6 +122,9 @@ static void ael100x_txon(struct cphy *ph msleep(30); } +/* + * Read an 8-bit word from a device attached to the PHY's i2c bus. + */ static int ael_i2c_rd(struct cphy *phy, int dev_addr, int word_addr) { int i, err; @@ -131,11 +148,14 @@ static int ael_i2c_rd(struct cphy *phy, return data >> 8; } } - CH_WARN(phy->adapter, "PHY %u I2C read of addr %u timed out\n", - phy->addr, word_addr); + CH_WARN(phy->adapter, "PHY %u i2c read of dev.addr %x.%x timed out\n", + phy->addr, dev_addr, word_addr); return -ETIMEDOUT; } +/* + * Write an 8-bit word to a device attached to the PHY's i2c bus. + */ static int ael_i2c_wr(struct cphy *phy, int dev_addr, int word_addr, int data) { int i, err; @@ -158,8 +178,8 @@ static int ael_i2c_wr(struct cphy *phy, if ((stat & 3) == 1) return 0; } - CH_WARN(phy->adapter, "PHY %u I2C Write of addr %u timed out\n", - phy->addr, word_addr); + CH_WARN(phy->adapter, "PHY %u i2c Write of dev.addr %x.%x = %#x timed out\n", + phy->addr, dev_addr, word_addr, data); return -ETIMEDOUT; } @@ -230,9 +250,9 @@ static int ael1002_get_module_type(struc if (delay_ms) msleep(delay_ms); - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0); + v = ael2xxx_get_module_type(phy, delay_ms); - return v == -ETIMEDOUT ? phy_modtype_none : get_module_type(phy); + return (v == -ETIMEDOUT ? phy_modtype_none : v); } static int ael1002_reset(struct cphy *phy, int wait) @@ -312,12 +332,13 @@ static struct cphy_ops ael1002_ops = { }; #endif -int t3_ael1002_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, +int t3_ael1002_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops) { int err; + struct cphy *phy = &pinfo->phy; - cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops, + cphy_init(phy, pinfo->adapter, pinfo, phy_addr, &ael1002_ops, mdio_ops, SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE, "10GBASE-R"); ael100x_txon(phy); @@ -366,12 +387,6 @@ static int ael1006_reset(struct cphy *ph } -static int ael1006_power_down(struct cphy *phy, int enable) -{ - return t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, - BMCR_PDOWN, enable ? BMCR_PDOWN : 0); -} - #ifdef C99_NOT_SUPPORTED static struct cphy_ops ael1006_ops = { ael1006_reset, @@ -385,7 +400,7 @@ static struct cphy_ops ael1006_ops = { NULL, NULL, get_link_status_r, - ael1006_power_down, + ael1002_power_down, }; #else static struct cphy_ops ael1006_ops = { @@ -395,20 +410,97 @@ static struct cphy_ops ael1006_ops = { .intr_clear = t3_phy_lasi_intr_clear, .intr_handler = t3_phy_lasi_intr_handler, .get_link_status = get_link_status_r, - .power_down = ael1006_power_down, + .power_down = ael1002_power_down, }; #endif -int t3_ael1006_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, +int t3_ael1006_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops) { - cphy_init(phy, adapter, phy_addr, &ael1006_ops, mdio_ops, + struct cphy *phy = &pinfo->phy; + + cphy_init(phy, pinfo->adapter, pinfo, phy_addr, &ael1006_ops, mdio_ops, SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE, "10GBASE-SR"); + phy->modtype = phy_modtype_sr; ael100x_txon(phy); return 0; } +/* + * Decode our module type. + */ +static int ael2xxx_get_module_type(struct cphy *phy, int delay_ms) +{ + int v; + + if (delay_ms) + msleep(delay_ms); + + v = get_phytrans_type(phy); + if (v == phy_transtype_sfp) { + /* SFP: see SFF-8472 for below */ + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 3); + if (v < 0) + return v; + + if (v == 0x1) + return phy_modtype_twinax; + if (v == 0x10) + return phy_modtype_sr; + if (v == 0x20) + return phy_modtype_lr; + if (v == 0x40) + return phy_modtype_lrm; + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 6); + if (v < 0) + return v; + if (v != 4) + return phy_modtype_unknown; + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 10); + if (v < 0) + return v; + + if (v & 0x80) { + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0x12); + if (v < 0) + return v; + return v > 10 ? phy_modtype_twinax_long : + phy_modtype_twinax; + } + } else if (v == phy_transtype_xfp) { + /* XFP: See INF-8077i for details. */ + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 127); + if (v < 0) + return v; + + if (v != 1) { + /* XXX: set page select to table 1 yourself */ + return phy_modtype_unknown; + } + + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 131); + if (v < 0) + return v; + v &= 0xf0; + if (v == 0x10) + return phy_modtype_lrm; + if (v == 0x40) + return phy_modtype_lr; + if (v == 0x80) + return phy_modtype_sr; + } + + return phy_modtype_unknown; +} + +/* + * Code to support the Aeluros/NetLogic 2005 10Gb PHY. + */ static int ael2005_setup_sr_edc(struct cphy *phy) { static struct reg_val regs[] = { @@ -1103,72 +1195,21 @@ static int ael2005_setup_twinax_edc(stru return err; } -static int get_module_type(struct cphy *phy) +static int ael2005_get_module_type(struct cphy *phy, int delay_ms) { int v; + unsigned int stat; - v = get_phytrans_type(phy); - if (v == phy_transtype_sfp) { - /* SFP: see SFF-8472 for below */ - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 3); - if (v < 0) - return v; - - if (v == 0x1) - return phy_modtype_twinax; - if (v == 0x10) - return phy_modtype_sr; - if (v == 0x20) - return phy_modtype_lr; - if (v == 0x40) - return phy_modtype_lrm; - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 6); - if (v < 0) - return v; - if (v != 4) - return phy_modtype_unknown; - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 10); - if (v < 0) - return v; - - if (v & 0x80) { - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0x12); - if (v < 0) - return v; - return v > 10 ? phy_modtype_twinax_long : - phy_modtype_twinax; - } - } else if (v == phy_transtype_xfp) { - /* XFP: See INF-8077i for details. */ - - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 127); - if (v < 0) - return v; - - if (v != 1) { - /* XXX: set page select to table 1 yourself */ - return phy_modtype_unknown; - } + v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat); + if (v) + return v; - v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 131); - if (v < 0) - return v; - v &= 0xf0; - if (v == 0x10) - return phy_modtype_lrm; - if (v == 0x40) - return phy_modtype_lr; - if (v == 0x80) - return phy_modtype_sr; - } + if (stat & (1 << 8)) /* module absent */ + return phy_modtype_none; - return phy_modtype_unknown; + return ael2xxx_get_module_type(phy, delay_ms); } - static int ael2005_intr_enable(struct cphy *phy) { int err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, 0x200); @@ -1187,24 +1228,6 @@ static int ael2005_intr_clear(struct cph return err ? err : t3_phy_lasi_intr_clear(phy); } -static int ael2005_get_module_type(struct cphy *phy, int delay_ms) -{ - int v; - unsigned int stat; - - v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2005_GPIO_CTRL, &stat); - if (v) - return v; - - if (stat & (1 << 8)) /* module absent */ - return phy_modtype_none; - - if (delay_ms) - msleep(delay_ms); - - return get_module_type(phy); -} - static int ael2005_reset(struct cphy *phy, int wait) { static struct reg_val regs0[] = { @@ -1223,7 +1246,8 @@ static int ael2005_reset(struct cphy *ph { 0, 0, 0, 0 } }; - int err, lasi_ctrl; + int err; + unsigned int lasi_ctrl; err = mdio_read(phy, MDIO_DEV_PMA_PMD, LASI_CTRL, &lasi_ctrl); if (err) @@ -1311,8 +1335,8 @@ static int ael2005_intr_handler(struct c return ret; } -#ifdef C99_NOT_SUPPORTED static struct cphy_ops ael2005_ops = { +#ifdef C99_NOT_SUPPORTED ael2005_reset, ael2005_intr_enable, ael2005_intr_disable, @@ -1325,9 +1349,7 @@ static struct cphy_ops ael2005_ops = { NULL, get_link_status_r, ael1002_power_down, -}; #else -static struct cphy_ops ael2005_ops = { .reset = ael2005_reset, .intr_enable = ael2005_intr_enable, .intr_disable = ael2005_intr_disable, @@ -1335,14 +1357,16 @@ static struct cphy_ops ael2005_ops = { .intr_handler = ael2005_intr_handler, .get_link_status = get_link_status_r, .power_down = ael1002_power_down, -}; #endif +}; -int t3_ael2005_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr, +int t3_ael2005_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops) { int err; - cphy_init(phy, adapter, phy_addr, &ael2005_ops, mdio_ops, + struct cphy *phy = &pinfo->phy; + + cphy_init(phy, pinfo->adapter, pinfo, phy_addr, &ael2005_ops, mdio_ops, SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE | SUPPORTED_IRQ, "10GBASE-R"); msleep(125); @@ -1357,6 +1381,713 @@ int t3_ael2005_phy_prep(struct cphy *phy } /* + * Setup EDC and other parameters for operation with an optical module. + */ +static int ael2020_setup_sr_edc(struct cphy *phy) +{ + static struct reg_val regs[] = { + { MDIO_DEV_PMA_PMD, 0xcc01, 0xffff, 0x488a }, + + { MDIO_DEV_PMA_PMD, 0xcb1b, 0xffff, 0x0200 }, + { MDIO_DEV_PMA_PMD, 0xcb1c, 0xffff, 0x00f0 }, + { MDIO_DEV_PMA_PMD, 0xcc06, 0xffff, 0x00e0 }, + + /* end */ + { 0, 0, 0, 0 } + }; + int err; + + err = set_phy_regs(phy, regs); + msleep(50); + if (err) + return err; + + phy->priv = edc_sr; + return 0; +} + +/* + * Setup EDC and other parameters for operation with an TWINAX module. + */ +static int ael2020_setup_twinax_edc(struct cphy *phy, int modtype) +{ + static struct reg_val uCclock40MHz[] = { + { MDIO_DEV_PMA_PMD, 0xff28, 0xffff, 0x4001 }, + { MDIO_DEV_PMA_PMD, 0xff2a, 0xffff, 0x0002 }, + { 0, 0, 0, 0 } + }; + + static struct reg_val uCclockActivate[] = { + { MDIO_DEV_PMA_PMD, 0xd000, 0xffff, 0x5200 }, + { 0, 0, 0, 0 } + }; + + static struct reg_val uCactivate[] = { + { MDIO_DEV_PMA_PMD, 0xd080, 0xffff, 0x0100 }, + { MDIO_DEV_PMA_PMD, 0xd092, 0xffff, 0x0000 }, + { 0, 0, 0, 0 } + }; + + static u16 twinax_edc[] = { + 0xd800, 0x4009, + 0xd801, 0x2fff, + 0xd802, 0x300f, + 0xd803, 0x40aa, + 0xd804, 0x401c, + 0xd805, 0x401e, + 0xd806, 0x2ff4, + 0xd807, 0x3dc4, + 0xd808, 0x2035, + 0xd809, 0x3035, + 0xd80a, 0x6524, + 0xd80b, 0x2cb2, + 0xd80c, 0x3012, + 0xd80d, 0x1002, + 0xd80e, 0x26e2, + 0xd80f, 0x3022, + 0xd810, 0x1002, + 0xd811, 0x27d2, + 0xd812, 0x3022, + 0xd813, 0x1002, + 0xd814, 0x2822, + 0xd815, 0x3012, + 0xd816, 0x1002, + 0xd817, 0x2492, + 0xd818, 0x3022, + 0xd819, 0x1002, + 0xd81a, 0x2772, + 0xd81b, 0x3012, + 0xd81c, 0x1002, + 0xd81d, 0x23d2, + 0xd81e, 0x3022, + 0xd81f, 0x1002, + 0xd820, 0x22cd, + 0xd821, 0x301d, + 0xd822, 0x27f2, + 0xd823, 0x3022, + 0xd824, 0x1002, + 0xd825, 0x5553, + 0xd826, 0x0307, + 0xd827, 0x2522, + 0xd828, 0x3022, + 0xd829, 0x1002, + 0xd82a, 0x2142, + 0xd82b, 0x3012, + 0xd82c, 0x1002, + 0xd82d, 0x4016, + 0xd82e, 0x5e63, + 0xd82f, 0x0344, + 0xd830, 0x2142, + 0xd831, 0x3012, + 0xd832, 0x1002, + 0xd833, 0x400e, + 0xd834, 0x2522, + 0xd835, 0x3022, + 0xd836, 0x1002, + 0xd837, 0x2b52, + 0xd838, 0x3012, + 0xd839, 0x1002, + 0xd83a, 0x2742, + 0xd83b, 0x3022, + 0xd83c, 0x1002, + 0xd83d, 0x25e2, + 0xd83e, 0x3022, + 0xd83f, 0x1002, + 0xd840, 0x2fa4, + 0xd841, 0x3dc4, + 0xd842, 0x6624, + 0xd843, 0x414b, + 0xd844, 0x56b3, + 0xd845, 0x03c6, + 0xd846, 0x866b, + 0xd847, 0x400c, + 0xd848, 0x2712, + 0xd849, 0x3012, + 0xd84a, 0x1002, + 0xd84b, 0x2c4b, + 0xd84c, 0x309b, + 0xd84d, 0x56b3, + 0xd84e, 0x03c3, + 0xd84f, 0x866b, + 0xd850, 0x400c, + 0xd851, 0x2272, + 0xd852, 0x3022, + 0xd853, 0x1002, + 0xd854, 0x2742, + 0xd855, 0x3022, + 0xd856, 0x1002, + 0xd857, 0x25e2, + 0xd858, 0x3022, + 0xd859, 0x1002, + 0xd85a, 0x2fb4, + 0xd85b, 0x3dc4, + 0xd85c, 0x6624, + 0xd85d, 0x56b3, + 0xd85e, 0x03c3, + 0xd85f, 0x866b, + 0xd860, 0x401c, + 0xd861, 0x2c45, + 0xd862, 0x3095, + 0xd863, 0x5b53, + 0xd864, 0x2372, + 0xd865, 0x3012, + 0xd866, 0x13c2, + 0xd867, 0x5cc3, + 0xd868, 0x2712, + 0xd869, 0x3012, + 0xd86a, 0x1312, + 0xd86b, 0x2b52, + 0xd86c, 0x3012, + 0xd86d, 0x1002, + 0xd86e, 0x2742, + 0xd86f, 0x3022, + 0xd870, 0x1002, + 0xd871, 0x2582, + 0xd872, 0x3022, + 0xd873, 0x1002, + 0xd874, 0x2142, + 0xd875, 0x3012, + 0xd876, 0x1002, + 0xd877, 0x628f, + 0xd878, 0x2985, + 0xd879, 0x33a5, + 0xd87a, 0x25e2, + 0xd87b, 0x3022, + 0xd87c, 0x1002, + 0xd87d, 0x5653, + 0xd87e, 0x03d2, + 0xd87f, 0x401e, + 0xd880, 0x6f72, + 0xd881, 0x1002, + 0xd882, 0x628f, + 0xd883, 0x2304, + 0xd884, 0x3c84, + 0xd885, 0x6436, + 0xd886, 0xdff4, + 0xd887, 0x6436, + 0xd888, 0x2ff5, + 0xd889, 0x3005, + 0xd88a, 0x8656, + 0xd88b, 0xdfba, + 0xd88c, 0x56a3, + 0xd88d, 0xd05a, + 0xd88e, 0x2972, + 0xd88f, 0x3012, + 0xd890, 0x1392, + 0xd891, 0xd05a, + 0xd892, 0x56a3, + 0xd893, 0xdfba, + 0xd894, 0x0383, + 0xd895, 0x6f72, + 0xd896, 0x1002, + 0xd897, 0x2b45, + 0xd898, 0x3005, + 0xd899, 0x4178, + 0xd89a, 0x5653, + 0xd89b, 0x0384, + 0xd89c, 0x2a62, + 0xd89d, 0x3012, + 0xd89e, 0x1002, + 0xd89f, 0x2f05, + 0xd8a0, 0x3005, + 0xd8a1, 0x41c8, + 0xd8a2, 0x5653, + 0xd8a3, 0x0382, + 0xd8a4, 0x0002, + 0xd8a5, 0x4218, + 0xd8a6, 0x2474, + 0xd8a7, 0x3c84, + 0xd8a8, 0x6437, + 0xd8a9, 0xdff4, + 0xd8aa, 0x6437, + 0xd8ab, 0x2ff5, + 0xd8ac, 0x3c05, + 0xd8ad, 0x8757, + 0xd8ae, 0xb888, + 0xd8af, 0x9787, + 0xd8b0, 0xdff4, + 0xd8b1, 0x6724, + 0xd8b2, 0x866a, + 0xd8b3, 0x6f72, + 0xd8b4, 0x1002, + 0xd8b5, 0x2641, + 0xd8b6, 0x3021, + 0xd8b7, 0x1001, + 0xd8b8, 0xc620, + 0xd8b9, 0x0000, + 0xd8ba, 0xc621, + 0xd8bb, 0x0000, + 0xd8bc, 0xc622, + 0xd8bd, 0x00ce, + 0xd8be, 0xc623, + 0xd8bf, 0x007f, + 0xd8c0, 0xc624, + 0xd8c1, 0x0032, + 0xd8c2, 0xc625, + 0xd8c3, 0x0000, + 0xd8c4, 0xc627, + 0xd8c5, 0x0000, + 0xd8c6, 0xc628, + 0xd8c7, 0x0000, + 0xd8c8, 0xc62c, + 0xd8c9, 0x0000, + 0xd8ca, 0x0000, + 0xd8cb, 0x2641, + 0xd8cc, 0x3021, + 0xd8cd, 0x1001, + 0xd8ce, 0xc502, + 0xd8cf, 0x53ac, + 0xd8d0, 0xc503, + 0xd8d1, 0x2cd3, + 0xd8d2, 0xc600, + 0xd8d3, 0x2a6e, + 0xd8d4, 0xc601, + 0xd8d5, 0x2a2c, + 0xd8d6, 0xc605, + 0xd8d7, 0x5557, + 0xd8d8, 0xc60c, + 0xd8d9, 0x5400, + 0xd8da, 0xc710, + 0xd8db, 0x0700, + 0xd8dc, 0xc711, + 0xd8dd, 0x0f06, + 0xd8de, 0xc718, + 0xd8df, 0x0700, + 0xd8e0, 0xc719, + 0xd8e1, 0x0f06, + 0xd8e2, 0xc720, + 0xd8e3, 0x4700, + 0xd8e4, 0xc721, + 0xd8e5, 0x0f06, + 0xd8e6, 0xc728, + 0xd8e7, 0x0700, + 0xd8e8, 0xc729, + 0xd8e9, 0x1207, + 0xd8ea, 0xc801, + 0xd8eb, 0x7f50, + 0xd8ec, 0xc802, + 0xd8ed, 0x7760, + 0xd8ee, 0xc803, + 0xd8ef, 0x7fce, + 0xd8f0, 0xc804, + 0xd8f1, 0x520e, + 0xd8f2, 0xc805, + 0xd8f3, 0x5c11, + 0xd8f4, 0xc806, + 0xd8f5, 0x3c51, + 0xd8f6, 0xc807, + 0xd8f7, 0x4061, + 0xd8f8, 0xc808, + 0xd8f9, 0x49c1, + 0xd8fa, 0xc809, + 0xd8fb, 0x3840, + 0xd8fc, 0xc80a, + 0xd8fd, 0x0000, + 0xd8fe, 0xc821, + 0xd8ff, 0x0002, + 0xd900, 0xc822, + 0xd901, 0x0046, + 0xd902, 0xc844, + 0xd903, 0x182f, + 0xd904, 0xc013, + 0xd905, 0xf341, + 0xd906, 0xc084, + 0xd907, 0x0030, + 0xd908, 0xc904, + 0xd909, 0x1401, + 0xd90a, 0xcb0c, + 0xd90b, 0x0004, + 0xd90c, 0xcb0e, + 0xd90d, 0xa00a, + 0xd90e, 0xcb0f, + 0xd90f, 0xc0c0, + 0xd910, 0xcb10, + 0xd911, 0xc0c0, + 0xd912, 0xcb11, + 0xd913, 0x00a0, + 0xd914, 0xcb12, + 0xd915, 0x0007, + 0xd916, 0xc241, + 0xd917, 0xa000, + 0xd918, 0xc243, + 0xd919, 0x7fe0, + 0xd91a, 0xc604, + 0xd91b, 0x000e, + 0xd91c, 0xc609, + 0xd91d, 0x00f5, + 0xd91e, 0xc611, + 0xd91f, 0x000e, + 0xd920, 0xc660, + 0xd921, 0x9600, + 0xd922, 0xc687, + 0xd923, 0x0004, + 0xd924, 0xc60a, + 0xd925, 0x04f5, + 0xd926, 0x0000, + 0xd927, 0x2641, + 0xd928, 0x3021, + 0xd929, 0x1001, + 0xd92a, 0xc620, + 0xd92b, 0x14e5, + 0xd92c, 0xc621, + 0xd92d, 0xc53d, + 0xd92e, 0xc622, + 0xd92f, 0x3cbe, + 0xd930, 0xc623, + 0xd931, 0x4452, + 0xd932, 0xc624, + 0xd933, 0xc5c5, + 0xd934, 0xc625, + 0xd935, 0xe01e, + 0xd936, 0xc627, + 0xd937, 0x0000, + 0xd938, 0xc628, + 0xd939, 0x0000, + 0xd93a, 0xc62c, + 0xd93b, 0x0000, + 0xd93c, 0x0000, + 0xd93d, 0x2b84, + 0xd93e, 0x3c74, + 0xd93f, 0x6435, + 0xd940, 0xdff4, + 0xd941, 0x6435, + 0xd942, 0x2806, + 0xd943, 0x3006, + 0xd944, 0x8565, + 0xd945, 0x2b24, + 0xd946, 0x3c24, + 0xd947, 0x6436, + 0xd948, 0x1002, + 0xd949, 0x2b24, + 0xd94a, 0x3c24, + 0xd94b, 0x6436, + 0xd94c, 0x4045, + 0xd94d, 0x8656, + 0xd94e, 0x5663, + 0xd94f, 0x0302, + 0xd950, 0x401e, + 0xd951, 0x1002, + 0xd952, 0x2807, + 0xd953, 0x31a7, + 0xd954, 0x20c4, + 0xd955, 0x3c24, + 0xd956, 0x6724, + 0xd957, 0x1002, + 0xd958, 0x2807, + 0xd959, 0x3187, + 0xd95a, 0x20c4, + 0xd95b, 0x3c24, + 0xd95c, 0x6724, + 0xd95d, 0x1002, + 0xd95e, 0x24f4, + 0xd95f, 0x3c64, + 0xd960, 0x6436, + 0xd961, 0xdff4, + 0xd962, 0x6436, + 0xd963, 0x1002, + 0xd964, 0x2006, + 0xd965, 0x3d76, + 0xd966, 0xc161, + 0xd967, 0x6134, + 0xd968, 0x6135, + 0xd969, 0x5443, + 0xd96a, 0x0303, + 0xd96b, 0x6524, + 0xd96c, 0x00fb, + 0xd96d, 0x1002, + 0xd96e, 0x20d4, + 0xd96f, 0x3c24, + 0xd970, 0x2025, + 0xd971, 0x3005, + 0xd972, 0x6524, + 0xd973, 0x1002, + 0xd974, 0xd019, + 0xd975, 0x2104, + 0xd976, 0x3c24, + 0xd977, 0x2105, + 0xd978, 0x3805, + 0xd979, 0x6524, + 0xd97a, 0xdff4, + 0xd97b, 0x4005, + 0xd97c, 0x6524, + 0xd97d, 0x2e8d, + 0xd97e, 0x303d, + 0xd97f, 0x2408, + 0xd980, 0x35d8, + 0xd981, 0x5dd3, + 0xd982, 0x0307, + 0xd983, 0x8887, + 0xd984, 0x63a7, + 0xd985, 0x8887, + 0xd986, 0x63a7, + 0xd987, 0xdffd, + 0xd988, 0x00f9, + 0xd989, 0x1002, + 0xd98a, 0x0000, + }; + int i, err; + + /* set uC clock and activate it */ + err = set_phy_regs(phy, uCclock40MHz); + msleep(500); + if (err) + return err; + err = set_phy_regs(phy, uCclockActivate); + msleep(500); + if (err) + return err; + + for (i = 0; i < ARRAY_SIZE(twinax_edc) && !err; i += 2) + err = mdio_write(phy, MDIO_DEV_PMA_PMD, twinax_edc[i], + twinax_edc[i + 1]); + /* activate uC */ + err = set_phy_regs(phy, uCactivate); + if (!err) + phy->priv = edc_twinax; + return err; +} + +/* + * Return Module Type. + */ +static int ael2020_get_module_type(struct cphy *phy, int delay_ms) +{ + int v; + unsigned int stat; + + v = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2020_GPIO_STAT, &stat); + if (v) + return v; + + if (stat & (0x1 << (AEL2020_GPIO_MODDET*4))) { + /* module absent */ + return phy_modtype_none; + } + + return ael2xxx_get_module_type(phy, delay_ms); +} + +/* + * Enable PHY interrupts. We enable "Module Detection" interrupts (on any + * state transition) and then generic Link Alarm Status Interrupt (LASI). + */ +static int ael2020_intr_enable(struct cphy *phy) +{ + struct reg_val regs[] = { + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CFG+AEL2020_GPIO_LSTAT, + 0xffff, 0x4 }, + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0x8 << (AEL2020_GPIO_LSTAT*4) }, + + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0x2 << (AEL2020_GPIO_MODDET*4) }, + + /* end */ + { 0, 0, 0, 0 } + }; + int err; + + err = set_phy_regs(phy, regs); + if (err) + return err; + + phy->caps |= POLL_LINK_1ST_TIME; + + /* enable standard Link Alarm Status Interrupts */ + err = t3_phy_lasi_intr_enable(phy); + if (err) + return err; + + return 0; +} + +/* + * Disable PHY interrupts. The mirror of the above ... + */ +static int ael2020_intr_disable(struct cphy *phy) +{ + struct reg_val regs[] = { + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0xb << (AEL2020_GPIO_LSTAT*4) }, + + { MDIO_DEV_PMA_PMD, AEL2020_GPIO_CTRL, + 0xffff, 0x1 << (AEL2020_GPIO_MODDET*4) }, + + /* end */ + { 0, 0, 0, 0 } + }; + int err; + + err = set_phy_regs(phy, regs); + if (err) + return err; + + /* disable standard Link Alarm Status Interrupts */ + return t3_phy_lasi_intr_disable(phy); +} + +/* + * Clear PHY interrupt state. + */ +static int ael2020_intr_clear(struct cphy *phy) +{ + unsigned int stat; + int err = mdio_read(phy, MDIO_DEV_PMA_PMD, AEL2020_GPIO_INTR, &stat); + return err ? err : t3_phy_lasi_intr_clear(phy); +} + +/* + * Common register settings for the AEL2020 when it comes out of reset. + */ +static struct reg_val ael2020_reset_regs[] = { + { MDIO_DEV_PMA_PMD, 0xc003, 0xffff, 0x3101 }, + + { MDIO_DEV_PMA_PMD, 0xcd40, 0xffff, 0x0001 }, + + { MDIO_DEV_PMA_PMD, 0xff02, 0xffff, 0x0023 }, + { MDIO_DEV_PMA_PMD, 0xff03, 0xffff, 0x0000 }, + { MDIO_DEV_PMA_PMD, 0xff04, 0xffff, 0x0000 }, + + /* end */ + { 0, 0, 0, 0 } +}; + +/* + * Reset the PHY and put it into a canonical operating state. + */ +static int ael2020_reset(struct cphy *phy, int wait) +{ + int err; + unsigned int lasi_ctrl; + + /* grab current interrupt state */ + err = mdio_read(phy, MDIO_DEV_PMA_PMD, LASI_CTRL, &lasi_ctrl); + if (err) + return err; + + err = t3_phy_reset(phy, MDIO_DEV_PMA_PMD, 125); + if (err) + return err; + msleep(100); + + /* basic initialization for all module types */ + phy->priv = edc_none; + err = set_phy_regs(phy, ael2020_reset_regs); + if (err) + return err; + + /* determine module type and perform appropriate initialization */ + err = ael2020_get_module_type(phy, 0); + if (err < 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From marcus at FreeBSD.org Mon Oct 5 20:38:37 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Mon Oct 5 20:38:44 2009 Subject: svn commit: r197792 - stable/8/lib/libc/gen Message-ID: <200910052038.n95KcbM9024887@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Mon Oct 5 20:38:36 2009 New Revision: 197792 URL: http://svn.freebsd.org/changeset/base/197792 Log: Add merginfo for the _pthread_stubs.c commit which merged r197681 to stable/8. Requested by: kib Approved by: re (kib) Modified: stable/8/lib/libc/gen/ (props changed) From delphij at FreeBSD.org Mon Oct 5 21:11:05 2009 From: delphij at FreeBSD.org (Xin LI) Date: Mon Oct 5 21:11:17 2009 Subject: svn commit: r197793 - head/lib/libc/gen Message-ID: <200910052111.n95LB5mH025841@svn.freebsd.org> Author: delphij Date: Mon Oct 5 21:11:04 2009 New Revision: 197793 URL: http://svn.freebsd.org/changeset/base/197793 Log: fts_open() requires that the list passed as argument to contain at least one path. When the list is empty (contain only a NULL pointer), return EINVAL instead of pretending to succeed, which will cause a NULL pointer deference in a later fts_read() call. Noticed by: Christoph Mallon (via rdivacky@) MFC after: 2 weeks Modified: head/lib/libc/gen/fts.3 head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.3 ============================================================================== --- head/lib/libc/gen/fts.3 Mon Oct 5 20:38:36 2009 (r197792) +++ head/lib/libc/gen/fts.3 Mon Oct 5 21:11:04 2009 (r197793) @@ -28,7 +28,7 @@ .\" @(#)fts.3 8.5 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd January 26, 2008 +.Dd October 5, 2009 .Dt FTS 3 .Os .Sh NAME @@ -776,7 +776,7 @@ may fail and set as follows: .Bl -tag -width Er .It Bq Er EINVAL -The options were invalid. +The options were invalid, or the list were empty. .El .Sh SEE ALSO .Xr find 1 , Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Mon Oct 5 20:38:36 2009 (r197792) +++ head/lib/libc/gen/fts.c Mon Oct 5 21:11:04 2009 (r197793) @@ -124,6 +124,12 @@ fts_open(argv, options, compar) return (NULL); } + /* fts_open() requires at least one path */ + if (*argv == NULL) { + errno = EINVAL; + return (NULL); + } + /* Allocate/initialize the stream. */ if ((priv = malloc(sizeof(*priv))) == NULL) return (NULL); From rwatson at FreeBSD.org Mon Oct 5 22:23:13 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 22:23:24 2009 Subject: svn commit: r197794 - head/sys/kern Message-ID: <200910052223.n95MNDc9027482@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 22:23:12 2009 New Revision: 197794 URL: http://svn.freebsd.org/changeset/base/197794 Log: Fix build on amd64, where sysctl arg1 is a pointer. Reported by: Mr Tinderbox MFC after: 3 months Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Mon Oct 5 21:11:04 2009 (r197793) +++ head/sys/kern/uipc_usrreq.c Mon Oct 5 22:23:12 2009 (r197794) @@ -1468,7 +1468,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) break; default: - panic("unp_pcblist: arg1 %d", (intptr_t)arg1); + panic("unp_pcblist: arg1 %d", (int)(intptr_t)arg1); } /* From rwatson at FreeBSD.org Mon Oct 5 22:24:14 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 5 22:24:25 2009 Subject: svn commit: r197795 - head/sys/netinet Message-ID: <200910052224.n95MOEXH027549@svn.freebsd.org> Author: rwatson Date: Mon Oct 5 22:24:13 2009 New Revision: 197795 URL: http://svn.freebsd.org/changeset/base/197795 Log: In tcp_input(), we acquire a global write lock at first only if a segment is likely to trigger a TCP state change (i.e., FIN/RST/SYN). If we later have to upgrade the lock, we acquire an inpcb reference and drop both global/inpcb locks before reacquiring in-order. In that gap, the connection may transition into TIMEWAIT, so we need to loop back and reevaluate the inpcb after relocking. MFC after: 3 days Reported by: Kamigishi Rei Reviewed by: bz Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon Oct 5 22:23:12 2009 (r197794) +++ head/sys/netinet/tcp_input.c Mon Oct 5 22:24:13 2009 (r197795) @@ -648,6 +648,7 @@ findpcb: * tried to free the inpcb, in which case we need to loop back and * try to find a new inpcb to deliver to. */ +relocked: if (inp->inp_flags & INP_TIMEWAIT) { KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, ("%s: INP_TIMEWAIT ti_locked %d", __func__, ti_locked)); @@ -698,7 +699,8 @@ findpcb: * We've identified a valid inpcb, but it could be that we need an * inpcbinfo write lock and have only a read lock. In this case, * attempt to upgrade/relock using the same strategy as the TIMEWAIT - * case above. + * case above. If we relock, we have to jump back to 'relocked' as + * the connection might now be in TIMEWAIT. */ if (tp->t_state != TCPS_ESTABLISHED || (thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || @@ -720,6 +722,7 @@ findpcb: goto findpcb; } tcp_wlock_relocked++; + goto relocked; } else { ti_locked = TI_WLOCKED; tcp_wlock_upgraded++; From dougb at FreeBSD.org Tue Oct 6 02:13:35 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Oct 6 02:13:45 2009 Subject: svn commit: r197797 - head/games/fortune/datfiles Message-ID: <200910060213.n962DWVr032502@svn.freebsd.org> Author: dougb Date: Tue Oct 6 02:13:32 2009 New Revision: 197797 URL: http://svn.freebsd.org/changeset/base/197797 Log: "Potluck Pogo" was a collection of Walt Kelly's "Pogo" cartoons first published in 1955. "Putluck Pogo" seems to be a typo. Modified: head/games/fortune/datfiles/fortunes head/games/fortune/datfiles/fortunes.sp.ok Modified: head/games/fortune/datfiles/fortunes ============================================================================== --- head/games/fortune/datfiles/fortunes Mon Oct 5 23:19:51 2009 (r197796) +++ head/games/fortune/datfiles/fortunes Tue Oct 6 02:13:32 2009 (r197797) @@ -18126,7 +18126,7 @@ tail on me, go ahead. They'd be very bo commenting on rumors of womanizing. % Food for thought is no substitute for the real thing. - -- Walt Kelly, "Putluck Pogo" + -- Walt Kelly, "Potluck Pogo" % Foolproof Operation: No provision for adjustment. Modified: head/games/fortune/datfiles/fortunes.sp.ok ============================================================================== --- head/games/fortune/datfiles/fortunes.sp.ok Mon Oct 5 23:19:51 2009 (r197796) +++ head/games/fortune/datfiles/fortunes.sp.ok Tue Oct 6 02:13:32 2009 (r197797) @@ -3300,6 +3300,7 @@ postjudice Postnews Postpetroleum potholes +Potluck potty Poul Pournelle @@ -3376,7 +3377,6 @@ Purshottam PUSHes pushy pussycats -Putluck Putt's PVLC PxP From maxim at FreeBSD.org Tue Oct 6 04:57:19 2009 From: maxim at FreeBSD.org (Maxim Konovalov) Date: Tue Oct 6 04:57:25 2009 Subject: svn commit: r197799 - head/share/man/man4 Message-ID: <200910060457.n964vJPT036055@svn.freebsd.org> Author: maxim Date: Tue Oct 6 04:57:18 2009 New Revision: 197799 URL: http://svn.freebsd.org/changeset/base/197799 Log: o Fix typo: "an in particular" -> "and in particular". PR: docs/139370 Submitted by: Kenyon Ralph MFC after: 1 week Modified: head/share/man/man4/de.4 Modified: head/share/man/man4/de.4 ============================================================================== --- head/share/man/man4/de.4 Tue Oct 6 03:53:29 2009 (r197798) +++ head/share/man/man4/de.4 Tue Oct 6 04:57:18 2009 (r197799) @@ -88,7 +88,7 @@ setup utility and are not changeable. .Pp Use the .Xr ifconfig 8 -command an in particular the +command and in particular the .Fl m flag to list the supported media types for your particular card. .Pp From alc at cs.rice.edu Tue Oct 6 08:01:58 2009 From: alc at cs.rice.edu (Alan Cox) Date: Tue Oct 6 08:02:05 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4ACA0F09.2010808@FreeBSD.org> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4AC9F4F4.4030008@FreeBSD.org> <4ACA0000.2080005@cs.rice.edu> <4ACA0F09.2010808@FreeBSD.org> Message-ID: <4ACAF96C.6070204@cs.rice.edu> John Baldwin wrote: > > Do you care what is in the padding in this case or more about just > having each mutex on a separate cache line? __aligned() is fine if > you don't mind the padding getting reused for something else. > Yes, I care. I would also like to prevent the placement of the heads of the active, inactive, and hold queues (vm_page_queues[]) in the same cache line as the free page queue mutex. Alan From des at FreeBSD.org Tue Oct 6 10:19:21 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Tue Oct 6 10:20:36 2009 Subject: svn commit: r197802 - head/crypto/openssh Message-ID: <200910061019.n96AJKjW043720@svn.freebsd.org> Author: des Date: Tue Oct 6 10:19:20 2009 New Revision: 197802 URL: http://svn.freebsd.org/changeset/base/197802 Log: Expand $FreeBSD$ Modified: head/crypto/openssh/sftp-server.8 (props changed) head/crypto/openssh/ssh-agent.1 (props changed) From attilio at FreeBSD.org Tue Oct 6 13:45:50 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Tue Oct 6 13:45:57 2009 Subject: svn commit: r197803 - in head/sys: amd64/include i386/include Message-ID: <200910061345.n96DjnS1048710@svn.freebsd.org> Author: attilio Date: Tue Oct 6 13:45:49 2009 New Revision: 197803 URL: http://svn.freebsd.org/changeset/base/197803 Log: Per their definition, atomic instructions used in conjuction with memory barriers should also ensure that the compiler doesn't reorder paths where they are used. GCC, however, does that aggressively, even in presence of volatile operands. The most reliable way GCC offers for avoid instructions reordering is clobbering "memory" even if that is theoretically an heavy-weight operation, flushing the content of all the registers and forcing reload of them (We could rely, however, on gcc DTRT by just understanding the purpose as this is a well-known pattern for many modern operating-systems). Not all our memory barriers, right now, clobber memory for GCC-like compilers. The most notable cases are IA32 and amd64 where the memory barrier are treacted the same as normal atomic instructions. Fix this by offering the possibility to implement atomic instructions with memory barriers separately from the normal version and implement the GCC-like specific one using memory clobbering. Thanks to Chris Lattner (@apple) for his discussion on llvm specifics. Reported by: jhb Reviewed by: jhb Tested by: rdivacky, Giovanni Trematerra Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Tue Oct 6 10:19:20 2009 (r197802) +++ head/sys/amd64/include/atomic.h Tue Oct 6 13:45:49 2009 (r197803) @@ -73,10 +73,13 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src); +int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); +int atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); @@ -97,8 +100,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -108,6 +112,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -160,6 +173,9 @@ atomic_cmpset_long(volatile u_long *dst, return (res); } +#define atomic_cmpset_barr_int atomic_cmpset_int +#define atomic_cmpset_barr_long atomic_cmpset_long + /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -205,18 +221,23 @@ atomic_fetchadd_long(volatile u_long *p, * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile ("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile ("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -247,7 +268,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -327,46 +349,45 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int -#define atomic_cmpset_acq_int atomic_cmpset_int -#define atomic_cmpset_rel_int atomic_cmpset_int - -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long -#define atomic_cmpset_acq_long atomic_cmpset_long -#define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_barr_int +#define atomic_cmpset_rel_int atomic_cmpset_barr_int + +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_barr_long +#define atomic_cmpset_rel_long atomic_cmpset_barr_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Tue Oct 6 10:19:20 2009 (r197802) +++ head/sys/i386/include/atomic.h Tue Oct 6 13:45:49 2009 (r197803) @@ -73,9 +73,11 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); +int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ @@ -95,8 +97,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -106,6 +109,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -168,6 +180,8 @@ atomic_cmpset_int(volatile u_int *dst, u #endif /* CPU_DISABLE_CMPXCHG */ +#define atomic_cmpset_barr_int atomic_cmpset_int + /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -194,18 +208,23 @@ atomic_fetchadd_int(volatile u_int *p, u * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -236,7 +255,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -282,6 +302,14 @@ atomic_cmpset_long(volatile u_long *dst, (u_int)src)); } +static __inline int +atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src) +{ + + return (atomic_cmpset_barr_int((volatile u_int *)dst, (u_int)exp, + (u_int)src)); +} + static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) { @@ -331,46 +359,45 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int -#define atomic_cmpset_acq_int atomic_cmpset_int -#define atomic_cmpset_rel_int atomic_cmpset_int - -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long -#define atomic_cmpset_acq_long atomic_cmpset_long -#define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_barr_int +#define atomic_cmpset_rel_int atomic_cmpset_barr_int + +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_barr_long +#define atomic_cmpset_rel_long atomic_cmpset_barr_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char From rwatson at FreeBSD.org Tue Oct 6 14:05:58 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 6 14:06:09 2009 Subject: svn commit: r197804 - in head: include lib/libc/gen Message-ID: <200910061405.n96E5vsq049153@svn.freebsd.org> Author: rwatson Date: Tue Oct 6 14:05:57 2009 New Revision: 197804 URL: http://svn.freebsd.org/changeset/base/197804 Log: Add basename_r(3) to complement basename(3). basename_r(3) which accepts a caller-allocated buffer of at least MAXPATHLEN, rather than using a global buffer. MFC after: 1 month Sponsored by: Google Modified: head/include/libgen.h head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/basename.3 head/lib/libc/gen/basename.c Modified: head/include/libgen.h ============================================================================== --- head/include/libgen.h Tue Oct 6 13:45:49 2009 (r197803) +++ head/include/libgen.h Tue Oct 6 14:05:57 2009 (r197804) @@ -36,6 +36,7 @@ __BEGIN_DECLS char *basename(const char *); +char *basename_r(const char *, char *); char *dirname(const char *); #if 0 char *regcmp(const char *, ...); Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/Makefile.inc Tue Oct 6 14:05:57 2009 (r197804) @@ -76,6 +76,7 @@ MAN+= alarm.3 arc4random.3 \ MLINKS+=arc4random.3 arc4random_addrandom.3 arc4random.3 arc4random_stir.3 \ arc4random.3 arc4random_buf.3 arc4random.3 arc4random_uniform.3 +MLINKS+=basename.3 basename_r.3 MLINKS+=ctermid.3 ctermid_r.3 MLINKS+=devname.3 devname_r.3 MLINKS+=devname.3 fdevname.3 Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/Symbol.map Tue Oct 6 14:05:57 2009 (r197804) @@ -367,6 +367,7 @@ FBSD_1.1 { }; FBSD_1.2 { + basename_r; getpagesizes; }; Modified: head/lib/libc/gen/basename.3 ============================================================================== --- head/lib/libc/gen/basename.3 Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/basename.3 Tue Oct 6 14:05:57 2009 (r197804) @@ -27,7 +27,7 @@ .\" $OpenBSD: basename.3,v 1.12 2000/04/18 03:01:25 aaron Exp $ .\" $FreeBSD$ .\" -.Dd October 12, 2006 +.Dd October 6, 2009 .Dt BASENAME 3 .Os .Sh NAME @@ -37,6 +37,8 @@ .In libgen.h .Ft char * .Fn basename "const char *path" +.Ft char * +.Fn basename_r "const char *path" "char *bname" .Sh DESCRIPTION The .Fn basename @@ -58,6 +60,12 @@ If is a null pointer or the empty string, a pointer to the string .Qq \&. is returned. +.Pp +The +.Fn basename_r +variation accepts a buffer of at least +.Dv MAXPATHLEN +bytes in which to store the resulting component. .Sh IMPLEMENTATION NOTES The .Fn basename @@ -65,15 +73,17 @@ function returns a pointer to internal storage space allocated on the first call that will be overwritten by subsequent calls. +.Fn basename_r +is therefore preferred for threaded applications. .Sh RETURN VALUES On successful completion, .Fn basename -returns a pointer to the last component of +and +.Fn basename_r +return pointers to the last component of .Fa path . .Pp -If -.Fn basename -fails, a null pointer is returned and the global variable +If they fail, a null pointer is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS Modified: head/lib/libc/gen/basename.c ============================================================================== --- head/lib/libc/gen/basename.c Tue Oct 6 13:45:49 2009 (r197803) +++ head/lib/libc/gen/basename.c Tue Oct 6 14:05:57 2009 (r197804) @@ -40,18 +40,12 @@ __FBSDID("$FreeBSD$"); #include char * -basename(path) +basename_r(path, bname) const char *path; + char *bname; { - static char *bname = NULL; const char *endp, *startp; - if (bname == NULL) { - bname = (char *)malloc(MAXPATHLEN); - if (bname == NULL) - return(NULL); - } - /* Empty or NULL string gets treated as "." */ if (path == NULL || *path == '\0') { (void)strcpy(bname, "."); @@ -82,3 +76,17 @@ basename(path) bname[endp - startp + 1] = '\0'; return(bname); } + +char * +basename(path) + const char *path; +{ + static char *bname = NULL; + + if (bname == NULL) { + bname = (char *)malloc(MAXPATHLEN); + if (bname == NULL) + return (NULL); + } + return (basename_r(path, bname)); +} From cokane at FreeBSD.org Tue Oct 6 16:05:07 2009 From: cokane at FreeBSD.org (Coleman Kane) Date: Tue Oct 6 16:05:19 2009 Subject: svn commit: r197806 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/if_ndis dev/xen/xenpci Message-ID: <200910061605.n96G56kA051644@svn.freebsd.org> Author: cokane Date: Tue Oct 6 16:05:06 2009 New Revision: 197806 URL: http://svn.freebsd.org/changeset/base/197806 Log: MFC: r197403, r197644, r197654, and r197659 Fix some unexpected potential NULL de-references in kernel mode due to usage of pre-8.0 wifi operations with the ndis driver wrapping a Win32/64 wifi driver. Submitted by: Paul B Mahol Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/if_ndis/if_ndis.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/if_ndis/if_ndis.c ============================================================================== --- stable/8/sys/dev/if_ndis/if_ndis.c Tue Oct 6 15:44:08 2009 (r197805) +++ stable/8/sys/dev/if_ndis/if_ndis.c Tue Oct 6 16:05:06 2009 (r197806) @@ -1012,7 +1012,12 @@ static void ndis_vap_delete(struct ieee80211vap *vap) { struct ndis_vap *nvp = NDIS_VAP(vap); + struct ieee80211com *ic = vap->iv_ic; + struct ifnet *ifp = ic->ic_ifp; + struct ndis_softc *sc = ifp->if_softc; + ndis_stop(sc); + callout_drain(&sc->ndis_scan_callout); ieee80211_vap_detach(vap); free(nvp, M_80211_VAP); } @@ -1529,7 +1534,7 @@ ndis_inputtask(dobj, arg) if (m == NULL) break; KeReleaseSpinLock(&sc->ndis_rxlock, irql); - if (sc->ndis_80211) + if ((sc->ndis_80211 != 0) && (vap != NULL)) vap->iv_deliver_data(vap, vap->iv_bss, m); else (*ifp->if_input)(ifp, m); @@ -1741,7 +1746,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_CONNECT) { sc->ndis_link = 1; NDIS_UNLOCK(sc); - if (sc->ndis_80211) { + if ((sc->ndis_80211 != 0) && (vap != NULL)) { ndis_getstate_80211(sc); ieee80211_new_state(vap, IEEE80211_S_RUN, -1); } @@ -1753,7 +1758,7 @@ ndis_ticktask(d, xsc) sc->ndis_sts == NDIS_STATUS_MEDIA_DISCONNECT) { sc->ndis_link = 0; NDIS_UNLOCK(sc); - if (sc->ndis_80211) + if ((sc->ndis_80211 != 0) && (vap != NULL)) ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); NDIS_LOCK(sc); if_link_state_change(sc->ifp, LINK_STATE_DOWN); @@ -2042,9 +2047,6 @@ ndis_init(xsc) /* Setup task offload. */ ndis_set_offload(sc); - if (sc->ndis_80211) - ndis_setstate_80211(sc); - NDIS_LOCK(sc); sc->ndis_txidx = 0; @@ -2292,8 +2294,6 @@ ndis_setstate_80211(sc) ifp = sc->ifp; ic = ifp->if_l2com; vap = TAILQ_FIRST(&ic->ic_vaps); - if (vap == NULL) - return; if (!NDIS_INITIALIZED(sc)) { DPRINTF(("%s: NDIS not initialized\n", __func__)); @@ -2725,8 +2725,6 @@ ndis_getstate_80211(sc) ifp = sc->ifp; ic = ifp->if_l2com; vap = TAILQ_FIRST(&ic->ic_vaps); - if (vap == NULL) - return; ni = vap->iv_bss; if (!NDIS_INITIALIZED(sc)) From marcus at FreeBSD.org Tue Oct 6 17:10:38 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Tue Oct 6 17:10:44 2009 Subject: svn commit: r197807 - in stable/8/lib/libc: . stdio stdtime string Message-ID: <200910061710.n96HAcrw053053@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Tue Oct 6 17:10:38 2009 New Revision: 197807 URL: http://svn.freebsd.org/changeset/base/197807 Log: Properly record merginfo for r197681 into lib/libc instead of lib/libc/gen. Kib didn't see the previous commit before I committed it. I had assumed implicit approval when he requested the merginfo. So pointhats to me all around. This commit was reviewed by kib. Approved by: re (kib) Modified: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdio/asprintf.c (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/string/ffsll.c (props changed) stable/8/lib/libc/string/flsll.c (props changed) stable/8/lib/libc/string/wcpcpy.c (props changed) stable/8/lib/libc/string/wcpncpy.c (props changed) From rwatson at FreeBSD.org Tue Oct 6 17:14:39 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 6 17:14:51 2009 Subject: svn commit: r197808 - head/libexec/rtld-elf Message-ID: <200910061714.n96HEd4U053183@svn.freebsd.org> Author: rwatson Date: Tue Oct 6 17:14:39 2009 New Revision: 197808 URL: http://svn.freebsd.org/changeset/base/197808 Log: In rtld's map_object(), use pread(..., 0) rather than read() to read the ELF header from the front of the file. As all other I/O on the binary is done using mmap(), this avoids the need for seek privileges on the file descriptor during run-time linking. MFC after: 1 month Sponsored by: Google Modified: head/libexec/rtld-elf/map_object.c Modified: head/libexec/rtld-elf/map_object.c ============================================================================== --- head/libexec/rtld-elf/map_object.c Tue Oct 6 17:10:38 2009 (r197807) +++ head/libexec/rtld-elf/map_object.c Tue Oct 6 17:14:39 2009 (r197808) @@ -273,7 +273,7 @@ get_elf_header (int fd, const char *path } u; ssize_t nbytes; - if ((nbytes = read(fd, u.buf, PAGE_SIZE)) == -1) { + if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) { _rtld_error("%s: read error: %s", path, strerror(errno)); return NULL; } From qingli at FreeBSD.org Tue Oct 6 18:47:03 2009 From: qingli at FreeBSD.org (Qing Li) Date: Tue Oct 6 18:47:20 2009 Subject: svn commit: r197810 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net Message-ID: <200910061847.n96Il2Dm060975@svn.freebsd.org> Author: qingli Date: Tue Oct 6 18:47:02 2009 New Revision: 197810 URL: http://svn.freebsd.org/changeset/base/197810 Log: MFC r197687 The flow-table associates TCP/UDP flows and IP destinations with specific routes. When the routing table changes, for example, when a new route with a more specific prefix is inserted into the routing table, the flow-table is not updated to reflect that change. As such existing connections cannot take advantage of the new path. In some cases the path is broken. This patch will update the affected flow-table entries when a more specific route is added. The route entry is properly marked when a route is deleted from the table. In this case, when the flow-table performs a search, the stale entry is updated automatically. Therefore this patch is not necessary for route deletion. Reviewed by: bz, kmacy Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/net/flowtable.c stable/8/sys/net/flowtable.h stable/8/sys/net/route.c Modified: stable/8/sys/net/flowtable.c ============================================================================== --- stable/8/sys/net/flowtable.c Tue Oct 6 17:33:00 2009 (r197809) +++ stable/8/sys/net/flowtable.c Tue Oct 6 18:47:02 2009 (r197810) @@ -830,7 +830,7 @@ fle_free(struct flentry *fle) } static void -flowtable_free_stale(struct flowtable *ft) +flowtable_free_stale(struct flowtable *ft, struct rtentry *rt) { int curbit = 0, count; struct flentry *fle, **flehead, *fleprev; @@ -866,8 +866,14 @@ flowtable_free_stale(struct flowtable *f curbit); } #endif - while (fle != NULL) { - if (!flow_stale(ft, fle)) { + while (fle != NULL) { + if (rt != NULL) { + if (__DEVOLATILE(struct rtentry *, fle->f_rt) != rt) { + fleprev = fle; + fle = fle->f_next; + continue; + } + } else if (!flow_stale(ft, fle)) { fleprev = fle; fle = fle->f_next; continue; @@ -916,6 +922,30 @@ flowtable_free_stale(struct flowtable *f log(LOG_DEBUG, "freed %d flow entries\n", count); } +void +flowtable_route_flush(struct flowtable *ft, struct rtentry *rt) +{ + int i; + if (ft->ft_flags & FL_PCPU) { + for (i = 0; i <= mp_maxid; i++) { + if (CPU_ABSENT(i)) + continue; + + thread_lock(curthread); + sched_bind(curthread, i); + thread_unlock(curthread); + + flowtable_free_stale(ft, rt); + + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); + } + } else { + flowtable_free_stale(ft, rt); + } +} + static void flowtable_clean_vnet(void) { @@ -933,14 +963,14 @@ flowtable_clean_vnet(void) sched_bind(curthread, i); thread_unlock(curthread); - flowtable_free_stale(ft); + flowtable_free_stale(ft, NULL); thread_lock(curthread); sched_unbind(curthread); thread_unlock(curthread); } } else { - flowtable_free_stale(ft); + flowtable_free_stale(ft, NULL); } ft = ft->ft_next; } Modified: stable/8/sys/net/flowtable.h ============================================================================== --- stable/8/sys/net/flowtable.h Tue Oct 6 17:33:00 2009 (r197809) +++ stable/8/sys/net/flowtable.h Tue Oct 6 18:47:02 2009 (r197810) @@ -51,5 +51,7 @@ struct flowtable *flowtable_alloc(int ne int flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro, uint32_t fibnum); +void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt); + #endif /* _KERNEL */ #endif Modified: stable/8/sys/net/route.c ============================================================================== --- stable/8/sys/net/route.c Tue Oct 6 17:33:00 2009 (r197809) +++ stable/8/sys/net/route.c Tue Oct 6 18:47:02 2009 (r197810) @@ -56,6 +56,7 @@ #include #include #include +#include #ifdef RADIX_MPATH #include @@ -996,6 +997,9 @@ rtrequest1_fib(int req, struct rt_addrin { int error = 0, needlock = 0; register struct rtentry *rt; +#ifdef FLOWTABLE + register struct rtentry *rt0; +#endif register struct radix_node *rn; register struct radix_node_head *rnh; struct ifaddr *ifa; @@ -1153,6 +1157,53 @@ rtrequest1_fib(int req, struct rt_addrin } #endif +#ifdef FLOWTABLE + rt0 = NULL; + /* XXX + * "flow-table" only support IPv4 at the moment. + */ + if (dst->sa_family == AF_INET) { + rn = rnh->rnh_matchaddr(dst, rnh); + if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { + struct sockaddr *mask; + u_char *m, *n; + int len; + + /* + * compare mask to see if the new route is + * more specific than the existing one + */ + rt0 = RNTORT(rn); + RT_LOCK(rt0); + RT_ADDREF(rt0); + RT_UNLOCK(rt0); + /* + * A host route is already present, so + * leave the flow-table entries as is. + */ + if (rt0->rt_flags & RTF_HOST) { + RTFREE(rt0); + rt0 = NULL; + } else if (!(flags & RTF_HOST) && netmask) { + mask = rt_mask(rt0); + len = mask->sa_len; + m = (u_char *)mask; + n = (u_char *)netmask; + while (len-- > 0) { + if (*n != *m) + break; + n++; + m++; + } + if (len == 0 || (*n < *m)) { + RTFREE(rt0); + rt0 = NULL; + } + } + } + } +#endif + /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); /* @@ -1165,8 +1216,18 @@ rtrequest1_fib(int req, struct rt_addrin Free(rt_key(rt)); RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); +#ifdef FLOWTABLE + if (rt0 != NULL) + RTFREE(rt0); +#endif senderr(EEXIST); + } +#ifdef FLOWTABLE + else if (rt0 != NULL) { + flowtable_route_flush(V_ip_ft, rt0); + RTFREE(rt0); } +#endif /* * If this protocol has something to add to this then From qingli at FreeBSD.org Tue Oct 6 19:44:45 2009 From: qingli at FreeBSD.org (Qing Li) Date: Tue Oct 6 19:45:02 2009 Subject: svn commit: r197811 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet Message-ID: <200910061944.n96JijDv062097@svn.freebsd.org> Author: qingli Date: Tue Oct 6 19:44:44 2009 New Revision: 197811 URL: http://svn.freebsd.org/changeset/base/197811 Log: MFC 197695 Previously, if an address alias is configured on an interface, and this address alias has a prefix matching that of another address configured on the same interface, then the ARP entry for the alias is not deleted from the ARP table when that address alias is removed. This patch fixes the aforementioned issue. PR: kern/139113 Reviewed by: bz Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/in.c Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Tue Oct 6 18:47:02 2009 (r197810) +++ stable/8/sys/netinet/in.c Tue Oct 6 19:44:44 2009 (r197811) @@ -1060,6 +1060,8 @@ in_scrubprefix(struct in_ifaddr *target) !(target->ia_ifp->if_flags & IFF_LOOPBACK)) { error = ifa_del_loopback_route((struct ifaddr *)target, (struct sockaddr *)&target->ia_addr); + /* remove arp cache */ + arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } if ((target->ia_flags & IFA_ROUTE) == 0) { @@ -1082,8 +1084,6 @@ in_scrubprefix(struct in_ifaddr *target) prefix = target->ia_addr.sin_addr; mask = target->ia_sockmask.sin_addr; prefix.s_addr &= mask.s_addr; - /* remove arp cache */ - arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } IN_IFADDR_RLOCK(); From gabor at FreeBSD.org Tue Oct 6 19:47:03 2009 From: gabor at FreeBSD.org (Gabor Kovesdan) Date: Tue Oct 6 19:47:09 2009 Subject: svn commit: r197804 - in head: include lib/libc/gen In-Reply-To: <200910061405.n96E5vsq049153@svn.freebsd.org> References: <200910061405.n96E5vsq049153@svn.freebsd.org> Message-ID: <4ACB9A21.10502@FreeBSD.org> Robert Watson escribi?: > + > +char * > +basename(path) > + const char *path; > +{ > + static char *bname = NULL; > + > Sorry if it's a trivial question but isn't ANSI prototype preferred over K&R function definition? -- Gabor Kovesdan FreeBSD Volunteer EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org From rdivacky at FreeBSD.org Tue Oct 6 20:19:17 2009 From: rdivacky at FreeBSD.org (Roman Divacky) Date: Tue Oct 6 20:19:23 2009 Subject: svn commit: r197812 - head/contrib/tcsh Message-ID: <200910062019.n96KJG5Q062846@svn.freebsd.org> Author: rdivacky Date: Tue Oct 6 20:19:16 2009 New Revision: 197812 URL: http://svn.freebsd.org/changeset/base/197812 Log: Fix tcsh losing history when tcsh terminates because the pty beneath it is closed. Diagnosed by Ted Anderson: New signal queuing logic was introduced in 6.15 and allows the signal handlers to be run explicitly by calling handle_pending_signals, instead of immediately when the signal is delivered. This function is called at various places, typically when receiving a EINTR from a slow system call such as read or write. In the pty exit case, it was called from xwrite, called from flush, while printing the "exit" message after receiving EOF when reading from the pty (note that the read did not return EINTR but zero bytes, indicating EOF). The SIGHUP handler, phup(), called rechist, which opened the history file and began writing the merged history to it. This process invoked flush recursively to actually write the data. In this case, however, the flush noticed it was being called recursively and decided fail by calling stderror. My conclusion was that the signal was being handled at a bad time. But whether to fix flush not to care about the recursive call, or to handle the signal some other time and when to handle it, was unclear to me. However, by adding an extra call to handle_pending_signals, just after process() returns to main(), I was able to avoid the truncated history after network outages and similar failures. I verified this fix in version 6.17. Approved by: ed (mentor) MFC after: 1 week Modified: head/contrib/tcsh/sh.c Modified: head/contrib/tcsh/sh.c ============================================================================== --- head/contrib/tcsh/sh.c Tue Oct 6 19:44:44 2009 (r197811) +++ head/contrib/tcsh/sh.c Tue Oct 6 20:19:16 2009 (r197812) @@ -1291,6 +1291,8 @@ main(int argc, char **argv) /* * Mop-up. */ + /* Take care of these (especially HUP) here instead of inside flush. */ + handle_pending_signals(); if (intty) { if (loginsh) { xprintf("logout\n"); From rwatson at FreeBSD.org Tue Oct 6 20:21:58 2009 From: rwatson at FreeBSD.org (Robert N. M. Watson) Date: Tue Oct 6 20:22:10 2009 Subject: svn commit: r197804 - in head: include lib/libc/gen In-Reply-To: <4ACB9A21.10502@FreeBSD.org> References: <200910061405.n96E5vsq049153@svn.freebsd.org> <4ACB9A21.10502@FreeBSD.org> Message-ID: <1A174135-001D-4550-B3E7-84EAA69A2169@FreeBSD.org> On 6 Oct 2009, at 20:27, Gabor Kovesdan wrote: > Robert Watson escribi?: >> + >> +char * >> +basename(path) >> + const char *path; >> +{ >> + static char *bname = NULL; >> + >> > Sorry if it's a trivial question but isn't ANSI prototype preferred > over K&R function definition? For the purposes of this purely functional change, I maintained the existing style in the file, which was K&R. Robert From qingli at FreeBSD.org Tue Oct 6 20:33:02 2009 From: qingli at FreeBSD.org (Qing Li) Date: Tue Oct 6 20:33:19 2009 Subject: svn commit: r197813 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet Message-ID: <200910062033.n96KX2iw063170@svn.freebsd.org> Author: qingli Date: Tue Oct 6 20:33:02 2009 New Revision: 197813 URL: http://svn.freebsd.org/changeset/base/197813 Log: MFC r197696 Remove a log message from production code. This log message can be triggered by a misconfigured host that is sending out gratuious ARPs. This log message can also be triggered during a network renumbering event when multiple prefixes co-exist on a single network segment. Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/in.c Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Tue Oct 6 20:19:16 2009 (r197812) +++ stable/8/sys/netinet/in.c Tue Oct 6 20:33:02 2009 (r197813) @@ -1327,8 +1327,10 @@ in_lltable_rtcheck(struct ifnet *ifp, co /* XXX rtalloc1 should take a const param */ rt = rtalloc1(__DECONST(struct sockaddr *, l3addr), 0, 0); if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) || rt->rt_ifp != ifp) { +#ifdef DIAGNOSTICS log(LOG_INFO, "IPv4 address: \"%s\" is not on the network\n", inet_ntoa(((const struct sockaddr_in *)l3addr)->sin_addr)); +#endif if (rt != NULL) RTFREE_LOCKED(rt); return (EINVAL); From rwatson at FreeBSD.org Tue Oct 6 20:35:41 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Oct 6 20:35:48 2009 Subject: svn commit: r197814 - head/sys/netinet Message-ID: <200910062035.n96KZfM3063262@svn.freebsd.org> Author: rwatson Date: Tue Oct 6 20:35:41 2009 New Revision: 197814 URL: http://svn.freebsd.org/changeset/base/197814 Log: Remove tcp_input lock statistics; these are intended for debugging only and are not intended to ship in 8.0 as they dirty additional cache lines in a performance-critical per-packet path. MFC after: 3 days Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Oct 6 20:33:02 2009 (r197813) +++ head/sys/netinet/tcp_input.c Tue Oct 6 20:35:41 2009 (r197814) @@ -180,26 +180,6 @@ int tcp_read_locking = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, read_locking, CTLFLAG_RW, &tcp_read_locking, 0, "Enable read locking strategy"); -int tcp_rlock_atfirst; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, rlock_atfirst, CTLFLAG_RD, - &tcp_rlock_atfirst, 0, ""); - -int tcp_wlock_atfirst; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcp_wlock_atfirst, CTLFLAG_RD, - &tcp_wlock_atfirst, 0, ""); - -int tcp_wlock_upgraded; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_upgraded, CTLFLAG_RD, - &tcp_wlock_upgraded, 0, ""); - -int tcp_wlock_relocked; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_relocked, CTLFLAG_RD, - &tcp_wlock_relocked, 0, ""); - -int tcp_wlock_looped; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_looped, CTLFLAG_RD, - &tcp_wlock_looped, 0, ""); - VNET_DEFINE(struct inpcbhead, tcb); VNET_DEFINE(struct inpcbinfo, tcbinfo); #define tcb6 tcb /* for KAME src sync over BSD*'s */ @@ -505,11 +485,9 @@ tcp_input(struct mbuf *m, int off0) tcp_read_locking == 0) { INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; - tcp_wlock_atfirst++; } else { INP_INFO_RLOCK(&V_tcbinfo); ti_locked = TI_RLOCKED; - tcp_rlock_atfirst++; } findpcb: @@ -662,15 +640,11 @@ relocked: ti_locked = TI_WLOCKED; INP_WLOCK(inp); if (in_pcbrele(inp)) { - tcp_wlock_looped++; inp = NULL; goto findpcb; } - tcp_wlock_relocked++; - } else { + } else ti_locked = TI_WLOCKED; - tcp_wlock_upgraded++; - } } INP_INFO_WLOCK_ASSERT(&V_tcbinfo); @@ -717,16 +691,12 @@ relocked: ti_locked = TI_WLOCKED; INP_WLOCK(inp); if (in_pcbrele(inp)) { - tcp_wlock_looped++; inp = NULL; goto findpcb; } - tcp_wlock_relocked++; goto relocked; - } else { + } else ti_locked = TI_WLOCKED; - tcp_wlock_upgraded++; - } } INP_INFO_WLOCK_ASSERT(&V_tcbinfo); } From jilles at FreeBSD.org Tue Oct 6 21:23:51 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Tue Oct 6 21:24:26 2009 Subject: svn commit: r197815 - in stable/8/usr.sbin/lpr: . lp Message-ID: <200910062123.n96LNo2R064347@svn.freebsd.org> Author: jilles Date: Tue Oct 6 21:23:49 2009 New Revision: 197815 URL: http://svn.freebsd.org/changeset/base/197815 Log: MFC r197625: Fix using lp(1) without the new -t option after r194171. Approved by: re (kib) Modified: stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/lpr/lp/lp.sh Modified: stable/8/usr.sbin/lpr/lp/lp.sh ============================================================================== --- stable/8/usr.sbin/lpr/lp/lp.sh Tue Oct 6 20:35:41 2009 (r197814) +++ stable/8/usr.sbin/lpr/lp/lp.sh Tue Oct 6 21:23:49 2009 (r197815) @@ -70,7 +70,7 @@ do s) # (silent option) : ;; t) # title for banner page - title="-J${OPTARG}";; + title="${OPTARG}";; *) # (error msg printed by getopts) exit 2;; esac @@ -78,4 +78,4 @@ done shift $(($OPTIND - 1)) -exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} "${title}" "$@" +exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} ${title:+-J"${title}"} "$@" From kmacy at FreeBSD.org Tue Oct 6 21:40:51 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Tue Oct 6 21:41:02 2009 Subject: svn commit: r197816 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910062140.n96LeoDG064737@svn.freebsd.org> Author: kmacy Date: Tue Oct 6 21:40:50 2009 New Revision: 197816 URL: http://svn.freebsd.org/changeset/base/197816 Log: Prevent paging pressure from draining arc too much - always drain arc if above arc_c_max - never drain arc if arc is below arc_c_max MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 6 21:23:49 2009 (r197815) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 6 21:40:50 2009 (r197816) @@ -1821,6 +1821,12 @@ arc_reclaim_needed(void) #endif #ifdef _KERNEL + if (needfree) + return (1); + if (arc_size > arc_c_max) + return (1); + if (arc_size <= arc_c_min) + return (0); /* * If pages are needed or we're within 2048 pages @@ -1829,9 +1835,6 @@ arc_reclaim_needed(void) if (vm_pages_needed || (vm_paging_target() > -2048)) return (1); - if (needfree) - return (1); - #if 0 /* * take 'desfree' extra pages, so we reclaim sooner, rather than later From jilles at FreeBSD.org Tue Oct 6 21:49:14 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Tue Oct 6 21:49:20 2009 Subject: svn commit: r197819 - in stable/7/usr.sbin/lpr: . lp Message-ID: <200910062149.n96LnDgL065032@svn.freebsd.org> Author: jilles Date: Tue Oct 6 21:49:13 2009 New Revision: 197819 URL: http://svn.freebsd.org/changeset/base/197819 Log: MFC r197625: Fix using lp(1) without the new -t option after r195349. Modified: stable/7/usr.sbin/lpr/ (props changed) stable/7/usr.sbin/lpr/lp/lp.sh Modified: stable/7/usr.sbin/lpr/lp/lp.sh ============================================================================== --- stable/7/usr.sbin/lpr/lp/lp.sh Tue Oct 6 21:46:03 2009 (r197818) +++ stable/7/usr.sbin/lpr/lp/lp.sh Tue Oct 6 21:49:13 2009 (r197819) @@ -70,7 +70,7 @@ do s) # (silent option) : ;; t) # title for banner page - title="-J${OPTARG}";; + title="${OPTARG}";; *) # (error msg printed by getopts) exit 2;; esac @@ -78,4 +78,4 @@ done shift $(($OPTIND - 1)) -exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} "${title}" "$@" +exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} ${title:+-J"${title}"} "$@" From jilles at FreeBSD.org Tue Oct 6 22:00:15 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Tue Oct 6 22:00:27 2009 Subject: svn commit: r197820 - in head: bin/sh tools/regression/bin/sh/execution Message-ID: <200910062200.n96M0FMX065301@svn.freebsd.org> Author: jilles Date: Tue Oct 6 22:00:14 2009 New Revision: 197820 URL: http://svn.freebsd.org/changeset/base/197820 Log: sh: Send the "xyz: not found" message to redirected fd 2. This also fixes that trying to execute a non-regular file with a command name without '/' returns 127 instead of 126. The fix is rather simplistic: treat CMDUNKNOWN as if the command were found as an external program. The resulting fork is a bit wasteful but executing unknown commands should not be very frequent. PR: bin/137659 Added: head/tools/regression/bin/sh/execution/unknown1.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/exec.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Oct 6 21:49:13 2009 (r197819) +++ head/bin/sh/eval.c Tue Oct 6 22:00:14 2009 (r197820) @@ -713,12 +713,7 @@ evalcommand(union node *cmd, int flags, do_clearcmdentry = 1; } - find_command(argv[0], &cmdentry, 1, path); - if (cmdentry.cmdtype == CMDUNKNOWN) { /* command not found */ - exitstatus = 127; - flushout(&errout); - return; - } + find_command(argv[0], &cmdentry, 0, path); /* implement the bltin builtin here */ if (cmdentry.cmdtype == CMDBUILTIN && cmdentry.u.index == BLTINCMD) { for (;;) { @@ -740,7 +735,7 @@ evalcommand(union node *cmd, int flags, /* Fork off a child process if necessary. */ if (cmd->ncmd.backgnd - || (cmdentry.cmdtype == CMDNORMAL + || ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN) && ((flags & EV_EXIT) == 0 || have_traps())) || ((flags & EV_BACKCMD) != 0 && (cmdentry.cmdtype != CMDBUILTIN Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Tue Oct 6 21:49:13 2009 (r197819) +++ head/bin/sh/exec.c Tue Oct 6 22:00:14 2009 (r197820) @@ -429,6 +429,7 @@ loop: outfmt(out2, "%s: %s\n", name, strerror(e)); } entry->cmdtype = CMDUNKNOWN; + entry->u.index = 0; return; success: Added: head/tools/regression/bin/sh/execution/unknown1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/unknown1.0 Tue Oct 6 22:00:14 2009 (r197820) @@ -0,0 +1,29 @@ +# $FreeBSD$ + +nosuchtool 2>/dev/null +[ $? -ne 127 ] && exit 1 +/var/empty/nosuchtool 2>/dev/null +[ $? -ne 127 ] && exit 1 +(nosuchtool) 2>/dev/null +[ $? -ne 127 ] && exit 1 +(/var/empty/nosuchtool) 2>/dev/null +[ $? -ne 127 ] && exit 1 +/ 2>/dev/null +[ $? -ne 126 ] && exit 1 +PATH=/usr bin 2>/dev/null +[ $? -ne 126 ] && exit 1 + +dummy=$(nosuchtool 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$(/var/empty/nosuchtool 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$( (nosuchtool) 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$( (/var/empty/nosuchtool) 2>/dev/null) +[ $? -ne 127 ] && exit 1 +dummy=$(/ 2>/dev/null) +[ $? -ne 126 ] && exit 1 +dummy=$(PATH=/usr bin 2>/dev/null) +[ $? -ne 126 ] && exit 1 + +exit 0 From dougb at FreeBSD.org Tue Oct 6 22:15:12 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Oct 6 22:15:23 2009 Subject: svn commit: r197821 - stable/8/usr.bin/whois Message-ID: <200910062215.n96MFCgE065657@svn.freebsd.org> Author: dougb Date: Tue Oct 6 22:15:12 2009 New Revision: 197821 URL: http://svn.freebsd.org/changeset/base/197821 Log: MFC r197725: The 6bone was decommissioned on 6/6/06, so remove references to it. Approved by: re (kib) Modified: stable/8/usr.bin/whois/ (props changed) stable/8/usr.bin/whois/whois.1 stable/8/usr.bin/whois/whois.c Modified: stable/8/usr.bin/whois/whois.1 ============================================================================== --- stable/8/usr.bin/whois/whois.1 Tue Oct 6 22:00:14 2009 (r197820) +++ stable/8/usr.bin/whois/whois.1 Tue Oct 6 22:15:12 2009 (r197821) @@ -32,7 +32,7 @@ .\" From: @(#)whois.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd January 23, 2006 +.Dd October 2, 2009 .Dt WHOIS 1 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd "Internet domain name and network number directory service" .Sh SYNOPSIS .Nm -.Op Fl aAbdfgiIklmQrR6 +.Op Fl aAbdfgiIklmQrR .Op Fl c Ar country-code | Fl h Ar host .Op Fl p Ar port .Ar name ... @@ -212,17 +212,14 @@ This option is deprecated; use the option with an argument of .Qq Li RU instead. -.It Fl 6 -Use the IPv6 Resource Center -.Pq Tn 6bone -database. -It contains network names and addresses for the IPv6 network. -.El .Pp The operands specified to .Nm are treated independently and may be used as queries on different whois servers. +.El +.Sh EXIT STATUS +.Ex -std .Sh EXAMPLES Most types of data, such as domain names and .Tn IP @@ -255,15 +252,6 @@ but other .Tn TLDs can be queried by using a similar syntax.) .Pp -The following example demonstrates how to obtain information about an -.Tn IPv6 -address or hostname using the -.Fl 6 -option, which directs the query to -.Tn 6bone . -.Pp -.Dl "whois -6 IPv6-IP-Address" -.Pp The following example demonstrates how to query a whois server using a non-standard port, where .Dq Li query-data Modified: stable/8/usr.bin/whois/whois.c ============================================================================== --- stable/8/usr.bin/whois/whois.c Tue Oct 6 22:00:14 2009 (r197820) +++ stable/8/usr.bin/whois/whois.c Tue Oct 6 22:15:12 2009 (r197821) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #define PNICHOST "whois.apnic.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" -#define SNICHOST "whois.6bone.net" #define BNICHOST "whois.registro.br" #define NORIDHOST "whois.norid.no" #define IANAHOST "whois.iana.org" @@ -164,8 +163,10 @@ main(int argc, char *argv[]) warnx("-R is deprecated; use '-c ru' instead"); country = "ru"; break; + /* Remove in FreeBSD 10 */ case '6': - host = SNICHOST; + errx(EX_USAGE, + "-6 is deprecated; use -[aAflr] instead"); break; case '?': default: From dougb at FreeBSD.org Tue Oct 6 22:19:34 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Oct 6 22:19:46 2009 Subject: svn commit: r197822 - stable/7/usr.bin/whois Message-ID: <200910062219.n96MJWow065808@svn.freebsd.org> Author: dougb Date: Tue Oct 6 22:19:32 2009 New Revision: 197822 URL: http://svn.freebsd.org/changeset/base/197822 Log: MFC r197725: The 6bone was decommissioned on 6/6/06, so remove references to it. Modified: stable/7/usr.bin/whois/ (props changed) stable/7/usr.bin/whois/whois.1 stable/7/usr.bin/whois/whois.c Modified: stable/7/usr.bin/whois/whois.1 ============================================================================== --- stable/7/usr.bin/whois/whois.1 Tue Oct 6 22:15:12 2009 (r197821) +++ stable/7/usr.bin/whois/whois.1 Tue Oct 6 22:19:32 2009 (r197822) @@ -32,7 +32,7 @@ .\" From: @(#)whois.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd January 23, 2006 +.Dd October 2, 2009 .Dt WHOIS 1 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd "Internet domain name and network number directory service" .Sh SYNOPSIS .Nm -.Op Fl aAbdfgiIklmQrR6 +.Op Fl aAbdfgiIklmQrR .Op Fl c Ar country-code | Fl h Ar host .Op Fl p Ar port .Ar name ... @@ -212,17 +212,14 @@ This option is deprecated; use the option with an argument of .Qq Li RU instead. -.It Fl 6 -Use the IPv6 Resource Center -.Pq Tn 6bone -database. -It contains network names and addresses for the IPv6 network. -.El .Pp The operands specified to .Nm are treated independently and may be used as queries on different whois servers. +.El +.Sh EXIT STATUS +.Ex -std .Sh EXAMPLES Most types of data, such as domain names and .Tn IP @@ -255,15 +252,6 @@ but other .Tn TLDs can be queried by using a similar syntax.) .Pp -The following example demonstrates how to obtain information about an -.Tn IPv6 -address or hostname using the -.Fl 6 -option, which directs the query to -.Tn 6bone . -.Pp -.Dl "whois -6 IPv6-IP-Address" -.Pp The following example demonstrates how to query a whois server using a non-standard port, where .Dq Li query-data Modified: stable/7/usr.bin/whois/whois.c ============================================================================== --- stable/7/usr.bin/whois/whois.c Tue Oct 6 22:15:12 2009 (r197821) +++ stable/7/usr.bin/whois/whois.c Tue Oct 6 22:19:32 2009 (r197822) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #define PNICHOST "whois.apnic.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" -#define SNICHOST "whois.6bone.net" #define BNICHOST "whois.registro.br" #define NORIDHOST "whois.norid.no" #define IANAHOST "whois.iana.org" @@ -164,8 +163,10 @@ main(int argc, char *argv[]) warnx("-R is deprecated; use '-c ru' instead"); country = "ru"; break; + /* Remove in FreeBSD 10 */ case '6': - host = SNICHOST; + errx(EX_USAGE, + "-6 is deprecated; use -[aAflr] instead"); break; case '?': default: From dougb at FreeBSD.org Tue Oct 6 22:21:53 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Oct 6 22:22:00 2009 Subject: svn commit: r197823 - stable/6/usr.bin/whois Message-ID: <200910062221.n96MLpru065915@svn.freebsd.org> Author: dougb Date: Tue Oct 6 22:21:51 2009 New Revision: 197823 URL: http://svn.freebsd.org/changeset/base/197823 Log: MFC r197725: The 6bone was decommissioned on 6/6/06, so remove references to it. Modified: stable/6/usr.bin/whois/ (props changed) stable/6/usr.bin/whois/whois.1 stable/6/usr.bin/whois/whois.c Modified: stable/6/usr.bin/whois/whois.1 ============================================================================== --- stable/6/usr.bin/whois/whois.1 Tue Oct 6 22:19:32 2009 (r197822) +++ stable/6/usr.bin/whois/whois.1 Tue Oct 6 22:21:51 2009 (r197823) @@ -32,7 +32,7 @@ .\" From: @(#)whois.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 11, 2004 +.Dd October 2, 2009 .Dt WHOIS 1 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd "Internet domain name and network number directory service" .Sh SYNOPSIS .Nm -.Op Fl aAbdfgiIklmQrR6 +.Op Fl aAbdfgiIklmQrR .Op Fl c Ar country-code | Fl h Ar host .Op Fl p Ar port .Ar name ... @@ -211,17 +211,14 @@ This option is deprecated; use the option with an argument of .Qq Li RU instead. -.It Fl 6 -Use the IPv6 Resource Center -.Pq Tn 6bone -database. -It contains network names and addresses for the IPv6 network. -.El .Pp The operands specified to .Nm are treated independently and may be used as queries on different whois servers. +.El +.Sh EXIT STATUS +.Ex -std .Sh EXAMPLES Most types of data, such as domain names and .Tn IP @@ -254,15 +251,6 @@ but other .Tn TLDs can be queried by using a similar syntax.) .Pp -The following example demonstrates how to obtain information about an -.Tn IPv6 -address or hostname using the -.Fl 6 -option, which directs the query to -.Tn 6bone . -.Pp -.Dl "whois -6 IPv6-IP-Address" -.Pp The following example demonstrates how to query a whois server using a non-standard port, where .Dq Li query-data Modified: stable/6/usr.bin/whois/whois.c ============================================================================== --- stable/6/usr.bin/whois/whois.c Tue Oct 6 22:19:32 2009 (r197822) +++ stable/6/usr.bin/whois/whois.c Tue Oct 6 22:21:51 2009 (r197823) @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); #define PNICHOST "whois.apnic.net" #define MNICHOST "whois.ra.net" #define QNICHOST_TAIL ".whois-servers.net" -#define SNICHOST "whois.6bone.net" #define BNICHOST "whois.registro.br" #define NORIDHOST "whois.norid.no" #define IANAHOST "whois.iana.org" @@ -164,8 +163,10 @@ main(int argc, char *argv[]) warnx("-R is deprecated; use '-c ru' instead"); country = "ru"; break; + /* Remove in FreeBSD 10 */ case '6': - host = SNICHOST; + errx(EX_USAGE, + "-6 is deprecated; use -[aAflr] instead"); break; case '?': default: From attilio at FreeBSD.org Tue Oct 6 23:48:29 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Tue Oct 6 23:48:34 2009 Subject: svn commit: r197824 - in head/sys: amd64/include i386/include Message-ID: <200910062348.n96NmSIj067721@svn.freebsd.org> Author: attilio Date: Tue Oct 6 23:48:28 2009 New Revision: 197824 URL: http://svn.freebsd.org/changeset/base/197824 Log: - All the functions in atomic.h needs to be in "physical" form (like not defined through macros or similar) in order to be later compiled in the kernel and offer this way the support for modules (and compatibility among the UP case and SMP case). Fix this for the newly introduced atomic_cmpset_barr_* cases by defining and specifying a template. Note that the new DEFINE_CMPSET_GEN() template save more typing on amd64 than the current code. [1] - Fix the style for memory barriers on amd64. [1] Reported by: Paul B. Mahol Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Tue Oct 6 22:21:51 2009 (r197823) +++ head/sys/amd64/include/atomic.h Tue Oct 6 23:48:28 2009 (r197824) @@ -32,9 +32,9 @@ #error this file needs sys/cdefs.h as a prerequisite #endif -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") +#define mb() __asm __volatile("mfence;" : : : "memory") +#define wmb() __asm __volatile("sfence;" : : : "memory") +#define rmb() __asm __volatile("lfence;" : : : "memory") /* * Various simple operations on memory, each of which is atomic in the @@ -131,50 +131,33 @@ struct __hack * Returns 0 on failure, non-zero on success */ -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %2,%1 ; " - " sete %0 ; " - "1: " - "# atomic_cmpset_int" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} - -static __inline int -atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgq %2,%1 ; " - " sete %0 ; " - "1: " - "# atomic_cmpset_long" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} +#define DEFINE_CMPSET_GEN(NAME, TYPE, OP) \ +static __inline int \ +atomic_cmpset_##NAME(volatile u_##TYPE *dst, u_##TYPE exp, u_##TYPE src)\ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " " OP " %2,%1 ; " \ + " sete %0 ; " \ + "1: " \ + "# atomic_cmpset_##NAME" \ + : "=a" (res), /* 0 */ \ + "=m" (*dst) /* 1 */ \ + : "r" (src), /* 2 */ \ + "a" (exp), /* 3 */ \ + "m" (*dst) /* 4 */ \ + : "memory"); \ + \ + return (res); \ +} \ +struct __hack -#define atomic_cmpset_barr_int atomic_cmpset_int -#define atomic_cmpset_barr_long atomic_cmpset_long +DEFINE_CMPSET_GEN(int, int, "cmpxchgl"); +DEFINE_CMPSET_GEN(long, long, "cmpxchgq"); +DEFINE_CMPSET_GEN(barr_int, int, "cmpxchgl"); +DEFINE_CMPSET_GEN(barr_long, long, "cmpxchgq"); /* * Atomically add the value of v to the integer pointed to by p and return Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Tue Oct 6 22:21:51 2009 (r197823) +++ head/sys/i386/include/atomic.h Tue Oct 6 23:48:28 2009 (r197824) @@ -130,57 +130,62 @@ struct __hack #ifdef CPU_DISABLE_CMPXCHG -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) -{ - u_char res; - - __asm __volatile( - " pushfl ; " - " cli ; " - " cmpl %3,%4 ; " - " jne 1f ; " - " movl %2,%1 ; " - "1: " - " sete %0 ; " - " popfl ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "r" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} +#define DEFINE_CMPSET_GEN(NAME) \ +static __inline int \ +atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " pushfl ; " \ + " cli ; " \ + " cmpl %3,%4 ; " \ + " jne 1f ; " \ + " movl %2,%1 ; " \ + "1: " \ + " sete %0 ; " \ + " popfl ; " \ + "# atomic_cmpset_##NAME" \ + : "=q" (res), /* 0 */ \ + "=m" (*dst) /* 1 */ \ + : "r" (src), /* 2 */ \ + "r" (exp), /* 3 */ \ + "m" (*dst) /* 4 */ \ + : "memory"); \ + \ + return (res); \ +} \ +struct __hack #else /* !CPU_DISABLE_CMPXCHG */ -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %2,%1 ; " - " sete %0 ; " - "1: " - "# atomic_cmpset_int" - : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (exp), /* 3 */ - "m" (*dst) /* 4 */ - : "memory"); - - return (res); -} +#define DEFINE_CMPSET_GEN(NAME) \ +static __inline int \ +atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchgl %2,%1 ; " \ + " sete %0 ; " \ + "1: " \ + "# atomic_cmpset_##NAME" \ + : "=a" (res), /* 0 */ \ + "=m" (*dst) /* 1 */ \ + : "r" (src), /* 2 */ \ + "a" (exp), /* 3 */ \ + "m" (*dst) /* 4 */ \ + : "memory"); \ + \ + return (res); \ +} \ +struct __hack #endif /* CPU_DISABLE_CMPXCHG */ -#define atomic_cmpset_barr_int atomic_cmpset_int +DEFINE_CMPSET_GEN(int); +DEFINE_CMPSET_GEN(barr_int); /* * Atomically add the value of v to the integer pointed to by p and return From rpaulo at FreeBSD.org Wed Oct 7 09:07:08 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Wed Oct 7 09:07:15 2009 Subject: svn commit: r197829 - head/contrib/tcpdump Message-ID: <200910070907.n97977Dt079392@svn.freebsd.org> Author: rpaulo Date: Wed Oct 7 09:07:06 2009 New Revision: 197829 URL: http://svn.freebsd.org/changeset/base/197829 Log: Add parsing code for TCP UTO (User Timeout Option). Submitted by: fangwang@ Obtained from: //depot/projects/soc2009/tcputo/ Modified: head/contrib/tcpdump/print-tcp.c head/contrib/tcpdump/tcp.h Modified: head/contrib/tcpdump/print-tcp.c ============================================================================== --- head/contrib/tcpdump/print-tcp.c Wed Oct 7 08:43:06 2009 (r197828) +++ head/contrib/tcpdump/print-tcp.c Wed Oct 7 09:07:06 2009 (r197829) @@ -124,6 +124,7 @@ struct tok tcp_option_values[] = { { TCPOPT_CCECHO, "" }, { TCPOPT_SIGNATURE, "md5" }, { TCPOPT_AUTH, "enhanced auth" }, + { TCPOPT_UTO, "uto" }, { 0, NULL } }; @@ -613,6 +614,17 @@ tcp_print(register const u_char *bp, reg */ break; + case TCPOPT_UTO: + datalen = 2; + LENCHECK(datalen); + uint utoval = EXTRACT_16BITS(cp); + if (utoval & 0x0001) + utoval = (utoval >> 1) * 60; + else + utoval >>= 1; + (void)printf(" %u", utoval); + break; + default: datalen = len - 2; for (i = 0; i < datalen; ++i) { Modified: head/contrib/tcpdump/tcp.h ============================================================================== --- head/contrib/tcpdump/tcp.h Wed Oct 7 08:43:06 2009 (r197828) +++ head/contrib/tcpdump/tcp.h Wed Oct 7 09:07:06 2009 (r197829) @@ -83,6 +83,8 @@ struct tcphdr { #define TCPOLEN_SIGNATURE 18 #define TCP_SIGLEN 16 /* length of an option 19 digest */ #define TCPOPT_AUTH 20 /* Enhanced AUTH option */ +#define TCPOPT_UTO 28 /* tcp user timeout (rfc5482) */ +#define TCPOLEN_UTO 4 #define TCPOPT_TSTAMP_HDR \ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) From kib at FreeBSD.org Wed Oct 7 09:22:28 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Oct 7 09:22:40 2009 Subject: svn commit: r197830 - svnadmin/conf Message-ID: <200910070922.n979MSE2079723@svn.freebsd.org> Author: kib Date: Wed Oct 7 09:22:27 2009 New Revision: 197830 URL: http://svn.freebsd.org/changeset/base/197830 Log: Free Rick Macklem from mentorship. Discussed with: rwatson Approved by: core (implicit) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Wed Oct 7 09:07:06 2009 (r197829) +++ svnadmin/conf/mentors Wed Oct 7 09:22:27 2009 (r197830) @@ -22,7 +22,6 @@ neel imp nork imp rdivacky ed remko imp -rmacklem rwatson Co-mentor: kib sbruno scottl snb dwmalone sson gnn From pjd at FreeBSD.org Wed Oct 7 12:38:19 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 12:38:31 2009 Subject: svn commit: r197831 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910071238.n97CcJxh084465@svn.freebsd.org> Author: pjd Date: Wed Oct 7 12:38:19 2009 New Revision: 197831 URL: http://svn.freebsd.org/changeset/base/197831 Log: Fix situation where Mac OS X NFS client creates a file and when it tries to set ownership and mode in the same setattr operation, the mode was overwritten by secpolicy_vnode_setattr(). PR: kern/118320 Submitted by: Mark Thompson MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Oct 7 09:22:27 2009 (r197830) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Oct 7 12:38:19 2009 (r197831) @@ -2538,6 +2538,7 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, i vattr_t oldva; uint_t mask = vap->va_mask; uint_t saved_mask; + uint64_t saved_mode; int trim_mask = 0; uint64_t new_mode; znode_t *attrzp; @@ -2766,6 +2767,13 @@ top: if (trim_mask) { saved_mask = vap->va_mask; vap->va_mask &= ~trim_mask; + if (trim_mask & AT_MODE) { + /* + * Save the mode, as secpolicy_vnode_setattr() + * will overwrite it with ova.va_mode. + */ + saved_mode = vap->va_mode; + } } err = secpolicy_vnode_setattr(cr, vp, vap, &oldva, flags, (int (*)(void *, int, cred_t *))zfs_zaccess_unix, zp); @@ -2774,8 +2782,16 @@ top: return (err); } - if (trim_mask) + if (trim_mask) { vap->va_mask |= saved_mask; + if (trim_mask & AT_MODE) { + /* + * Recover the mode after + * secpolicy_vnode_setattr(). + */ + vap->va_mode = saved_mode; + } + } } /* From stas at FreeBSD.org Wed Oct 7 13:12:44 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Oct 7 13:12:56 2009 Subject: svn commit: r197832 - head/sys/dev/bge Message-ID: <200910071312.n97DCigb085206@svn.freebsd.org> Author: stas Date: Wed Oct 7 13:12:43 2009 New Revision: 197832 URL: http://svn.freebsd.org/changeset/base/197832 Log: - Add support for new BGE chips (5761, 5784 and 57780). These chips uses new BGE_PCI_PRODID_ASICREV register to store the chip identifier and its revision. - Add new grouping macro for 7575+ chips (BGE_IS_5755_PLUS). - Add IDs for Fujitsu-branded Broadcom adapters. PR: kern/127587 Tested by: Thomas Quinot (BCM7561 A0) MFC after: 2 weeks Obtained from: OpenBSD Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 7 12:38:19 2009 (r197831) +++ head/sys/dev/bge/if_bge.c Wed Oct 7 13:12:43 2009 (r197832) @@ -170,6 +170,7 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5723 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5751 }, @@ -184,12 +185,21 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5754M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5755 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5755M }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761E }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761S }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5761SE }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5764 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5780 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5780S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5781 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5782 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5784 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5785F }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5785G }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5786 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5787 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5787F }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5787M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5788 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5789 }, @@ -198,11 +208,19 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5903M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5906 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5906M }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57760 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57780 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57788 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57790 }, { SK_VENDORID, SK_DEVICEID_ALTIMA }, { TC_VENDORID, TC_DEVICEID_3C996 }, + { FJTSU_VENDORID, FJTSU_DEVICEID_PW008GE4 }, + { FJTSU_VENDORID, FJTSU_DEVICEID_PW008GE5 }, + { FJTSU_VENDORID, FJTSU_DEVICEID_PP250450 }, + { 0, 0 } }; @@ -216,6 +234,7 @@ static const struct bge_vendor { { BCOM_VENDORID, "Broadcom" }, { SK_VENDORID, "SysKonnect" }, { TC_VENDORID, "3Com" }, + { FJTSU_VENDORID, "Fujitsu" }, { 0, NULL } }; @@ -271,12 +290,18 @@ static const struct bge_revision { { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, { BGE_CHIPID_BCM5722_A0, "BCM5722 A0" }, + { BGE_CHIPID_BCM5761_A0, "BCM5761 A0" }, + { BGE_CHIPID_BCM5761_A1, "BCM5761 A1" }, + { BGE_CHIPID_BCM5784_A0, "BCM5784 A0" }, + { BGE_CHIPID_BCM5784_A1, "BCM5784 A1" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_CHIPID_BCM5787_A0, "BCM5754/5787 A0" }, { BGE_CHIPID_BCM5787_A1, "BCM5754/5787 A1" }, { BGE_CHIPID_BCM5787_A2, "BCM5754/5787 A2" }, { BGE_CHIPID_BCM5906_A1, "BCM5906 A1" }, { BGE_CHIPID_BCM5906_A2, "BCM5906 A2" }, + { BGE_CHIPID_BCM57780_A0, "BCM57780 A0" }, + { BGE_CHIPID_BCM57780_A1, "BCM57780 A1" }, { 0, NULL } }; @@ -297,9 +322,13 @@ static const struct bge_revision bge_maj { BGE_ASICREV_BCM5780, "unknown BCM5780" }, { BGE_ASICREV_BCM5714, "unknown BCM5714" }, { BGE_ASICREV_BCM5755, "unknown BCM5755" }, + { BGE_ASICREV_BCM5761, "unknown BCM5761" }, + { BGE_ASICREV_BCM5784, "unknown BCM5784" }, + { BGE_ASICREV_BCM5785, "unknown BCM5785" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, { BGE_ASICREV_BCM5906, "unknown BCM5906" }, + { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { 0, NULL } }; @@ -309,6 +338,7 @@ static const struct bge_revision bge_maj #define BGE_IS_5705_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5705_PLUS) #define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5714_FAMILY) #define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS) +#define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5755_PLUS) const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); @@ -1758,8 +1788,7 @@ bge_blockinit(struct bge_softc *sc) val = BGE_WDMAMODE_ENABLE | BGE_WDMAMODE_ALL_ATTNS; /* Enable host coalescing bug fix. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || - sc->bge_asicrev == BGE_ASICREV_BCM5787) + if (BGE_IS_5755_PLUS(sc)) val |= 1 << 29; /* Turn on write DMA state machine */ @@ -1768,6 +1797,12 @@ bge_blockinit(struct bge_softc *sc) /* Turn on read DMA state machine */ val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || + sc->bge_asicrev == BGE_ASICREV_BCM57780) + val |= BGE_RDMAMODE_BD_SBD_CRPT_ATTN | + BGE_RDMAMODE_MBUF_RBD_CRPT_ATTN | + BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN; if (sc->bge_flags & BGE_FLAG_PCIE) val |= BGE_RDMAMODE_FIFO_LONG_BURST; CSR_WRITE_4(sc, BGE_RDMA_MODE, val); @@ -1790,7 +1825,10 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_SBDC_MODE, BGE_SBDCMODE_ENABLE); /* Turn on send data completion state machine */ - CSR_WRITE_4(sc, BGE_SDC_MODE, BGE_SDCMODE_ENABLE); + val = BGE_SDCMODE_ENABLE; + if (sc->bge_asicrev == BGE_ASICREV_BCM5761) + val |= BGE_SDCMODE_CDELAY; + CSR_WRITE_4(sc, BGE_SDC_MODE, val); /* Turn on send data initiator state machine */ CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE); @@ -1897,8 +1935,11 @@ bge_probe(device_t dev) const struct bge_vendor *v; uint32_t id; - id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & - BGE_PCIMISCCTL_ASICREV; + id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> + BGE_PCIMISCCTL_ASICREV_SHIFT; + if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) + id = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); br = bge_lookup_rev(id); v = bge_lookup_vendor(vid); { @@ -1915,8 +1956,8 @@ bge_probe(device_t dev) br != NULL ? br->br_name : "NetXtreme Ethernet Controller"); } - snprintf(buf, 96, "%s, %sASIC rev. %#04x", model, - br != NULL ? "" : "unknown ", id >> 16); + snprintf(buf, 96, "%s, %sASIC rev. %#08x", model, + br != NULL ? "" : "unknown ", id); device_set_desc_copy(dev, buf); if (pci_get_subvendor(dev) == DELL_VENDORID) sc->bge_flags |= BGE_FLAG_NO_3LED; @@ -2411,8 +2452,11 @@ bge_attach(device_t dev) /* Save various chip information. */ sc->bge_chipid = - pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & - BGE_PCIMISCCTL_ASICREV; + pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> + BGE_PCIMISCCTL_ASICREV_SHIFT; + if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) + sc->bge_chipid = pci_read_config(dev, BGE_PCI_PRODID_ASICREV, + 4); sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); @@ -2431,6 +2475,15 @@ bge_attach(device_t dev) /* Save chipset family. */ switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5755: + case BGE_ASICREV_BCM5761: + case BGE_ASICREV_BCM5784: + case BGE_ASICREV_BCM5785: + case BGE_ASICREV_BCM5787: + case BGE_ASICREV_BCM57780: + sc->bge_flags |= BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | + BGE_FLAG_5705_PLUS; + break; case BGE_ASICREV_BCM5700: case BGE_ASICREV_BCM5701: case BGE_ASICREV_BCM5703: @@ -2444,8 +2497,6 @@ bge_attach(device_t dev) /* FALLTHROUGH */ case BGE_ASICREV_BCM5750: case BGE_ASICREV_BCM5752: - case BGE_ASICREV_BCM5755: - case BGE_ASICREV_BCM5787: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; /* FALLTHROUGH */ @@ -2466,6 +2517,8 @@ bge_attach(device_t dev) if (BGE_IS_5705_PLUS(sc) && !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || + sc->bge_asicrev == BGE_ASICREV_BCM5761 || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5787) { if (sc->bge_chipid != BGE_CHIPID_BCM5722_A0) sc->bge_flags |= BGE_FLAG_JITTER_BUG; @@ -2873,8 +2926,7 @@ bge_reset(struct bge_softc *sc) /* Disable fastboot on controllers that support it. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5752 || - sc->bge_asicrev == BGE_ASICREV_BCM5755 || - sc->bge_asicrev == BGE_ASICREV_BCM5787) { + BGE_IS_5755_PLUS(sc)) { if (bootverbose) device_printf(sc->bge_dev, "Disabling fastboot\n"); CSR_WRITE_4(sc, BGE_FASTBOOT_PC, 0x0); @@ -4689,6 +4741,8 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG } printf("Hardware Flags:\n"); + if (BGE_IS_5755_PLUS(sc)) + printf(" - 5755 Plus\n"); if (BGE_IS_575X_PLUS(sc)) printf(" - 575X Plus\n"); if (BGE_IS_5705_PLUS(sc)) Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Wed Oct 7 12:38:19 2009 (r197831) +++ head/sys/dev/bge/if_bgereg.h Wed Oct 7 13:12:43 2009 (r197832) @@ -218,6 +218,7 @@ #define BGE_PCI_UNDI_TX_BD_PRODIDX_LO 0xAC #define BGE_PCI_ISR_MBX_HI 0xB0 #define BGE_PCI_ISR_MBX_LO 0xB4 +#define BGE_PCI_PRODID_ASICREV 0xBC /* PCI Misc. Host control register */ #define BGE_PCIMISCCTL_CLEAR_INTA 0x00000001 @@ -229,6 +230,7 @@ #define BGE_PCIMISCCTL_REG_WORDSWAP 0x00000040 #define BGE_PCIMISCCTL_INDIRECT_ACCESS 0x00000080 #define BGE_PCIMISCCTL_ASICREV 0xFFFF0000 +#define BGE_PCIMISCCTL_ASICREV_SHIFT 16 #define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP) #if BYTE_ORDER == LITTLE_ENDIAN @@ -245,66 +247,72 @@ (BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \ BGE_PCIMISCCTL_MASK_PCI_INTR|BGE_PCIMISCCTL_INDIRECT_ACCESS) -#define BGE_CHIPID_TIGON_I 0x40000000 -#define BGE_CHIPID_TIGON_II 0x60000000 -#define BGE_CHIPID_BCM5700_A0 0x70000000 -#define BGE_CHIPID_BCM5700_A1 0x70010000 -#define BGE_CHIPID_BCM5700_B0 0x71000000 -#define BGE_CHIPID_BCM5700_B1 0x71010000 -#define BGE_CHIPID_BCM5700_B2 0x71020000 -#define BGE_CHIPID_BCM5700_B3 0x71030000 -#define BGE_CHIPID_BCM5700_ALTIMA 0x71040000 -#define BGE_CHIPID_BCM5700_C0 0x72000000 -#define BGE_CHIPID_BCM5701_A0 0x00000000 /* grrrr */ -#define BGE_CHIPID_BCM5701_B0 0x01000000 -#define BGE_CHIPID_BCM5701_B2 0x01020000 -#define BGE_CHIPID_BCM5701_B5 0x01050000 -#define BGE_CHIPID_BCM5703_A0 0x10000000 -#define BGE_CHIPID_BCM5703_A1 0x10010000 -#define BGE_CHIPID_BCM5703_A2 0x10020000 -#define BGE_CHIPID_BCM5703_A3 0x10030000 -#define BGE_CHIPID_BCM5703_B0 0x11000000 -#define BGE_CHIPID_BCM5704_A0 0x20000000 -#define BGE_CHIPID_BCM5704_A1 0x20010000 -#define BGE_CHIPID_BCM5704_A2 0x20020000 -#define BGE_CHIPID_BCM5704_A3 0x20030000 -#define BGE_CHIPID_BCM5704_B0 0x21000000 -#define BGE_CHIPID_BCM5705_A0 0x30000000 -#define BGE_CHIPID_BCM5705_A1 0x30010000 -#define BGE_CHIPID_BCM5705_A2 0x30020000 -#define BGE_CHIPID_BCM5705_A3 0x30030000 -#define BGE_CHIPID_BCM5750_A0 0x40000000 -#define BGE_CHIPID_BCM5750_A1 0x40010000 -#define BGE_CHIPID_BCM5750_A3 0x40030000 -#define BGE_CHIPID_BCM5750_B0 0x41000000 -#define BGE_CHIPID_BCM5750_B1 0x41010000 -#define BGE_CHIPID_BCM5750_C0 0x42000000 -#define BGE_CHIPID_BCM5750_C1 0x42010000 -#define BGE_CHIPID_BCM5750_C2 0x42020000 -#define BGE_CHIPID_BCM5714_A0 0x50000000 -#define BGE_CHIPID_BCM5752_A0 0x60000000 -#define BGE_CHIPID_BCM5752_A1 0x60010000 -#define BGE_CHIPID_BCM5752_A2 0x60020000 -#define BGE_CHIPID_BCM5714_B0 0x80000000 -#define BGE_CHIPID_BCM5714_B3 0x80030000 -#define BGE_CHIPID_BCM5715_A0 0x90000000 -#define BGE_CHIPID_BCM5715_A1 0x90010000 -#define BGE_CHIPID_BCM5715_A3 0x90030000 -#define BGE_CHIPID_BCM5755_A0 0xa0000000 -#define BGE_CHIPID_BCM5755_A1 0xa0010000 -#define BGE_CHIPID_BCM5755_A2 0xa0020000 -#define BGE_CHIPID_BCM5722_A0 0xa2000000 -#define BGE_CHIPID_BCM5754_A0 0xb0000000 -#define BGE_CHIPID_BCM5754_A1 0xb0010000 -#define BGE_CHIPID_BCM5754_A2 0xb0020000 -#define BGE_CHIPID_BCM5787_A0 0xb0000000 -#define BGE_CHIPID_BCM5787_A1 0xb0010000 -#define BGE_CHIPID_BCM5787_A2 0xb0020000 -#define BGE_CHIPID_BCM5906_A1 0xc0010000 -#define BGE_CHIPID_BCM5906_A2 0xc0020000 +#define BGE_CHIPID_TIGON_I 0x4000 +#define BGE_CHIPID_TIGON_II 0x6000 +#define BGE_CHIPID_BCM5700_A0 0x7000 +#define BGE_CHIPID_BCM5700_A1 0x7001 +#define BGE_CHIPID_BCM5700_B0 0x7100 +#define BGE_CHIPID_BCM5700_B1 0x7101 +#define BGE_CHIPID_BCM5700_B2 0x7102 +#define BGE_CHIPID_BCM5700_B3 0x7103 +#define BGE_CHIPID_BCM5700_ALTIMA 0x7104 +#define BGE_CHIPID_BCM5700_C0 0x7200 +#define BGE_CHIPID_BCM5701_A0 0x0000 /* grrrr */ +#define BGE_CHIPID_BCM5701_B0 0x0100 +#define BGE_CHIPID_BCM5701_B2 0x0102 +#define BGE_CHIPID_BCM5701_B5 0x0105 +#define BGE_CHIPID_BCM5703_A0 0x1000 +#define BGE_CHIPID_BCM5703_A1 0x1001 +#define BGE_CHIPID_BCM5703_A2 0x1002 +#define BGE_CHIPID_BCM5703_A3 0x1003 +#define BGE_CHIPID_BCM5703_B0 0x1100 +#define BGE_CHIPID_BCM5704_A0 0x2000 +#define BGE_CHIPID_BCM5704_A1 0x2001 +#define BGE_CHIPID_BCM5704_A2 0x2002 +#define BGE_CHIPID_BCM5704_A3 0x2003 +#define BGE_CHIPID_BCM5704_B0 0x2100 +#define BGE_CHIPID_BCM5705_A0 0x3000 +#define BGE_CHIPID_BCM5705_A1 0x3001 +#define BGE_CHIPID_BCM5705_A2 0x3002 +#define BGE_CHIPID_BCM5705_A3 0x3003 +#define BGE_CHIPID_BCM5750_A0 0x4000 +#define BGE_CHIPID_BCM5750_A1 0x4001 +#define BGE_CHIPID_BCM5750_A3 0x4000 +#define BGE_CHIPID_BCM5750_B0 0x4100 +#define BGE_CHIPID_BCM5750_B1 0x4101 +#define BGE_CHIPID_BCM5750_C0 0x4200 +#define BGE_CHIPID_BCM5750_C1 0x4201 +#define BGE_CHIPID_BCM5750_C2 0x4202 +#define BGE_CHIPID_BCM5714_A0 0x5000 +#define BGE_CHIPID_BCM5752_A0 0x6000 +#define BGE_CHIPID_BCM5752_A1 0x6001 +#define BGE_CHIPID_BCM5752_A2 0x6002 +#define BGE_CHIPID_BCM5714_B0 0x8000 +#define BGE_CHIPID_BCM5714_B3 0x8003 +#define BGE_CHIPID_BCM5715_A0 0x9000 +#define BGE_CHIPID_BCM5715_A1 0x9001 +#define BGE_CHIPID_BCM5715_A3 0x9003 +#define BGE_CHIPID_BCM5755_A0 0xa000 +#define BGE_CHIPID_BCM5755_A1 0xa001 +#define BGE_CHIPID_BCM5755_A2 0xa002 +#define BGE_CHIPID_BCM5722_A0 0xa200 +#define BGE_CHIPID_BCM5754_A0 0xb000 +#define BGE_CHIPID_BCM5754_A1 0xb001 +#define BGE_CHIPID_BCM5754_A2 0xb002 +#define BGE_CHIPID_BCM5761_A0 0x5761000 +#define BGE_CHIPID_BCM5761_A1 0x5761100 +#define BGE_CHIPID_BCM5784_A0 0x5784000 +#define BGE_CHIPID_BCM5784_A1 0x5784100 +#define BGE_CHIPID_BCM5787_A0 0xb000 +#define BGE_CHIPID_BCM5787_A1 0xb001 +#define BGE_CHIPID_BCM5787_A2 0xb002 +#define BGE_CHIPID_BCM5906_A1 0xc001 +#define BGE_CHIPID_BCM5906_A2 0xc002 +#define BGE_CHIPID_BCM57780_A0 0x57780000 +#define BGE_CHIPID_BCM57780_A1 0x57780001 /* shorthand one */ -#define BGE_ASICREV(x) ((x) >> 28) +#define BGE_ASICREV(x) ((x) >> 12) #define BGE_ASICREV_BCM5701 0x00 #define BGE_ASICREV_BCM5703 0x01 #define BGE_ASICREV_BCM5704 0x02 @@ -319,9 +327,16 @@ #define BGE_ASICREV_BCM5754 0x0b #define BGE_ASICREV_BCM5787 0x0b #define BGE_ASICREV_BCM5906 0x0c +/* Should consult BGE_PCI_PRODID_ASICREV for ChipID */ +#define BGE_ASICREV_USE_PRODID_REG 0x0f +/* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ +#define BGE_ASICREV_BCM5761 0x5761 +#define BGE_ASICREV_BCM5784 0x5784 +#define BGE_ASICREV_BCM5785 0x5785 +#define BGE_ASICREV_BCM57780 0x57780 /* chip revisions */ -#define BGE_CHIPREV(x) ((x) >> 24) +#define BGE_CHIPREV(x) ((x) >> 8) #define BGE_CHIPREV_5700_AX 0x70 #define BGE_CHIPREV_5700_BX 0x71 #define BGE_CHIPREV_5700_CX 0x72 @@ -331,6 +346,9 @@ #define BGE_CHIPREV_5704_BX 0x21 #define BGE_CHIPREV_5750_AX 0x40 #define BGE_CHIPREV_5750_BX 0x41 +/* BGE_PCI_PRODID_ASICREV chip rev. identifiers. */ +#define BGE_CHIPREV_5761_AX 0x57611 +#define BGE_CHIPREV_5784_AX 0x57841 /* PCI DMA Read/Write Control register */ #define BGE_PCIDMARWCTL_MINDMA 0x000000FF @@ -861,6 +879,7 @@ #define BGE_SDCMODE_RESET 0x00000001 #define BGE_SDCMODE_ENABLE 0x00000002 #define BGE_SDCMODE_ATTN 0x00000004 +#define BGE_SDCMODE_CDELAY 0x00000010 /* Send Data completion status register */ #define BGE_SDCSTAT_ATTN 0x00000004 @@ -1378,6 +1397,9 @@ #define BGE_RDMAMODE_PCI_FIFOOREAD_ATTN 0x00000100 #define BGE_RDMAMODE_LOCWRITE_TOOBIG 0x00000200 #define BGE_RDMAMODE_ALL_ATTNS 0x000003FC +#define BGE_RDMAMODE_BD_SBD_CRPT_ATTN 0x00000800 +#define BGE_RDMAMODE_MBUF_RBD_CRPT_ATTN 0x00001000 +#define BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN 0x00002000 #define BGE_RDMAMODE_FIFO_SIZE_128 0x00020000 #define BGE_RDMAMODE_FIFO_LONG_BURST 0x00030000 @@ -2101,6 +2123,7 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5720 0x1658 #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A +#define BCOM_DEVICEID_BCM5723 0x165B #define BCOM_DEVICEID_BCM5750 0x1676 #define BCOM_DEVICEID_BCM5750M 0x167C #define BCOM_DEVICEID_BCM5751 0x1677 @@ -2115,13 +2138,22 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5754M 0x1672 #define BCOM_DEVICEID_BCM5755 0x167B #define BCOM_DEVICEID_BCM5755M 0x1673 +#define BCOM_DEVICEID_BCM5761 0x1681 +#define BCOM_DEVICEID_BCM5761E 0x1680 +#define BCOM_DEVICEID_BCM5761S 0x1688 +#define BCOM_DEVICEID_BCM5761SE 0x1689 +#define BCOM_DEVICEID_BCM5764 0x1684 #define BCOM_DEVICEID_BCM5780 0x166A #define BCOM_DEVICEID_BCM5780S 0x166B #define BCOM_DEVICEID_BCM5781 0x16DD #define BCOM_DEVICEID_BCM5782 0x1696 +#define BCOM_DEVICEID_BCM5784 0x1698 +#define BCOM_DEVICEID_BCM5785F 0x16a0 +#define BCOM_DEVICEID_BCM5785G 0x1699 #define BCOM_DEVICEID_BCM5786 0x169A #define BCOM_DEVICEID_BCM5787 0x169B #define BCOM_DEVICEID_BCM5787M 0x1693 +#define BCOM_DEVICEID_BCM5787F 0x167f #define BCOM_DEVICEID_BCM5788 0x169C #define BCOM_DEVICEID_BCM5789 0x169D #define BCOM_DEVICEID_BCM5901 0x170D @@ -2129,6 +2161,10 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5903M 0x16FF #define BCOM_DEVICEID_BCM5906 0x1712 #define BCOM_DEVICEID_BCM5906M 0x1713 +#define BCOM_DEVICEID_BCM57760 0x1690 +#define BCOM_DEVICEID_BCM57780 0x1692 +#define BCOM_DEVICEID_BCM57788 0x1691 +#define BCOM_DEVICEID_BCM57790 0x1694 /* * Alteon AceNIC PCI vendor/device ID. @@ -2179,6 +2215,14 @@ struct bge_status_block { #define SUN_VENDORID 0x108e /* + * Fujitsu vendor/device IDs + */ +#define FJTSU_VENDORID 0x10cf +#define FJTSU_DEVICEID_PW008GE5 0x11a1 +#define FJTSU_DEVICEID_PW008GE4 0x11a2 +#define FJTSU_DEVICEID_PP250450 0x11cc /* PRIMEPOWER250/450 LAN */ + +/* * Offset of MAC address inside EEPROM. */ #define BGE_EE_MAC_OFFSET 0x7C @@ -2558,6 +2602,7 @@ struct bge_softc { #define BGE_FLAG_5705_PLUS 0x00002000 #define BGE_FLAG_5714_FAMILY 0x00004000 #define BGE_FLAG_575X_PLUS 0x00008000 +#define BGE_FLAG_5755_PLUS 0x00010000 #define BGE_FLAG_RX_ALIGNBUG 0x00100000 #define BGE_FLAG_NO_3LED 0x00200000 #define BGE_FLAG_ADC_BUG 0x00400000 @@ -2568,8 +2613,8 @@ struct bge_softc { #define BGE_FLAG_CRC_BUG 0x08000000 #define BGE_FLAG_5788 0x20000000 uint32_t bge_chipid; - uint8_t bge_asicrev; - uint8_t bge_chiprev; + uint32_t bge_asicrev; + uint32_t bge_chiprev; uint8_t bge_asf_mode; uint8_t bge_asf_count; struct bge_ring_data bge_ldata; /* rings */ From jh at FreeBSD.org Wed Oct 7 13:25:23 2009 From: jh at FreeBSD.org (Jaakko Heinonen) Date: Wed Oct 7 13:25:37 2009 Subject: svn commit: r197833 - head/usr.sbin/cdcontrol Message-ID: <200910071325.n97DPNJN085484@svn.freebsd.org> Author: jh Date: Wed Oct 7 13:25:22 2009 New Revision: 197833 URL: http://svn.freebsd.org/changeset/base/197833 Log: When run() returns an error, print the error message also in non-interactive mode. Previously error messages were printed only in interactive mode. PR: bin/124517 Approved by: trasz (mentor) MFC after: 1 month Modified: head/usr.sbin/cdcontrol/cdcontrol.c Modified: head/usr.sbin/cdcontrol/cdcontrol.c ============================================================================== --- head/usr.sbin/cdcontrol/cdcontrol.c Wed Oct 7 13:12:43 2009 (r197832) +++ head/usr.sbin/cdcontrol/cdcontrol.c Wed Oct 7 13:25:22 2009 (r197833) @@ -241,7 +241,7 @@ int main (int argc, char **argv) if (argc > 0) { char buf[80], *p; - int len; + int len, rc; for (p=buf; argc-->0; ++argv) { len = strlen (*argv); @@ -257,7 +257,11 @@ int main (int argc, char **argv) } *p = 0; arg = parse (buf, &cmd); - return (run (cmd, arg)); + rc = run (cmd, arg); + if (rc < 0 && verbose) + warn(NULL); + + return (rc); } if (verbose == 1) From stas at FreeBSD.org Wed Oct 7 13:25:24 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Oct 7 13:25:48 2009 Subject: svn commit: r197834 - head/share/man/man4 Message-ID: <200910071325.n97DPODb085517@svn.freebsd.org> Author: stas Date: Wed Oct 7 13:25:24 2009 New Revision: 197834 URL: http://svn.freebsd.org/changeset/base/197834 Log: - Document new revisions of chips supported. Modified: head/share/man/man4/bge.4 Modified: head/share/man/man4/bge.4 ============================================================================== --- head/share/man/man4/bge.4 Wed Oct 7 13:25:22 2009 (r197833) +++ head/share/man/man4/bge.4 Wed Oct 7 13:25:24 2009 (r197834) @@ -31,12 +31,12 @@ .\" .\" $FreeBSD$ .\" -.Dd May 19, 2009 +.Dd Oct 7, 2009 .Dt BGE 4 .Os .Sh NAME .Nm bge -.Nd "Broadcom BCM570x/5714/5721/5722/5750/5751/5752/5789 PCI Gigabit Ethernet adapter driver" +.Nd "Broadcom BCM570x/5714/5721/5722/5750/5751/5752/5761/5784/5789/57780 PCI Gigabit Ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -56,8 +56,8 @@ if_bge_load="YES" The .Nm driver provides support for various NICs based on the Broadcom BCM570x, -5714, 5721, 5722, 5750, 5751, 5752 and 5789 families of Gigabit Ethernet -controller chips. +5714, 5721, 5722, 5750, 5751, 5752, 5761, 5784, 5789 and 57780 families +of Gigabit Ethernet controller chips. .Pp All of these NICs are capable of 10, 100 and 1000Mbps speeds over CAT5 copper cable, except for the SysKonnect SK-9D41 which supports only From simon at FreeBSD.org Wed Oct 7 13:45:12 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Wed Oct 7 13:45:19 2009 Subject: svn commit: r197835 - head/share/man/man4 Message-ID: <200910071345.n97DjC88085937@svn.freebsd.org> Author: simon Date: Wed Oct 7 13:45:12 2009 New Revision: 197835 URL: http://svn.freebsd.org/changeset/base/197835 Log: - Document that 'Dell PowerEdge R710' has bce(4) supported NIC. - Bump document date. MFC after: 3 days Modified: head/share/man/man4/bce.4 Modified: head/share/man/man4/bce.4 ============================================================================== --- head/share/man/man4/bce.4 Wed Oct 7 13:25:24 2009 (r197834) +++ head/share/man/man4/bce.4 Wed Oct 7 13:45:12 2009 (r197835) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2009 +.Dd October 7, 2009 .Dt BCE 4 .Os .Sh NAME @@ -165,6 +165,8 @@ Dell PowerEdge 1950 integrated BCM5708 N .It Dell PowerEdge 2950 integrated BCM5708 NIC .It +Dell PowerEdge R710 integrated BCM5709 NIC +.It HP NC370F Multifunction Gigabit Server Adapter .It HP NC370T Multifunction Gigabit Server Adapter From nyan at FreeBSD.org Wed Oct 7 14:14:06 2009 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Wed Oct 7 14:14:22 2009 Subject: svn commit: r197836 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci modules/nfslockd nlm Message-ID: <200910071414.n97EE5B3086509@svn.freebsd.org> Author: nyan Date: Wed Oct 7 14:14:05 2009 New Revision: 197836 URL: http://svn.freebsd.org/changeset/base/197836 Log: MFC: revision 197730 unifdef NFSCLIENT because the nlm depends on the nfsclient even if NFSCLIENT is not defined. Now the nfslockd module works with the nfsclient module. Reviewed by: kib Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/nfslockd/Makefile stable/8/sys/nlm/nlm_prot_impl.c Modified: stable/8/sys/modules/nfslockd/Makefile ============================================================================== --- stable/8/sys/modules/nfslockd/Makefile Wed Oct 7 13:45:12 2009 (r197835) +++ stable/8/sys/modules/nfslockd/Makefile Wed Oct 7 14:14:05 2009 (r197836) @@ -14,18 +14,12 @@ SRCS+= opt_inet6.h opt_nfs.h .if !defined(KERNBUILDDIR) NFS_INET6?= 1 # 0/1 - requires INET6 to be configured in kernel -NFSCLIENT?= 1 # 0/1 - requires NFSCLIENT to be configured in kernel .if ${NFS_INET6} > 0 opt_inet6.h: echo "#define INET6 1" > ${.TARGET} .endif -.if ${NFSCLIENT} > 0 -opt_nfs.h: - echo "#define NFSCLIENT 1" > ${.TARGET} -.endif - .endif .include Modified: stable/8/sys/nlm/nlm_prot_impl.c ============================================================================== --- stable/8/sys/nlm/nlm_prot_impl.c Wed Oct 7 13:45:12 2009 (r197835) +++ stable/8/sys/nlm/nlm_prot_impl.c Wed Oct 7 14:14:05 2009 (r197836) @@ -26,7 +26,6 @@ */ #include "opt_inet6.h" -#include "opt_nfs.h" #include __FBSDID("$FreeBSD$"); @@ -671,8 +670,6 @@ nlm_host_destroy(struct nlm_host *host) free(host, M_NLM); } -#ifdef NFSCLIENT - /* * Thread start callback for client lock recovery */ @@ -695,8 +692,6 @@ nlm_client_recovery_start(void *arg) kthread_exit(); } -#endif - /* * This is called when we receive a host state change notification. We * unlock any active locks owned by the host. When rpc.lockd is @@ -735,7 +730,6 @@ nlm_host_notify(struct nlm_host *host, i lf_clearremotesys(host->nh_sysid); host->nh_state = newstate; -#ifdef NFSCLIENT /* * If we have any remote locks for this host (i.e. it * represents a remote NFS server that our local NFS client @@ -750,7 +744,6 @@ nlm_host_notify(struct nlm_host *host, i kthread_add(nlm_client_recovery_start, host, curproc, &td, 0, 0, "NFS lock recovery for %s", host->nh_caller_name); } -#endif } /* @@ -1479,10 +1472,8 @@ nlm_server_main(int addr_count, char **a enum clnt_stat stat; struct nlm_host *host, *nhost; struct nlm_waiting_lock *nw; -#ifdef NFSCLIENT vop_advlock_t *old_nfs_advlock; vop_reclaim_t *old_nfs_reclaim; -#endif int v4_used; #ifdef INET6 int v6_used; @@ -1583,20 +1574,16 @@ nlm_server_main(int addr_count, char **a NLM_DEBUG(1, "NLM: local NSM state is %d\n", smstat.state); nlm_nsm_state = smstat.state; -#ifdef NFSCLIENT old_nfs_advlock = nfs_advlock_p; nfs_advlock_p = nlm_advlock; old_nfs_reclaim = nfs_reclaim_p; nfs_reclaim_p = nlm_reclaim; -#endif svc_run(pool); error = 0; -#ifdef NFSCLIENT nfs_advlock_p = old_nfs_advlock; nfs_reclaim_p = old_nfs_reclaim; -#endif out: if (pool) From stas at FreeBSD.org Wed Oct 7 14:29:50 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Wed Oct 7 14:29:56 2009 Subject: svn commit: r197837 - head/sys/dev/bge Message-ID: <200910071429.n97ETmS3086922@svn.freebsd.org> Author: stas Date: Wed Oct 7 14:29:48 2009 New Revision: 197837 URL: http://svn.freebsd.org/changeset/base/197837 Log: - Give a name to the host coalescing bug fix WDMA mode register bit instead of using hardcoded value in the code. Obtained from: OpenBSD Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 7 14:14:05 2009 (r197836) +++ head/sys/dev/bge/if_bge.c Wed Oct 7 14:29:48 2009 (r197837) @@ -1789,7 +1789,7 @@ bge_blockinit(struct bge_softc *sc) /* Enable host coalescing bug fix. */ if (BGE_IS_5755_PLUS(sc)) - val |= 1 << 29; + val |= BGE_WDMAMODE_STATUS_TAG_FIX; /* Turn on write DMA state machine */ CSR_WRITE_4(sc, BGE_WDMA_MODE, val); Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Wed Oct 7 14:14:05 2009 (r197836) +++ head/sys/dev/bge/if_bgereg.h Wed Oct 7 14:29:48 2009 (r197837) @@ -1431,6 +1431,7 @@ #define BGE_WDMAMODE_PCI_FIFOOREAD_ATTN 0x00000100 #define BGE_WDMAMODE_LOCREAD_TOOBIG 0x00000200 #define BGE_WDMAMODE_ALL_ATTNS 0x000003FC +#define BGE_WDMAMODE_STATUS_TAG_FIX 0x20000000 /* Write DMA status register */ #define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 From mav at FreeBSD.org Wed Oct 7 15:40:05 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Wed Oct 7 15:40:25 2009 Subject: svn commit: r197838 - in head/sys/dev: ahci siis Message-ID: <200910071540.n97Fe4xN088962@svn.freebsd.org> Author: mav Date: Wed Oct 7 15:40:04 2009 New Revision: 197838 URL: http://svn.freebsd.org/changeset/base/197838 Log: On command timeout handle frozen command first, to not run it inside XXX_end_transaction(). Submitted by: avg Modified: head/sys/dev/ahci/ahci.c head/sys/dev/siis/siis.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Oct 7 14:29:48 2009 (r197837) +++ head/sys/dev/ahci/ahci.c Wed Oct 7 15:40:04 2009 (r197838) @@ -1259,15 +1259,16 @@ ahci_timeout(struct ahci_slot *slot) if (!ch->readlog) xpt_freeze_simq(ch->sim, ch->numrslots); - /* Handle command with timeout. */ - ahci_end_transaction(&ch->slot[slot->slot], AHCI_ERR_TIMEOUT); - /* Handle the rest of commands. */ + /* Handle frozen command. */ if (ch->frozen) { union ccb *fccb = ch->frozen; ch->frozen = NULL; fccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; xpt_done(fccb); } + /* Handle command with timeout. */ + ahci_end_transaction(&ch->slot[slot->slot], AHCI_ERR_TIMEOUT); + /* Handle the rest of commands. */ for (i = 0; i < ch->numslots; i++) { /* Do we have a running request on slot? */ if (ch->slot[i].state < AHCI_SLOT_RUNNING) Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Wed Oct 7 14:29:48 2009 (r197837) +++ head/sys/dev/siis/siis.c Wed Oct 7 15:40:04 2009 (r197838) @@ -982,15 +982,16 @@ device_printf(dev, "%s is %08x ss %08x r if (!ch->readlog) xpt_freeze_simq(ch->sim, ch->numrslots); - /* Handle command with timeout. */ - siis_end_transaction(&ch->slot[slot->slot], SIIS_ERR_TIMEOUT); - /* Handle the rest of commands. */ + /* Handle frozen command. */ if (ch->frozen) { union ccb *fccb = ch->frozen; ch->frozen = NULL; fccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; xpt_done(fccb); } + /* Handle command with timeout. */ + siis_end_transaction(&ch->slot[slot->slot], SIIS_ERR_TIMEOUT); + /* Handle the rest of commands. */ for (i = 0; i < SIIS_MAX_SLOTS; i++) { /* Do we have a running request on slot? */ if (ch->slot[i].state < SIIS_SLOT_RUNNING) From marcus at FreeBSD.org Wed Oct 7 15:41:30 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Wed Oct 7 15:41:42 2009 Subject: svn commit: r197839 - stable/7/lib/libc Message-ID: <200910071541.n97FfU9G089113@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Wed Oct 7 15:41:30 2009 New Revision: 197839 URL: http://svn.freebsd.org/changeset/base/197839 Log: Record mergeinfo data for r197681. Approved by: kib Modified: stable/7/lib/libc/ (props changed) From zml at FreeBSD.org Wed Oct 7 19:50:14 2009 From: zml at FreeBSD.org (Zachary Loafman) Date: Wed Oct 7 19:50:21 2009 Subject: svn commit: r197840 - head/sys/nlm Message-ID: <200910071950.n97JoECb097724@svn.freebsd.org> Author: zml Date: Wed Oct 7 19:50:14 2009 New Revision: 197840 URL: http://svn.freebsd.org/changeset/base/197840 Log: Handle GRANTED_RES messages more gracefully: Send along a grant cookie to reference the lock, look up the grant cookie when the GRANTED_RES comes back. Properly handle the case of an error on the grant. Add a short expiration window so that granted locks are not freed immediately. Approved by: dfr (mentor) MFC after: 2 weeks Modified: head/sys/nlm/nlm.h head/sys/nlm/nlm_prot_impl.c head/sys/nlm/nlm_prot_server.c Modified: head/sys/nlm/nlm.h ============================================================================== --- head/sys/nlm/nlm.h Wed Oct 7 15:41:30 2009 (r197839) +++ head/sys/nlm/nlm.h Wed Oct 7 19:50:14 2009 (r197840) @@ -49,6 +49,12 @@ extern struct timeval nlm_zero_tv; extern int nlm_nsm_state; /* + * Make a struct netobj. + */ +extern void nlm_make_netobj(struct netobj *dst, caddr_t srt, + size_t srcsize, struct malloc_type *type); + +/* * Copy a struct netobj. */ extern void nlm_copy_netobj(struct netobj *dst, struct netobj *src, @@ -193,6 +199,12 @@ extern int nlm_do_granted(nlm4_testargs struct svc_req *rqstp, CLIENT **rpcp); /* + * Implementation for the granted result RPC. The client may reject the granted + * message, in which case we need to handle it appropriately. + */ +extern void nlm_do_granted_res(nlm4_res *argp, struct svc_req *rqstp); + +/* * Free all locks associated with the hostname argp->name. */ extern void nlm_do_free_all(nlm4_notify *argp); Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Wed Oct 7 15:41:30 2009 (r197839) +++ head/sys/nlm/nlm_prot_impl.c Wed Oct 7 19:50:14 2009 (r197840) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -77,6 +78,11 @@ MALLOC_DEFINE(M_NLM, "NLM", "Network Loc #define NLM_IDLE_PERIOD 5 /* + * We only look for GRANTED_RES messages for a little while. + */ +#define NLM_EXPIRE_TIMEOUT 10 + +/* * Support for sysctl vfs.nlm.sysid */ SYSCTL_NODE(_vfs, OID_AUTO, nlm, CTLFLAG_RW, NULL, "Network Lock Manager"); @@ -204,6 +210,7 @@ struct nlm_async_lock { struct nlm_host *af_host; /* (c) host which is locking */ CLIENT *af_rpc; /* (c) rpc client to send message */ nlm4_testargs af_granted; /* (c) notification details */ + time_t af_expiretime; /* (c) notification time */ }; TAILQ_HEAD(nlm_async_lock_list, nlm_async_lock); @@ -237,7 +244,9 @@ struct nlm_host { enum nlm_host_state nh_monstate; /* (l) local NSM monitoring state */ time_t nh_idle_timeout; /* (s) Time at which host is idle */ struct sysctl_ctx_list nh_sysctl; /* (c) vfs.nlm.sysid nodes */ + uint32_t nh_grantcookie; /* (l) grant cookie counter */ struct nlm_async_lock_list nh_pending; /* (l) pending async locks */ + struct nlm_async_lock_list nh_granted; /* (l) granted locks */ struct nlm_async_lock_list nh_finished; /* (l) finished async locks */ }; TAILQ_HEAD(nlm_host_list, nlm_host); @@ -247,6 +256,25 @@ static uint32_t nlm_next_sysid = 1; / static void nlm_host_unmonitor(struct nlm_host *); +struct nlm_grantcookie { + uint32_t ng_sysid; + uint32_t ng_cookie; +}; + +static inline uint32_t +ng_sysid(struct netobj *src) +{ + + return ((struct nlm_grantcookie *)src->n_bytes)->ng_sysid; +} + +static inline uint32_t +ng_cookie(struct netobj *src) +{ + + return ((struct nlm_grantcookie *)src->n_bytes)->ng_cookie; +} + /**********************************************************************/ /* @@ -281,6 +309,19 @@ nlm_uninit(void *dummy) SYSUNINIT(nlm_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, nlm_uninit, NULL); /* + * Create a netobj from an arbitrary source. + */ +void +nlm_make_netobj(struct netobj *dst, caddr_t src, size_t srcsize, + struct malloc_type *type) +{ + + dst->n_len = srcsize; + dst->n_bytes = malloc(srcsize, type, M_WAITOK); + memcpy(dst->n_bytes, src, srcsize); +} + +/* * Copy a struct netobj. */ void @@ -288,11 +329,10 @@ nlm_copy_netobj(struct netobj *dst, stru struct malloc_type *type) { - dst->n_len = src->n_len; - dst->n_bytes = malloc(src->n_len, type, M_WAITOK); - memcpy(dst->n_bytes, src->n_bytes, src->n_len); + nlm_make_netobj(dst, src->n_bytes, src->n_len, type); } + /* * Create an RPC client handle for the given (address,prog,vers) * triple using UDP. @@ -518,8 +558,10 @@ nlm_lock_callback(void *arg, int pending struct nlm_async_lock *af = (struct nlm_async_lock *) arg; struct rpc_callextra ext; - NLM_DEBUG(2, "NLM: async lock %p for %s (sysid %d) granted\n", - af, af->af_host->nh_caller_name, af->af_host->nh_sysid); + NLM_DEBUG(2, "NLM: async lock %p for %s (sysid %d) granted," + " cookie %d:%d\n", af, af->af_host->nh_caller_name, + af->af_host->nh_sysid, ng_sysid(&af->af_granted.cookie), + ng_cookie(&af->af_granted.cookie)); /* * Send the results back to the host. @@ -556,16 +598,12 @@ nlm_lock_callback(void *arg, int pending } /* - * Move this entry to the nh_finished list. Someone else will - * free it later - its too hard to do it here safely without - * racing with cancel. - * - * XXX possibly we should have a third "granted sent but not - * ack'ed" list so that we can re-send the granted message. + * Move this entry to the nh_granted list. */ + af->af_expiretime = time_uptime + NLM_EXPIRE_TIMEOUT; mtx_lock(&af->af_host->nh_lock); TAILQ_REMOVE(&af->af_host->nh_pending, af, af_link); - TAILQ_INSERT_TAIL(&af->af_host->nh_finished, af, af_link); + TAILQ_INSERT_TAIL(&af->af_host->nh_granted, af, af_link); mtx_unlock(&af->af_host->nh_lock); } @@ -635,11 +673,23 @@ nlm_cancel_async_lock(struct nlm_async_l } static void -nlm_free_finished_locks(struct nlm_host *host) +nlm_check_expired_locks(struct nlm_host *host) { struct nlm_async_lock *af; + time_t uptime = time_uptime; mtx_lock(&host->nh_lock); + while ((af = TAILQ_FIRST(&host->nh_granted)) != NULL + && uptime >= af->af_expiretime) { + NLM_DEBUG(2, "NLM: async lock %p for %s (sysid %d) expired," + " cookie %d:%d\n", af, af->af_host->nh_caller_name, + af->af_host->nh_sysid, ng_sysid(&af->af_granted.cookie), + ng_cookie(&af->af_granted.cookie)); + TAILQ_REMOVE(&host->nh_granted, af, af_link); + mtx_unlock(&host->nh_lock); + nlm_free_async_lock(af); + mtx_lock(&host->nh_lock); + } while ((af = TAILQ_FIRST(&host->nh_finished)) != NULL) { TAILQ_REMOVE(&host->nh_finished, af, af_link); mtx_unlock(&host->nh_lock); @@ -722,7 +772,7 @@ nlm_host_notify(struct nlm_host *host, i nlm_cancel_async_lock(af); } mtx_unlock(&host->nh_lock); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); /* * The host just rebooted - trash its locks. @@ -799,7 +849,9 @@ nlm_create_host(const char* caller_name) host->nh_vers = 0; host->nh_state = 0; host->nh_monstate = NLM_UNMONITORED; + host->nh_grantcookie = 1; TAILQ_INIT(&host->nh_pending); + TAILQ_INIT(&host->nh_granted); TAILQ_INIT(&host->nh_finished); TAILQ_INSERT_TAIL(&nlm_hosts, host, nh_link); @@ -1834,7 +1886,7 @@ nlm_do_test(nlm4_testargs *argp, nlm4_te NLM_DEBUG(3, "nlm_do_test(): caller_name = %s (sysid = %d)\n", host->nh_caller_name, host->nh_sysid); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -1939,7 +1991,7 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re nlm_host_notify(host, argp->state); } - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -1968,6 +2020,7 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re if (argp->block) { struct nlm_async_lock *af; CLIENT *client; + struct nlm_grantcookie cookie; /* * First, make sure we can contact the host's NLM. @@ -1993,6 +2046,10 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re break; } } + if (!af) { + cookie.ng_sysid = host->nh_sysid; + cookie.ng_cookie = host->nh_grantcookie++; + } mtx_unlock(&host->nh_lock); if (af) { CLNT_RELEASE(client); @@ -2011,6 +2068,8 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re * We use M_RPC here so that we can xdr_free the thing * later. */ + nlm_make_netobj(&af->af_granted.cookie, + (caddr_t)&cookie, sizeof(cookie), M_RPC); af->af_granted.exclusive = argp->exclusive; af->af_granted.alock.caller_name = strdup(argp->alock.caller_name, M_RPC); @@ -2111,7 +2170,7 @@ nlm_do_cancel(nlm4_cancargs *argp, nlm4_ NLM_DEBUG(3, "nlm_do_cancel(): caller_name = %s (sysid = %d)\n", host->nh_caller_name, host->nh_sysid); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -2200,7 +2259,7 @@ nlm_do_unlock(nlm4_unlockargs *argp, nlm NLM_DEBUG(3, "nlm_do_unlock(): caller_name = %s (sysid = %d)\n", host->nh_caller_name, host->nh_sysid); - nlm_free_finished_locks(host); + nlm_check_expired_locks(host); sysid = host->nh_sysid; nlm_convert_to_fhandle_t(&fh, &argp->alock.fh); @@ -2257,6 +2316,7 @@ nlm_do_granted(nlm4_testargs *argp, nlm4 nlm_copy_netobj(&result->cookie, &argp->cookie, M_RPC); result->stat.stat = nlm4_denied; + KFAIL_POINT_CODE(DEBUG_FP, nlm_deny_grant, goto out); mtx_lock(&nlm_global_lock); TAILQ_FOREACH(nw, &nlm_waiting_locks, nw_link) { @@ -2275,6 +2335,8 @@ nlm_do_granted(nlm4_testargs *argp, nlm4 } } mtx_unlock(&nlm_global_lock); + +out: if (rpcp) *rpcp = nlm_host_get_rpc(host, TRUE); nlm_host_release(host); @@ -2282,6 +2344,65 @@ nlm_do_granted(nlm4_testargs *argp, nlm4 } void +nlm_do_granted_res(nlm4_res *argp, struct svc_req *rqstp) +{ + struct nlm_host *host = NULL; + struct nlm_async_lock *af = NULL; + int error; + + if (argp->cookie.n_len != sizeof(struct nlm_grantcookie)) { + NLM_DEBUG(1, "NLM: bogus grant cookie"); + goto out; + } + + host = nlm_find_host_by_sysid(ng_sysid(&argp->cookie)); + if (!host) { + NLM_DEBUG(1, "NLM: Unknown host rejected our grant"); + goto out; + } + + mtx_lock(&host->nh_lock); + TAILQ_FOREACH(af, &host->nh_granted, af_link) + if (ng_cookie(&argp->cookie) == + ng_cookie(&af->af_granted.cookie)) + break; + if (af) + TAILQ_REMOVE(&host->nh_granted, af, af_link); + mtx_unlock(&host->nh_lock); + + if (!af) { + NLM_DEBUG(1, "NLM: host %s (sysid %d) replied to our grant " + "with unrecognized cookie %d:%d", host->nh_caller_name, + host->nh_sysid, ng_sysid(&argp->cookie), + ng_cookie(&argp->cookie)); + goto out; + } + + if (argp->stat.stat != nlm4_granted) { + af->af_fl.l_type = F_UNLCK; + error = VOP_ADVLOCK(af->af_vp, NULL, F_UNLCK, &af->af_fl, F_REMOTE); + if (error) { + NLM_DEBUG(1, "NLM: host %s (sysid %d) rejected our grant " + "and we failed to unlock (%d)", host->nh_caller_name, + host->nh_sysid, error); + goto out; + } + + NLM_DEBUG(5, "NLM: async lock %p rejected by host %s (sysid %d)", + af, host->nh_caller_name, host->nh_sysid); + } else { + NLM_DEBUG(5, "NLM: async lock %p accepted by host %s (sysid %d)", + af, host->nh_caller_name, host->nh_sysid); + } + + out: + if (af) + nlm_free_async_lock(af); + if (host) + nlm_host_release(host); +} + +void nlm_do_free_all(nlm4_notify *argp) { struct nlm_host *host, *thost; Modified: head/sys/nlm/nlm_prot_server.c ============================================================================== --- head/sys/nlm/nlm_prot_server.c Wed Oct 7 15:41:30 2009 (r197839) +++ head/sys/nlm/nlm_prot_server.c Wed Oct 7 19:50:14 2009 (r197840) @@ -671,6 +671,7 @@ bool_t nlm4_granted_res_4_svc(nlm4_res *argp, void *result, struct svc_req *rqstp) { + nlm_do_granted_res(argp, rqstp); return (FALSE); } From pjd at FreeBSD.org Wed Oct 7 20:09:27 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 20:09:33 2009 Subject: svn commit: r197816 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs In-Reply-To: <200910062140.n96LeoDG064737@svn.freebsd.org> References: <200910062140.n96LeoDG064737@svn.freebsd.org> Message-ID: <20091007200918.GC2049@garage.freebsd.pl> On Tue, Oct 06, 2009 at 09:40:50PM +0000, Kip Macy wrote: > Author: kmacy > Date: Tue Oct 6 21:40:50 2009 > New Revision: 197816 > URL: http://svn.freebsd.org/changeset/base/197816 > > Log: > Prevent paging pressure from draining arc too much > - always drain arc if above arc_c_max - never drain arc if arc is below arc_c_max Below arc_c_min, right? Thanks for working on this. > + if (arc_size <= arc_c_min) > + return (0); -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20091007/6806142f/attachment.pgp From rwatson at FreeBSD.org Wed Oct 7 20:20:52 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Wed Oct 7 20:20:59 2009 Subject: svn commit: r197841 - in head: lib/libc/gen lib/libc/sys sys/sys Message-ID: <200910072020.n97KKqPx098336@svn.freebsd.org> Author: rwatson Date: Wed Oct 7 20:20:51 2009 New Revision: 197841 URL: http://svn.freebsd.org/changeset/base/197841 Log: Add a new errno, ENOTCAPABLE, to be returned when a process requests an operation on a file descriptor that is not authorized by the descriptor's capability flags. MFC after: 1 month Sponsored by: Google Modified: head/lib/libc/gen/errlst.c head/lib/libc/sys/intro.2 head/sys/sys/errno.h Modified: head/lib/libc/gen/errlst.c ============================================================================== --- head/lib/libc/gen/errlst.c Wed Oct 7 19:50:14 2009 (r197840) +++ head/lib/libc/gen/errlst.c Wed Oct 7 20:20:51 2009 (r197841) @@ -150,5 +150,6 @@ const char *const sys_errlist[] = { "Multihop attempted", /* 90 - EMULTIHOP */ "Link has been severed", /* 91 - ENOLINK */ "Protocol error", /* 92 - EPROTO */ + "Capabilities insufficient", /* 93 - ENOTCAPABLE */ }; const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]); Modified: head/lib/libc/sys/intro.2 ============================================================================== --- head/lib/libc/sys/intro.2 Wed Oct 7 19:50:14 2009 (r197840) +++ head/lib/libc/sys/intro.2 Wed Oct 7 20:20:51 2009 (r197841) @@ -456,6 +456,9 @@ The specified extended attribute does no .It Er 88 EDOOFUS Em "Programming error" . A function or API is being abused in a way which could only be detected at run-time. +.It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . +An operation on a capability file descriptor requires greater privilege than +the capability allows. .El .Sh DEFINITIONS .Bl -tag -width Ds Modified: head/sys/sys/errno.h ============================================================================== --- head/sys/sys/errno.h Wed Oct 7 19:50:14 2009 (r197840) +++ head/sys/sys/errno.h Wed Oct 7 20:20:51 2009 (r197841) @@ -174,7 +174,11 @@ __END_DECLS #define EPROTO 92 /* Protocol error */ #ifndef _POSIX_SOURCE -#define ELAST 92 /* Must be equal largest errno */ +#define ENOTCAPABLE 93 /* Capabilities insufficient */ +#endif /* _POSIX_SOURCE */ + +#ifndef _POSIX_SOURCE +#define ELAST 93 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ #ifdef _KERNEL From pjd at FreeBSD.org Wed Oct 7 20:54:07 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 20:54:13 2009 Subject: svn commit: r197842 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910072054.n97Ks7EB099062@svn.freebsd.org> Author: pjd Date: Wed Oct 7 20:54:07 2009 New Revision: 197842 URL: http://svn.freebsd.org/changeset/base/197842 Log: Fix white-spaces. MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:20:51 2009 (r197841) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:54:07 2009 (r197842) @@ -433,7 +433,7 @@ vdev_geom_open_by_guid(vdev_t *vd) if (cp != NULL) { len = strlen(cp->provider->name) + strlen("/dev/") + 1; buf = kmem_alloc(len, KM_SLEEP); - + snprintf(buf, len, "/dev/%s", cp->provider->name); spa_strfree(vd->vdev_path); vd->vdev_path = buf; @@ -663,11 +663,11 @@ static void vdev_geom_io_done(zio_t *zio) { - /* - * If the device returned ENXIO, then attempt we should verify if GEOM - * provider has been removed. If this is the case, then we trigger an - * asynchronous removal of the device. - */ + /* + * If the device returned ENXIO, then attempt we should verify if GEOM + * provider has been removed. If this is the case, then we trigger an + * asynchronous removal of the device. + */ if (zio->io_error == ENXIO) { vdev_t *vd = zio->io_vd; vdev_geom_ctx_t *ctx; From pjd at FreeBSD.org Wed Oct 7 20:56:16 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Wed Oct 7 20:56:28 2009 Subject: svn commit: r197843 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910072056.n97KuGfc099150@svn.freebsd.org> Author: pjd Date: Wed Oct 7 20:56:15 2009 New Revision: 197843 URL: http://svn.freebsd.org/changeset/base/197843 Log: On FreeBSD it is enough to report provider removal when orphan event is received, we don't have to do it on every ENXIO error in I/O path. Solaris has no GEOM so they have to handle it in a less clean way. MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:54:07 2009 (r197842) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 7 20:56:15 2009 (r197843) @@ -662,26 +662,6 @@ sendreq: static void vdev_geom_io_done(zio_t *zio) { - - /* - * If the device returned ENXIO, then attempt we should verify if GEOM - * provider has been removed. If this is the case, then we trigger an - * asynchronous removal of the device. - */ - if (zio->io_error == ENXIO) { - vdev_t *vd = zio->io_vd; - vdev_geom_ctx_t *ctx; - struct g_provider *pp = NULL; - - ctx = vd->vdev_tsd; - if (ctx != NULL && ctx->gc_consumer != NULL) - pp = ctx->gc_consumer->provider; - - if (pp == NULL || (pp->flags & G_PF_ORPHAN)) { - vd->vdev_remove_wanted = B_TRUE; - spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE); - } - } } vdev_ops_t vdev_geom_ops = { From marcus at FreeBSD.org Wed Oct 7 21:05:41 2009 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Wed Oct 7 21:05:47 2009 Subject: svn commit: r197846 - stable/6/lib/libc Message-ID: <200910072105.n97L5eZH099572@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Wed Oct 7 21:05:40 2009 New Revision: 197846 URL: http://svn.freebsd.org/changeset/base/197846 Log: Record merginfo data for r197681. Approved by: kib Modified: stable/6/lib/libc/ (props changed) From edwin at FreeBSD.org Wed Oct 7 21:14:46 2009 From: edwin at FreeBSD.org (Edwin Groothuis) Date: Wed Oct 7 21:14:57 2009 Subject: svn commit: r197847 - head/usr.bin/locale Message-ID: <200910072114.n97LEjH3099863@svn.freebsd.org> Author: edwin Date: Wed Oct 7 21:14:45 2009 New Revision: 197847 URL: http://svn.freebsd.org/changeset/base/197847 Log: Add the comment "(FreeBSD only)" to the altmonth_x keywords MFC after: 1 week Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Wed Oct 7 21:05:40 2009 (r197846) +++ head/usr.bin/locale/locale.c Wed Oct 7 21:14:45 2009 (r197847) @@ -190,18 +190,18 @@ struct _kwinfo { { "abmon_10", 1, LC_TIME, ABMON_10, "" }, { "abmon_11", 1, LC_TIME, ABMON_11, "" }, { "abmon_12", 1, LC_TIME, ABMON_12, "" }, - { "altmon_1", 1, LC_TIME, ALTMON_1, "" }, - { "altmon_2", 1, LC_TIME, ALTMON_2, "" }, - { "altmon_3", 1, LC_TIME, ALTMON_3, "" }, - { "altmon_4", 1, LC_TIME, ALTMON_4, "" }, - { "altmon_5", 1, LC_TIME, ALTMON_5, "" }, - { "altmon_6", 1, LC_TIME, ALTMON_6, "" }, - { "altmon_7", 1, LC_TIME, ALTMON_7, "" }, - { "altmon_8", 1, LC_TIME, ALTMON_8, "" }, - { "altmon_9", 1, LC_TIME, ALTMON_9, "" }, - { "altmon_10", 1, LC_TIME, ALTMON_10, "" }, - { "altmon_11", 1, LC_TIME, ALTMON_11, "" }, - { "altmon_12", 1, LC_TIME, ALTMON_12, "" }, + { "altmon_1", 1, LC_TIME, ALTMON_1, "(FreeBSD only)" }, + { "altmon_2", 1, LC_TIME, ALTMON_2, "(FreeBSD only)" }, + { "altmon_3", 1, LC_TIME, ALTMON_3, "(FreeBSD only)" }, + { "altmon_4", 1, LC_TIME, ALTMON_4, "(FreeBSD only)" }, + { "altmon_5", 1, LC_TIME, ALTMON_5, "(FreeBSD only)" }, + { "altmon_6", 1, LC_TIME, ALTMON_6, "(FreeBSD only)" }, + { "altmon_7", 1, LC_TIME, ALTMON_7, "(FreeBSD only)" }, + { "altmon_8", 1, LC_TIME, ALTMON_8, "(FreeBSD only)" }, + { "altmon_9", 1, LC_TIME, ALTMON_9, "(FreeBSD only)" }, + { "altmon_10", 1, LC_TIME, ALTMON_10, "(FreeBSD only)" }, + { "altmon_11", 1, LC_TIME, ALTMON_11, "(FreeBSD only)" }, + { "altmon_12", 1, LC_TIME, ALTMON_12, "(FreeBSD only)" }, { "era", 1, LC_TIME, ERA, "(unavailable)" }, { "era_d_fmt", 1, LC_TIME, ERA_D_FMT, "(unavailable)" }, { "era_d_t_fmt", 1, LC_TIME, ERA_D_T_FMT, "(unavailable)" }, From jilles at FreeBSD.org Wed Oct 7 22:21:54 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Wed Oct 7 22:22:14 2009 Subject: svn commit: r197848 - head/bin/sh Message-ID: <200910072221.n97MLsfX001294@svn.freebsd.org> Author: jilles Date: Wed Oct 7 22:21:53 2009 New Revision: 197848 URL: http://svn.freebsd.org/changeset/base/197848 Log: Clarify quoting of word in ${v=word} in sh(1). Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Wed Oct 7 21:14:45 2009 (r197847) +++ head/bin/sh/sh.1 Wed Oct 7 22:21:53 2009 (r197848) @@ -1227,6 +1227,9 @@ In all cases, the final value of .Ar parameter is substituted. +Quoting inside +.Ar word +does not prevent field splitting or pathname expansion. Only variables, not positional parameters or special parameters, can be assigned in this way. From delphij at FreeBSD.org Wed Oct 7 23:01:32 2009 From: delphij at FreeBSD.org (Xin LI) Date: Wed Oct 7 23:01:50 2009 Subject: svn commit: r197849 - head/tools/regression/tmpfs Message-ID: <200910072301.n97N1VI6002073@svn.freebsd.org> Author: delphij Date: Wed Oct 7 23:01:31 2009 New Revision: 197849 URL: http://svn.freebsd.org/changeset/base/197849 Log: Fix build on amd64. PR: misc/139409 Submitted by: gk Modified: head/tools/regression/tmpfs/h_tools.c Modified: head/tools/regression/tmpfs/h_tools.c ============================================================================== --- head/tools/regression/tmpfs/h_tools.c Wed Oct 7 22:21:53 2009 (r197848) +++ head/tools/regression/tmpfs/h_tools.c Wed Oct 7 23:01:31 2009 (r197849) @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -250,10 +251,10 @@ statvfs_main(int argc, char **argv) return EXIT_FAILURE; } - (void)printf("f_bsize=%llu\n", buf.f_bsize); - (void)printf("f_blocks=%llu\n", buf.f_blocks); - (void)printf("f_bfree=%llu\n", buf.f_bfree); - (void)printf("f_files=%llu\n", buf.f_files); + (void)printf("f_bsize=%ju\n", (uintmax_t)buf.f_bsize); + (void)printf("f_blocks=%ju\n", (uintmax_t)buf.f_blocks); + (void)printf("f_bfree=%ju\n", (uintmax_t)buf.f_bfree); + (void)printf("f_files=%ju\n", (uintmax_t)buf.f_files); return EXIT_SUCCESS; } From delphij at FreeBSD.org Wed Oct 7 23:17:16 2009 From: delphij at FreeBSD.org (Xin LI) Date: Wed Oct 7 23:17:22 2009 Subject: svn commit: r197850 - head/sys/fs/tmpfs Message-ID: <200910072317.n97NHFKL002393@svn.freebsd.org> Author: delphij Date: Wed Oct 7 23:17:15 2009 New Revision: 197850 URL: http://svn.freebsd.org/changeset/base/197850 Log: Add a special workaround to handle UIO_NOCOPY case. This fixes data corruption observed when sendfile() is being used. PR: kern/127213 Submitted by: gk MFC after: 2 weeks Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:01:31 2009 (r197849) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:17:15 2009 (r197850) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -428,15 +430,72 @@ tmpfs_setattr(struct vop_setattr_args *v } /* --------------------------------------------------------------------- */ +static int +tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, + vm_offset_t offset, size_t tlen, struct uio *uio) +{ + vm_page_t m; + int error; + + VM_OBJECT_LOCK(tobj); + vm_object_pip_add(tobj, 1); + m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | + VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + if (m->valid != VM_PAGE_BITS_ALL) { + if (vm_pager_has_page(tobj, idx, NULL, NULL)) { + error = vm_pager_get_pages(tobj, &m, 1, 0); + if (error != 0) { + printf("tmpfs get pages from pager error [read]\n"); + goto out; + } + } else + vm_page_zero_invalid(m, TRUE); + } + VM_OBJECT_UNLOCK(tobj); + error = uiomove_fromphys(&m, offset, tlen, uio); + VM_OBJECT_LOCK(tobj); +out: + vm_page_lock_queues(); + vm_page_unwire(m, TRUE); + vm_page_unlock_queues(); + vm_page_wakeup(m); + vm_object_pip_subtract(tobj, 1); + VM_OBJECT_UNLOCK(tobj); + + return (error); +} + +static __inline int +tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, + vm_offset_t offset, size_t tlen, void *buf) +{ + struct uio uio; + struct iovec iov; + + uio.uio_iovcnt = 1; + uio.uio_iov = &iov; + iov.iov_base = buf; + iov.iov_len = tlen; + + uio.uio_offset = 0; + uio.uio_resid = tlen; + uio.uio_rw = UIO_READ; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_td = curthread; + + return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); +} static int tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) { + struct sf_buf *sf; vm_pindex_t idx; vm_page_t m; vm_offset_t offset; off_t addr; size_t tlen; + char *ma; int error; addr = uio->uio_offset; @@ -461,33 +520,30 @@ lookupvpg: vm_page_wakeup(m); VM_OBJECT_UNLOCK(vobj); return (error); + } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { + if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) + goto lookupvpg; + vm_page_busy(m); + VM_OBJECT_UNLOCK(vobj); + sched_pin(); + sf = sf_buf_alloc(m, SFB_CPUPRIVATE); + ma = (char *)sf_buf_kva(sf); + error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, + ma + offset); + if (error == 0) { + uio->uio_offset += tlen; + uio->uio_resid -= tlen; + } + sf_buf_free(sf); + sched_unpin(); + VM_OBJECT_LOCK(vobj); + vm_page_wakeup(m); + VM_OBJECT_UNLOCK(vobj); + return (error); } VM_OBJECT_UNLOCK(vobj); nocache: - VM_OBJECT_LOCK(tobj); - vm_object_pip_add(tobj, 1); - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - if (m->valid != VM_PAGE_BITS_ALL) { - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { - error = vm_pager_get_pages(tobj, &m, 1, 0); - if (error != 0) { - printf("tmpfs get pages from pager error [read]\n"); - goto out; - } - } else - vm_page_zero_invalid(m, TRUE); - } - VM_OBJECT_UNLOCK(tobj); - error = uiomove_fromphys(&m, offset, tlen, uio); - VM_OBJECT_LOCK(tobj); -out: - vm_page_lock_queues(); - vm_page_unwire(m, TRUE); - vm_page_unlock_queues(); - vm_page_wakeup(m); - vm_object_pip_subtract(tobj, 1); - VM_OBJECT_UNLOCK(tobj); + error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); return (error); } From snb at FreeBSD.org Thu Oct 8 09:03:05 2009 From: snb at FreeBSD.org (Sean Nicholas Barkas) Date: Thu Oct 8 09:03:11 2009 Subject: svn commit: r197852 - in stable/7/sys: . ufs/ufs Message-ID: <200910080903.n98934BO017462@svn.freebsd.org> Author: snb Date: Thu Oct 8 09:03:04 2009 New Revision: 197852 URL: http://svn.freebsd.org/changeset/base/197852 Log: MFC r193375, r194387, r195003: Add vm_lowmem event handler for dirhash. This will cause dirhashes to be deleted when the system is low on memory. This ought to allow an increase to vfs.ufs.dirhash_maxmem on machines that have lots of memory, without degrading performance by having too much memory reserved for dirhash when other things need it. The default value for dirhash_maxmem is being kept at 2MB for now, though. Approved by: dwmalone (mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/ufs/ufs/dirhash.h stable/7/sys/ufs/ufs/ufs_dirhash.c Modified: stable/7/sys/ufs/ufs/dirhash.h ============================================================================== --- stable/7/sys/ufs/ufs/dirhash.h Thu Oct 8 00:22:42 2009 (r197851) +++ stable/7/sys/ufs/ufs/dirhash.h Thu Oct 8 09:03:04 2009 (r197852) @@ -105,6 +105,8 @@ struct dirhash { int dh_onlist; /* true if on the ufsdirhash_list chain */ + time_t dh_lastused; /* time the dirhash was last read or written*/ + /* Protected by ufsdirhash_mtx. */ TAILQ_ENTRY(dirhash) dh_list; /* chain of all dirhashes */ }; Modified: stable/7/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_dirhash.c Thu Oct 8 00:22:42 2009 (r197851) +++ stable/7/sys/ufs/ufs/ufs_dirhash.c Thu Oct 8 09:03:04 2009 (r197852) @@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -81,6 +83,13 @@ SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_m static int ufs_dirhashcheck = 0; SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_docheck, CTLFLAG_RW, &ufs_dirhashcheck, 0, "enable extra sanity tests"); +static int ufs_dirhashlowmemcount = 0; +SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_lowmemcount, CTLFLAG_RD, + &ufs_dirhashlowmemcount, 0, "number of times low memory hook called"); +static int ufs_dirhashreclaimage = 5; +SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_reclaimage, CTLFLAG_RW, + &ufs_dirhashreclaimage, 0, + "max time in seconds of hash inactivity before deletion in low VM events"); static int ufsdirhash_hash(struct dirhash *dh, char *name, int namelen); @@ -90,6 +99,7 @@ static int ufsdirhash_findslot(struct di doff_t offset); static doff_t ufsdirhash_getprev(struct direct *dp, doff_t offset); static int ufsdirhash_recycle(int wanted); +static void ufsdirhash_lowmem(void); static void ufsdirhash_free_locked(struct inode *ip); static uma_zone_t ufsdirhash_zone; @@ -387,6 +397,7 @@ ufsdirhash_build(struct inode *ip) dh->dh_seqopt = 0; dh->dh_seqoff = 0; dh->dh_score = DH_SCOREINIT; + dh->dh_lastused = time_second; /* * Use non-blocking mallocs so that we will revert to a linear @@ -563,6 +574,9 @@ ufsdirhash_lookup(struct inode *ip, char /* Update the score. */ if (dh->dh_score < DH_SCOREMAX) dh->dh_score++; + + /* Update last used time. */ + dh->dh_lastused = time_second; DIRHASHLIST_UNLOCK(); vp = ip->i_vnode; @@ -805,6 +819,9 @@ ufsdirhash_add(struct inode *ip, struct dh->dh_hused++; DH_ENTRY(dh, slot) = offset; + /* Update last used time. */ + dh->dh_lastused = time_second; + /* Update the per-block summary info. */ ufsdirhash_adjfree(dh, offset, -DIRSIZ(0, dirp)); ufsdirhash_release(dh); @@ -1144,6 +1161,44 @@ ufsdirhash_getprev(struct direct *dirp, } /* + * Delete the given dirhash and reclaim its memory. Assumes that + * ufsdirhash_list is locked, and leaves it locked. Also assumes + * that dh is locked. Returns the amount of memory freed. + */ +static int +ufsdirhash_destroy(struct dirhash *dh) +{ + doff_t **hash; + u_int8_t *blkfree; + int i, mem, narrays; + + KASSERT(dh->dh_hash != NULL, ("dirhash: NULL hash on list")); + + /* Remove it from the list and detach its memory. */ + TAILQ_REMOVE(&ufsdirhash_list, dh, dh_list); + dh->dh_onlist = 0; + hash = dh->dh_hash; + dh->dh_hash = NULL; + blkfree = dh->dh_blkfree; + dh->dh_blkfree = NULL; + narrays = dh->dh_narrays; + mem = dh->dh_memreq; + dh->dh_memreq = 0; + + /* Unlock dirhash and free the detached memory. */ + ufsdirhash_release(dh); + for (i = 0; i < narrays; i++) + DIRHASH_BLKFREE(hash[i]); + free(hash, M_DIRHASH); + free(blkfree, M_DIRHASH); + + /* Account for the returned memory. */ + ufs_dirhashmem -= mem; + + return (mem); +} + +/* * Try to free up `wanted' bytes by stealing memory from existing * dirhashes. Returns zero with list locked if successful. */ @@ -1151,9 +1206,6 @@ static int ufsdirhash_recycle(int wanted) { struct dirhash *dh; - doff_t **hash; - u_int8_t *blkfree; - int i, mem, narrays; DIRHASHLIST_LOCK(); dh = TAILQ_FIRST(&ufsdirhash_list); @@ -1171,36 +1223,61 @@ ufsdirhash_recycle(int wanted) dh = TAILQ_NEXT(dh, dh_list); continue; } - KASSERT(dh->dh_hash != NULL, ("dirhash: NULL hash on list")); - /* Remove it from the list and detach its memory. */ - TAILQ_REMOVE(&ufsdirhash_list, dh, dh_list); - dh->dh_onlist = 0; - hash = dh->dh_hash; - dh->dh_hash = NULL; - blkfree = dh->dh_blkfree; - dh->dh_blkfree = NULL; - narrays = dh->dh_narrays; - mem = dh->dh_memreq; - dh->dh_memreq = 0; + ufsdirhash_destroy(dh); - /* Unlock everything, free the detached memory. */ - ufsdirhash_release(dh); - DIRHASHLIST_UNLOCK(); - for (i = 0; i < narrays; i++) - DIRHASH_BLKFREE(hash[i]); - FREE(hash, M_DIRHASH); - FREE(blkfree, M_DIRHASH); - - /* Account for the returned memory, and repeat if necessary. */ - DIRHASHLIST_LOCK(); - ufs_dirhashmem -= mem; + /* Repeat if necessary. */ dh = TAILQ_FIRST(&ufsdirhash_list); } /* Success; return with list locked. */ return (0); } +/* + * Callback that frees some dirhashes when the system is low on virtual memory. + */ +static void +ufsdirhash_lowmem() +{ + struct dirhash *dh, *dh_temp; + int memfreed = 0; + /* XXX: this 10% may need to be adjusted */ + int memwanted = ufs_dirhashmem / 10; + + ufs_dirhashlowmemcount++; + + DIRHASHLIST_LOCK(); + /* + * Delete dirhashes not used for more than ufs_dirhashreclaimage + * seconds. If we can't get a lock on the dirhash, it will be skipped. + */ + TAILQ_FOREACH_SAFE(dh, &ufsdirhash_list, dh_list, dh_temp) { + if (!sx_try_xlock(&dh->dh_lock)) + continue; + if (time_second - dh->dh_lastused > ufs_dirhashreclaimage) + memfreed += ufsdirhash_destroy(dh); + /* Unlock if we didn't delete the dirhash */ + else + ufsdirhash_release(dh); + } + + /* + * If not enough memory was freed, keep deleting hashes from the head + * of the dirhash list. The ones closest to the head should be the + * oldest. + */ + if (memfreed < memwanted) { + TAILQ_FOREACH_SAFE(dh, &ufsdirhash_list, dh_list, dh_temp) { + if (!sx_try_xlock(&dh->dh_lock)) + continue; + memfreed += ufsdirhash_destroy(dh); + if (memfreed >= memwanted) + break; + } + } + DIRHASHLIST_UNLOCK(); +} + void ufsdirhash_init() @@ -1209,6 +1286,10 @@ ufsdirhash_init() NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); mtx_init(&ufsdirhash_mtx, "dirhash list", NULL, MTX_DEF); TAILQ_INIT(&ufsdirhash_list); + + /* Register a callback function to handle low memory signals */ + EVENTHANDLER_REGISTER(vm_lowmem, ufsdirhash_lowmem, NULL, + EVENTHANDLER_PRI_FIRST); } void From ed at FreeBSD.org Thu Oct 8 10:26:50 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Thu Oct 8 10:26:56 2009 Subject: svn commit: r197853 - head/sys/teken Message-ID: <200910081026.n98AQoEM019144@svn.freebsd.org> Author: ed Date: Thu Oct 8 10:26:49 2009 New Revision: 197853 URL: http://svn.freebsd.org/changeset/base/197853 Log: Discard Device Control Strings and Operating System Commands. These strings often contain things like: - Window titles. - Extended key map functionality. - Color palette switching. We could look at these features in the future (if people consider them to be important enough), but we'd better discard them now. This fixes some artifacts people reported when using TERM=xterm. Reported by: des@, Paul B. Mahol Modified: head/sys/teken/sequences head/sys/teken/teken.c head/sys/teken/teken_subr.h Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Thu Oct 8 09:03:04 2009 (r197852) +++ head/sys/teken/sequences Thu Oct 8 10:26:49 2009 (r197853) @@ -88,6 +88,7 @@ ICH Insert character ^[ [ @ n IL Insert line ^[ [ L n IND Index ^[ D NEL Next line ^[ E +OSC Operating System Command ^[ ] RI Reverse index ^[ M RIS Reset to Initial State ^[ c RM Reset Mode ^[ [ l r Modified: head/sys/teken/teken.c ============================================================================== --- head/sys/teken/teken.c Thu Oct 8 09:03:04 2009 (r197852) +++ head/sys/teken/teken.c Thu Oct 8 10:26:49 2009 (r197853) @@ -56,6 +56,7 @@ static FILE *df; #define TS_WRAPPED 0x10 /* Next character should be printed on col 0. */ #define TS_8BIT 0x20 /* UTF-8 disabled. */ #define TS_CONS25 0x40 /* cons25 emulation. */ +#define TS_INSTRING 0x80 /* Inside string. */ /* Character that blanks a cell. */ #define BLANK ' ' @@ -176,6 +177,24 @@ static void teken_input_char(teken_t *t, teken_char_t c) { + /* + * There is no support for DCS and OSC. Just discard strings + * until we receive characters that may indicate string + * termination. + */ + if (t->t_stateflags & TS_INSTRING) { + switch (c) { + case '\x1B': + t->t_stateflags &= ~TS_INSTRING; + break; + case '\a': + t->t_stateflags &= ~TS_INSTRING; + return; + default: + return; + } + } + switch (c) { case '\0': break; Modified: head/sys/teken/teken_subr.h ============================================================================== --- head/sys/teken/teken_subr.h Thu Oct 8 09:03:04 2009 (r197852) +++ head/sys/teken/teken_subr.h Thu Oct 8 10:26:49 2009 (r197853) @@ -425,10 +425,11 @@ teken_subr_delete_line(teken_t *t, unsig } static void -teken_subr_device_control_string(teken_t *t __unused) +teken_subr_device_control_string(teken_t *t) { - teken_printf("device control string???\n"); + teken_printf("Unsupported device control string\n"); + t->t_stateflags |= TS_INSTRING; } static void @@ -744,6 +745,14 @@ teken_subr_next_line(teken_t *t) } static void +teken_subr_operating_system_command(teken_t *t) +{ + + teken_printf("Unsupported operating system command\n"); + t->t_stateflags |= TS_INSTRING; +} + +static void teken_subr_pan_down(teken_t *t, unsigned int nrows) { @@ -1258,7 +1267,10 @@ static void teken_subr_string_terminator(teken_t *t __unused) { - teken_printf("string terminator???\n"); + /* + * Strings are already terminated in teken_input_char() when ^[ + * is inserted. + */ } static void From rwatson at FreeBSD.org Thu Oct 8 11:07:16 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Thu Oct 8 11:07:31 2009 Subject: svn commit: r197854 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet Message-ID: <200910081107.n98B7FZ9021077@svn.freebsd.org> Author: rwatson Date: Thu Oct 8 11:07:15 2009 New Revision: 197854 URL: http://svn.freebsd.org/changeset/base/197854 Log: Merge r197795 from head to stable/8: In tcp_input(), we acquire a global write lock at first only if a segment is likely to trigger a TCP state change (i.e., FIN/RST/SYN). If we later have to upgrade the lock, we acquire an inpcb reference and drop both global/inpcb locks before reacquiring in-order. In that gap, the connection may transition into TIMEWAIT, so we need to loop back and reevaluate the inpcb after relocking. Reported by: Kamigishi Rei Reviewed by: bz Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/tcp_input.c Modified: stable/8/sys/netinet/tcp_input.c ============================================================================== --- stable/8/sys/netinet/tcp_input.c Thu Oct 8 10:26:49 2009 (r197853) +++ stable/8/sys/netinet/tcp_input.c Thu Oct 8 11:07:15 2009 (r197854) @@ -648,6 +648,7 @@ findpcb: * tried to free the inpcb, in which case we need to loop back and * try to find a new inpcb to deliver to. */ +relocked: if (inp->inp_flags & INP_TIMEWAIT) { KASSERT(ti_locked == TI_RLOCKED || ti_locked == TI_WLOCKED, ("%s: INP_TIMEWAIT ti_locked %d", __func__, ti_locked)); @@ -698,7 +699,8 @@ findpcb: * We've identified a valid inpcb, but it could be that we need an * inpcbinfo write lock and have only a read lock. In this case, * attempt to upgrade/relock using the same strategy as the TIMEWAIT - * case above. + * case above. If we relock, we have to jump back to 'relocked' as + * the connection might now be in TIMEWAIT. */ if (tp->t_state != TCPS_ESTABLISHED || (thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || @@ -720,6 +722,7 @@ findpcb: goto findpcb; } tcp_wlock_relocked++; + goto relocked; } else { ti_locked = TI_WLOCKED; tcp_wlock_upgraded++; From kib at FreeBSD.org Thu Oct 8 11:28:33 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 8 11:28:50 2009 Subject: svn commit: r197855 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern Message-ID: <200910081128.n98BSWCd021500@svn.freebsd.org> Author: kib Date: Thu Oct 8 11:28:32 2009 New Revision: 197855 URL: http://svn.freebsd.org/changeset/base/197855 Log: MFC r197662: Do not dereference vp->v_mount without holding vnode lock and checking that the vnode is not reclaimed. Approved by: re (bz) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/uipc_syscalls.c Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Thu Oct 8 11:07:15 2009 (r197854) +++ stable/8/sys/kern/uipc_syscalls.c Thu Oct 8 11:28:32 2009 (r197855) @@ -2085,9 +2085,11 @@ retry_space: /* * Get the page from backing store. */ - bsize = vp->v_mount->mnt_stat.f_iosize; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_SHARED | LK_RETRY); + error = vn_lock(vp, LK_SHARED); + if (error != 0) + goto after_read; + bsize = vp->v_mount->mnt_stat.f_iosize; /* * XXXMAC: Because we don't have fp->f_cred @@ -2100,6 +2102,7 @@ retry_space: IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), td->td_ucred, NOCRED, &resid, td); VOP_UNLOCK(vp, 0); + after_read: VFS_UNLOCK_GIANT(vfslocked); VM_OBJECT_LOCK(obj); vm_page_io_finish(pg); From rrs at FreeBSD.org Thu Oct 8 11:36:06 2009 From: rrs at FreeBSD.org (Randall Stewart) Date: Thu Oct 8 11:36:12 2009 Subject: svn commit: r197856 - head/sys/netinet Message-ID: <200910081136.n98Ba63d021725@svn.freebsd.org> Author: rrs Date: Thu Oct 8 11:36:06 2009 New Revision: 197856 URL: http://svn.freebsd.org/changeset/base/197856 Log: Fix so that round robing stream scheduling works as advertised MFC after: 0 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Oct 8 11:28:32 2009 (r197855) +++ head/sys/netinet/sctp_output.c Thu Oct 8 11:36:06 2009 (r197856) @@ -5602,8 +5602,6 @@ sctp_insert_on_wheel(struct sctp_tcb *st struct sctp_association *asoc, struct sctp_stream_out *strq, int holds_lock) { - struct sctp_stream_out *stre, *strn; - if (holds_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } @@ -5612,26 +5610,7 @@ sctp_insert_on_wheel(struct sctp_tcb *st /* already on wheel */ goto outof_here; } - stre = TAILQ_FIRST(&asoc->out_wheel); - if (stre == NULL) { - /* only one on wheel */ - TAILQ_INSERT_HEAD(&asoc->out_wheel, strq, next_spoke); - goto outof_here; - } - for (; stre; stre = strn) { - strn = TAILQ_NEXT(stre, next_spoke); - if (stre->stream_no > strq->stream_no) { - TAILQ_INSERT_BEFORE(stre, strq, next_spoke); - goto outof_here; - } else if (stre->stream_no == strq->stream_no) { - /* huh, should not happen */ - goto outof_here; - } else if (strn == NULL) { - /* next one is null */ - TAILQ_INSERT_AFTER(&asoc->out_wheel, stre, strq, - next_spoke); - } - } + TAILQ_INSERT_TAIL(&asoc->out_wheel, strq, next_spoke); outof_here: if (holds_lock == 0) { SCTP_TCB_SEND_UNLOCK(stcb); @@ -7202,8 +7181,6 @@ done_it: if (strq == NULL) { strq = asoc->last_out_stream = TAILQ_FIRST(&asoc->out_wheel); } - /* Save off the last stream */ - asoc->last_out_stream = strq; return (strq); } @@ -7280,7 +7257,9 @@ sctp_fill_outqueue(struct sctp_tcb *stcb bail = 0; moved_how_much = sctp_move_to_outqueue(stcb, net, strq, goal_mtu, frag_point, &locked, &giveup, eeor_mode, &bail); - asoc->last_out_stream = strq; + if (moved_how_much) + asoc->last_out_stream = strq; + if (locked) { asoc->locked_on_sending = strq; if ((moved_how_much == 0) || (giveup) || bail) From kib at FreeBSD.org Thu Oct 8 11:42:24 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Thu Oct 8 11:42:35 2009 Subject: svn commit: r197857 - in stable/7/sys: . contrib/pf kern Message-ID: <200910081142.n98BgOGp021906@svn.freebsd.org> Author: kib Date: Thu Oct 8 11:42:24 2009 New Revision: 197857 URL: http://svn.freebsd.org/changeset/base/197857 Log: MFC r197662: Do not dereference vp->v_mount without holding vnode lock and checking that the vnode is not reclaimed. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/uipc_syscalls.c Modified: stable/7/sys/kern/uipc_syscalls.c ============================================================================== --- stable/7/sys/kern/uipc_syscalls.c Thu Oct 8 11:36:06 2009 (r197856) +++ stable/7/sys/kern/uipc_syscalls.c Thu Oct 8 11:42:24 2009 (r197857) @@ -2076,9 +2076,11 @@ retry_space: /* * Get the page from backing store. */ - bsize = vp->v_mount->mnt_stat.f_iosize; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_SHARED | LK_RETRY, td); + error = vn_lock(vp, LK_SHARED, td); + if (error != 0) + goto after_read; + bsize = vp->v_mount->mnt_stat.f_iosize; /* * XXXMAC: Because we don't have fp->f_cred @@ -2091,6 +2093,7 @@ retry_space: IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), td->td_ucred, NOCRED, &resid, td); VOP_UNLOCK(vp, 0, td); + after_read: VFS_UNLOCK_GIANT(vfslocked); VM_OBJECT_LOCK(obj); vm_page_io_finish(pg); From trasz at FreeBSD.org Thu Oct 8 15:34:01 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Oct 8 15:34:13 2009 Subject: svn commit: r197859 - head/cddl/contrib/opensolaris/lib/libzfs/common Message-ID: <200910081534.n98FY185026334@svn.freebsd.org> Author: trasz Date: Thu Oct 8 15:34:01 2009 New Revision: 197859 URL: http://svn.freebsd.org/changeset/base/197859 Log: 'aclmode' and 'aclinherit' properties should work as advertised; don't refuse to set them. Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 13:57:51 2009 (r197858) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 15:34:01 2009 (r197859) @@ -1792,8 +1792,6 @@ zfs_prop_set(zfs_handle_t *zhp, const ch switch (prop) { case ZFS_PROP_SHAREISCSI: case ZFS_PROP_DEVICES: - case ZFS_PROP_ACLMODE: - case ZFS_PROP_ACLINHERIT: case ZFS_PROP_ISCSIOPTIONS: (void) snprintf(errbuf, sizeof (errbuf), "property '%s' not supported on FreeBSD", propname); From pjd at FreeBSD.org Thu Oct 8 16:03:20 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Thu Oct 8 16:03:27 2009 Subject: svn commit: r197860 - head/sys/cddl/compat/opensolaris/kern Message-ID: <200910081603.n98G3KxV026926@svn.freebsd.org> Author: pjd Date: Thu Oct 8 16:03:19 2009 New Revision: 197860 URL: http://svn.freebsd.org/changeset/base/197860 Log: File system owner is when uid matches and jail matches. MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 15:34:01 2009 (r197859) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 16:03:19 2009 (r197860) @@ -78,12 +78,11 @@ secpolicy_fs_owner(struct mount *mp, str if (zfs_super_owner) { if (cred->cr_uid == mp->mnt_cred->cr_uid && - (!jailed(cred) || - cred->cr_prison == mp->mnt_cred->cr_prison)) { + cred->cr_prison == mp->mnt_cred->cr_prison) { return (0); } } - return (priv_check_cred(cred, PRIV_VFS_MOUNT_OWNER, 0)); + return (EPERM); } /* From pjd at FreeBSD.org Thu Oct 8 16:05:17 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Thu Oct 8 16:05:23 2009 Subject: svn commit: r197861 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs Message-ID: <200910081605.n98G5HJY027001@svn.freebsd.org> Author: pjd Date: Thu Oct 8 16:05:17 2009 New Revision: 197861 URL: http://svn.freebsd.org/changeset/base/197861 Log: Allow file system owner to modify system flags if securelevel permits. MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c head/sys/cddl/compat/opensolaris/sys/policy.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 16:03:19 2009 (r197860) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Thu Oct 8 16:05:17 2009 (r197861) @@ -358,8 +358,11 @@ secpolicy_fs_mount_clearopts(cred_t *cr, * Check privileges for setting xvattr attributes */ int -secpolicy_xvattr(xvattr_t *xvap, uid_t owner, cred_t *cr, vtype_t vtype) +secpolicy_xvattr(struct vnode *vp, xvattr_t *xvap, uid_t owner, cred_t *cr, + vtype_t vtype) { + if (secpolicy_fs_owner(vp->v_mount, cr) == 0) + return (0); return (priv_check_cred(cr, PRIV_VFS_SYSFLAGS, 0)); } Modified: head/sys/cddl/compat/opensolaris/sys/policy.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/policy.h Thu Oct 8 16:03:19 2009 (r197860) +++ head/sys/cddl/compat/opensolaris/sys/policy.h Thu Oct 8 16:05:17 2009 (r197861) @@ -70,7 +70,8 @@ int secpolicy_setid_setsticky_clear(stru int secpolicy_fs_owner(struct mount *vfsp, struct ucred *cred); int secpolicy_fs_mount(cred_t *cr, vnode_t *mvp, struct mount *vfsp); void secpolicy_fs_mount_clearopts(cred_t *cr, struct mount *vfsp); -int secpolicy_xvattr(xvattr_t *xvap, uid_t owner, cred_t *cr, vtype_t vtype); +int secpolicy_xvattr(struct vnode *vp, xvattr_t *xvap, uid_t owner, + cred_t *cr, vtype_t vtype); #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 8 16:03:19 2009 (r197860) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 8 16:05:17 2009 (r197861) @@ -1306,7 +1306,7 @@ zfs_create(vnode_t *dvp, char *name, vat } if (vap->va_mask & AT_XVATTR) { - if ((error = secpolicy_xvattr((xvattr_t *)vap, + if ((error = secpolicy_xvattr(dvp, (xvattr_t *)vap, crgetuid(cr), cr, vap->va_type)) != 0) { ZFS_EXIT(zfsvfs); return (error); @@ -1758,7 +1758,7 @@ zfs_mkdir(vnode_t *dvp, char *dirname, v zf |= ZCILOOK; if (vap->va_mask & AT_XVATTR) - if ((error = secpolicy_xvattr((xvattr_t *)vap, + if ((error = secpolicy_xvattr(dvp, (xvattr_t *)vap, crgetuid(cr), cr, vap->va_type)) != 0) { ZFS_EXIT(zfsvfs); return (error); @@ -4206,12 +4206,6 @@ zfs_freebsd_setattr(ap) if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) return (EOPNOTSUPP); /* - * Callers may only modify the file flags on objects they - * have VADMIN rights for. - */ - if ((error = VOP_ACCESS(vp, VADMIN, cred, curthread)) != 0) - return (error); - /* * Unprivileged processes are not permitted to unset system * flags, or modify flags if any system flags are set. * Privileged non-jail processes may not modify system flags @@ -4221,14 +4215,21 @@ zfs_freebsd_setattr(ap) * is non-zero; otherwise, they behave like unprivileged * processes. */ - if (priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0) == 0) { + if (secpolicy_fs_owner(vp->v_mount, cred) == 0 || + priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0) == 0) { if (zflags & (ZFS_IMMUTABLE | ZFS_APPENDONLY | ZFS_NOUNLINK)) { error = securelevel_gt(cred, 0); - if (error) + if (error != 0) return (error); } } else { + /* + * Callers may only modify the file flags on objects they + * have VADMIN rights for. + */ + if ((error = VOP_ACCESS(vp, VADMIN, cred, curthread)) != 0) + return (error); if (zflags & (ZFS_IMMUTABLE | ZFS_APPENDONLY | ZFS_NOUNLINK)) { return (EPERM); From stefanf at FreeBSD.org Thu Oct 8 17:11:02 2009 From: stefanf at FreeBSD.org (Stefan Farfeleder) Date: Thu Oct 8 17:11:08 2009 Subject: svn commit: r197862 - stable/7/bin/sh Message-ID: <200910081711.n98HB2eV028248@svn.freebsd.org> Author: stefanf Date: Thu Oct 8 17:11:01 2009 New Revision: 197862 URL: http://svn.freebsd.org/changeset/base/197862 Log: Merge r191009. > Parse 'cmd1 && ! cmd2 | cmd3' correctly, the bang should apply to the entire > pipeline cmd2 | cmd3 and not just cmd2. Modified: stable/7/bin/sh/ (props changed) stable/7/bin/sh/parser.c Modified: stable/7/bin/sh/parser.c ============================================================================== --- stable/7/bin/sh/parser.c Thu Oct 8 16:05:17 2009 (r197861) +++ stable/7/bin/sh/parser.c Thu Oct 8 17:11:01 2009 (r197862) @@ -250,6 +250,7 @@ pipeline(void) int negate; negate = 0; + checkkwd = 2; TRACE(("pipeline: entered\n")); while (readtoken() == TNOT) negate = !negate; From jkim at FreeBSD.org Thu Oct 8 17:41:54 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Oct 8 17:42:05 2009 Subject: svn commit: r197863 - head/sys/amd64/acpica Message-ID: <200910081741.n98HfrI3028811@svn.freebsd.org> Author: jkim Date: Thu Oct 8 17:41:53 2009 New Revision: 197863 URL: http://svn.freebsd.org/changeset/base/197863 Log: Clean up amd64 suspend/resume code. - Allocate memory for wakeup code after ACPI bus is attached. The early memory allocation hack was inherited from i386 but amd64 does not need it. - Exclude real mode IVT and BDA explicitly. Improve comments about memory allocation and reason for the exclusions. It is a no-op in reality, though. - Remove an unnecessary CLD from wakeup code and re-align. Modified: head/sys/amd64/acpica/acpi_machdep.c head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/acpica/acpi_wakeup.c Modified: head/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- head/sys/amd64/acpica/acpi_machdep.c Thu Oct 8 17:11:01 2009 (r197862) +++ head/sys/amd64/acpica/acpi_machdep.c Thu Oct 8 17:41:53 2009 (r197863) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include @@ -511,7 +512,6 @@ acpi_machdep_init(device_t dev) sc->acpi_clone = apm_create_clone(sc->acpi_dev_t, sc); clone_setup(&apm_clones); EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000); - acpi_install_wakeup_handler(sc); if (intr_model != ACPI_INTR_PIC) acpi_SetIntrModel(intr_model); @@ -801,13 +801,20 @@ nexus_acpi_probe(device_t dev) static int nexus_acpi_attach(device_t dev) { + device_t acpi_dev; + int error; nexus_init_resources(); bus_generic_probe(dev); - if (BUS_ADD_CHILD(dev, 10, "acpi", 0) == NULL) + acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0); + if (acpi_dev == NULL) panic("failed to add acpi0 device"); - return (bus_generic_attach(dev)); + error = bus_generic_attach(dev); + if (error == 0) + acpi_install_wakeup_handler(device_get_softc(acpi_dev)); + + return (error); } static device_method_t nexus_acpi_methods[] = { Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Thu Oct 8 17:11:01 2009 (r197862) +++ head/sys/amd64/acpica/acpi_wakecode.S Thu Oct 8 17:41:53 2009 (r197863) @@ -54,18 +54,17 @@ .data /* So we can modify it */ ALIGN_TEXT -wakeup_start: .code16 +wakeup_start: /* * Set up segment registers for real mode, a small stack for * any calls we make, and clear any flags. */ cli /* make sure no interrupts */ - cld mov %cs, %ax /* copy %cs to %ds. Remember these */ mov %ax, %ds /* are offsets rather than selectors */ mov %ax, %ss - movw $PAGE_SIZE - 8, %sp + movw $PAGE_SIZE, %sp xorw %ax, %ax pushw %ax popfw @@ -129,6 +128,7 @@ wakeup_sw32: /* * At this point, we are running in 32 bit legacy protected mode. */ + ALIGN_TEXT .code32 wakeup_32: Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Thu Oct 8 17:11:01 2009 (r197862) +++ head/sys/amd64/acpica/acpi_wakeup.c Thu Oct 8 17:41:53 2009 (r197863) @@ -31,13 +31,11 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include #include #include -#include #include #include @@ -46,11 +44,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef SMP #include #include +#include #endif #include @@ -63,10 +61,6 @@ __FBSDID("$FreeBSD$"); /* Make sure the code is less than a page and leave room for the stack. */ CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024); -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - extern int acpi_resume_beep; extern int acpi_reset_video; @@ -79,7 +73,7 @@ static struct xpcb *stopxpcbs; int acpi_restorecpu(struct xpcb *, vm_offset_t); int acpi_savecpu(struct xpcb *); -static void acpi_alloc_wakeup_handler(void); +static void *acpi_alloc_wakeup_handler(void); static void acpi_stop_beep(void *); #ifdef SMP @@ -322,49 +316,50 @@ out: return (ret); } -static vm_offset_t acpi_wakeaddr; - -static void +static void * acpi_alloc_wakeup_handler(void) { void *wakeaddr; - if (!cold) - return; - /* * Specify the region for our wakeup code. We want it in the low 1 MB - * region, excluding video memory and above (0xa0000). We ask for - * it to be page-aligned, just to be safe. + * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA + * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), + * and ROM area (0xa0000 and above). The temporary page tables must be + * page-aligned. */ - wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0, 0x9ffff, - PAGE_SIZE, 0ul); + wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0x500, + 0xa0000, PAGE_SIZE, 0ul); if (wakeaddr == NULL) { printf("%s: can't alloc wake memory\n", __func__); - return; + return (NULL); } stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_NOWAIT); if (stopxpcbs == NULL) { contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF); printf("%s: can't alloc CPU state memory\n", __func__); - return; + return (NULL); } - acpi_wakeaddr = (vm_offset_t)wakeaddr; -} -SYSINIT(acpiwakeup, SI_SUB_KMEM, SI_ORDER_ANY, acpi_alloc_wakeup_handler, 0); + return (wakeaddr); +} void acpi_install_wakeup_handler(struct acpi_softc *sc) { + static void *wakeaddr = NULL; uint64_t *pt4, *pt3, *pt2; int i; - if (acpi_wakeaddr == 0ul) + if (wakeaddr != NULL) + return; + + wakeaddr = acpi_alloc_wakeup_handler(); + if (wakeaddr == NULL) return; - sc->acpi_wakeaddr = acpi_wakeaddr; - sc->acpi_wakephys = vtophys(acpi_wakeaddr); + sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; + sc->acpi_wakephys = vtophys(wakeaddr); bcopy(wakecode, (void *)WAKECODE_VADDR(sc), sizeof(wakecode)); @@ -390,7 +385,7 @@ acpi_install_wakeup_handler(struct acpi_ WAKECODE_FIXUP(wakeup_sfmask, uint64_t, rdmsr(MSR_SF_MASK)); /* Build temporary page tables below realmode code. */ - pt4 = (uint64_t *)acpi_wakeaddr; + pt4 = wakeaddr; pt3 = pt4 + (PAGE_SIZE) / sizeof(uint64_t); pt2 = pt3 + (PAGE_SIZE) / sizeof(uint64_t); From attilio at freebsd.org Thu Oct 8 18:22:57 2009 From: attilio at freebsd.org (Attilio Rao) Date: Thu Oct 8 18:23:03 2009 Subject: svn commit: r197863 - head/sys/amd64/acpica In-Reply-To: <200910081741.n98HfrI3028811@svn.freebsd.org> References: <200910081741.n98HfrI3028811@svn.freebsd.org> Message-ID: <3bbf2fe10910081122t2e23d1cep44846da4a7035227@mail.gmail.com> 2009/10/8 Jung-uk Kim : > Author: jkim > Date: Thu Oct 8 17:41:53 2009 > New Revision: 197863 > URL: http://svn.freebsd.org/changeset/base/197863 > > Log: > Clean up amd64 suspend/resume code. > @@ -322,49 +316,50 @@ out: > return (ret); > } > > -static vm_offset_t acpi_wakeaddr; > - > -static void > +static void * > acpi_alloc_wakeup_handler(void) > { > void *wakeaddr; > > - if (!cold) > - return; > - > /* > * Specify the region for our wakeup code. We want it in the low 1 MB > - * region, excluding video memory and above (0xa0000). We ask for > - * it to be page-aligned, just to be safe. > + * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA > + * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), > + * and ROM area (0xa0000 and above). The temporary page tables must be > + * page-aligned. > */ > - wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0, 0x9ffff, > - PAGE_SIZE, 0ul); > + wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0x500, > + 0xa0000, PAGE_SIZE, 0ul); > if (wakeaddr == NULL) { > printf("%s: can't alloc wake memory\n", __func__); > - return; > + return (NULL); > } > stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_NOWAIT); > if (stopxpcbs == NULL) { > contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF); > printf("%s: can't alloc CPU state memory\n", __func__); > - return; > + return (NULL); > } > - acpi_wakeaddr = (vm_offset_t)wakeaddr; > -} > > -SYSINIT(acpiwakeup, SI_SUB_KMEM, SI_ORDER_ANY, acpi_alloc_wakeup_handler, 0); > + return (wakeaddr); > +} > > void > acpi_install_wakeup_handler(struct acpi_softc *sc) > { > + static void *wakeaddr = NULL; > uint64_t *pt4, *pt3, *pt2; > int i; Maybe it was better to have a non-reentrat function here? Attilio -- Peace can only be achieved by understanding - A. Einstein From jkim at FreeBSD.org Thu Oct 8 18:59:31 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Oct 8 18:59:42 2009 Subject: svn commit: r197863 - head/sys/amd64/acpica In-Reply-To: <3bbf2fe10910081122t2e23d1cep44846da4a7035227@mail.gmail.com> References: <200910081741.n98HfrI3028811@svn.freebsd.org> <3bbf2fe10910081122t2e23d1cep44846da4a7035227@mail.gmail.com> Message-ID: <200910081459.22441.jkim@FreeBSD.org> 2009/10/8 Jung-uk Kim : On Thursday 08 October 2009 02:22 pm, Attilio Rao wrote: > > void > > acpi_install_wakeup_handler(struct acpi_softc *sc) > > { > > + static void *wakeaddr = NULL; > > uint64_t *pt4, *pt3, *pt2; > > int i; > > Maybe it was better to have a non-reentrat function here? It won't re-enter here because we cannot detach ACPI bus ATM. It is just a safety belt for the distant(?) future. ;-) Jung-uk Kim From trasz at FreeBSD.org Thu Oct 8 19:45:37 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Thu Oct 8 19:45:43 2009 Subject: svn commit: r197867 - head/cddl/contrib/opensolaris/lib/libzfs/common Message-ID: <200910081945.n98Jjbrd031264@svn.freebsd.org> Author: trasz Date: Thu Oct 8 19:45:37 2009 New Revision: 197867 URL: http://svn.freebsd.org/changeset/base/197867 Log: Properly mark ZFS properties which are not changeable under FreeBSD. Reviewed by: pjd Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 18:55:12 2009 (r197866) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Oct 8 19:45:37 2009 (r197867) @@ -1790,9 +1790,14 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* We don't support those properties on FreeBSD. */ switch (prop) { - case ZFS_PROP_SHAREISCSI: case ZFS_PROP_DEVICES: + case ZFS_PROP_ZONED: + case ZFS_PROP_SHAREISCSI: case ZFS_PROP_ISCSIOPTIONS: + case ZFS_PROP_XATTR: + case ZFS_PROP_VSCAN: + case ZFS_PROP_NBMAND: + case ZFS_PROP_SHARESMB: (void) snprintf(errbuf, sizeof (errbuf), "property '%s' not supported on FreeBSD", propname); ret = zfs_error(hdl, EZFS_PERM, errbuf); From tuexen at FreeBSD.org Thu Oct 8 20:33:13 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Thu Oct 8 20:33:31 2009 Subject: svn commit: r197868 - head/sys/netinet Message-ID: <200910082033.n98KXC8O032354@svn.freebsd.org> Author: tuexen Date: Thu Oct 8 20:33:12 2009 New Revision: 197868 URL: http://svn.freebsd.org/changeset/base/197868 Log: Use correct arguments when calling SCTP_RTALLOC(). Approved by: rrs (mentor) MFC after: 0 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Oct 8 19:45:37 2009 (r197867) +++ head/sys/netinet/sctp_output.c Thu Oct 8 20:33:12 2009 (r197868) @@ -3570,7 +3570,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_free_ifa(_lsrc); } else { ip->ip_src = over_addr->sin.sin_addr; - SCTP_RTALLOC((&ro->ro_rt), vrf_id); + SCTP_RTALLOC(ro, vrf_id); } } if (port) { @@ -3924,7 +3924,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_free_ifa(_lsrc); } else { lsa6->sin6_addr = over_addr->sin6.sin6_addr; - SCTP_RTALLOC((&ro->ro_rt), vrf_id); + SCTP_RTALLOC(ro, vrf_id); } (void)sa6_recoverscope(sin6); } From bz at FreeBSD.org Thu Oct 8 20:58:10 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Thu Oct 8 20:58:22 2009 Subject: svn commit: r197869 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net Message-ID: <200910082058.n98KwA2W032852@svn.freebsd.org> Author: bz Date: Thu Oct 8 20:58:09 2009 New Revision: 197869 URL: http://svn.freebsd.org/changeset/base/197869 Log: MFC r197727: Put #ifdef INET around parts of the FLOWTABLE code, to unbreak nooptions INET kernel builds. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/net/route.c Modified: stable/8/sys/net/route.c ============================================================================== --- stable/8/sys/net/route.c Thu Oct 8 20:33:12 2009 (r197868) +++ stable/8/sys/net/route.c Thu Oct 8 20:58:09 2009 (r197869) @@ -1162,6 +1162,7 @@ rtrequest1_fib(int req, struct rt_addrin /* XXX * "flow-table" only support IPv4 at the moment. */ +#ifdef INET if (dst->sa_family == AF_INET) { rn = rnh->rnh_matchaddr(dst, rnh); if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { @@ -1203,6 +1204,7 @@ rtrequest1_fib(int req, struct rt_addrin } } #endif +#endif /* XXX mtu manipulation will be done in rnh_addaddr -- itojun */ rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes); @@ -1224,7 +1226,9 @@ rtrequest1_fib(int req, struct rt_addrin } #ifdef FLOWTABLE else if (rt0 != NULL) { +#ifdef INET flowtable_route_flush(V_ip_ft, rt0); +#endif RTFREE(rt0); } #endif From rwatson at FreeBSD.org Fri Oct 9 09:18:23 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Fri Oct 9 09:18:30 2009 Subject: svn commit: r197895 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet Message-ID: <200910090918.n999IN5o048144@svn.freebsd.org> Author: rwatson Date: Fri Oct 9 09:18:22 2009 New Revision: 197895 URL: http://svn.freebsd.org/changeset/base/197895 Log: Merge r197814 from head to stable/8: Remove tcp_input lock statistics; these are intended for debugging only and are not intended to ship in 8.0 as they dirty additional cache lines in a performance-critical per-packet path. Approved by: re (kib, bz) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/tcp_input.c Modified: stable/8/sys/netinet/tcp_input.c ============================================================================== --- stable/8/sys/netinet/tcp_input.c Fri Oct 9 09:12:19 2009 (r197894) +++ stable/8/sys/netinet/tcp_input.c Fri Oct 9 09:18:22 2009 (r197895) @@ -180,26 +180,6 @@ int tcp_read_locking = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, read_locking, CTLFLAG_RW, &tcp_read_locking, 0, "Enable read locking strategy"); -int tcp_rlock_atfirst; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, rlock_atfirst, CTLFLAG_RD, - &tcp_rlock_atfirst, 0, ""); - -int tcp_wlock_atfirst; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcp_wlock_atfirst, CTLFLAG_RD, - &tcp_wlock_atfirst, 0, ""); - -int tcp_wlock_upgraded; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_upgraded, CTLFLAG_RD, - &tcp_wlock_upgraded, 0, ""); - -int tcp_wlock_relocked; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_relocked, CTLFLAG_RD, - &tcp_wlock_relocked, 0, ""); - -int tcp_wlock_looped; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, wlock_looped, CTLFLAG_RD, - &tcp_wlock_looped, 0, ""); - VNET_DEFINE(struct inpcbhead, tcb); VNET_DEFINE(struct inpcbinfo, tcbinfo); #define tcb6 tcb /* for KAME src sync over BSD*'s */ @@ -505,11 +485,9 @@ tcp_input(struct mbuf *m, int off0) tcp_read_locking == 0) { INP_INFO_WLOCK(&V_tcbinfo); ti_locked = TI_WLOCKED; - tcp_wlock_atfirst++; } else { INP_INFO_RLOCK(&V_tcbinfo); ti_locked = TI_RLOCKED; - tcp_rlock_atfirst++; } findpcb: @@ -662,15 +640,11 @@ relocked: ti_locked = TI_WLOCKED; INP_WLOCK(inp); if (in_pcbrele(inp)) { - tcp_wlock_looped++; inp = NULL; goto findpcb; } - tcp_wlock_relocked++; - } else { + } else ti_locked = TI_WLOCKED; - tcp_wlock_upgraded++; - } } INP_INFO_WLOCK_ASSERT(&V_tcbinfo); @@ -717,16 +691,12 @@ relocked: ti_locked = TI_WLOCKED; INP_WLOCK(inp); if (in_pcbrele(inp)) { - tcp_wlock_looped++; inp = NULL; goto findpcb; } - tcp_wlock_relocked++; goto relocked; - } else { + } else ti_locked = TI_WLOCKED; - tcp_wlock_upgraded++; - } } INP_INFO_WLOCK_ASSERT(&V_tcbinfo); } From pjd at FreeBSD.org Fri Oct 9 09:30:00 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Oct 9 09:30:07 2009 Subject: svn commit: r197896 - head/sys/cam/ata Message-ID: <200910090929.n999Txp5048391@svn.freebsd.org> Author: pjd Date: Fri Oct 9 09:29:59 2009 New Revision: 197896 URL: http://svn.freebsd.org/changeset/base/197896 Log: Export disk serial numbers for adaX disks. Reviewed by: mav MFC after: 3 days Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Fri Oct 9 09:18:22 2009 (r197895) +++ head/sys/cam/ata/ata_da.c Fri Oct 9 09:29:59 2009 (r197896) @@ -721,6 +721,8 @@ adaregister(struct cam_periph *periph, v softc->disk->d_flags = 0; if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; + strlcpy(softc->disk->d_ident, cgd->serial_num, + MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1)); adasetgeom(periph, cgd); softc->disk->d_sectorsize = softc->params.secsize; From des at FreeBSD.org Fri Oct 9 09:38:57 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Fri Oct 9 09:39:09 2009 Subject: svn commit: r197897 - vendor/openpam/dist/doc/man Message-ID: <200910090938.n999cvok048601@svn.freebsd.org> Author: des Date: Fri Oct 9 09:38:57 2009 New Revision: 197897 URL: http://svn.freebsd.org/changeset/base/197897 Log: Merge upstream r421: grammar nit in pam.conf(5). Modified: vendor/openpam/dist/doc/man/pam.conf.5 Modified: vendor/openpam/dist/doc/man/pam.conf.5 ============================================================================== --- vendor/openpam/dist/doc/man/pam.conf.5 Fri Oct 9 09:29:59 2009 (r197896) +++ vendor/openpam/dist/doc/man/pam.conf.5 Fri Oct 9 09:38:57 2009 (r197897) @@ -109,7 +109,7 @@ will be failure regardless of the succes .It Cm requisite If this module succeeds, the result of the chain will be success unless a later module fails. -If it module fails, the chain is broken and the result is failure. +If the module fails, the chain is broken and the result is failure. .It Cm sufficient If this module succeeds, the chain is broken and the result is success. From pjd at FreeBSD.org Fri Oct 9 09:42:23 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Oct 9 09:42:35 2009 Subject: svn commit: r197898 - in head/sys/geom: concat label part shsec stripe uzip Message-ID: <200910090942.n999gMb5048731@svn.freebsd.org> Author: pjd Date: Fri Oct 9 09:42:22 2009 New Revision: 197898 URL: http://svn.freebsd.org/changeset/base/197898 Log: If provider is open for writing when we taste it, skip it for classes that depend on on-disk metadata. This was we won't attach to providers that are used by other classes. For example we don't want to configure partitions on da0 if it is part of gmirror, what we really want is partitions on mirror/foo. During regular work it works like this: if provider is open for writing a class receives the spoiled event from GEOM and detaches, once provider is closed the taste event is send again and class can rediscover its metadata if it is still there. This doesn't work that way when new class arrives, because GEOM gives all existing providers for it to taste, also those open for writing. Classes have to decided on their own if they want to deal with such providers (eg. geom_dev) or not (classes modified by this commit). Reported by: des, Oliver Lehmann Tested by: des, Oliver Lehmann Discussed with: phk, marcel Reviewed by: marcel MFC after: 3 days Modified: head/sys/geom/concat/g_concat.c head/sys/geom/label/g_label.c head/sys/geom/part/g_part.c head/sys/geom/shsec/g_shsec.c head/sys/geom/stripe/g_stripe.c head/sys/geom/uzip/g_uzip.c Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/concat/g_concat.c Fri Oct 9 09:42:22 2009 (r197898) @@ -599,6 +599,10 @@ g_concat_taste(struct g_class *mp, struc g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + G_CONCAT_DEBUG(3, "Tasting %s.", pp->name); gp = g_new_geomf(mp, "concat:taste"); Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/label/g_label.c Fri Oct 9 09:42:22 2009 (r197898) @@ -271,6 +271,10 @@ g_label_taste(struct g_class *mp, struct G_LABEL_DEBUG(2, "Tasting %s.", pp->name); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + if (strcmp(pp->geom->class->name, mp->name) == 0) return (NULL); Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/part/g_part.c Fri Oct 9 09:42:22 2009 (r197898) @@ -1459,6 +1459,10 @@ g_part_taste(struct g_class *mp, struct G_PART_TRACE((G_T_TOPOLOGY, "%s(%s,%s)", __func__, mp->name, pp->name)); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + /* * Create a GEOM with consumer and hook it up to the provider. * With that we become part of the topology. Optain read access Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/shsec/g_shsec.c Fri Oct 9 09:42:22 2009 (r197898) @@ -638,6 +638,10 @@ g_shsec_taste(struct g_class *mp, struct g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + G_SHSEC_DEBUG(3, "Tasting %s.", pp->name); gp = g_new_geomf(mp, "shsec:taste"); Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/stripe/g_stripe.c Fri Oct 9 09:42:22 2009 (r197898) @@ -912,6 +912,10 @@ g_stripe_taste(struct g_class *mp, struc g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + G_STRIPE_DEBUG(3, "Tasting %s.", pp->name); gp = g_new_geomf(mp, "stripe:taste"); Modified: head/sys/geom/uzip/g_uzip.c ============================================================================== --- head/sys/geom/uzip/g_uzip.c Fri Oct 9 09:38:57 2009 (r197897) +++ head/sys/geom/uzip/g_uzip.c Fri Oct 9 09:42:22 2009 (r197898) @@ -363,6 +363,11 @@ g_uzip_taste(struct g_class *mp, struct g_trace(G_T_TOPOLOGY, "g_uzip_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); + + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + buf = NULL; /* From des at FreeBSD.org Fri Oct 9 09:42:58 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Fri Oct 9 09:43:09 2009 Subject: svn commit: r197899 - in head/contrib/openpam: . doc/man Message-ID: <200910090942.n999gwAG048800@svn.freebsd.org> Author: des Date: Fri Oct 9 09:42:58 2009 New Revision: 197899 URL: http://svn.freebsd.org/changeset/base/197899 Log: Merge upstream r421: grammar nit in pam.conf(5). Modified: head/contrib/openpam/ (props changed) head/contrib/openpam/doc/man/pam.conf.5 Modified: head/contrib/openpam/doc/man/pam.conf.5 ============================================================================== --- head/contrib/openpam/doc/man/pam.conf.5 Fri Oct 9 09:42:22 2009 (r197898) +++ head/contrib/openpam/doc/man/pam.conf.5 Fri Oct 9 09:42:58 2009 (r197899) @@ -109,7 +109,7 @@ will be failure regardless of the succes .It Cm requisite If this module succeeds, the result of the chain will be success unless a later module fails. -If it module fails, the chain is broken and the result is failure. +If the module fails, the chain is broken and the result is failure. .It Cm sufficient If this module succeeds, the chain is broken and the result is success. From brueffer at FreeBSD.org Fri Oct 9 10:03:42 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 10:03:53 2009 Subject: svn commit: r197900 - head/share/man/man4 Message-ID: <200910091003.n99A3gmU050168@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 10:03:41 2009 New Revision: 197900 URL: http://svn.freebsd.org/changeset/base/197900 Log: Improved one-line description of this module (taken from NOTES). Modified: head/share/man/man4/lindev.4 Modified: head/share/man/man4/lindev.4 ============================================================================== --- head/share/man/man4/lindev.4 Fri Oct 9 09:42:58 2009 (r197899) +++ head/share/man/man4/lindev.4 Fri Oct 9 10:03:41 2009 (r197900) @@ -30,7 +30,7 @@ .Os .Sh NAME .Nm lindev -.Nd the lindev module +.Nd Linux-specific pseudo devices support .Sh SYNOPSIS To compile this collection of linux-specific pseudo devices into the kernel, place the following line in your kernel configuration file: From brueffer at FreeBSD.org Fri Oct 9 13:25:46 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 13:25:52 2009 Subject: svn commit: r197902 - in stable/8/sbin/geom: . class/nop Message-ID: <200910091325.n99DPkRS054062@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 13:25:45 2009 New Revision: 197902 URL: http://svn.freebsd.org/changeset/base/197902 Log: MFC: r197274 Fix the example, -w is the right switch for write failure probability. Approved by: re (kib) Modified: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/nop/gnop.8 Modified: stable/8/sbin/geom/class/nop/gnop.8 ============================================================================== --- stable/8/sbin/geom/class/nop/gnop.8 Fri Oct 9 10:13:18 2009 (r197901) +++ stable/8/sbin/geom/class/nop/gnop.8 Fri Oct 9 13:25:45 2009 (r197902) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 8, 2006 +.Dd September 17, 2009 .Dt GNOP 8 .Os .Sh NAME @@ -147,9 +147,9 @@ Exit status is 0 on success, and 1 if th .Sh EXAMPLES The following example shows how to create a transparent provider for disk .Pa /dev/da0 -with 50% failure probability, and how to destroy it. +with 50% write failure probability, and how to destroy it. .Bd -literal -offset indent -gnop create -v -f 50 da0 +gnop create -v -w 50 da0 gnop destroy -v da0.nop .Ed .Pp From brueffer at FreeBSD.org Fri Oct 9 13:31:37 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 13:32:00 2009 Subject: svn commit: r197903 - stable/8/sbin/mksnap_ffs Message-ID: <200910091331.n99DVbhL054203@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 13:31:36 2009 New Revision: 197903 URL: http://svn.freebsd.org/changeset/base/197903 Log: MFC: r197275 Fix an xref. Approved by: re (kib) Modified: stable/8/sbin/mksnap_ffs/ (props changed) stable/8/sbin/mksnap_ffs/mksnap_ffs.8 Modified: stable/8/sbin/mksnap_ffs/mksnap_ffs.8 ============================================================================== --- stable/8/sbin/mksnap_ffs/mksnap_ffs.8 Fri Oct 9 13:25:45 2009 (r197902) +++ stable/8/sbin/mksnap_ffs/mksnap_ffs.8 Fri Oct 9 13:31:36 2009 (r197903) @@ -69,7 +69,7 @@ mount -o ro /dev/md0 /mnt/ .Sh SEE ALSO .Xr chmod 2 , .Xr chown 8 , -.Xr mdconfig 8, +.Xr mdconfig 8 , .Xr mount 8 .Sh CAVEATS The disk full situation is not handled gracefully and may From brueffer at FreeBSD.org Fri Oct 9 13:36:16 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 13:36:27 2009 Subject: svn commit: r197904 - stable/8/share/man/man4 Message-ID: <200910091336.n99DaEdb054345@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 13:36:14 2009 New Revision: 197904 URL: http://svn.freebsd.org/changeset/base/197904 Log: MFC: r197276 Correct a sysctl name. Approved by: re (kib) Modified: stable/8/share/man/man4/ (props changed) stable/8/share/man/man4/acpi_panasonic.4 Modified: stable/8/share/man/man4/acpi_panasonic.4 ============================================================================== --- stable/8/share/man/man4/acpi_panasonic.4 Fri Oct 9 13:31:36 2009 (r197903) +++ stable/8/share/man/man4/acpi_panasonic.4 Fri Oct 9 13:36:14 2009 (r197904) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 11, 2004 +.Dd September 17, 2009 .Dt ACPI_PANASONIC 4 i386 .Os .Sh NAME @@ -144,7 +144,7 @@ The following MIBs are available: The maximum level of brightness. The value is read only and automatically set according to hardware model. -.It Va hw.acpi.panasonic.lcd_brightness_max +.It Va hw.acpi.panasonic.lcd_brightness_min The minimum level of brightness. The value is read only and automatically set according to hardware model. From brueffer at FreeBSD.org Fri Oct 9 13:41:54 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 13:42:01 2009 Subject: svn commit: r197905 - stable/8/share/man/man9 Message-ID: <200910091341.n99DfrNE054503@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 13:41:53 2009 New Revision: 197905 URL: http://svn.freebsd.org/changeset/base/197905 Log: MFC: r197300 Various mdoc, spelling etc fixes. Approved by: re (kib) Modified: stable/8/share/man/man9/ (props changed) stable/8/share/man/man9/ieee80211.9 stable/8/share/man/man9/ieee80211_amrr.9 stable/8/share/man/man9/ieee80211_beacon.9 stable/8/share/man/man9/ieee80211_bmiss.9 stable/8/share/man/man9/ieee80211_crypto.9 stable/8/share/man/man9/ieee80211_ddb.9 stable/8/share/man/man9/ieee80211_input.9 stable/8/share/man/man9/ieee80211_node.9 stable/8/share/man/man9/ieee80211_output.9 stable/8/share/man/man9/ieee80211_proto.9 stable/8/share/man/man9/ieee80211_radiotap.9 stable/8/share/man/man9/ieee80211_regdomain.9 stable/8/share/man/man9/ieee80211_scan.9 stable/8/share/man/man9/ieee80211_vap.9 Modified: stable/8/share/man/man9/ieee80211.9 ============================================================================== --- stable/8/share/man/man9/ieee80211.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -225,7 +225,7 @@ Allocate and initialize a structure. This method cannot sleep. The default method allocates zero'd memory using -.Xr malloc 9. +.Xr malloc 9 . Drivers should override this method to allocate extended storage for their own needs. Memory allocated by the driver must be tagged with @@ -301,7 +301,7 @@ This method is called immediately after and must initiate the work to scan a channel and schedule a timer to advance to the next channel in the scan list. This callback is done in a sleepable context. -The default method handles active scan work (e.g. sending ProbRequest +The default method handles active scan work (e.g. sending ProbeRequest frames), and schedules a call to .Xr ieee80211_scan_next 9 according to the maximum dwell time for the channel. @@ -558,4 +558,4 @@ Device supports Reduced Inter Frame Spac .Xr ieee80211_send_action 9 , .Xr ieee80211_radiotap_attach 9 , .Xr ifnet 9 , -.Xr malloc 9 . +.Xr malloc 9 Modified: stable/8/share/man/man9/ieee80211_amrr.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_amrr.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_amrr.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -191,4 +191,4 @@ Drivers that poll a device to retrieve s (instead or in addition). .Sh SEE ALSO .Xr ieee80211 9 , -.Xr ieee80211_output 9 , +.Xr ieee80211_output 9 Modified: stable/8/share/man/man9/ieee80211_beacon.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_beacon.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_beacon.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -112,4 +112,4 @@ Staggering beacon frames is usually supe about eight vaps, at which point the overhead becomes significant and the channel becomes noticeably busy anyway. .Sh SEE ALSO -.Xr ieee80211 9 . +.Xr ieee80211 9 Modified: stable/8/share/man/man9/ieee80211_bmiss.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_bmiss.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_bmiss.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -86,6 +86,6 @@ Note that software beacon miss handling it can be used in any operating mode where beacons from a peer station are received. .Sh SEE ALSO -.Xr ieee80211 9 , -.Xr ieee80211_vap 9 , .Xr wpa_supplicant 8 , +.Xr ieee80211 9 , +.Xr ieee80211_vap 9 Modified: stable/8/share/man/man9/ieee80211_crypto.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_crypto.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_crypto.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -65,10 +65,10 @@ .\" .Ft int .Fo ieee80211_crypto_newkey -.Fa "struct ieee80211vap * -.Fa "int cipher -.Fa "int flags -.Fa "struct ieee80211_key * +.Fa "struct ieee80211vap *" +.Fa "int cipher" +.Fa "int flags" +.Fa "struct ieee80211_key *" .Fc .\" .Ft int @@ -141,7 +141,7 @@ so it can reclaim resources. .Pp Crypto modules can notify the system of two events. When a packet replay event is recognized -.Fn ieee80111_notify_replay_failure +.Fn ieee80211_notify_replay_failure can be used to signal the event. When a .Dv TKIP @@ -256,4 +256,4 @@ when receive traffic is active. .Xr ioctl 2 , .Xr wlan_ccmp 4 , .Xr wlan_tkip 4 , -.Xr wlan_wep 4 . +.Xr wlan_wep 4 Modified: stable/8/share/man/man9/ieee80211_ddb.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_ddb.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_ddb.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -54,7 +54,7 @@ This is especially important because wir built for embedded environments where cross-machine or post-mortem debugging facilities like .Xr kgdb 1 -infeasible. +are infeasible. .Pp The most commonly used command is .Bd -literal -offset indent @@ -69,4 +69,4 @@ and data structures in the system. .Sh SEE ALSO .Xr ddb 4 , -.Xr ieee80211 9 . +.Xr ieee80211 9 Modified: stable/8/share/man/man9/ieee80211_input.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_input.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_input.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -113,4 +113,4 @@ Otherwise the values are made available (with the rssi presented as a filtered average over the last ten values and the noise floor the last reported value). .Sh SEE ALSO -.Xr ieee80211 9 . +.Xr ieee80211 9 Modified: stable/8/share/man/man9/ieee80211_node.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_node.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_node.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -248,4 +248,4 @@ then a normal lookup is done without a t .Sh SEE ALSO .Xr ddb 9 .Xr ieee80211 9 , -.Xr ieee80211_proto 9 , +.Xr ieee80211_proto 9 Modified: stable/8/share/man/man9/ieee80211_output.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_output.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_output.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -47,9 +47,9 @@ .\" .Ft void .Fo ieee80211_process_callback -.Fa struct ieee80211_node * -.Fa struct mbuf * -.Fa int +.Fa "struct ieee80211_node *" +.Fa "struct mbuf *" +.Fa "int" .Fc .Sh DESCRIPTION The @@ -101,7 +101,7 @@ Similarly, .Nm net80211 handles activities such as background scanning and power save mode, frames will not be sent to a driver unless it is operating on the -BSS channel will +BSS channel with .Dq full power . .Pp All frames passed to a driver for transmit hold a reference to a Modified: stable/8/share/man/man9/ieee80211_proto.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_proto.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_proto.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -119,7 +119,7 @@ and .Vt ic_bsschan are guaranteed to be usable. .It Dv IEEE80211_S_CSA -Channel Switch Annoucememnt (CSA) is pending. +Channel Switch Announcement (CSA) is pending. This state is reached only from .Dv IEEE80211_S_RUN when either a CSA is received from an access point (in station mode) @@ -229,11 +229,11 @@ handled by or, in the case of card eject or vap destroy, work will be initiated outside the driver. .Sh SEE ALSO -.Xr ioctl 2 +.Xr ioctl 2 , +.Xr wpa_supplicant 8 , .Xr ieee80211 9 , -.Xr ifnet 9 +.Xr ifnet 9 , .Xr taskqueue 9 -.Xr wpa_supplicant 8 .Sh HISTORY The state machine concept was part of the original .Nm ieee80211 Modified: stable/8/share/man/man9/ieee80211_radiotap.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_radiotap.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_radiotap.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -198,11 +198,11 @@ RF noise power at the antenna, in decibe .\"power as unitless distance from maximum power set at factory calibration. .\"0 indicates maximum transmit power. .\"Monotonically nondecreasing with lower power levels. -\.".It Dv IEEE80211_RADIOTAP_DB_TX_ATTENUATION -\."This field contains a single unsigned 16-bit value, expressing transmit -\."power as decibel distance from maximum power set at factory calibration. -\."0 indicates maximum transmit power. -\."Monotonically nondecreasing with lower power levels. +.\".It Dv IEEE80211_RADIOTAP_DB_TX_ATTENUATION +.\"This field contains a single unsigned 16-bit value, expressing transmit +.\"power as decibel distance from maximum power set at factory calibration. +.\"0 indicates maximum transmit power. +.\"Monotonically nondecreasing with lower power levels. .It Dv IEEE80211_RADIOTAP_DBM_TX_POWER Transmit power expressed as decibels from a 1mW reference. This field is a single signed 8-bit value. @@ -223,9 +223,9 @@ This field contains a single unsigned 8- RF noise power at the antenna, in decibels difference from an arbitrary, fixed reference. .It Dv IEEE80211_RADIOTAP_XCHANNEL -This field containts four values: a 32-bit unsigned bitmap of +This field contains four values: a 32-bit unsigned bitmap of flags that describe the channel attributes, a 16-bit unsigned -freqeuncy in MHz (typically the channel center), an 8-bit +frequency in MHz (typically the channel center), an 8-bit unsigned IEEE channel number, and a signed 8-bit value that holds the maximum regulatory transmit power cap in .5 dBm (8 bytes total). @@ -237,10 +237,10 @@ This property supersedes .Dv IEEE80211_RADIOTAP_CHANNEL and is the only way to completely express all channel attributes and the -mapping between channel freqeuncy and IEEE channel number. +mapping between channel frequency and IEEE channel number. .El .Sh EXAMPLES -Radiotap receive definitions for the Intersil Prims driver: +Radiotap receive definitions for the Intersil Prism driver: .Bd -literal -offset indent #define WI_RX_RADIOTAP_PRESENT \\ ((1 << IEEE80211_RADIOTAP_TSFT) \\ @@ -298,7 +298,6 @@ definitions first appeared in .\" .Sh AUTHORS .An -nosplit -.Pp The original version of this manual page was written by .An Bruce M. Simpson Aq bms@FreeBSD.org and Modified: stable/8/share/man/man9/ieee80211_regdomain.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_regdomain.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_regdomain.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -112,7 +112,7 @@ routine. This should be done whenever the channel table contents are modified. .Pp The -.Fn ieee80211_alloc_countrie +.Fn ieee80211_alloc_countryie function allocates an information element as specified by 802.11h. Because this is expensive to generate it is cached in .Vt ic_countryie @@ -140,4 +140,4 @@ The exact rules by which to operate are .Sh SEE ALSO .Xr regdomain 5 , .Xr ifconfig 8 , -.Xr ieee80211 9 . +.Xr ieee80211 9 Modified: stable/8/share/man/man9/ieee80211_scan.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_scan.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_scan.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -347,4 +347,4 @@ request. .Sh SEE ALSO .Xr ioctl 2 , .Xr ieee80211 9 . -.Xr ieee80211_proto 9 . +.Xr ieee80211_proto 9 Modified: stable/8/share/man/man9/ieee80211_vap.9 ============================================================================== --- stable/8/share/man/man9/ieee80211_vap.9 Fri Oct 9 13:36:14 2009 (r197904) +++ stable/8/share/man/man9/ieee80211_vap.9 Fri Oct 9 13:41:53 2009 (r197905) @@ -151,4 +151,4 @@ that beacon are stopped before stopping .Sh SEE ALSO .Xr ieee80211 9 , .Xr ifnet 9 , -.Xr malloc 9 . +.Xr malloc 9 From brueffer at FreeBSD.org Fri Oct 9 13:46:55 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 13:47:02 2009 Subject: svn commit: r197906 - stable/8/share/man/man9 Message-ID: <200910091346.n99Dktnl054666@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 13:46:55 2009 New Revision: 197906 URL: http://svn.freebsd.org/changeset/base/197906 Log: MFC: r197310 Fix mdoc, typos, contractions. Approved by: re (kib) Modified: stable/8/share/man/man9/ (props changed) stable/8/share/man/man9/fail.9 Modified: stable/8/share/man/man9/fail.9 ============================================================================== --- stable/8/share/man/man9/fail.9 Fri Oct 9 13:41:53 2009 (r197905) +++ stable/8/share/man/man9/fail.9 Fri Oct 9 13:46:55 2009 (r197906) @@ -37,7 +37,6 @@ .Nm KFAIL_POINT_GOTO , .Nm fail_point , .Nm DEBUG_FP -. .Nd fail points .Sh SYNOPSIS .In sys/fail.h @@ -79,7 +78,7 @@ is derived from the .Fn return value set in the sysctl MIB. See -.Sx SYSCTL SETTINGS +.Sx SYSCTL VARIABLES below. .Pp The remaining @@ -100,7 +99,6 @@ is the equivalent of .Sy KFAIL_POINT_CODE(..., { error_var = RETURN_VALUE; goto label;}) .El -.Pp .Sh SYSCTL VARIABLES The .Fn KFAIL_POINT_* @@ -108,28 +106,28 @@ macros add sysctl MIBs where specified. Many base kernel MIBs can be found in the .Sy debug.fail_point tree (referenced in code by -.Sy DEBUG_FP -). +.Sy DEBUG_FP ) . .Pp The sysctl variable may be set using the following grammar: .Pp +.Bd -literal :: ( "->" )* -.Pp + :: ( ( "%") | ( "*" ) )* [ "(" ")" ] -.Pp + :: [ "." ] | "." -.Pp + :: "off" | "return" | "sleep" | "panic" | "break" | "print" +.Ed .Pp -The -argument specifies which action to take: +The argument specifies which action to take: .Bl -tag -width ".Dv return" .It Sy off Take no action (does not trigger fail point code) @@ -158,13 +156,13 @@ is evaluated before the count, i.e. "2%5 but only 5 times total". .Pp The operator -> can be used to express cascading terms. -If you specify ->, it means that if doesn't -'execute', is evaluated. +If you specify ->, it means that if does not +.Ql execute , + is evaluated. For the purpose of this operator, the return() and print() operators are the only types that cascade. A return() term only cascades if the code executes, and a print() term only cascades when passed a non-zero argument. -.Pp .Sh EXAMPLES .Bl -tag .It Sy sysctl debug.fail_point.foobar="2.1%return(5)" @@ -175,7 +173,7 @@ with RETURN_VALUE set to 5. 2/100ths of the time, execute .Fa code with RETURN_VALUE set to 5. -If that doesn't happen, 5% of the time execute +If that does not happen, 5% of the time execute .Fa code with RETURN_VALUE set to 22. .It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)" @@ -186,9 +184,8 @@ Return 5 for 1 in 1000 executions, but o .It Sy sysctl debug.fail_point.foobar="1%*sleep(50)" 1/100th of the time, sleep 50ms. .El -.Pp .Sh CAVEATS -It's easy to shoot yourself in the foot by setting fail points too +It is easy to shoot yourself in the foot by setting fail points too aggressively or setting too many in combination. For example, forcing .Fn malloc @@ -201,7 +198,6 @@ Currently, .Fn fail_point_eval does not verify whether the context is appropriate for calling .Fn msleep . -.Pp .Sh AUTHORS .An -nosplit This manual page was written by From brueffer at FreeBSD.org Fri Oct 9 13:52:49 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Fri Oct 9 13:52:56 2009 Subject: svn commit: r197907 - in stable/8: lib/libc lib/libc/gen lib/libc/stdio lib/libc/stdtime lib/libc/string lib/libc/sys sbin/ipfw Message-ID: <200910091352.n99DqnGF054847@svn.freebsd.org> Author: brueffer Date: Fri Oct 9 13:52:49 2009 New Revision: 197907 URL: http://svn.freebsd.org/changeset/base/197907 Log: MFC: r197312 Fix setfib(1) section number. Approved by: re (kib) Modified: stable/8/lib/libc/ (props changed) stable/8/lib/libc/gen/ (props changed) stable/8/lib/libc/stdio/asprintf.c (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/string/ffsll.c (props changed) stable/8/lib/libc/string/flsll.c (props changed) stable/8/lib/libc/string/wcpcpy.c (props changed) stable/8/lib/libc/string/wcpncpy.c (props changed) stable/8/lib/libc/sys/setfib.2 stable/8/sbin/ipfw/ (props changed) stable/8/sbin/ipfw/ipfw.8 Modified: stable/8/lib/libc/sys/setfib.2 ============================================================================== --- stable/8/lib/libc/sys/setfib.2 Fri Oct 9 13:46:55 2009 (r197906) +++ stable/8/lib/libc/sys/setfib.2 Fri Oct 9 13:52:49 2009 (r197907) @@ -67,8 +67,8 @@ if the .Fa fib argument is greater than the current system maximum. .Sh SEE ALSO -.Xr setsockopt 2 , -.Xr setfib 8 +.Xr setfib 1 , +.Xr setsockopt 2 .Sh STANDARDS The .Fn setfib Modified: stable/8/sbin/ipfw/ipfw.8 ============================================================================== --- stable/8/sbin/ipfw/ipfw.8 Fri Oct 9 13:46:55 2009 (r197906) +++ stable/8/sbin/ipfw/ipfw.8 Fri Oct 9 13:52:49 2009 (r197907) @@ -869,7 +869,7 @@ The packet is tagged so as to use the FI .Ar fibnum in any subsequent forwarding decisions. Initially this is limited to the values 0 through 15, see -.Xr setfib 8 . +.Xr setfib 1 . Processing continues at the next rule. .It Cm reass Queue and reassemble ip fragments. From attilio at FreeBSD.org Fri Oct 9 15:51:40 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Fri Oct 9 15:51:46 2009 Subject: svn commit: r197910 - in head/sys: amd64/include i386/include Message-ID: <200910091551.n99Fpe3Z057493@svn.freebsd.org> Author: attilio Date: Fri Oct 9 15:51:40 2009 New Revision: 197910 URL: http://svn.freebsd.org/changeset/base/197910 Log: atomic_cmpset_barr_* was added in order to cope with compilers willing to specify their own version of atomic_cmpset_* which could have been different than the membar version. Right now, however, FreeBSD is bound mostly to GCC-like compilers and it is desired to add new support and compat shim mostly when there is a real necessity, in order to avoid too much compatibility bloats. In this optic, bring back atomic_cmpset_{acq, rel}_* to be the same as atomic_cmpset_* and unwind the atomic_cmpset_barr_* introduction. Requested by: jhb Reviewed by: jhb Tested by: Giovanni Trematerra Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Fri Oct 9 14:31:29 2009 (r197909) +++ head/sys/amd64/include/atomic.h Fri Oct 9 15:51:40 2009 (r197910) @@ -78,8 +78,6 @@ void atomic_##NAME##_barr_##TYPE(volatil int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src); -int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); -int atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); @@ -131,33 +129,47 @@ struct __hack * Returns 0 on failure, non-zero on success */ -#define DEFINE_CMPSET_GEN(NAME, TYPE, OP) \ -static __inline int \ -atomic_cmpset_##NAME(volatile u_##TYPE *dst, u_##TYPE exp, u_##TYPE src)\ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " " MPLOCKED " " \ - " " OP " %2,%1 ; " \ - " sete %0 ; " \ - "1: " \ - "# atomic_cmpset_##NAME" \ - : "=a" (res), /* 0 */ \ - "=m" (*dst) /* 1 */ \ - : "r" (src), /* 2 */ \ - "a" (exp), /* 3 */ \ - "m" (*dst) /* 4 */ \ - : "memory"); \ - \ - return (res); \ -} \ -struct __hack +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " cmpxchgl %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_int" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} + +static __inline int +atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src) +{ + u_char res; -DEFINE_CMPSET_GEN(int, int, "cmpxchgl"); -DEFINE_CMPSET_GEN(long, long, "cmpxchgq"); -DEFINE_CMPSET_GEN(barr_int, int, "cmpxchgl"); -DEFINE_CMPSET_GEN(barr_long, long, "cmpxchgq"); + __asm __volatile( + " " MPLOCKED " " + " cmpxchgq %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_long" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} /* * Atomically add the value of v to the integer pointed to by p and return @@ -358,8 +370,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_int atomic_add_barr_int #define atomic_subtract_acq_int atomic_subtract_barr_int #define atomic_subtract_rel_int atomic_subtract_barr_int -#define atomic_cmpset_acq_int atomic_cmpset_barr_int -#define atomic_cmpset_rel_int atomic_cmpset_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_int +#define atomic_cmpset_rel_int atomic_cmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -369,8 +381,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_long atomic_add_barr_long #define atomic_subtract_acq_long atomic_subtract_barr_long #define atomic_subtract_rel_long atomic_subtract_barr_long -#define atomic_cmpset_acq_long atomic_cmpset_barr_long -#define atomic_cmpset_rel_long atomic_cmpset_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_long +#define atomic_cmpset_rel_long atomic_cmpset_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Fri Oct 9 14:31:29 2009 (r197909) +++ head/sys/i386/include/atomic.h Fri Oct 9 15:51:40 2009 (r197910) @@ -77,7 +77,6 @@ void atomic_##NAME##_##TYPE(volatile u_# void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); -int atomic_cmpset_barr_int(volatile u_int *dst, u_int exp, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ @@ -130,62 +129,55 @@ struct __hack #ifdef CPU_DISABLE_CMPXCHG -#define DEFINE_CMPSET_GEN(NAME) \ -static __inline int \ -atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " pushfl ; " \ - " cli ; " \ - " cmpl %3,%4 ; " \ - " jne 1f ; " \ - " movl %2,%1 ; " \ - "1: " \ - " sete %0 ; " \ - " popfl ; " \ - "# atomic_cmpset_##NAME" \ - : "=q" (res), /* 0 */ \ - "=m" (*dst) /* 1 */ \ - : "r" (src), /* 2 */ \ - "r" (exp), /* 3 */ \ - "m" (*dst) /* 4 */ \ - : "memory"); \ - \ - return (res); \ -} \ -struct __hack +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + u_char res; + + __asm __volatile( + " pushfl ; " + " cli ; " + " cmpl %3,%4 ; " + " jne 1f ; " + " movl %2,%1 ; " + "1: " + " sete %0 ; " + " popfl ; " + "# atomic_cmpset_int" + : "=q" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "r" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} #else /* !CPU_DISABLE_CMPXCHG */ -#define DEFINE_CMPSET_GEN(NAME) \ -static __inline int \ -atomic_cmpset_##NAME(volatile u_int *dst, u_int exp, u_int src)\ -{ \ - u_char res; \ - \ - __asm __volatile( \ - " " MPLOCKED " " \ - " cmpxchgl %2,%1 ; " \ - " sete %0 ; " \ - "1: " \ - "# atomic_cmpset_##NAME" \ - : "=a" (res), /* 0 */ \ - "=m" (*dst) /* 1 */ \ - : "r" (src), /* 2 */ \ - "a" (exp), /* 3 */ \ - "m" (*dst) /* 4 */ \ - : "memory"); \ - \ - return (res); \ -} \ -struct __hack +static __inline int +atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) +{ + u_char res; -#endif /* CPU_DISABLE_CMPXCHG */ + __asm __volatile( + " " MPLOCKED " " + " cmpxchgl %2,%1 ; " + " sete %0 ; " + "1: " + "# atomic_cmpset_int" + : "=a" (res), /* 0 */ + "=m" (*dst) /* 1 */ + : "r" (src), /* 2 */ + "a" (exp), /* 3 */ + "m" (*dst) /* 4 */ + : "memory"); + + return (res); +} -DEFINE_CMPSET_GEN(int); -DEFINE_CMPSET_GEN(barr_int); +#endif /* CPU_DISABLE_CMPXCHG */ /* * Atomically add the value of v to the integer pointed to by p and return @@ -307,14 +299,6 @@ atomic_cmpset_long(volatile u_long *dst, (u_int)src)); } -static __inline int -atomic_cmpset_barr_long(volatile u_long *dst, u_long exp, u_long src) -{ - - return (atomic_cmpset_barr_int((volatile u_int *)dst, (u_int)exp, - (u_int)src)); -} - static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) { @@ -390,8 +374,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_int atomic_add_barr_int #define atomic_subtract_acq_int atomic_subtract_barr_int #define atomic_subtract_rel_int atomic_subtract_barr_int -#define atomic_cmpset_acq_int atomic_cmpset_barr_int -#define atomic_cmpset_rel_int atomic_cmpset_barr_int +#define atomic_cmpset_acq_int atomic_cmpset_int +#define atomic_cmpset_rel_int atomic_cmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -401,8 +385,8 @@ u_long atomic_readandclear_long(volatile #define atomic_add_rel_long atomic_add_barr_long #define atomic_subtract_acq_long atomic_subtract_barr_long #define atomic_subtract_rel_long atomic_subtract_barr_long -#define atomic_cmpset_acq_long atomic_cmpset_barr_long -#define atomic_cmpset_rel_long atomic_cmpset_barr_long +#define atomic_cmpset_acq_long atomic_cmpset_long +#define atomic_cmpset_rel_long atomic_cmpset_long /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char From jhb at freebsd.org Fri Oct 9 16:08:13 2009 From: jhb at freebsd.org (John Baldwin) Date: Fri Oct 9 16:08:46 2009 Subject: svn commit: r197750 - head/sys/vm In-Reply-To: <4ACAF96C.6070204@cs.rice.edu> References: <200910041853.n94IrAf7082338@svn.freebsd.org> <4ACA0F09.2010808@FreeBSD.org> <4ACAF96C.6070204@cs.rice.edu> Message-ID: <200910091029.04442.jhb@freebsd.org> On Tuesday 06 October 2009 4:01:48 am Alan Cox wrote: > John Baldwin wrote: > > > > Do you care what is in the padding in this case or more about just > > having each mutex on a separate cache line? __aligned() is fine if > > you don't mind the padding getting reused for something else. > > > > Yes, I care. I would also like to prevent the placement of the heads of > the active, inactive, and hold queues (vm_page_queues[]) in the same > cache line as the free page queue mutex. Hmm, ok. -- John Baldwin From tuexen at FreeBSD.org Fri Oct 9 19:30:23 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Fri Oct 9 19:30:29 2009 Subject: svn commit: r197914 - head/sys/netinet Message-ID: <200910091930.n99JUNbc061867@svn.freebsd.org> Author: tuexen Date: Fri Oct 9 19:30:23 2009 New Revision: 197914 URL: http://svn.freebsd.org/changeset/base/197914 Log: Do not include vnet.h twice. Approved by: rrs (mentor) MFC after: 3 days Modified: head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Fri Oct 9 19:23:12 2009 (r197913) +++ head/sys/netinet/sctp_os_bsd.h Fri Oct 9 19:30:23 2009 (r197914) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From ota at j.email.ne.jp Fri Oct 9 20:10:25 2009 From: ota at j.email.ne.jp (Yoshihiro Ota) Date: Fri Oct 9 20:10:58 2009 Subject: svn commit: r197850 - head/sys/fs/tmpfs In-Reply-To: <200910072317.n97NHFKL002393@svn.freebsd.org> References: <200910072317.n97NHFKL002393@svn.freebsd.org> Message-ID: <20091009154924.689f21e1.ota@j.email.ne.jp> Could someone explain what was the cause and why this fixes the issue? When I read it, it looked like that a vm object could be in 2 locations and one of them looked the cause of the problem. But I couldn't figure out thereafter. Thanks, Hiro On Wed, 7 Oct 2009 23:17:15 +0000 (UTC) Xin LI wrote: > Author: delphij > Date: Wed Oct 7 23:17:15 2009 > New Revision: 197850 > URL: http://svn.freebsd.org/changeset/base/197850 > > Log: > Add a special workaround to handle UIO_NOCOPY case. This fixes data > corruption observed when sendfile() is being used. > > PR: kern/127213 > Submitted by: gk > MFC after: 2 weeks > > Modified: > head/sys/fs/tmpfs/tmpfs_vnops.c > > Modified: head/sys/fs/tmpfs/tmpfs_vnops.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:01:31 2009 (r197849) > +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:17:15 2009 (r197850) > @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -428,15 +430,72 @@ tmpfs_setattr(struct vop_setattr_args *v > } > > /* --------------------------------------------------------------------- */ > +static int > +tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, > + vm_offset_t offset, size_t tlen, struct uio *uio) > +{ > + vm_page_t m; > + int error; > + > + VM_OBJECT_LOCK(tobj); > + vm_object_pip_add(tobj, 1); > + m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > + VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > + if (m->valid != VM_PAGE_BITS_ALL) { > + if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > + error = vm_pager_get_pages(tobj, &m, 1, 0); > + if (error != 0) { > + printf("tmpfs get pages from pager error [read]\n"); > + goto out; > + } > + } else > + vm_page_zero_invalid(m, TRUE); > + } > + VM_OBJECT_UNLOCK(tobj); > + error = uiomove_fromphys(&m, offset, tlen, uio); > + VM_OBJECT_LOCK(tobj); > +out: > + vm_page_lock_queues(); > + vm_page_unwire(m, TRUE); > + vm_page_unlock_queues(); > + vm_page_wakeup(m); > + vm_object_pip_subtract(tobj, 1); > + VM_OBJECT_UNLOCK(tobj); > + > + return (error); > +} > + > +static __inline int > +tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, > + vm_offset_t offset, size_t tlen, void *buf) > +{ > + struct uio uio; > + struct iovec iov; > + > + uio.uio_iovcnt = 1; > + uio.uio_iov = &iov; > + iov.iov_base = buf; > + iov.iov_len = tlen; > + > + uio.uio_offset = 0; > + uio.uio_resid = tlen; > + uio.uio_rw = UIO_READ; > + uio.uio_segflg = UIO_SYSSPACE; > + uio.uio_td = curthread; > + > + return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); > +} > > static int > tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) > { > + struct sf_buf *sf; > vm_pindex_t idx; > vm_page_t m; > vm_offset_t offset; > off_t addr; > size_t tlen; > + char *ma; > int error; > > addr = uio->uio_offset; > @@ -461,33 +520,30 @@ lookupvpg: > vm_page_wakeup(m); > VM_OBJECT_UNLOCK(vobj); > return (error); > + } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { > + if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) > + goto lookupvpg; > + vm_page_busy(m); > + VM_OBJECT_UNLOCK(vobj); > + sched_pin(); > + sf = sf_buf_alloc(m, SFB_CPUPRIVATE); > + ma = (char *)sf_buf_kva(sf); > + error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, > + ma + offset); > + if (error == 0) { > + uio->uio_offset += tlen; > + uio->uio_resid -= tlen; > + } > + sf_buf_free(sf); > + sched_unpin(); > + VM_OBJECT_LOCK(vobj); > + vm_page_wakeup(m); > + VM_OBJECT_UNLOCK(vobj); > + return (error); > } > VM_OBJECT_UNLOCK(vobj); > nocache: > - VM_OBJECT_LOCK(tobj); > - vm_object_pip_add(tobj, 1); > - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > - if (m->valid != VM_PAGE_BITS_ALL) { > - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > - error = vm_pager_get_pages(tobj, &m, 1, 0); > - if (error != 0) { > - printf("tmpfs get pages from pager error [read]\n"); > - goto out; > - } > - } else > - vm_page_zero_invalid(m, TRUE); > - } > - VM_OBJECT_UNLOCK(tobj); > - error = uiomove_fromphys(&m, offset, tlen, uio); > - VM_OBJECT_LOCK(tobj); > -out: > - vm_page_lock_queues(); > - vm_page_unwire(m, TRUE); > - vm_page_unlock_queues(); > - vm_page_wakeup(m); > - vm_object_pip_subtract(tobj, 1); > - VM_OBJECT_UNLOCK(tobj); > + error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); > > return (error); > } > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From gleb.kurtsou at gmail.com Fri Oct 9 20:59:07 2009 From: gleb.kurtsou at gmail.com (Gleb Kurtsou) Date: Fri Oct 9 20:59:14 2009 Subject: svn commit: r197850 - head/sys/fs/tmpfs In-Reply-To: <20091009154924.689f21e1.ota@j.email.ne.jp> References: <200910072317.n97NHFKL002393@svn.freebsd.org> <20091009154924.689f21e1.ota@j.email.ne.jp> Message-ID: <20091009205842.GA3808@tops> On (09/10/2009 15:49), Yoshihiro Ota wrote: > Could someone explain what was the cause and why this fixes the issue? > > When I read it, it looked like that a vm object could be in 2 locations > and one of them looked the cause of the problem. > But I couldn't figure out thereafter. kern_sendfile performs vm_page_grab which allocates a new page if not found. Then it calls VOP_READ with UIO_NOCOPY. The page itself is getting filled by bio routines, because it has no valid bits set (looks like allocbuf handles this case during buffer allocation). Both zfs and tmpfs do not use buffer management routines for io, that's why sendfile should be handled separately. There's also comment about this case in zfs: http://fxr.watson.org/fxr/source/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c?im=excerpts#L451 The patch does "real read" from swap backed storage (tobj) into that page. > > Thanks, > Hiro > > On Wed, 7 Oct 2009 23:17:15 +0000 (UTC) > Xin LI wrote: > > > Author: delphij > > Date: Wed Oct 7 23:17:15 2009 > > New Revision: 197850 > > URL: http://svn.freebsd.org/changeset/base/197850 > > > > Log: > > Add a special workaround to handle UIO_NOCOPY case. This fixes data > > corruption observed when sendfile() is being used. > > > > PR: kern/127213 > > Submitted by: gk > > MFC after: 2 weeks > > > > Modified: > > head/sys/fs/tmpfs/tmpfs_vnops.c > > > > Modified: head/sys/fs/tmpfs/tmpfs_vnops.c > > ============================================================================== > > --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:01:31 2009 (r197849) > > +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Oct 7 23:17:15 2009 (r197850) > > @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > @@ -428,15 +430,72 @@ tmpfs_setattr(struct vop_setattr_args *v > > } > > > > /* --------------------------------------------------------------------- */ > > +static int > > +tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, > > + vm_offset_t offset, size_t tlen, struct uio *uio) > > +{ > > + vm_page_t m; > > + int error; > > + > > + VM_OBJECT_LOCK(tobj); > > + vm_object_pip_add(tobj, 1); > > + m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > > + VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > > + if (m->valid != VM_PAGE_BITS_ALL) { > > + if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > > + error = vm_pager_get_pages(tobj, &m, 1, 0); > > + if (error != 0) { > > + printf("tmpfs get pages from pager error [read]\n"); > > + goto out; > > + } > > + } else > > + vm_page_zero_invalid(m, TRUE); > > + } > > + VM_OBJECT_UNLOCK(tobj); > > + error = uiomove_fromphys(&m, offset, tlen, uio); > > + VM_OBJECT_LOCK(tobj); > > +out: > > + vm_page_lock_queues(); > > + vm_page_unwire(m, TRUE); > > + vm_page_unlock_queues(); > > + vm_page_wakeup(m); > > + vm_object_pip_subtract(tobj, 1); > > + VM_OBJECT_UNLOCK(tobj); > > + > > + return (error); > > +} > > + > > +static __inline int > > +tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, > > + vm_offset_t offset, size_t tlen, void *buf) > > +{ > > + struct uio uio; > > + struct iovec iov; > > + > > + uio.uio_iovcnt = 1; > > + uio.uio_iov = &iov; > > + iov.iov_base = buf; > > + iov.iov_len = tlen; > > + > > + uio.uio_offset = 0; > > + uio.uio_resid = tlen; > > + uio.uio_rw = UIO_READ; > > + uio.uio_segflg = UIO_SYSSPACE; > > + uio.uio_td = curthread; > > + > > + return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); > > +} > > > > static int > > tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) > > { > > + struct sf_buf *sf; > > vm_pindex_t idx; > > vm_page_t m; > > vm_offset_t offset; > > off_t addr; > > size_t tlen; > > + char *ma; > > int error; > > > > addr = uio->uio_offset; > > @@ -461,33 +520,30 @@ lookupvpg: > > vm_page_wakeup(m); > > VM_OBJECT_UNLOCK(vobj); > > return (error); > > + } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { > > + if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) > > + goto lookupvpg; > > + vm_page_busy(m); > > + VM_OBJECT_UNLOCK(vobj); > > + sched_pin(); > > + sf = sf_buf_alloc(m, SFB_CPUPRIVATE); > > + ma = (char *)sf_buf_kva(sf); > > + error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, > > + ma + offset); > > + if (error == 0) { > > + uio->uio_offset += tlen; > > + uio->uio_resid -= tlen; > > + } > > + sf_buf_free(sf); > > + sched_unpin(); > > + VM_OBJECT_LOCK(vobj); > > + vm_page_wakeup(m); > > + VM_OBJECT_UNLOCK(vobj); > > + return (error); > > } > > VM_OBJECT_UNLOCK(vobj); > > nocache: > > - VM_OBJECT_LOCK(tobj); > > - vm_object_pip_add(tobj, 1); > > - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | > > - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); > > - if (m->valid != VM_PAGE_BITS_ALL) { > > - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { > > - error = vm_pager_get_pages(tobj, &m, 1, 0); > > - if (error != 0) { > > - printf("tmpfs get pages from pager error [read]\n"); > > - goto out; > > - } > > - } else > > - vm_page_zero_invalid(m, TRUE); > > - } > > - VM_OBJECT_UNLOCK(tobj); > > - error = uiomove_fromphys(&m, offset, tlen, uio); > > - VM_OBJECT_LOCK(tobj); > > -out: > > - vm_page_lock_queues(); > > - vm_page_unwire(m, TRUE); > > - vm_page_unlock_queues(); > > - vm_page_wakeup(m); > > - vm_object_pip_subtract(tobj, 1); > > - VM_OBJECT_UNLOCK(tobj); > > + error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); > > > > return (error); > > } > > _______________________________________________ > > svn-src-all@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/svn-src-all > > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From eri at FreeBSD.org Sat Oct 10 03:32:47 2009 From: eri at FreeBSD.org (Ermal Luçi) Date: Sat Oct 10 03:32:58 2009 Subject: svn commit: r197928 - head/sys/modules/pf Message-ID: <200910100332.n9A3Wkkm071801@svn.freebsd.org> Author: eri Date: Sat Oct 10 03:32:46 2009 New Revision: 197928 URL: http://svn.freebsd.org/changeset/base/197928 Log: Fix typo which has survived amazingly long! Approved by: mlaier(mentor) MFC after: 3 days Modified: head/sys/modules/pf/Makefile Modified: head/sys/modules/pf/Makefile ============================================================================== --- head/sys/modules/pf/Makefile Sat Oct 10 01:47:27 2009 (r197927) +++ head/sys/modules/pf/Makefile Sat Oct 10 03:32:46 2009 (r197928) @@ -28,7 +28,7 @@ opt_bpf.h: # pflog can be loaded as a module, have the additional checks turned on opt_pf.h: echo "#define DEV_PF 1" > ${.TARGET} - echo "#define DEF_PFLOG 1" >> ${.TARGET} + echo "#define DEV_PFLOG 1" >> ${.TARGET} .endif .include From tuexen at FreeBSD.org Sat Oct 10 13:59:19 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Sat Oct 10 13:59:31 2009 Subject: svn commit: r197929 - head/sys/netinet Message-ID: <200910101359.n9ADxJBl083948@svn.freebsd.org> Author: tuexen Date: Sat Oct 10 13:59:18 2009 New Revision: 197929 URL: http://svn.freebsd.org/changeset/base/197929 Log: Correct include order as indicated by bz. Approved by: re (mentor) MFC after: 3 days Modified: head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Sat Oct 10 03:32:46 2009 (r197928) +++ head/sys/netinet/sctp_os_bsd.h Sat Oct 10 13:59:18 2009 (r197929) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -77,8 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #ifdef IPSEC #include #include From bz at FreeBSD.org Sat Oct 10 14:10:08 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Oct 10 14:10:20 2009 Subject: svn commit: r197929 - head/sys/netinet In-Reply-To: <200910101359.n9ADxJBl083948@svn.freebsd.org> References: <200910101359.n9ADxJBl083948@svn.freebsd.org> Message-ID: <20091010140858.T5956@maildrop.int.zabbadoz.net> On Sat, 10 Oct 2009, Michael Tuexen wrote: > Author: tuexen > Date: Sat Oct 10 13:59:18 2009 > New Revision: 197929 > URL: http://svn.freebsd.org/changeset/base/197929 > > Log: > Correct include order as indicated by bz. > > Approved by: re (mentor) s,re,rrs, ? > MFC after: 3 days > > Modified: > head/sys/netinet/sctp_os_bsd.h > > Modified: head/sys/netinet/sctp_os_bsd.h > ============================================================================== > --- head/sys/netinet/sctp_os_bsd.h Sat Oct 10 03:32:46 2009 (r197928) > +++ head/sys/netinet/sctp_os_bsd.h Sat Oct 10 13:59:18 2009 (r197929) > @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include > #include > @@ -77,8 +78,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > > -#include > - > #ifdef IPSEC > #include > #include > -- Bjoern A. Zeeb It will not break if you know what you are doing. From kib at FreeBSD.org Sat Oct 10 14:56:35 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 14:56:59 2009 Subject: svn commit: r197930 - head/sys/kern Message-ID: <200910101456.n9AEuYIC085111@svn.freebsd.org> Author: kib Date: Sat Oct 10 14:56:34 2009 New Revision: 197930 URL: http://svn.freebsd.org/changeset/base/197930 Log: Postpone dropping fp till both kq_global and kqueue mutexes are unlocked. fdrop() closes file descriptor when reference count goes to zero. Close method for vnodes locks the vnode, resulting in "sleepable after non-sleepable". For pipes, pipe mutex is before kqueue lock, causing LOR. Reported and tested by: pho MFC after: 2 weeks Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sat Oct 10 13:59:18 2009 (r197929) +++ head/sys/kern/kern_event.c Sat Oct 10 14:56:34 2009 (r197930) @@ -1025,13 +1025,13 @@ findkn: /* knote is in the process of changing, wait for it to stablize. */ if (kn != NULL && (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0); if (fp != NULL) { fdrop(fp, td); fp = NULL; } - KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); - kq->kq_state |= KQ_FLUXWAIT; - msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0); goto findkn; } From tuexen at FreeBSD.org Sat Oct 10 15:27:10 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Sat Oct 10 15:27:48 2009 Subject: svn commit: r197929 - head/sys/netinet In-Reply-To: <20091010140858.T5956@maildrop.int.zabbadoz.net> References: <200910101359.n9ADxJBl083948@svn.freebsd.org> <20091010140858.T5956@maildrop.int.zabbadoz.net> Message-ID: On Oct 10, 2009, at 4:09 PM, Bjoern A. Zeeb wrote: > On Sat, 10 Oct 2009, Michael Tuexen wrote: > >> Author: tuexen >> Date: Sat Oct 10 13:59:18 2009 >> New Revision: 197929 >> URL: http://svn.freebsd.org/changeset/base/197929 >> >> Log: >> Correct include order as indicated by bz. >> >> Approved by: re (mentor) > > s,re,rrs, ? Sorry, rrs... Best regards Michael > > >> MFC after: 3 days >> >> Modified: >> head/sys/netinet/sctp_os_bsd.h >> >> Modified: head/sys/netinet/sctp_os_bsd.h >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- head/sys/netinet/sctp_os_bsd.h Sat Oct 10 03:32:46 2009 (r197928) >> +++ head/sys/netinet/sctp_os_bsd.h Sat Oct 10 13:59:18 2009 (r197929) >> @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -77,8 +78,6 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> >> -#include >> - >> #ifdef IPSEC >> #include >> #include >> > > -- > Bjoern A. Zeeb It will not break if you know what you are > doing. > From kib at FreeBSD.org Sat Oct 10 15:27:11 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:27:59 2009 Subject: svn commit: r197931 - head/libexec/rtld-elf Message-ID: <200910101527.n9AFRAwQ085645@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:27:10 2009 New Revision: 197931 URL: http://svn.freebsd.org/changeset/base/197931 Log: Calculate relocation base for the main object, and apply the relocation adjustment for all virtual addresses encoded into the ELF structures of it. PIE binary could and should be loaded at non-zero mapbase. For sym_zero pseudosymbol used as a return value from find_symdef() for undefined weak symbols, st_value also should be adjusted, since _rtld_bind corrects symbol values by relocbase. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sat Oct 10 14:56:34 2009 (r197930) +++ head/libexec/rtld-elf/rtld.c Sat Oct 10 15:27:10 2009 (r197931) @@ -474,6 +474,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ /* Initialize a fake symbol for resolving undefined weak references. */ sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE); sym_zero.st_shndx = SHN_UNDEF; + sym_zero.st_value = -(uintptr_t)obj_main->relocbase; if (!libmap_disable) libmap_disable = (bool)lm_init(libmap_override); @@ -991,26 +992,26 @@ digest_phdr(const Elf_Phdr *phdr, int ph obj = obj_new(); for (ph = phdr; ph < phlimit; ph++) { - switch (ph->p_type) { + if (ph->p_type != PT_PHDR) + continue; - case PT_PHDR: - if ((const Elf_Phdr *)ph->p_vaddr != phdr) { - _rtld_error("%s: invalid PT_PHDR", path); - return NULL; - } - obj->phdr = (const Elf_Phdr *) ph->p_vaddr; - obj->phsize = ph->p_memsz; - break; + obj->phdr = phdr; + obj->phsize = ph->p_memsz; + obj->relocbase = (caddr_t)phdr - ph->p_vaddr; + break; + } + + for (ph = phdr; ph < phlimit; ph++) { + switch (ph->p_type) { case PT_INTERP: - obj->interp = (const char *) ph->p_vaddr; + obj->interp = (const char *)(ph->p_vaddr + obj->relocbase); break; case PT_LOAD: if (nsegs == 0) { /* First load segment */ obj->vaddrbase = trunc_page(ph->p_vaddr); - obj->mapbase = (caddr_t) obj->vaddrbase; - obj->relocbase = obj->mapbase - obj->vaddrbase; + obj->mapbase = obj->vaddrbase + obj->relocbase; obj->textsize = round_page(ph->p_vaddr + ph->p_memsz) - obj->vaddrbase; } else { /* Last load segment */ @@ -1021,7 +1022,7 @@ digest_phdr(const Elf_Phdr *phdr, int ph break; case PT_DYNAMIC: - obj->dynamic = (const Elf_Dyn *) ph->p_vaddr; + obj->dynamic = (const Elf_Dyn *)(ph->p_vaddr + obj->relocbase); break; case PT_TLS: @@ -1029,7 +1030,7 @@ digest_phdr(const Elf_Phdr *phdr, int ph obj->tlssize = ph->p_memsz; obj->tlsalign = ph->p_align; obj->tlsinitsize = ph->p_filesz; - obj->tlsinit = (void*) ph->p_vaddr; + obj->tlsinit = (void*)(ph->p_vaddr + obj->relocbase); break; } } From kib at FreeBSD.org Sat Oct 10 15:28:52 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:28:58 2009 Subject: svn commit: r197932 - head/sys/kern Message-ID: <200910101528.n9AFSqDs085710@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:28:52 2009 New Revision: 197932 URL: http://svn.freebsd.org/changeset/base/197932 Log: Do not map segments of zero length. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Oct 10 15:27:10 2009 (r197931) +++ head/sys/kern/imgact_elf.c Sat Oct 10 15:28:52 2009 (r197932) @@ -635,7 +635,8 @@ __elfN(load_file)(struct proc *p, const } for (i = 0, numsegs = 0; i < hdr->e_phnum; i++) { - if (phdr[i].p_type == PT_LOAD) { /* Loadable segment */ + if (phdr[i].p_type == PT_LOAD && phdr[i].p_memsz != 0) { + /* Loadable segment */ prot = 0; if (phdr[i].p_flags & PF_X) prot |= VM_PROT_EXECUTE; @@ -764,6 +765,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i for (i = 0; i < hdr->e_phnum; i++) { switch (phdr[i].p_type) { case PT_LOAD: /* Loadable segment */ + if (phdr[i].p_memsz == 0) + break; prot = 0; if (phdr[i].p_flags & PF_X) prot |= VM_PROT_EXECUTE; From kib at FreeBSD.org Sat Oct 10 15:31:25 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:31:32 2009 Subject: svn commit: r197933 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include Message-ID: <200910101531.n9AFVOLI085794@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:31:24 2009 New Revision: 197933 URL: http://svn.freebsd.org/changeset/base/197933 Log: Define architectural load bases for PIE binaries. Addresses were selected by looking at the bases used for non-relocatable executables by gnu ld(1), and adjusting it slightly. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/sys/amd64/include/elf.h head/sys/arm/include/elf.h head/sys/i386/include/elf.h head/sys/ia64/include/elf.h head/sys/mips/include/elf.h head/sys/powerpc/include/elf.h head/sys/sparc64/include/elf.h head/sys/sun4v/include/elf.h Modified: head/sys/amd64/include/elf.h ============================================================================== --- head/sys/amd64/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/amd64/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -106,4 +106,10 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_X86_64 #define ELF_TARG_VER 1 +#if __ELF_WORD_SIZE == 32 +#define ET_DYN_LOAD_ADDR 0x01001000 +#else +#define ET_DYN_LOAD_ADDR 0x01021000 +#endif + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/arm/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -97,4 +97,7 @@ __ElfType(Auxinfo); * value. */ #define MAGIC_TRAMP_NUMBER 0x5c000003 + +#define ET_DYN_LOAD_ADDR 0x12000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/i386/include/elf.h ============================================================================== --- head/sys/i386/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/i386/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -105,4 +105,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_386 #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x01001000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/ia64/include/elf.h ============================================================================== --- head/sys/ia64/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/ia64/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -141,4 +141,6 @@ __ElfType(Auxinfo); #define DT_IA_64_PLT_RESERVE 0x70000000 +#define ET_DYN_LOAD_ADDR 0x2500000000000000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/mips/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -250,4 +250,6 @@ __ElfType(Auxinfo); #define AT_COUNT 16 /* Count of defined aux entry types. */ +#define ET_DYN_LOAD_ADDR 0x0120000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/powerpc/include/elf.h ============================================================================== --- head/sys/powerpc/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/powerpc/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -96,4 +96,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_PPC #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x01010000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/sparc64/include/elf.h ============================================================================== --- head/sys/sparc64/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/sparc64/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -97,4 +97,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH ELF_ARCH #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x150000000 + #endif /* !_MACHINE_ELF_H_ */ Modified: head/sys/sun4v/include/elf.h ============================================================================== --- head/sys/sun4v/include/elf.h Sat Oct 10 15:28:52 2009 (r197932) +++ head/sys/sun4v/include/elf.h Sat Oct 10 15:31:24 2009 (r197933) @@ -97,4 +97,6 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH ELF_ARCH #define ELF_TARG_VER 1 +#define ET_DYN_LOAD_ADDR 0x150000000 + #endif /* !_MACHINE_ELF_H_ */ From kib at FreeBSD.org Sat Oct 10 15:33:01 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 15:33:23 2009 Subject: svn commit: r197934 - head/sys/kern Message-ID: <200910101533.n9AFX1Gq085870@svn.freebsd.org> Author: kib Date: Sat Oct 10 15:33:01 2009 New Revision: 197934 URL: http://svn.freebsd.org/changeset/base/197934 Log: Map PIE binaries at non-zero base address. Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Oct 10 15:31:24 2009 (r197933) +++ head/sys/kern/imgact_elf.c Sat Oct 10 15:33:01 2009 (r197934) @@ -688,7 +688,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i u_long text_size = 0, data_size = 0, total_size = 0; u_long text_addr = 0, data_addr = 0; u_long seg_size, seg_addr; - u_long addr, entry = 0, proghdr = 0; + u_long addr, et_dyn_addr, entry = 0, proghdr = 0; int32_t osrel = 0; int error = 0, i; const char *interp = NULL, *newinterp = NULL; @@ -736,9 +736,12 @@ __CONCAT(exec_, __elfN(imgact))(struct i hdr->e_ident[EI_OSABI]); return (ENOEXEC); } - if (hdr->e_type == ET_DYN && - (brand_info->flags & BI_CAN_EXEC_DYN) == 0) - return (ENOEXEC); + if (hdr->e_type == ET_DYN) { + if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) + return (ENOEXEC); + et_dyn_addr = ET_DYN_LOAD_ADDR; + } else + et_dyn_addr = 0; sv = brand_info->sysvec; if (interp != NULL && brand_info->interp_newpath != NULL) newinterp = brand_info->interp_newpath; @@ -786,7 +789,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i if ((error = __elfN(load_section)(vmspace, imgp->object, phdr[i].p_offset, - (caddr_t)(uintptr_t)phdr[i].p_vaddr, + (caddr_t)(uintptr_t)phdr[i].p_vaddr + et_dyn_addr, phdr[i].p_memsz, phdr[i].p_filesz, prot, sv->sv_pagesize)) != 0) return (error); @@ -800,11 +803,12 @@ __CONCAT(exec_, __elfN(imgact))(struct i if (phdr[i].p_offset == 0 && hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize <= phdr[i].p_filesz) - proghdr = phdr[i].p_vaddr + hdr->e_phoff; + proghdr = phdr[i].p_vaddr + hdr->e_phoff + + et_dyn_addr; - seg_addr = trunc_page(phdr[i].p_vaddr); + seg_addr = trunc_page(phdr[i].p_vaddr + et_dyn_addr); seg_size = round_page(phdr[i].p_memsz + - phdr[i].p_vaddr - seg_addr); + phdr[i].p_vaddr + et_dyn_addr - seg_addr); /* * Is this .text or .data? We can't use @@ -826,7 +830,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i phdr[i].p_memsz)) { text_size = seg_size; text_addr = seg_addr; - entry = (u_long)hdr->e_entry; + entry = (u_long)hdr->e_entry + et_dyn_addr; } else { data_size = seg_size; data_addr = seg_addr; @@ -834,7 +838,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i total_size += seg_size; break; case PT_PHDR: /* Program header table info */ - proghdr = phdr[i].p_vaddr; + proghdr = phdr[i].p_vaddr + et_dyn_addr; break; default: break; From marcel at FreeBSD.org Sat Oct 10 18:24:54 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sat Oct 10 18:25:12 2009 Subject: svn commit: r197938 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/uart dev/xen/xenpci Message-ID: <200910101824.n9AIOscH089148@svn.freebsd.org> Author: marcel Date: Sat Oct 10 18:24:54 2009 New Revision: 197938 URL: http://svn.freebsd.org/changeset/base/197938 Log: MFC change 197721: Fix RTS/CTS flow control, broken by the TTY overhaul. The new TTY interface is fairly simple WRT dealing with flow control, but needed 2 new RX buffer functions with "get-char-from-buf" separated from "advance-buf-pointer" so that the pointer could be advanced only when ttydisc_rint() succeeded. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/uart/uart_bus.h stable/8/sys/dev/uart/uart_core.c stable/8/sys/dev/uart/uart_tty.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/uart/uart_bus.h ============================================================================== --- stable/8/sys/dev/uart/uart_bus.h Sat Oct 10 17:56:18 2009 (r197937) +++ stable/8/sys/dev/uart/uart_bus.h Sat Oct 10 18:24:54 2009 (r197938) @@ -96,6 +96,7 @@ struct uart_softc { int sc_opened:1; /* This UART is open for business. */ int sc_polled:1; /* This UART has no interrupts. */ int sc_txbusy:1; /* This UART is transmitting. */ + int sc_isquelch:1; /* This UART has input squelched. */ struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ @@ -141,6 +142,8 @@ int uart_bus_ipend(device_t dev); int uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan); int uart_bus_sysdev(device_t dev); +void uart_sched_softih(struct uart_softc *, uint32_t); + int uart_tty_attach(struct uart_softc *); int uart_tty_detach(struct uart_softc *); void uart_tty_intr(void *arg); @@ -175,6 +178,28 @@ uart_rx_get(struct uart_softc *sc) } static __inline int +uart_rx_next(struct uart_softc *sc) +{ + int ptr; + + ptr = sc->sc_rxget; + if (ptr == sc->sc_rxput) + return (-1); + ptr += 1; + sc->sc_rxget = (ptr < sc->sc_rxbufsz) ? ptr : 0; + return (0); +} + +static __inline int +uart_rx_peek(struct uart_softc *sc) +{ + int ptr; + + ptr = sc->sc_rxget; + return ((ptr == sc->sc_rxput) ? -1 : sc->sc_rxbuf[ptr]); +} + +static __inline int uart_rx_put(struct uart_softc *sc, int xc) { int ptr; Modified: stable/8/sys/dev/uart/uart_core.c ============================================================================== --- stable/8/sys/dev/uart/uart_core.c Sat Oct 10 17:56:18 2009 (r197937) +++ stable/8/sys/dev/uart/uart_core.c Sat Oct 10 18:24:54 2009 (r197938) @@ -91,7 +91,7 @@ uart_getrange(struct uart_class *uc) * Schedule a soft interrupt. We do this on the 0 to !0 transition * of the TTY pending interrupt status. */ -static void +void uart_sched_softih(struct uart_softc *sc, uint32_t ipend) { uint32_t new, old; Modified: stable/8/sys/dev/uart/uart_tty.c ============================================================================== --- stable/8/sys/dev/uart/uart_tty.c Sat Oct 10 17:56:18 2009 (r197937) +++ stable/8/sys/dev/uart/uart_tty.c Sat Oct 10 18:24:54 2009 (r197938) @@ -166,27 +166,6 @@ uart_tty_outwakeup(struct tty *tp) if (sc == NULL || sc->sc_leaving) return; - /* - * Handle input flow control. Note that if we have hardware support, - * we don't do anything here. We continue to receive until our buffer - * is full. At that time we cannot empty the UART itself and it will - * de-assert RTS for us. In that situation we're completely stuffed. - * Without hardware support, we need to toggle RTS ourselves. - */ - if ((tp->t_termios.c_cflag & CRTS_IFLOW) && !sc->sc_hwiflow) { -#if 0 - /*if ((tp->t_state & TS_TBLOCK) && - (sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS); - else */ if (/*!(tp->t_state & TS_TBLOCK) &&*/ - !(sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS|SER_RTS); -#endif - /* XXX: we should use inwakeup to implement this! */ - if (!(sc->sc_hwsig & SER_RTS)) - UART_SETSIG(sc, SER_DRTS|SER_RTS); - } - if (sc->sc_txbusy) return; @@ -195,6 +174,23 @@ uart_tty_outwakeup(struct tty *tp) UART_TRANSMIT(sc); } +static void +uart_tty_inwakeup(struct tty *tp) +{ + struct uart_softc *sc; + + sc = tty_softc(tp); + if (sc == NULL || sc->sc_leaving) + return; + + if (sc->sc_isquelch) { + if ((tp->t_termios.c_cflag & CRTS_IFLOW) && !sc->sc_hwiflow) + UART_SETSIG(sc, SER_DRTS|SER_RTS); + sc->sc_isquelch = 0; + uart_sched_softih(sc, SER_INT_RXREADY); + } +} + static int uart_tty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) { @@ -252,9 +248,9 @@ uart_tty_param(struct tty *tp, struct te UART_SETSIG(sc, SER_DDTR | SER_DTR); /* Set input flow control state. */ if (!sc->sc_hwiflow) { - /* if ((t->c_cflag & CRTS_IFLOW) && (tp->t_state & TS_TBLOCK)) + if ((t->c_cflag & CRTS_IFLOW) && sc->sc_isquelch) UART_SETSIG(sc, SER_DRTS); - else */ + else UART_SETSIG(sc, SER_DRTS | SER_RTS); } else UART_IOCTL(sc, UART_IOCTL_IFLOW, (t->c_cflag & CRTS_IFLOW)); @@ -294,8 +290,8 @@ uart_tty_intr(void *arg) tty_lock(tp); if (pend & SER_INT_RXREADY) { - while (!uart_rx_empty(sc) /* && !(tp->t_state & TS_TBLOCK)*/) { - xc = uart_rx_get(sc); + while (!uart_rx_empty(sc) && !sc->sc_isquelch) { + xc = uart_rx_peek(sc); c = xc & 0xff; if (xc & UART_STAT_FRAMERR) err |= TRE_FRAMING; @@ -303,7 +299,13 @@ uart_tty_intr(void *arg) err |= TRE_OVERRUN; if (xc & UART_STAT_PARERR) err |= TRE_PARITY; - ttydisc_rint(tp, c, err); + if (ttydisc_rint(tp, c, err) != 0) { + sc->sc_isquelch = 1; + if ((tp->t_termios.c_cflag & CRTS_IFLOW) && + !sc->sc_hwiflow) + UART_SETSIG(sc, SER_DRTS); + } else + uart_rx_next(sc); } } @@ -344,6 +346,7 @@ static struct ttydevsw uart_tty_class = .tsw_open = uart_tty_open, .tsw_close = uart_tty_close, .tsw_outwakeup = uart_tty_outwakeup, + .tsw_inwakeup = uart_tty_inwakeup, .tsw_ioctl = uart_tty_ioctl, .tsw_param = uart_tty_param, .tsw_modem = uart_tty_modem, From des at FreeBSD.org Sat Oct 10 21:10:49 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Sat Oct 10 21:11:00 2009 Subject: svn commit: r197941 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci Message-ID: <200910102110.n9ALAnSF092458@svn.freebsd.org> Author: des Date: Sat Oct 10 21:10:49 2009 New Revision: 197941 URL: http://svn.freebsd.org/changeset/base/197941 Log: Fix mergeinfo for r196843 (r196518) and r196997 (r196519). Folks, *please* use 'svn merge' instead of applying patches manually! Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) From kib at FreeBSD.org Sat Oct 10 21:17:30 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Oct 10 21:17:41 2009 Subject: svn commit: r197942 - head/sys/kern Message-ID: <200910102117.n9ALHUKW092617@svn.freebsd.org> Author: kib Date: Sat Oct 10 21:17:30 2009 New Revision: 197942 URL: http://svn.freebsd.org/changeset/base/197942 Log: Refine r195509, instead of checking that vnode type is VBAD, that is set quite late in the revocation path, properly verify that vnode is not doomed before calling VOP. Reported and tested by: Harald Schmalzbauer MFC after: 3 days Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sat Oct 10 21:10:49 2009 (r197941) +++ head/sys/kern/kern_exit.c Sat Oct 10 21:17:30 2009 (r197942) @@ -340,10 +340,10 @@ exit1(struct thread *td, int rv) if (ttyvp != NULL) { sx_xunlock(&proctree_lock); - vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY); - if (ttyvp->v_type != VBAD) + if (vn_lock(ttyvp, LK_EXCLUSIVE) == 0) { VOP_REVOKE(ttyvp, REVOKEALL); - VOP_UNLOCK(ttyvp, 0); + VOP_UNLOCK(ttyvp, 0); + } sx_xlock(&proctree_lock); } } From trasz at FreeBSD.org Sat Oct 10 21:49:04 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sat Oct 10 21:49:13 2009 Subject: svn commit: r197945 - head/sys/dev/fdc Message-ID: <200910102149.n9ALn4Br093280@svn.freebsd.org> Author: trasz Date: Sat Oct 10 21:49:04 2009 New Revision: 197945 URL: http://svn.freebsd.org/changeset/base/197945 Log: Orphaning provider with EXDEV seems weird; perhaps the author meant ENXIO here? Modified: head/sys/dev/fdc/fdc.c Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Sat Oct 10 21:43:04 2009 (r197944) +++ head/sys/dev/fdc/fdc.c Sat Oct 10 21:49:04 2009 (r197945) @@ -864,7 +864,7 @@ fdc_worker(struct fdc_data *fdc) fd->flags |= FD_NEWDISK; mtx_unlock(&fdc->fdc_mtx); g_topology_lock(); - g_orphan_provider(fd->fd_provider, EXDEV); + g_orphan_provider(fd->fd_provider, ENXIO); fd->fd_provider->flags |= G_PF_WITHER; fd->fd_provider = g_new_providerf(fd->fd_geom, fd->fd_geom->name); From dougb at FreeBSD.org Sat Oct 10 22:17:04 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Sat Oct 10 22:17:17 2009 Subject: svn commit: r197947 - in head/etc: . rc.d Message-ID: <200910102217.n9AMH3hU093866@svn.freebsd.org> Author: dougb Date: Sat Oct 10 22:17:03 2009 New Revision: 197947 URL: http://svn.freebsd.org/changeset/base/197947 Log: In regards to the "Starting foo:" type messages at boot time, create and employ a more generic solution, and use it in the individual rc.d scripts that also have an $rc_quiet test: 1. Add check_startmsgs() to rc.subr. 2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute variations of [ -z "$rc_quiet" ] with check_startmsgs 3. In savecore add a trailing '.' to the end of the message to make it more consistent with other scripts. 4. In newsyslog remove a : before the terminal '.' since we do not expect there to be anything printed out in between to make it more consistent. 5. In the following scripts change "quotes" to 'quotes' where no variables exist in the message: savecore pf newsyslog 6. In the following scripts substitute if/then/fi for the simpler (and more consistent) check_startmsgs &&: faith stf 7. In the following scripts separate the "Starting foo:" from the terminal '.' to make them more consistent: moused hostname pf 8. In nfsclient move the message to its own line to avoid a style bug 9. In pf rc_quiet does not apply to the _stop method, so remove the test there. 10. In motd add 'quotes' around the terminal '.' for consistency Modified: head/etc/rc.d/bgfsck head/etc/rc.d/cleartmp head/etc/rc.d/faith head/etc/rc.d/fsck head/etc/rc.d/hostid head/etc/rc.d/hostname head/etc/rc.d/ldconfig head/etc/rc.d/motd head/etc/rc.d/mountcritlocal head/etc/rc.d/moused head/etc/rc.d/netif head/etc/rc.d/newsyslog head/etc/rc.d/nfsclient head/etc/rc.d/pf head/etc/rc.d/savecore head/etc/rc.d/stf head/etc/rc.subr Modified: head/etc/rc.d/bgfsck ============================================================================== --- head/etc/rc.d/bgfsck Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/bgfsck Sat Oct 10 22:17:03 2009 (r197947) @@ -31,7 +31,7 @@ bgfsck_start () bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds" fi if [ -z "${rc_force}" ]; then - [ -z "${rc_quiet}" ] && echo "${bgfsck_msg}." + check_startmsgs && echo "${bgfsck_msg}." fi (sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \ Modified: head/etc/rc.d/cleartmp ============================================================================== --- head/etc/rc.d/cleartmp Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/cleartmp Sat Oct 10 22:17:03 2009 (r197947) @@ -25,7 +25,7 @@ cleartmp_start() ${tmp}/.ICE-unix ${tmp}/.font-unix" if checkyesno ${rcvar1}; then - [ -z "${rc_quiet}" ] && echo "Clearing ${tmp}." + check_startmsgs && echo "Clearing ${tmp}." # This is not needed for mfs, but doesn't hurt anything. # Things to note: @@ -44,7 +44,7 @@ cleartmp_start() elif checkyesno clear_tmp_X; then # Remove X lock files, since they will prevent you from # restarting X. Remove other X related directories. - [ -z "${rc_quiet}" ] && echo "Clearing ${tmp} (X related)." + check_startmsgs && echo "Clearing ${tmp} (X related)." rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs} fi if checkyesno clear_tmp_X; then Modified: head/etc/rc.d/faith ============================================================================== --- head/etc/rc.d/faith Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/faith Sat Oct 10 22:17:03 2009 (r197947) @@ -39,9 +39,7 @@ faith_up() route change -inet6 ${prefix} -prefixlen ${prefixlen} \ -ifp faith0 done - if [ -z "${rc_quiet}" ]; then - ifconfig faith0 - fi + check_startmsgs && ifconfig faith0 ;; esac } Modified: head/etc/rc.d/fsck ============================================================================== --- head/etc/rc.d/fsck Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/fsck Sat Oct 10 22:17:03 2009 (r197947) @@ -23,7 +23,7 @@ fsck_start() # During fsck ignore SIGQUIT trap : 3 - [ -z "${rc_quiet}" ] && echo "Starting file system checks:" + check_startmsgs && echo "Starting file system checks:" if checkyesno background_fsck; then fsck -F -p else Modified: head/etc/rc.d/hostid ============================================================================== --- head/etc/rc.d/hostid Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/hostid Sat Oct 10 22:17:03 2009 (r197947) @@ -49,9 +49,9 @@ hostid_set() # Set both kern.hostuuid and kern.hostid. # - [ -z "${rc_quiet}" ] && echo "Setting hostuuid: ${uuid}." + check_startmsgs && echo "Setting hostuuid: ${uuid}." ${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null - [ -z "${rc_quiet}" ] && echo "Setting hostid: ${id}." + check_startmsgs && echo "Setting hostid: ${id}." ${SYSCTL_W} kern.hostid=${id} >/dev/null } Modified: head/etc/rc.d/hostname ============================================================================== --- head/etc/rc.d/hostname Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/hostname Sat Oct 10 22:17:03 2009 (r197947) @@ -72,8 +72,9 @@ hostname_start() # All right, it is safe to invoke hostname(1) now. # - [ -z "${rc_quiet}" ] && echo "Setting hostname: ${hostname}." + check_startmsgs && echo -n "Setting hostname: ${hostname}" /bin/hostname "${hostname}" + check_startmsgs && echo '.' } load_rc_config $name Modified: head/etc/rc.d/ldconfig ============================================================================== --- head/etc/rc.d/ldconfig Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/ldconfig Sat Oct 10 22:17:03 2009 (r197947) @@ -36,7 +36,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && echo 'ELF ldconfig path:' ${_LDC} + check_startmsgs && echo 'ELF ldconfig path:' ${_LDC} ${ldconfig} -elf ${_ins} ${_LDC} case `sysctl -n hw.machine_arch` in @@ -55,7 +55,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && + check_startmsgs && echo '32-bit compatibility ldconfig path:' ${_LDC} ${ldconfig} -32 -m ${_ins} ${_LDC} ;; @@ -72,8 +72,7 @@ ldconfig_start() _LDC="${_LDC} ${i}" fi done - [ -z "${rc_quiet}" ] && - echo 'a.out ldconfig path:' ${_LDC} + check_startmsgs && echo 'a.out ldconfig path:' ${_LDC} ${ldconfig} -aout ${_ins} ${_LDC} ;; esac Modified: head/etc/rc.d/motd ============================================================================== --- head/etc/rc.d/motd Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/motd Sat Oct 10 22:17:03 2009 (r197947) @@ -22,7 +22,7 @@ motd_start() # Must be done *before* interactive logins are possible # to prevent possible race conditions. # - [ -z "${rc_quiet}" ] && echo -n 'Updating motd:' + check_startmsgs && echo -n 'Updating motd:' if [ ! -f /etc/motd ]; then install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd fi @@ -42,7 +42,7 @@ motd_start() } rm -f $T - [ -z "${rc_quiet}" ] && echo . + check_startmsgs && echo '.' } load_rc_config $name Modified: head/etc/rc.d/mountcritlocal ============================================================================== --- head/etc/rc.d/mountcritlocal Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/mountcritlocal Sat Oct 10 22:17:03 2009 (r197947) @@ -28,7 +28,7 @@ mountcritlocal_start() esac # Mount everything except nfs filesystems. - [ -z "${rc_quiet}" ] && echo -n 'Mounting local file systems:' + check_startmsgs && echo -n 'Mounting local file systems:' mount_excludes='no' for i in ${netfs_types}; do fstype=${i%:*} @@ -37,7 +37,7 @@ mountcritlocal_start() mount_excludes=${mount_excludes%,} mount -a -t ${mount_excludes} err=$? - [ -z "${rc_quiet}" ] && echo '.' + check_startmsgs && echo '.' case ${err} in 0) Modified: head/etc/rc.d/moused ============================================================================== --- head/etc/rc.d/moused Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/moused Sat Oct 10 22:17:03 2009 (r197947) @@ -51,8 +51,9 @@ moused_start() mytype="$moused_type" fi - [ -z "${rc_quiet}" ] && echo -n "Starting ${ms} moused." + check_startmsgs && echo -n "Starting ${ms} moused" /usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg} + check_startmsgs && echo '.' mousechar_arg= case ${mousechar_start} in Modified: head/etc/rc.d/netif ============================================================================== --- head/etc/rc.d/netif Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/netif Sat Oct 10 22:17:03 2009 (r197947) @@ -143,7 +143,7 @@ network_common() ;; esac echo "${_str} Network:${_ok}." - if [ -z "${rc_quiet}" ]; then + if check_startmsgs; then for ifn in ${_ok}; do /sbin/ifconfig ${ifn} done Modified: head/etc/rc.d/newsyslog ============================================================================== --- head/etc/rc.d/newsyslog Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/newsyslog Sat Oct 10 22:17:03 2009 (r197947) @@ -17,9 +17,9 @@ stop_cmd=":" newsyslog_start() { - [ -z "${rc_quiet}" ] && echo -n "Creating and/or trimming log files:" + check_startmsgs && echo -n 'Creating and/or trimming log files' ${command} ${rc_flags} - [ -z "${rc_quiet}" ] && echo "." + check_startmsgs && echo '.' } load_rc_config $name Modified: head/etc/rc.d/nfsclient ============================================================================== --- head/etc/rc.d/nfsclient Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/nfsclient Sat Oct 10 22:17:03 2009 (r197947) @@ -22,7 +22,8 @@ nfsclient_start() # if [ -n "${nfs_access_cache}" ]; then - [ -z "${rc_quiet}" ] && echo "NFS access cache time=${nfs_access_cache}" + check_startmsgs && + echo "NFS access cache time=${nfs_access_cache}" if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then warn "failed to set access cache timeout" fi Modified: head/etc/rc.d/pf ============================================================================== --- head/etc/rc.d/pf Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/pf Sat Oct 10 22:17:03 2009 (r197947) @@ -25,19 +25,21 @@ required_modules="pf" pf_start() { - [ -z "${rc_quiet}" ] && echo "Enabling pf." + check_startmsgs && echo -n 'Enabling pf' $pf_program -F all > /dev/null 2>&1 $pf_program -f "$pf_rules" $pf_flags if ! $pf_program -s info | grep -q "Enabled" ; then $pf_program -e fi + check_startmsgs && echo '.' } pf_stop() { if $pf_program -s info | grep -q "Enabled" ; then - [ -z "${rc_quiet}" ] && echo "Disabling pf." + echo -n 'Disabling pf' $pf_program -d + echo '.' fi } Modified: head/etc/rc.d/savecore ============================================================================== --- head/etc/rc.d/savecore Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/savecore Sat Oct 10 22:17:03 2009 (r197947) @@ -69,7 +69,7 @@ savecore_start() ${crashinfo_program} -d ${dumpdir} fi else - [ -z "${rc_quiet}" ] && echo "No core dumps found" + check_startmsgs && echo 'No core dumps found.' fi } Modified: head/etc/rc.d/stf ============================================================================== --- head/etc/rc.d/stf Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.d/stf Sat Oct 10 22:17:03 2009 (r197947) @@ -53,9 +53,8 @@ stf_up() ifconfig stf0 create >/dev/null 2>&1 ifconfig stf0 inet6 2002:${ipv4_in_hexformat}:${stf_interface_ipv6_slaid:-0}:${stf_interface_ipv6_ifid} \ prefixlen ${stf_prefixlen} - if [ -z "${rc_quiet}" ]; then - /sbin/ifconfig stf0 - fi + check_startmsgs && /sbin/ifconfig stf0 + # disallow packets to malicious 6to4 prefix route add -inet6 2002:e000:: -prefixlen 20 ::1 -reject route add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Oct 10 21:56:39 2009 (r197946) +++ head/etc/rc.subr Sat Oct 10 22:17:03 2009 (r197947) @@ -398,6 +398,20 @@ wait_for_pids() } # +# check_startmsgs +# If rc_quiet is set (usually as a result of using faststart at +# boot time) check if rc_startmsgs is enabled. +# +check_startmsgs() +{ + if [ -n "$rc_quiet" ]; then + checkyesno rc_startmsgs + else + return 0 + fi +} + +# # run_rc_command argument # Search for argument in the list of supported commands, which is: # "start stop restart rcvar status poll ${extra_commands}" @@ -708,13 +722,7 @@ run_rc_command() # setup the full command to run # - _show_startmsgs=1 - if [ -n "${rc_quiet}" ]; then - if ! checkyesno rc_startmsgs; then - unset _show_startmsgs - fi - fi - [ -n "$_show_startmsgs" ] && echo "Starting ${name}." + check_startmsgs && echo "Starting ${name}." if [ -n "$_chroot" ]; then _doit="\ ${_nice:+nice -n $_nice }\ From rpaulo at FreeBSD.org Sat Oct 10 22:29:34 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Sat Oct 10 22:29:41 2009 Subject: svn commit: r197948 - head/sys/dev/ath/ath_hal Message-ID: <200910102229.n9AMTYoQ094207@svn.freebsd.org> Author: rpaulo Date: Sat Oct 10 22:29:34 2009 New Revision: 197948 URL: http://svn.freebsd.org/changeset/base/197948 Log: Atheros EEPROM version 4K. This version is mostly based on version 1.4. This is needed by the upcoming AR9285 support. Information on the layout gathered from Linux ath9k. Not yet connected to the build. Tested by: Eugeny Dzhurinsky Added: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c (contents, props changed) head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h (contents, props changed) Added: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Sat Oct 10 22:29:34 2009 (r197948) @@ -0,0 +1,404 @@ +/* + * Copyright (c) 2009 Rui Paulo + * Copyright (c) 2008 Sam Leffler, Errno Consulting + * Copyright (c) 2008 Atheros Communications, Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#include "opt_ah.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ah_eeprom_v14.h" +#include "ah_eeprom_v4k.h" + +static HAL_STATUS +v4kEepromGet(struct ath_hal *ah, int param, void *val) +{ +#define CHAN_A_IDX 0 +#define CHAN_B_IDX 1 +#define IS_VERS(op, v) ((pBase->version & AR5416_EEP_VER_MINOR_MASK) op (v)) + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; + const BASE_EEP4K_HEADER *pBase = &ee->ee_base.baseEepHeader; + uint32_t sum; + uint8_t *macaddr; + int i; + + switch (param) { + case AR_EEP_NFTHRESH_5: + *(int16_t *)val = pModal[0].noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_NFTHRESH_2: + *(int16_t *)val = pModal[1].noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_MACADDR: /* Get MAC Address */ + sum = 0; + macaddr = val; + for (i = 0; i < 6; i++) { + macaddr[i] = pBase->macAddr[i]; + sum += pBase->macAddr[i]; + } + if (sum == 0 || sum == 0xffff*3) { + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mac address %s\n", + __func__, ath_hal_ether_sprintf(macaddr)); + return HAL_EEBADMAC; + } + return HAL_OK; + case AR_EEP_REGDMN_0: + return pBase->regDmn[0]; + case AR_EEP_REGDMN_1: + return pBase->regDmn[1]; + case AR_EEP_OPCAP: + return pBase->deviceCap; + case AR_EEP_OPMODE: + return pBase->opCapFlags; + case AR_EEP_RFSILENT: + return pBase->rfSilent; + case AR_EEP_OB_5: + return pModal[CHAN_A_IDX].ob; + case AR_EEP_DB_5: + return pModal[CHAN_A_IDX].db; + case AR_EEP_OB_2: + return pModal[CHAN_B_IDX].ob; + case AR_EEP_DB_2: + return pModal[CHAN_B_IDX].db; + case AR_EEP_TXMASK: + return pBase->txMask; + case AR_EEP_RXMASK: + return pBase->rxMask; + case AR_EEP_RXGAIN_TYPE: + return AR5416_EEP_RXGAIN_ORIG; + case AR_EEP_TXGAIN_TYPE: + return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? + pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; +#if 0 + case AR_EEP_OL_PWRCTRL: + HALASSERT(val == AH_NULL); + return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; +#endif + case AR_EEP_AMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11A ? + HAL_OK : HAL_EIO; + case AR_EEP_BMODE: + case AR_EEP_GMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11G ? + HAL_OK : HAL_EIO; + case AR_EEP_32KHZCRYSTAL: + case AR_EEP_COMPRESS: + case AR_EEP_FASTFRAME: /* XXX policy decision, h/w can do it */ + case AR_EEP_WRITEPROTECT: /* NB: no write protect bit */ + HALASSERT(val == AH_NULL); + /* fall thru... */ + case AR_EEP_MAXQCU: /* NB: not in opCapFlags */ + case AR_EEP_KCENTRIES: /* NB: not in opCapFlags */ + return HAL_EIO; + case AR_EEP_AES: + case AR_EEP_BURST: + case AR_EEP_RFKILL: + case AR_EEP_TURBO5DISABLE: + case AR_EEP_TURBO2DISABLE: + HALASSERT(val == AH_NULL); + return HAL_OK; + case AR_EEP_ANTGAINMAX_2: + *(int8_t *) val = ee->ee_antennaGainMax[1]; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + *(int8_t *) val = ee->ee_antennaGainMax[0]; + return HAL_OK; + default: + HALASSERT(0); + return HAL_EINVAL; + } +#undef IS_VERS +#undef CHAN_A_IDX +#undef CHAN_B_IDX +} + +static HAL_BOOL +v4kEepromSet(struct ath_hal *ah, int param, int v) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (param) { + case AR_EEP_ANTGAINMAX_2: + ee->ee_antennaGainMax[1] = (int8_t) v; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + ee->ee_antennaGainMax[0] = (int8_t) v; + return HAL_OK; + } + return HAL_EINVAL; +} + +static HAL_BOOL +v4kEepromDiag(struct ath_hal *ah, int request, + const void *args, uint32_t argsize, void **result, uint32_t *resultsize) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (request) { + case HAL_DIAG_EEPROM: + *result = &ee->ee_base; + *resultsize = sizeof(ee->ee_base); + return AH_TRUE; + } + return AH_FALSE; +} + +/* Do structure specific swaps if Eeprom format is non native to host */ +static void +eepromSwap(struct ar5416eeprom_4k *ee) +{ + uint32_t integer, i; + uint16_t word; + MODAL_EEP4K_HEADER *pModal; + + /* convert Base Eep header */ + word = __bswap16(ee->baseEepHeader.length); + ee->baseEepHeader.length = word; + + word = __bswap16(ee->baseEepHeader.checksum); + ee->baseEepHeader.checksum = word; + + word = __bswap16(ee->baseEepHeader.version); + ee->baseEepHeader.version = word; + + word = __bswap16(ee->baseEepHeader.regDmn[0]); + ee->baseEepHeader.regDmn[0] = word; + + word = __bswap16(ee->baseEepHeader.regDmn[1]); + ee->baseEepHeader.regDmn[1] = word; + + word = __bswap16(ee->baseEepHeader.rfSilent); + ee->baseEepHeader.rfSilent = word; + + word = __bswap16(ee->baseEepHeader.blueToothOptions); + ee->baseEepHeader.blueToothOptions = word; + + word = __bswap16(ee->baseEepHeader.deviceCap); + ee->baseEepHeader.deviceCap = word; + + /* convert Modal Eep header */ + pModal = &ee->modalHeader; + + /* XXX linux/ah_osdep.h only defines __bswap32 for BE */ + integer = __bswap32(pModal->antCtrlCommon); + pModal->antCtrlCommon = integer; + + for (i = 0; i < AR5416_4K_MAX_CHAINS; i++) { + integer = __bswap32(pModal->antCtrlChain[i]); + pModal->antCtrlChain[i] = integer; + } + + for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) { + word = __bswap16(pModal->spurChans[i].spurChan); + pModal->spurChans[i].spurChan = word; + } +} + +static uint16_t +v4kEepromGetSpurChan(struct ath_hal *ah, int ix, HAL_BOOL is2GHz) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + HALASSERT(0 <= ix && ix < AR5416_EEPROM_MODAL_SPURS); + HALASSERT(is2GHz); + return ee->ee_base.modalHeader.spurChans[ix].spurChan; +} + +/************************************************************************** + * fbin2freq + * + * Get channel value from binary representation held in eeprom + * RETURNS: the frequency in MHz + */ +static uint16_t +fbin2freq(uint8_t fbin, HAL_BOOL is2GHz) +{ + /* + * Reserved value 0xFF provides an empty definition both as + * an fbin and as a frequency - do not convert + */ + if (fbin == AR5416_BCHAN_UNUSED) + return fbin; + return (uint16_t)((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); +} + +/* + * Copy EEPROM Conformance Testing Limits contents + * into the allocated space + */ +/* USE CTLS from chain zero */ +#define CTL_CHAIN 0 + +static void +v4kEepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_v4k *ee) +{ + RD_EDGES_POWER *rep = ee->ee_rdEdgesPower; + int i, j; + + HALASSERT(AR5416_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); + + for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_4K_NUM_CTLS; i++) { + for (j = 0; j < NUM_EDGES; j ++) { + /* XXX Confirm this is the right thing to do when an invalid channel is stored */ + if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) { + rep[j].rdEdge = 0; + rep[j].twice_rdEdgePower = 0; + rep[j].flag = 0; + } else { + rep[j].rdEdge = fbin2freq( + ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel, + (ee->ee_base.ctlIndex[i] & CTL_MODE_M) != CTL_11A); + rep[j].twice_rdEdgePower = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_POWER); + rep[j].flag = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_FLAG) != 0; + } + } + rep += NUM_EDGES; + } + ee->ee_numCtls = i; + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Numctls = %u\n",__func__,i); +} + +/* + * Reclaim any EEPROM-related storage. + */ +static void +v4kEepromDetach(struct ath_hal *ah) +{ + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + + ath_hal_free(ee); + AH_PRIVATE(ah)->ah_eeprom = AH_NULL; +} + +#define owl_get_eep_ver(_ee) \ + (((_ee)->ee_base.baseEepHeader.version >> 12) & 0xF) +#define owl_get_eep_rev(_ee) \ + (((_ee)->ee_base.baseEepHeader.version) & 0xFFF) + +HAL_STATUS +ath_hal_v4kEepromAttach(struct ath_hal *ah) +{ +#define NW(a) (sizeof(a) / sizeof(uint16_t)) + HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + uint16_t *eep_data, magic; + HAL_BOOL need_swap; + u_int w, off, len; + uint32_t sum; + + HALASSERT(ee == AH_NULL); + + if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s Error reading Eeprom MAGIC\n", __func__); + return HAL_EEREAD; + } + HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n", + __func__, magic); + if (magic != AR5416_EEPROM_MAGIC) { + HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n"); + return HAL_EEMAGIC; + } + + ee = ath_hal_malloc(sizeof(HAL_EEPROM_v4k)); + if (ee == AH_NULL) { + /* XXX message */ + return HAL_ENOMEM; + } + + eep_data = (uint16_t *)&ee->ee_base; + for (w = 0; w < NW(struct ar5416eeprom_4k); w++) { + off = owl_eep_start_loc + w; /* NB: AP71 starts at 0 */ + if (!ath_hal_eepromRead(ah, off, &eep_data[w])) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s eeprom read error at offset 0x%x\n", + __func__, off); + return HAL_EEREAD; + } + } + /* Convert to eeprom native eeprom endian format */ + if (isBigEndian()) { + for (w = 0; w < NW(struct ar5416eeprom_4k); w++) + eep_data[w] = __bswap16(eep_data[w]); + } + + /* + * At this point, we're in the native eeprom endian format + * Now, determine the eeprom endian by looking at byte 26?? + */ + need_swap = ((ee->ee_base.baseEepHeader.eepMisc & AR5416_EEPMISC_BIG_ENDIAN) != 0) ^ isBigEndian(); + if (need_swap) { + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "Byte swap EEPROM contents.\n"); + len = __bswap16(ee->ee_base.baseEepHeader.length); + } else { + len = ee->ee_base.baseEepHeader.length; + } + len = AH_MIN(len, sizeof(struct ar5416eeprom_4k)) / sizeof(uint16_t); + + /* Apply the checksum, done in native eeprom format */ + /* XXX - Need to check to make sure checksum calculation is done + * in the correct endian format. Right now, it seems it would + * cast the raw data to host format and do the calculation, which may + * not be correct as the calculation may need to be done in the native + * eeprom format + */ + sum = 0; + for (w = 0; w < len; w++) { + sum ^= eep_data[w]; + } + /* Check CRC - Attach should fail on a bad checksum */ + if (sum != 0xffff) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "Bad EEPROM checksum 0x%x (Len=%u)\n", sum, len); + return HAL_EEBADSUM; + } + + if (need_swap) + eepromSwap(&ee->ee_base); /* byte swap multi-byte data */ + + /* swap words 0+2 so version is at the front */ + magic = eep_data[0]; + eep_data[0] = eep_data[2]; + eep_data[2] = magic; + + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Eeprom Version %u.%u\n", __func__, + owl_get_eep_ver(ee), owl_get_eep_rev(ee)); + + /* NB: must be after all byte swapping */ + if (owl_get_eep_ver(ee) != AR5416_EEP_VER) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "Bad EEPROM version 0x%x\n", owl_get_eep_ver(ee)); + return HAL_EEBADSUM; + } + + v4kEepromReadCTLInfo(ah, ee); /* Get CTLs */ + + AH_PRIVATE(ah)->ah_eeprom = ee; + AH_PRIVATE(ah)->ah_eeversion = ee->ee_base.baseEepHeader.version; + AH_PRIVATE(ah)->ah_eepromDetach = v4kEepromDetach; + AH_PRIVATE(ah)->ah_eepromGet = v4kEepromGet; + AH_PRIVATE(ah)->ah_eepromSet = v4kEepromSet; + AH_PRIVATE(ah)->ah_getSpurChan = v4kEepromGetSpurChan; + AH_PRIVATE(ah)->ah_eepromDiag = v4kEepromDiag; + return HAL_OK; +#undef NW +} Added: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h Sat Oct 10 22:29:34 2009 (r197948) @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2009 Rui Paulo + * Copyright (c) 2008 Sam Leffler, Errno Consulting + * Copyright (c) 2008 Atheros Communications, Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#ifndef _AH_EEPROM_V4K_H_ +#define _AH_EEPROM_V4K_H_ + +#include "ah_eeprom.h" +#include "ah_eeprom_v14.h" + +#undef owl_eep_start_loc +#ifdef __LINUX_ARM_ARCH__ /* AP71 */ +#define owl_eep_start_loc 0 +#else +#define owl_eep_start_loc 64 +#endif + +// 16-bit offset location start of calibration struct +#define AR5416_4K_EEP_START_LOC 64 +#define AR5416_4K_NUM_2G_CAL_PIERS 3 +#define AR5416_4K_NUM_2G_CCK_TARGET_POWERS 3 +#define AR5416_4K_NUM_2G_20_TARGET_POWERS 3 +#define AR5416_4K_NUM_2G_40_TARGET_POWERS 3 +#define AR5416_4K_NUM_CTLS 12 +#define AR5416_4K_NUM_BAND_EDGES 4 +#define AR5416_4K_NUM_PD_GAINS 2 +#define AR5416_4K_PD_GAINS_IN_MASK 4 +#define AR5416_4K_PD_GAIN_ICEPTS 5 +#define AR5416_4K_MAX_CHAINS 1 + +/* + * NB: The format in EEPROM has words 0 and 2 swapped (i.e. version + * and length are swapped). We reverse their position after reading + * the data into host memory so the version field is at the same + * offset as in previous EEPROM layouts. This makes utilities that + * inspect the EEPROM contents work without looking at the PCI device + * id which may or may not be reliable. + */ +typedef struct BaseEepHeader4k { + uint16_t version; /* NB: length in EEPROM */ + uint16_t checksum; + uint16_t length; /* NB: version in EEPROM */ + uint8_t opCapFlags; + uint8_t eepMisc; + uint16_t regDmn[2]; + uint8_t macAddr[6]; + uint8_t rxMask; + uint8_t txMask; + uint16_t rfSilent; + uint16_t blueToothOptions; + uint16_t deviceCap; + uint32_t binBuildNumber; + uint8_t deviceType; + uint8_t txGainType; /* high power tx gain table support */ +} __packed BASE_EEP4K_HEADER; // 32 B + +typedef struct ModalEepHeader4k { + uint32_t antCtrlChain[AR5416_4K_MAX_CHAINS]; // 12 + uint32_t antCtrlCommon; // 4 + int8_t antennaGainCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t switchSettling; // 1 + uint8_t txRxAttenCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t rxTxMarginCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t adcDesiredSize; // 1 + int8_t pgaDesiredSize; // 1 + uint8_t xlnaGainCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t txEndToXpaOff; // 1 + uint8_t txEndToRxOn; // 1 + uint8_t txFrameToXpaOn; // 1 + uint8_t thresh62; // 1 + uint8_t noiseFloorThreshCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t xpdGain; // 1 + uint8_t xpd; // 1 + int8_t iqCalICh[AR5416_4K_MAX_CHAINS]; // 1 + int8_t iqCalQCh[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t pdGainOverlap; // 1 + uint8_t ob; // 1 + uint8_t db; // 1 + uint8_t xpaBiasLvl; // 1 +#if 0 + uint8_t pwrDecreaseFor2Chain; // 1 + uint8_t pwrDecreaseFor3Chain; // 1 -> 48 B +#endif + uint8_t txFrameToDataStart; // 1 + uint8_t txFrameToPaOn; // 1 + uint8_t ht40PowerIncForPdadc; // 1 + uint8_t bswAtten[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t bswMargin[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t swSettleHt40; // 1 + uint8_t xatten2Db[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t xatten2Margin[AR5416_4K_MAX_CHAINS]; // 1 + uint8_t ob_ch1; // 1 -> ob and db become chain specific from AR9280 + uint8_t db_ch1; // 1 + uint8_t flagBits; // 1 +#define AR5416_EEP_FLAG_USEANT1 0x01 /* +1 configured antenna */ +#define AR5416_EEP_FLAG_FORCEXPAON 0x02 /* force XPA bit for 5G */ +#define AR5416_EEP_FLAG_LOCALBIAS 0x04 /* enable local bias */ +#define AR5416_EEP_FLAG_FEMBANDSELECT 0x08 /* FEM band select used */ +#define AR5416_EEP_FLAG_XLNABUFIN 0x10 +#define AR5416_EEP_FLAG_XLNAISEL 0x60 +#define AR5416_EEP_FLAG_XLNAISEL_S 5 +#define AR5416_EEP_FLAG_XLNABUFMODE 0x80 + uint8_t miscBits; // [0..1]: bb_tx_dac_scale_cck + uint16_t xpaBiasLvlFreq[3]; // 6 + uint8_t futureModal[2]; // 2 + + SPUR_CHAN spurChans[AR5416_EEPROM_MODAL_SPURS]; // 20 B +} __packed MODAL_EEP4K_HEADER; // == 68 B + +typedef struct CalCtlData4k { + CAL_CTL_EDGES ctlEdges[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_BAND_EDGES]; +} __packed CAL_CTL_DATA_4K; + +typedef struct calDataPerFreq4k { + uint8_t pwrPdg[AR5416_4K_NUM_PD_GAINS][AR5416_4K_PD_GAIN_ICEPTS]; + uint8_t vpdPdg[AR5416_4K_NUM_PD_GAINS][AR5416_4K_PD_GAIN_ICEPTS]; +} __packed CAL_DATA_PER_FREQ_4K; + +struct ar5416eeprom_4k { + BASE_EEP4K_HEADER baseEepHeader; // 32 B + uint8_t custData[20]; // 20 B + MODAL_EEP4K_HEADER modalHeader; // 68 B + uint8_t calFreqPier2G[AR5416_4K_NUM_2G_CAL_PIERS]; + CAL_DATA_PER_FREQ_4K calPierData2G[AR5416_4K_MAX_CHAINS][AR5416_4K_NUM_2G_CAL_PIERS]; + CAL_TARGET_POWER_LEG calTargetPowerCck[AR5416_4K_NUM_2G_CCK_TARGET_POWERS]; + CAL_TARGET_POWER_LEG calTargetPower2G[AR5416_4K_NUM_2G_20_TARGET_POWERS]; + CAL_TARGET_POWER_HT calTargetPower2GHT20[AR5416_4K_NUM_2G_20_TARGET_POWERS]; + CAL_TARGET_POWER_HT calTargetPower2GHT40[AR5416_4K_NUM_2G_40_TARGET_POWERS]; + uint8_t ctlIndex[AR5416_4K_NUM_CTLS]; + CAL_CTL_DATA_4K ctlData[AR5416_4K_NUM_CTLS]; + uint8_t padding; +} __packed; + +typedef struct { + struct ar5416eeprom_4k ee_base; +#define NUM_EDGES 8 + uint16_t ee_numCtls; + RD_EDGES_POWER ee_rdEdgesPower[NUM_EDGES*AR5416_4K_NUM_CTLS]; + /* XXX these are dynamically calculated for use by shared code */ + int8_t ee_antennaGainMax[2]; +} HAL_EEPROM_v4k; +#endif /* _AH_EEPROM_V4K_H_ */ From das at FreeBSD.org Sun Oct 11 00:08:55 2009 From: das at FreeBSD.org (David Schultz) Date: Sun Oct 11 00:09:07 2009 Subject: svn commit: r197949 - head/lib/libc/sys Message-ID: <200910110008.n9B08tQc095922@svn.freebsd.org> Author: das Date: Sun Oct 11 00:08:55 2009 New Revision: 197949 URL: http://svn.freebsd.org/changeset/base/197949 Log: Document errno codes added in r144530. Modified: head/lib/libc/sys/intro.2 Modified: head/lib/libc/sys/intro.2 ============================================================================== --- head/lib/libc/sys/intro.2 Sat Oct 10 22:29:34 2009 (r197948) +++ head/lib/libc/sys/intro.2 Sun Oct 11 00:08:55 2009 (r197949) @@ -456,6 +456,14 @@ The specified extended attribute does no .It Er 88 EDOOFUS Em "Programming error" . A function or API is being abused in a way which could only be detected at run-time. +.It Er 89 EBADMSG Em "Bad message" . +A corrupted message was detected. +.It Er 90 EMULTIHOP Em "Multihop attempted" . +This error code is unused, but present for compatibility with other systems. +.It Er 91 ENOLINK Em "Link has been severed" . +This error code is unused, but present for compatibility with other systems. +.It Er 92 EPROTO Em "Protocol error" . +A device or socket encountered an unrecoverable protocol error. .It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . An operation on a capability file descriptor requires greater privilege than the capability allows. From oliver.pntr at gmail.com Sun Oct 11 00:27:40 2009 From: oliver.pntr at gmail.com (Oliver Pinter) Date: Sun Oct 11 00:27:52 2009 Subject: svn commit: r197855 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern In-Reply-To: <200910081128.n98BSWCd021500@svn.freebsd.org> References: <200910081128.n98BSWCd021500@svn.freebsd.org> Message-ID: <6101e8c40910101727t632d295ercccde04db34efac3@mail.gmail.com> this like commit MFC to 7-STABLE? On 10/8/09, Konstantin Belousov wrote: > Author: kib > Date: Thu Oct 8 11:28:32 2009 > New Revision: 197855 > URL: http://svn.freebsd.org/changeset/base/197855 > > Log: > MFC r197662: > Do not dereference vp->v_mount without holding vnode lock and checking > that the vnode is not reclaimed. > > Approved by: re (bz) > > Modified: > stable/8/sys/ (props changed) > stable/8/sys/amd64/include/xen/ (props changed) > stable/8/sys/cddl/contrib/opensolaris/ (props changed) > stable/8/sys/contrib/dev/acpica/ (props changed) > stable/8/sys/contrib/pf/ (props changed) > stable/8/sys/dev/xen/xenpci/ (props changed) > stable/8/sys/kern/uipc_syscalls.c > > Modified: stable/8/sys/kern/uipc_syscalls.c > ============================================================================== > --- stable/8/sys/kern/uipc_syscalls.c Thu Oct 8 11:07:15 2009 (r197854) > +++ stable/8/sys/kern/uipc_syscalls.c Thu Oct 8 11:28:32 2009 (r197855) > @@ -2085,9 +2085,11 @@ retry_space: > /* > * Get the page from backing store. > */ > - bsize = vp->v_mount->mnt_stat.f_iosize; > vfslocked = VFS_LOCK_GIANT(vp->v_mount); > - vn_lock(vp, LK_SHARED | LK_RETRY); > + error = vn_lock(vp, LK_SHARED); > + if (error != 0) > + goto after_read; > + bsize = vp->v_mount->mnt_stat.f_iosize; > > /* > * XXXMAC: Because we don't have fp->f_cred > @@ -2100,6 +2102,7 @@ retry_space: > IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), > td->td_ucred, NOCRED, &resid, td); > VOP_UNLOCK(vp, 0); > + after_read: > VFS_UNLOCK_GIANT(vfslocked); > VM_OBJECT_LOCK(obj); > vm_page_io_finish(pg); > _______________________________________________ > svn-src-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable > To unsubscribe, send any mail to "svn-src-stable-unsubscribe@freebsd.org" > From rnoland at FreeBSD.org Sun Oct 11 01:51:36 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Oct 11 01:51:47 2009 Subject: svn commit: r197950 - head/sys/dev/agp Message-ID: <200910110151.n9B1panj097787@svn.freebsd.org> Author: rnoland Date: Sun Oct 11 01:51:35 2009 New Revision: 197950 URL: http://svn.freebsd.org/changeset/base/197950 Log: Add pci id's for Intel G41 chipset Submitted by: Artyom Mirgorodsky MFC after: 3 days Modified: head/sys/dev/agp/agp_i810.c Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Sun Oct 11 00:08:55 2009 (r197949) +++ head/sys/dev/agp/agp_i810.c Sun Oct 11 01:51:35 2009 (r197950) @@ -175,6 +175,8 @@ static const struct agp_i810_match { "Intel Q45 SVGA controller"}, {0x2E228086, CHIP_G4X, 0x00020000, "Intel G45 SVGA controller"}, + {0x2E328086, CHIP_G4X, 0x00020000, + "Intel G41 SVGA controller"}, {0, 0, 0, NULL} }; From rnoland at FreeBSD.org Sun Oct 11 01:54:01 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Sun Oct 11 01:54:28 2009 Subject: svn commit: r197951 - head/sys/dev/drm Message-ID: <200910110154.n9B1s1lw097867@svn.freebsd.org> Author: rnoland Date: Sun Oct 11 01:54:00 2009 New Revision: 197951 URL: http://svn.freebsd.org/changeset/base/197951 Log: Add support for Intel G41 chipset Submitted by: Artyom Mirgorodsky MFC after: 3 days Modified: head/sys/dev/drm/drm_pciids.h head/sys/dev/drm/i915_drv.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Sun Oct 11 01:51:35 2009 (r197950) +++ head/sys/dev/drm/drm_pciids.h Sun Oct 11 01:54:00 2009 (r197951) @@ -552,6 +552,7 @@ {0x8086, 0x2E02, CHIP_I9XX|CHIP_I965, "Intel Integrated Graphics Device"}, \ {0x8086, 0x2E12, CHIP_I9XX|CHIP_I965, "Intel Q45/Q43"}, \ {0x8086, 0x2E22, CHIP_I9XX|CHIP_I965, "Intel G45/G43"}, \ + {0x8086, 0x2E32, CHIP_I9XX|CHIP_I965, "Intel G41"}, \ {0, 0, 0, NULL} #define imagine_PCI_IDS \ Modified: head/sys/dev/drm/i915_drv.h ============================================================================== --- head/sys/dev/drm/i915_drv.h Sun Oct 11 01:51:35 2009 (r197950) +++ head/sys/dev/drm/i915_drv.h Sun Oct 11 01:54:00 2009 (r197951) @@ -644,7 +644,8 @@ extern int i915_wait_ring(struct drm_dev (dev)->pci_device == 0x2A42 || \ (dev)->pci_device == 0x2E02 || \ (dev)->pci_device == 0x2E12 || \ - (dev)->pci_device == 0x2E22) + (dev)->pci_device == 0x2E22 || \ + (dev)->pci_device == 0x2E32) #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02) @@ -653,6 +654,7 @@ extern int i915_wait_ring(struct drm_dev #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ (dev)->pci_device == 0x2E12 || \ (dev)->pci_device == 0x2E22 || \ + (dev)->pci_device == 0x2E32 || \ IS_GM45(dev)) #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ From julian at FreeBSD.org Sun Oct 11 05:59:43 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Sun Oct 11 05:59:57 2009 Subject: svn commit: r197952 - in head/sys: net netgraph netinet netinet/ipfw netinet6 Message-ID: <200910110559.n9B5xhNg002528@svn.freebsd.org> Author: julian Date: Sun Oct 11 05:59:43 2009 New Revision: 197952 URL: http://svn.freebsd.org/changeset/base/197952 Log: Virtualize the pfil hooks so that different jails may chose different packet filters. ALso allows ipfw to be enabled on on ejail and disabled on another. In 8.0 it's a global setting. Sitting aroung in tree waiting to commit for: 2 months MFC after: 2 months Modified: head/sys/net/if_bridge.c head/sys/net/if_ethersubr.c head/sys/net/pfil.c head/sys/netgraph/ng_bridge.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet/ip_var.h head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c head/sys/netinet6/ip6_var.h Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/net/if_bridge.c Sun Oct 11 05:59:43 2009 (r197952) @@ -109,6 +109,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* for struct arpcom */ #include @@ -1800,9 +1801,9 @@ bridge_dummynet(struct mbuf *m, struct i return; } - if (PFIL_HOOKED(&inet_pfil_hook) + if (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif ) { if (bridge_pfil(&m, sc->sc_ifp, ifp, PFIL_OUT) != 0) @@ -2062,9 +2063,9 @@ bridge_forward(struct bridge_softc *sc, ETHER_BPF_MTAP(ifp, m); /* run the packet filter */ - if (PFIL_HOOKED(&inet_pfil_hook) + if (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif ) { BRIDGE_UNLOCK(sc); @@ -2102,9 +2103,9 @@ bridge_forward(struct bridge_softc *sc, BRIDGE_UNLOCK(sc); - if (PFIL_HOOKED(&inet_pfil_hook) + if (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif ) { if (bridge_pfil(&m, ifp, dst_if, PFIL_OUT) != 0) @@ -2243,7 +2244,7 @@ bridge_input(struct ifnet *ifp, struct m #ifdef INET6 # define OR_PFIL_HOOKED_INET6 \ - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #else # define OR_PFIL_HOOKED_INET6 #endif @@ -2260,7 +2261,7 @@ bridge_input(struct ifnet *ifp, struct m iface->if_ipackets++; \ /* Filter on the physical interface. */ \ if (pfil_local_phys && \ - (PFIL_HOOKED(&inet_pfil_hook) \ + (PFIL_HOOKED(&V_inet_pfil_hook) \ OR_PFIL_HOOKED_INET6)) { \ if (bridge_pfil(&m, NULL, ifp, \ PFIL_IN) != 0 || m == NULL) { \ @@ -2349,9 +2350,9 @@ bridge_broadcast(struct bridge_softc *sc } /* Filter on the bridge interface before broadcasting */ - if (runfilt && (PFIL_HOOKED(&inet_pfil_hook) + if (runfilt && (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif )) { if (bridge_pfil(&m, sc->sc_ifp, NULL, PFIL_OUT) != 0) @@ -2396,9 +2397,9 @@ bridge_broadcast(struct bridge_softc *sc * pointer so we do not redundantly filter on the bridge for * each interface we broadcast on. */ - if (runfilt && (PFIL_HOOKED(&inet_pfil_hook) + if (runfilt && (PFIL_HOOKED(&V_inet_pfil_hook) #ifdef INET6 - || PFIL_HOOKED(&inet6_pfil_hook) + || PFIL_HOOKED(&V_inet6_pfil_hook) #endif )) { if (used == 0) { @@ -3037,7 +3038,7 @@ bridge_pfil(struct mbuf **mp, struct ifn goto bad; } - if (ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { + if (V_ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { struct dn_pkt_tag *dn_tag; error = -1; @@ -3057,7 +3058,7 @@ bridge_pfil(struct mbuf **mp, struct ifn args.next_hop = NULL; args.eh = &eh2; args.inp = NULL; /* used by ipfw uid/gid/jail rules */ - i = ip_fw_chk_ptr(&args); + i = V_ip_fw_chk_ptr(&args); *mp = args.m; if (*mp == NULL) @@ -3109,21 +3110,21 @@ ipfwpass: * in_if -> bridge_if -> out_if */ if (pfil_bridge && dir == PFIL_OUT && bifp != NULL) - error = pfil_run_hooks(&inet_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_member && ifp != NULL) - error = pfil_run_hooks(&inet_pfil_hook, mp, ifp, + error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_bridge && dir == PFIL_IN && bifp != NULL) - error = pfil_run_hooks(&inet_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ @@ -3163,21 +3164,21 @@ ipfwpass: #ifdef INET6 case ETHERTYPE_IPV6: if (pfil_bridge && dir == PFIL_OUT && bifp != NULL) - error = pfil_run_hooks(&inet6_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_member && ifp != NULL) - error = pfil_run_hooks(&inet6_pfil_hook, mp, ifp, + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, ifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; if (pfil_bridge && dir == PFIL_IN && bifp != NULL) - error = pfil_run_hooks(&inet6_pfil_hook, mp, bifp, + error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, dir, NULL); break; #endif Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/net/if_ethersubr.c Sun Oct 11 05:59:43 2009 (r197952) @@ -434,7 +434,7 @@ ether_output_frame(struct ifnet *ifp, st { #if defined(INET) || defined(INET6) - if (ip_fw_chk_ptr && V_ether_ipfw != 0) { + if (V_ip_fw_chk_ptr && V_ether_ipfw != 0) { if (ether_ipfw_chk(&m, ifp, 0) == 0) { if (m) { m_freem(m); @@ -502,7 +502,7 @@ ether_ipfw_chk(struct mbuf **m0, struct args.next_hop = NULL; /* we do not support forward yet */ args.eh = &save_eh; /* MAC header for bridged/MAC packets */ args.inp = NULL; /* used by ipfw uid/gid/jail rules */ - i = ip_fw_chk_ptr(&args); + i = V_ip_fw_chk_ptr(&args); m = args.m; if (m != NULL) { /* @@ -775,7 +775,7 @@ ether_demux(struct ifnet *ifp, struct mb * Allow dummynet and/or ipfw to claim the frame. * Do not do this for PROMISC frames in case we are re-entered. */ - if (ip_fw_chk_ptr && V_ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) { + if (V_ip_fw_chk_ptr && V_ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) { if (ether_ipfw_chk(&m, NULL, 0) == 0) { if (m) m_freem(m); /* dropped; free mbuf chain */ Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/net/pfil.c Sun Oct 11 05:59:43 2009 (r197952) @@ -56,8 +56,9 @@ static int pfil_list_add(pfil_list_t *, static int pfil_list_remove(pfil_list_t *, int (*)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), void *); -LIST_HEAD(, pfil_head) pfil_head_list = - LIST_HEAD_INITIALIZER(&pfil_head_list); +LIST_HEAD(pfilheadhead, pfil_head); +VNET_DEFINE(struct pfilheadhead, pfil_head_list); +#define V_pfil_head_list VNET(pfil_head_list) /* * pfil_run_hooks() runs the specified packet filter hooks. @@ -97,7 +98,7 @@ pfil_head_register(struct pfil_head *ph) struct pfil_head *lph; PFIL_LIST_LOCK(); - LIST_FOREACH(lph, &pfil_head_list, ph_list) { + LIST_FOREACH(lph, &V_pfil_head_list, ph_list) { if (ph->ph_type == lph->ph_type && ph->ph_un.phu_val == lph->ph_un.phu_val) { PFIL_LIST_UNLOCK(); @@ -108,7 +109,7 @@ pfil_head_register(struct pfil_head *ph) ph->ph_nhooks = 0; TAILQ_INIT(&ph->ph_in); TAILQ_INIT(&ph->ph_out); - LIST_INSERT_HEAD(&pfil_head_list, ph, ph_list); + LIST_INSERT_HEAD(&V_pfil_head_list, ph, ph_list); PFIL_LIST_UNLOCK(); return (0); } @@ -143,7 +144,7 @@ pfil_head_get(int type, u_long val) struct pfil_head *ph; PFIL_LIST_LOCK(); - LIST_FOREACH(ph, &pfil_head_list, ph_list) + LIST_FOREACH(ph, &V_pfil_head_list, ph_list) if (ph->ph_type == type && ph->ph_un.phu_val == val) break; PFIL_LIST_UNLOCK(); @@ -284,3 +285,45 @@ pfil_list_remove(pfil_list_t *list, } return ENOENT; } + +/**************** + * Stuff that must be initialized for every instance + * (including the first of course). + */ +static int +vnet_pfil_init(const void *unused) +{ + LIST_INIT(&V_pfil_head_list); + return (0); +} + +/*********************** + * Called for the removal of each instance. + */ +static int +vnet_pfil_uninit(const void *unused) +{ + /* XXX should panic if list is not empty */ + return 0; +} + +/* Define startup order. */ +#define PFIL_SYSINIT_ORDER SI_SUB_PROTO_BEGIN +#define PFIL_MODEVENT_ORDER (SI_ORDER_FIRST) /* On boot slot in here. */ +#define PFIL_VNET_ORDER (PFIL_MODEVENT_ORDER + 2) /* Later still. */ + +/* + * Starting up. + * VNET_SYSINIT is called for each existing vnet and each new vnet. + */ +VNET_SYSINIT(vnet_pfil_init, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, + vnet_pfil_init, NULL); + +/* + * Closing up shop. These are done in REVERSE ORDER, + * Not called on reboot. + * VNET_SYSUNINIT is called for each exiting vnet as it exits. + */ +VNET_SYSUNINIT(vnet_pfil_uninit, PFIL_SYSINIT_ORDER, PFIL_VNET_ORDER, + vnet_pfil_uninit, NULL); + Modified: head/sys/netgraph/ng_bridge.c ============================================================================== --- head/sys/netgraph/ng_bridge.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netgraph/ng_bridge.c Sun Oct 11 05:59:43 2009 (r197952) @@ -634,7 +634,7 @@ ng_bridge_rcvdata(hook_p hook, item_p it /* Run packet through ipfw processing, if enabled */ #if 0 - if (priv->conf.ipfw[linkNum] && V_fw_enable && ip_fw_chk_ptr != NULL) { + if (priv->conf.ipfw[linkNum] && V_fw_enable && V_ip_fw_chk_ptr != NULL) { /* XXX not implemented yet */ } #endif Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_fastfwd.c Sun Oct 11 05:59:43 2009 (r197952) @@ -351,10 +351,11 @@ ip_fastforward(struct mbuf *m) /* * Run through list of ipfilter hooks for input packets */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passin; - if (pfil_run_hooks(&inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL) || + if (pfil_run_hooks( + &V_inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL) || m == NULL) goto drop; @@ -438,10 +439,10 @@ passin: /* * Run through list of hooks for output packets. */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; - if (pfil_run_hooks(&inet_pfil_hook, &m, ifp, PFIL_OUT, NULL) || m == NULL) { + if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, NULL) || m == NULL) { goto drop; } Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_input.c Sun Oct 11 05:59:43 2009 (r197952) @@ -170,7 +170,7 @@ SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, &VNET_NAME(ip_checkinterface), 0, "Verify packet arrives on correct interface"); -struct pfil_head inet_pfil_hook; /* Packet filter hooks */ +VNET_DEFINE(struct pfil_head, inet_pfil_hook); /* Packet filter hooks */ static struct netisr_handler ip_nh = { .nh_name = "ip", @@ -318,6 +318,13 @@ ip_init(void) NULL, UMA_ALIGN_PTR, 0); maxnipq_update(); + /* Initialize packet filter hooks. */ + V_inet_pfil_hook.ph_type = PFIL_TYPE_AF; + V_inet_pfil_hook.ph_af = AF_INET; + if ((i = pfil_head_register(&V_inet_pfil_hook)) != 0) + printf("%s: WARNING: unable to register pfil hook, " + "error %d\n", __func__, i); + #ifdef FLOWTABLE TUNABLE_INT_FETCH("net.inet.ip.output_flowtable_size", &V_ip_output_flowtable_size); @@ -348,13 +355,6 @@ ip_init(void) ip_protox[pr->pr_protocol] = pr - inetsw; } - /* Initialize packet filter hooks. */ - inet_pfil_hook.ph_type = PFIL_TYPE_AF; - inet_pfil_hook.ph_af = AF_INET; - if ((i = pfil_head_register(&inet_pfil_hook)) != 0) - printf("%s: WARNING: unable to register pfil hook, " - "error %d\n", __func__, i); - /* Start ipport_tick. */ callout_init(&ipport_tick_callout, CALLOUT_MPSAFE); callout_reset(&ipport_tick_callout, 1, ipport_tick, NULL); @@ -510,11 +510,11 @@ tooshort: */ /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passin; odst = ip->ip_dst; - if (pfil_run_hooks(&inet_pfil_hook, &m, ifp, PFIL_IN, NULL) != 0) + if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_IN, NULL) != 0) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_output.c Sun Oct 11 05:59:43 2009 (r197952) @@ -489,12 +489,12 @@ sendit: #endif /* IPSEC */ /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet_pfil_hook)) + if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; /* Run through list of hooks for output packets. */ odst.s_addr = ip->ip_dst.s_addr; - error = pfil_run_hooks(&inet_pfil_hook, &m, ifp, PFIL_OUT, inp); + error = pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, inp); if (error != 0 || m == NULL) goto done; Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ip_var.h Sun Oct 11 05:59:43 2009 (r197952) @@ -244,14 +244,20 @@ extern int (*ip_rsvp_vif)(struct socket extern void (*ip_rsvp_force_done)(struct socket *); extern void (*rsvp_input_p)(struct mbuf *m, int off); -extern struct pfil_head inet_pfil_hook; /* packet filter hooks */ +VNET_DECLARE(struct pfil_head, inet_pfil_hook); /* packet filter hooks */ +#define V_inet_pfil_hook VNET(inet_pfil_hook) void in_delayed_cksum(struct mbuf *m); /* ipfw and dummynet hooks. Most are declared in raw_ip.c */ struct ip_fw_args; -extern int (*ip_fw_chk_ptr)(struct ip_fw_args *args); -extern int (*ip_fw_ctl_ptr)(struct sockopt *); +typedef int (*ip_fw_chk_ptr_t)(struct ip_fw_args *args); +typedef int (*ip_fw_ctl_ptr_t)(struct sockopt *); +VNET_DECLARE(ip_fw_chk_ptr_t, ip_fw_chk_ptr); +VNET_DECLARE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr); +#define V_ip_fw_chk_ptr VNET(ip_fw_chk_ptr) +#define V_ip_fw_ctl_ptr VNET(ip_fw_ctl_ptr) + extern int (*ip_dn_ctl_ptr)(struct sockopt *); extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa); extern void (*ip_dn_ruledel_ptr)(void *); /* in ip_fw2.c */ Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ipfw/ip_fw2.c Sun Oct 11 05:59:43 2009 (r197952) @@ -2495,6 +2495,10 @@ do { \ } IPFW_RLOCK(chain); + if (! V_ipfw_vnet_ready) { /* shutting down, leave NOW. */ + IPFW_RUNLOCK(chain); + return (IP_FW_PASS); /* accept */ + } mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL); if (args->rule) { /* @@ -4637,29 +4641,21 @@ ipfw_init(void) printf("limited to %d packets/entry by default\n", V_verbose_limit); - /* - * Hook us up to pfil. - * Eventually pfil will be per vnet. - */ - if ((error = ipfw_hook()) != 0) { - printf("ipfw_hook() error\n"); - return (error); - } -#ifdef INET6 - if ((error = ipfw6_hook()) != 0) { - printf("ipfw6_hook() error\n"); - return (error); - } -#endif - /* - * Other things that are only done the first time. - * (now that we are guaranteed of success). - */ - ip_fw_ctl_ptr = ipfw_ctl; - ip_fw_chk_ptr = ipfw_chk; return (error); } +/********************** + * Called for the removal of the last instance only on module unload. + */ +static void +ipfw_destroy(void) +{ + + uma_zdestroy(ipfw_dyn_rule_zone); + IPFW_DYN_LOCK_DESTROY(); + printf("IP firewall unloaded\n"); +} + /**************** * Stuff that must be initialized for every instance * (including the first of course). @@ -4743,19 +4739,30 @@ vnet_ipfw_init(const void *unused) /* First set up some values that are compile time options */ V_ipfw_vnet_ready = 1; /* Open for business */ - return (0); -} -/********************** - * Called for the removal of the last instance only on module unload. - */ -static void -ipfw_destroy(void) -{ + /* Hook up the raw inputs */ + V_ip_fw_ctl_ptr = ipfw_ctl; + V_ip_fw_chk_ptr = ipfw_chk; - uma_zdestroy(ipfw_dyn_rule_zone); - IPFW_DYN_LOCK_DESTROY(); - printf("IP firewall unloaded\n"); + /* + * Hook us up to pfil. + */ + if (V_fw_enable) { + if ((error = ipfw_hook()) != 0) { + printf("ipfw_hook() error\n"); + return (error); + } + } +#ifdef INET6 + if (V_fw6_enable) { + if ((error = ipfw6_hook()) != 0) { + printf("ipfw6_hook() error\n"); + /* XXX should we unhook everything else? */ + return (error); + } + } +#endif + return (0); } /*********************** @@ -4767,9 +4774,18 @@ vnet_ipfw_uninit(const void *unused) struct ip_fw *reap; V_ipfw_vnet_ready = 0; /* tell new callers to go away */ - callout_drain(&V_ipfw_timeout); + ipfw_unhook(); +#ifdef INET6 + ipfw6_unhook(); +#endif + /* layer2 and other entrypoints still come in this way. */ + V_ip_fw_chk_ptr = NULL; + V_ip_fw_ctl_ptr = NULL; + IPFW_WLOCK(&V_layer3_chain); /* We wait on the wlock here until the last user leaves */ + IPFW_WUNLOCK(&V_layer3_chain); IPFW_WLOCK(&V_layer3_chain); + callout_drain(&V_ipfw_timeout); flush_tables(&V_layer3_chain); V_layer3_chain.reap = NULL; free_chain(&V_layer3_chain, 1 /* kill default rule */); @@ -4803,21 +4819,10 @@ ipfw_modevent(module_t mod, int type, vo /* Called once at module load or * system boot if compiled in. */ break; - case MOD_UNLOAD: - break; case MOD_QUIESCE: - /* Yes, the unhooks can return errors, we can safely ignore - * them. Eventually these will be done per jail as they - * shut down. We will wait on each vnet's l3 lock as existing - * callers go away. - */ - ipfw_unhook(); -#ifdef INET6 - ipfw6_unhook(); -#endif - /* layer2 and other entrypoints still come in this way. */ - ip_fw_chk_ptr = NULL; - ip_fw_ctl_ptr = NULL; + /* Called before unload. May veto unloading. */ + break; + case MOD_UNLOAD: /* Called during unload. */ break; case MOD_SHUTDOWN: @@ -4866,4 +4871,3 @@ SYSUNINIT(ipfw_destroy, IPFW_SI_SUB_FIRE VNET_SYSUNINIT(vnet_ipfw_uninit, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER, vnet_ipfw_uninit, NULL); - Modified: head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_pfil.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/ipfw/ip_fw_pfil.c Sun Oct 11 05:59:43 2009 (r197952) @@ -515,42 +515,54 @@ ipfw6_unhook(void) int ipfw_chg_hook(SYSCTL_HANDLER_ARGS) { - int enable = *(int *)arg1; + int enable; + int oldenable; int error; -#ifdef VIMAGE /* Since enabling is global, only let base do it. */ - if (! IS_DEFAULT_VNET(curvnet)) - return (EPERM); + if (arg1 == &VNET_NAME(fw_enable)) { + enable = V_fw_enable; + } +#ifdef INET6 + else if (arg1 == &VNET_NAME(fw6_enable)) { + enable = V_fw6_enable; + } #endif + else + return (EINVAL); + + oldenable = enable; + error = sysctl_handle_int(oidp, &enable, 0, req); + if (error) return (error); enable = (enable) ? 1 : 0; - if (enable == *(int *)arg1) + if (enable == oldenable) return (0); - if (arg1 == &V_fw_enable) { + if (arg1 == &VNET_NAME(fw_enable)) { if (enable) error = ipfw_hook(); else error = ipfw_unhook(); + if (error) + return (error); + V_fw_enable = enable; } #ifdef INET6 - if (arg1 == &V_fw6_enable) { + else if (arg1 == &VNET_NAME(fw6_enable)) { if (enable) error = ipfw6_hook(); else error = ipfw6_unhook(); + if (error) + return (error); + V_fw6_enable = enable; } #endif - if (error) - return (error); - - *(int *)arg1 = enable; - return (0); } Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet/raw_ip.c Sun Oct 11 05:59:43 2009 (r197952) @@ -84,9 +84,9 @@ VNET_DEFINE(struct inpcbinfo, ripcbinfo) * The data hooks are not used here but it is convenient * to keep them all in one place. */ -int (*ip_fw_ctl_ptr)(struct sockopt *) = NULL; +VNET_DEFINE(ip_fw_chk_ptr_t, ip_fw_chk_ptr) = NULL; +VNET_DEFINE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr) = NULL; int (*ip_dn_ctl_ptr)(struct sockopt *) = NULL; -int (*ip_fw_chk_ptr)(struct ip_fw_args *args) = NULL; int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa) = NULL; /* @@ -523,8 +523,8 @@ rip_ctloutput(struct socket *so, struct case IP_FW_TABLE_LIST: case IP_FW_NAT_GET_CONFIG: case IP_FW_NAT_GET_LOG: - if (ip_fw_ctl_ptr != NULL) - error = ip_fw_ctl_ptr(sopt); + if (V_ip_fw_ctl_ptr != NULL) + error = V_ip_fw_ctl_ptr(sopt); else error = ENOPROTOOPT; break; @@ -584,8 +584,8 @@ rip_ctloutput(struct socket *so, struct case IP_FW_TABLE_FLUSH: case IP_FW_NAT_CFG: case IP_FW_NAT_DEL: - if (ip_fw_ctl_ptr != NULL) - error = ip_fw_ctl_ptr(sopt); + if (V_ip_fw_ctl_ptr != NULL) + error = V_ip_fw_ctl_ptr(sopt); else error = ENOPROTOOPT; break; Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_forward.c Sun Oct 11 05:59:43 2009 (r197952) @@ -551,11 +551,11 @@ skip_routing: in6_clearscope(&ip6->ip6_dst); /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet6_pfil_hook)) + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto pass; /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, NULL); + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, rt->rt_ifp, PFIL_OUT, NULL); if (error != 0) goto senderr; if (m == NULL) Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_input.c Sun Oct 11 05:59:43 2009 (r197952) @@ -152,7 +152,7 @@ VNET_DECLARE(int, udp6_recvspace); struct rwlock in6_ifaddr_lock; RW_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); -struct pfil_head inet6_pfil_hook; +VNET_DEFINE (struct pfil_head, inet6_pfil_hook); static void ip6_init2(void *); static struct ip6aux *ip6_setdstifaddr(struct mbuf *, struct in6_ifaddr *); @@ -247,6 +247,13 @@ ip6_init(void) V_ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR; + /* Initialize packet filter hooks. */ + V_inet6_pfil_hook.ph_type = PFIL_TYPE_AF; + V_inet6_pfil_hook.ph_af = AF_INET6; + if ((i = pfil_head_register(&V_inet6_pfil_hook)) != 0) + printf("%s: WARNING: unable to register pfil hook, " + "error %d\n", __func__, i); + /* Skip global initialization stuff for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) return; @@ -275,13 +282,6 @@ ip6_init(void) ip6_protox[pr->pr_protocol] = pr - inet6sw; } - /* Initialize packet filter hooks. */ - inet6_pfil_hook.ph_type = PFIL_TYPE_AF; - inet6_pfil_hook.ph_af = AF_INET6; - if ((i = pfil_head_register(&inet6_pfil_hook)) != 0) - printf("%s: WARNING: unable to register pfil hook, " - "error %d\n", __func__, i); - netisr_register(&ip6_nh); } @@ -515,10 +515,11 @@ ip6_input(struct mbuf *m) odst = ip6->ip6_dst; /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet6_pfil_hook)) + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passin; - if (pfil_run_hooks(&inet6_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL)) + if (pfil_run_hooks(&V_inet6_pfil_hook, &m, + m->m_pkthdr.rcvif, PFIL_IN, NULL)) return; if (m == NULL) /* consumed by filter */ return; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_output.c Sun Oct 11 05:59:43 2009 (r197952) @@ -805,12 +805,12 @@ again: } /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&inet6_pfil_hook)) + if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passout; odst = ip6->ip6_dst; /* Run through list of hooks for output packets. */ - error = pfil_run_hooks(&inet6_pfil_hook, &m, ifp, PFIL_OUT, inp); + error = pfil_run_hooks(&V_inet6_pfil_hook, &m, ifp, PFIL_OUT, inp); if (error != 0 || m == NULL) goto done; ip6 = mtod(m, struct ip6_hdr *); Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Sun Oct 11 01:54:00 2009 (r197951) +++ head/sys/netinet6/ip6_var.h Sun Oct 11 05:59:43 2009 (r197952) @@ -358,7 +358,8 @@ VNET_DECLARE(int, ip6_use_defzone); /* W #endif #define V_ip6_use_defzone VNET(ip6_use_defzone) -extern struct pfil_head inet6_pfil_hook; /* packet filter hooks */ +VNET_DECLARE (struct pfil_head, inet6_pfil_hook); /* packet filter hooks */ +#define V_inet6_pfil_hook VNET(inet6_pfil_hook) extern struct pr_usrreqs rip6_usrreqs; struct sockopt; From delphij at FreeBSD.org Sun Oct 11 07:03:57 2009 From: delphij at FreeBSD.org (Xin LI) Date: Sun Oct 11 07:04:03 2009 Subject: svn commit: r197953 - head/sys/fs/tmpfs Message-ID: <200910110703.n9B73uSs003722@svn.freebsd.org> Author: delphij Date: Sun Oct 11 07:03:56 2009 New Revision: 197953 URL: http://svn.freebsd.org/changeset/base/197953 Log: Add locking around access to parent node, and bail out when the parent node is already freed rather than panicking the system. PR: kern/122038 Submitted by: gk Tested by: pho MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Sun Oct 11 05:59:43 2009 (r197952) +++ head/sys/fs/tmpfs/tmpfs.h Sun Oct 11 07:03:56 2009 (r197953) @@ -303,10 +303,30 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define TMPFS_NODE_LOCK(node) mtx_lock(&(node)->tn_interlock) #define TMPFS_NODE_UNLOCK(node) mtx_unlock(&(node)->tn_interlock) -#define TMPFS_NODE_MTX(node) (&(node)->tn_interlock) +#define TMPFS_NODE_MTX(node) (&(node)->tn_interlock) + +#ifdef INVARIANTS +#define TMPFS_ASSERT_LOCKED(node) do { \ + MPASS(node != NULL); \ + MPASS(node->tn_vnode != NULL); \ + if (!VOP_ISLOCKED(node->tn_vnode) && \ + !mtx_owned(TMPFS_NODE_MTX(node))) \ + panic("tmpfs: node is not locked: %p", node); \ + } while (0) +#define TMPFS_ASSERT_ELOCKED(node) do { \ + MPASS((node) != NULL); \ + MPASS((node)->tn_vnode != NULL); \ + mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); \ + ASSERT_VOP_LOCKED((node)->tn_vnode, "tmpfs"); \ + } while (0) +#else +#define TMPFS_ASSERT_LOCKED(node) (void)0 +#define TMPFS_ASSERT_ELOCKED(node) (void)0 +#endif #define TMPFS_VNODE_ALLOCATING 1 #define TMPFS_VNODE_WANT 2 +#define TMPFS_VNODE_DOOMED 4 /* --------------------------------------------------------------------- */ /* Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sun Oct 11 05:59:43 2009 (r197952) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sun Oct 11 07:03:56 2009 (r197953) @@ -124,7 +124,9 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp nnode->tn_dir.tn_readdir_lastn = 0; nnode->tn_dir.tn_readdir_lastp = NULL; nnode->tn_links++; + TMPFS_NODE_LOCK(nnode->tn_dir.tn_parent); nnode->tn_dir.tn_parent->tn_links++; + TMPFS_NODE_UNLOCK(nnode->tn_dir.tn_parent); break; case VFIFO: @@ -187,6 +189,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, #ifdef INVARIANTS TMPFS_NODE_LOCK(node); MPASS(node->tn_vnode == NULL); + MPASS((node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0); TMPFS_NODE_UNLOCK(node); #endif @@ -312,6 +315,7 @@ tmpfs_alloc_vp(struct mount *mp, struct loop: TMPFS_NODE_LOCK(node); if ((vp = node->tn_vnode) != NULL) { + MPASS((node->tn_vpstate & TMPFS_VNODE_DOOMED) == 0); VI_LOCK(vp); TMPFS_NODE_UNLOCK(node); vholdl(vp); @@ -330,6 +334,14 @@ loop: goto out; } + if ((node->tn_vpstate & TMPFS_VNODE_DOOMED) || + (node->tn_type == VDIR && node->tn_dir.tn_parent == NULL)) { + TMPFS_NODE_UNLOCK(node); + error = ENOENT; + vp = NULL; + goto out; + } + /* * otherwise lock the vp list while we call getnewvnode * since that can block. @@ -375,6 +387,7 @@ loop: vp->v_op = &tmpfs_fifoop_entries; break; case VDIR: + MPASS(node->tn_dir.tn_parent != NULL); if (node->tn_dir.tn_parent == node) vp->v_vflag |= VV_ROOT; break; @@ -428,10 +441,9 @@ tmpfs_free_vp(struct vnode *vp) node = VP_TO_TMPFS_NODE(vp); - TMPFS_NODE_LOCK(node); + mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); node->tn_vnode = NULL; vp->v_data = NULL; - TMPFS_NODE_UNLOCK(node); } /* --------------------------------------------------------------------- */ @@ -653,7 +665,18 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod TMPFS_VALIDATE_DIR(node); MPASS(uio->uio_offset == TMPFS_DIRCOOKIE_DOTDOT); + /* + * Return ENOENT if the current node is already removed. + */ + TMPFS_ASSERT_LOCKED(node); + if (node->tn_dir.tn_parent == NULL) { + return (ENOENT); + } + + TMPFS_NODE_LOCK(node->tn_dir.tn_parent); dent.d_fileno = node->tn_dir.tn_parent->tn_id; + TMPFS_NODE_UNLOCK(node->tn_dir.tn_parent); + dent.d_type = DT_DIR; dent.d_namlen = 2; dent.d_name[0] = '.'; Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 11 05:59:43 2009 (r197952) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Oct 11 07:03:56 2009 (r197953) @@ -87,6 +87,11 @@ tmpfs_lookup(struct vop_cachedlookup_arg dnode->tn_dir.tn_parent == dnode, !(cnp->cn_flags & ISDOTDOT))); + TMPFS_ASSERT_LOCKED(dnode); + if (dnode->tn_dir.tn_parent == NULL) { + error = ENOENT; + goto out; + } if (cnp->cn_flags & ISDOTDOT) { int ltype = 0; @@ -914,6 +919,7 @@ tmpfs_rename(struct vop_rename_args *v) char *newname; int error; struct tmpfs_dirent *de; + struct tmpfs_mount *tmp; struct tmpfs_node *fdnode; struct tmpfs_node *fnode; struct tmpfs_node *tnode; @@ -934,6 +940,7 @@ tmpfs_rename(struct vop_rename_args *v) goto out; } + tmp = VFS_TO_TMPFS(tdvp->v_mount); tdnode = VP_TO_TMPFS_DIR(tdvp); /* If source and target are the same file, there is nothing to do. */ @@ -1018,25 +1025,63 @@ tmpfs_rename(struct vop_rename_args *v) * directory being moved. Otherwise, we'd end up * with stale nodes. */ n = tdnode; + /* TMPFS_LOCK garanties that no nodes are freed while + * traversing the list. Nodes can only be marked as + * removed: tn_parent == NULL. */ + TMPFS_LOCK(tmp); + TMPFS_NODE_LOCK(n); while (n != n->tn_dir.tn_parent) { + struct tmpfs_node *parent; + if (n == fnode) { + TMPFS_NODE_UNLOCK(n); + TMPFS_UNLOCK(tmp); error = EINVAL; if (newname != NULL) free(newname, M_TMPFSNAME); goto out_locked; } - n = n->tn_dir.tn_parent; + parent = n->tn_dir.tn_parent; + TMPFS_NODE_UNLOCK(n); + if (parent == NULL) { + n = NULL; + break; + } + TMPFS_NODE_LOCK(parent); + if (parent->tn_dir.tn_parent == NULL) { + TMPFS_NODE_UNLOCK(parent); + n = NULL; + break; + } + n = parent; + } + TMPFS_UNLOCK(tmp); + if (n == NULL) { + error = EINVAL; + if (newname != NULL) + free(newname, M_TMPFSNAME); + goto out_locked; } + TMPFS_NODE_UNLOCK(n); /* Adjust the parent pointer. */ TMPFS_VALIDATE_DIR(fnode); + TMPFS_NODE_LOCK(de->td_node); de->td_node->tn_dir.tn_parent = tdnode; + TMPFS_NODE_UNLOCK(de->td_node); /* As a result of changing the target of the '..' * entry, the link count of the source and target * directories has to be adjusted. */ - fdnode->tn_links--; + TMPFS_NODE_LOCK(tdnode); + TMPFS_ASSERT_LOCKED(tdnode); tdnode->tn_links++; + TMPFS_NODE_UNLOCK(tdnode); + + TMPFS_NODE_LOCK(fdnode); + TMPFS_ASSERT_LOCKED(fdnode); + fdnode->tn_links--; + TMPFS_NODE_UNLOCK(fdnode); } /* Do the move: just remove the entry from the source directory @@ -1163,15 +1208,26 @@ tmpfs_rmdir(struct vop_rmdir_args *v) goto out; } + /* Detach the directory entry from the directory (dnode). */ tmpfs_dir_detach(dvp, de); + /* No vnode should be allocated for this entry from this point */ + TMPFS_NODE_LOCK(node); + TMPFS_ASSERT_ELOCKED(node); node->tn_links--; + node->tn_dir.tn_parent = NULL; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ TMPFS_NODE_MODIFIED; - node->tn_dir.tn_parent->tn_links--; - node->tn_dir.tn_parent->tn_status |= TMPFS_NODE_ACCESSED | \ + + TMPFS_NODE_UNLOCK(node); + + TMPFS_NODE_LOCK(dnode); + TMPFS_ASSERT_ELOCKED(dnode); + dnode->tn_links--; + dnode->tn_status |= TMPFS_NODE_ACCESSED | \ TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; + TMPFS_NODE_UNLOCK(dnode); cache_purge(dvp); cache_purge(vp); @@ -1359,13 +1415,21 @@ tmpfs_reclaim(struct vop_reclaim_args *v vnode_destroy_vobject(vp); cache_purge(vp); + + TMPFS_NODE_LOCK(node); + TMPFS_ASSERT_ELOCKED(node); tmpfs_free_vp(vp); /* If the node referenced by this vnode was deleted by the user, * we must free its associated data structures (now that the vnode * is being reclaimed). */ - if (node->tn_links == 0) + if (node->tn_links == 0 && + (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { + node->tn_vpstate = TMPFS_VNODE_DOOMED; + TMPFS_NODE_UNLOCK(node); tmpfs_free_node(tmp, node); + } else + TMPFS_NODE_UNLOCK(node); MPASS(vp->v_data == NULL); return 0; From tuexen at FreeBSD.org Sun Oct 11 12:23:56 2009 From: tuexen at FreeBSD.org (Michael Tuexen) Date: Sun Oct 11 12:24:02 2009 Subject: svn commit: r197955 - head/sys/netinet Message-ID: <200910111223.n9BCNuTp011104@svn.freebsd.org> Author: tuexen Date: Sun Oct 11 12:23:56 2009 New Revision: 197955 URL: http://svn.freebsd.org/changeset/base/197955 Log: Fix a race condition where a mutex was destroyed while sleeping on it. Found while analyzing a report from julian. It might fix his bug. Approved by: rrs (mentor) MFC after: 3 days Modified: head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Sun Oct 11 11:00:14 2009 (r197954) +++ head/sys/netinet/sctp_bsd_addr.c Sun Oct 11 12:23:56 2009 (r197955) @@ -97,6 +97,7 @@ sctp_iterator_thread(void *v) &SCTP_BASE_INFO(ipi_iterator_wq_mtx), 0, "waiting_for_work", 0); if (SCTP_BASE_INFO(threads_must_exit)) { + SCTP_IPI_ITERATOR_WQ_DESTROY(); kthread_exit(); } sctp_iterator_worker(); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Oct 11 11:00:14 2009 (r197954) +++ head/sys/netinet/sctp_pcb.c Sun Oct 11 12:23:56 2009 (r197955) @@ -5616,7 +5616,6 @@ sctp_pcb_finish(void) SCTP_IP_PKTLOG_DESTROY(); #endif - SCTP_IPI_ITERATOR_WQ_DESTROY(); SCTP_IPI_ADDR_DESTROY(); SCTP_ITERATOR_LOCK_DESTROY(); SCTP_STATLOG_DESTROY(); From jh at FreeBSD.org Sun Oct 11 12:32:26 2009 From: jh at FreeBSD.org (Jaakko Heinonen) Date: Sun Oct 11 12:32:38 2009 Subject: svn commit: r197956 - head/usr.bin/systat Message-ID: <200910111232.n9BCWQfE011299@svn.freebsd.org> Author: jh Date: Sun Oct 11 12:32:25 2009 New Revision: 197956 URL: http://svn.freebsd.org/changeset/base/197956 Log: - Catch SIGHUP to perform cleanup before exiting. - Exit if getch() returns with an error other than EINTR. Otherwise systat(1) may get stuck in an infinite loop if it doesn't receive SIGHUP when terminal closes. [1] - Remove attempt to clear stdio error indicators. getch() doesn't use stdio, making it useless. [2] - Remove unneeded masking of getch() return value. [2] PR: bin/107171 Reviewed by: bde Approved by: trasz (mentor) Obtained from: OpenBSD [1] Suggested by: bde [2] MFC after: 1 month Modified: head/usr.bin/systat/keyboard.c head/usr.bin/systat/main.c Modified: head/usr.bin/systat/keyboard.c ============================================================================== --- head/usr.bin/systat/keyboard.c Sun Oct 11 12:23:56 2009 (r197955) +++ head/usr.bin/systat/keyboard.c Sun Oct 11 12:32:25 2009 (r197956) @@ -39,8 +39,10 @@ __FBSDID("$FreeBSD$"); static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif +#include #include #include +#include #include #include "systat.h" @@ -57,10 +59,11 @@ keyboard(void) move(CMDLINE, 0); do { refresh(); - ch = getch() & 0177; - if (ch == 0177 && ferror(stdin)) { - clearerr(stdin); - continue; + ch = getch(); + if (ch == ERR) { + if (errno == EINTR) + continue; + exit(1); } if (ch >= 'A' && ch <= 'Z') ch += 'a' - 'A'; Modified: head/usr.bin/systat/main.c ============================================================================== --- head/usr.bin/systat/main.c Sun Oct 11 12:23:56 2009 (r197955) +++ head/usr.bin/systat/main.c Sun Oct 11 12:32:25 2009 (r197956) @@ -133,6 +133,7 @@ main(int argc, char **argv) exit(1); } } + signal(SIGHUP, die); signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die); From des at FreeBSD.org Sun Oct 11 14:27:33 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Sun Oct 11 14:27:40 2009 Subject: svn commit: r197957 - head/crypto/openssh Message-ID: <200910111427.n9BERXkE013479@svn.freebsd.org> Author: des Date: Sun Oct 11 14:27:33 2009 New Revision: 197957 URL: http://svn.freebsd.org/changeset/base/197957 Log: Remove dupe. Modified: head/crypto/openssh/sshd_config Modified: head/crypto/openssh/sshd_config ============================================================================== --- head/crypto/openssh/sshd_config Sun Oct 11 12:32:25 2009 (r197956) +++ head/crypto/openssh/sshd_config Sun Oct 11 14:27:33 2009 (r197957) @@ -17,7 +17,6 @@ #VersionAddendum FreeBSD-20091001 #Port 22 -#Protocol 2 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: From kib at FreeBSD.org Sun Oct 11 16:23:11 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 11 16:23:17 2009 Subject: svn commit: r197958 - head/lib/libc/sys Message-ID: <200910111623.n9BGNBlG015888@svn.freebsd.org> Author: kib Date: Sun Oct 11 16:23:11 2009 New Revision: 197958 URL: http://svn.freebsd.org/changeset/base/197958 Log: In nanosleep(2), note that the calling thread is put to sleep, not the whole process. Also explicitely name the parameter that specifies sleep interval. Modified: head/lib/libc/sys/nanosleep.2 Modified: head/lib/libc/sys/nanosleep.2 ============================================================================== --- head/lib/libc/sys/nanosleep.2 Sun Oct 11 14:27:33 2009 (r197957) +++ head/lib/libc/sys/nanosleep.2 Sun Oct 11 16:23:11 2009 (r197958) @@ -47,7 +47,9 @@ The .Fn nanosleep system call -causes the process to sleep for the specified time. +causes the calling thread to sleep until the time interval specified by +.Fa rqtp +has elapsed. An unmasked signal will cause it to terminate the sleep early, regardless of the .Dv SA_RESTART From jilles at FreeBSD.org Sun Oct 11 16:35:13 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Sun Oct 11 16:35:19 2009 Subject: svn commit: r197959 - in stable/8: bin/sh tools/regression/bin/sh tools/regression/bin/sh/execution Message-ID: <200910111635.n9BGZCR9016223@svn.freebsd.org> Author: jilles Date: Sun Oct 11 16:35:12 2009 New Revision: 197959 URL: http://svn.freebsd.org/changeset/base/197959 Log: MFC r196483,r196634: sh: Fix crash when undefining or redefining a currently executing function Add a reference count to function definitions. Memory may leak if a SIGINT arrives in interactive mode at exactly the wrong time, this will be fixed later by changing SIGINT handling. PR: bin/137640 Approved by: re (kib) Added: stable/8/tools/regression/bin/sh/execution/func1.0 - copied unchanged from r196483, head/tools/regression/bin/sh/execution/func1.0 stable/8/tools/regression/bin/sh/execution/func2.0 - copied unchanged from r196634, head/tools/regression/bin/sh/execution/func2.0 Modified: stable/8/bin/sh/ (props changed) stable/8/bin/sh/eval.c stable/8/bin/sh/exec.c stable/8/bin/sh/exec.h stable/8/bin/sh/mknodes.c stable/8/bin/sh/nodes.c.pat stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/bin/sh/eval.c ============================================================================== --- stable/8/bin/sh/eval.c Sun Oct 11 16:23:11 2009 (r197958) +++ stable/8/bin/sh/eval.c Sun Oct 11 16:35:12 2009 (r197959) @@ -785,6 +785,7 @@ evalcommand(union node *cmd, int flags, INTOFF; savelocalvars = localvars; localvars = NULL; + reffunc(cmdentry.u.func); INTON; savehandler = handler; if (setjmp(jmploc.loc)) { @@ -794,6 +795,7 @@ evalcommand(union node *cmd, int flags, freeparam(&shellparam); shellparam = saveparam; } + unreffunc(cmdentry.u.func); poplocalvars(); localvars = savelocalvars; handler = savehandler; @@ -805,11 +807,12 @@ evalcommand(union node *cmd, int flags, funcnest++; exitstatus = oexitstatus; if (flags & EV_TESTED) - evaltree(cmdentry.u.func, EV_TESTED); + evaltree(getfuncnode(cmdentry.u.func), EV_TESTED); else - evaltree(cmdentry.u.func, 0); + evaltree(getfuncnode(cmdentry.u.func), 0); funcnest--; INTOFF; + unreffunc(cmdentry.u.func); poplocalvars(); localvars = savelocalvars; freeparam(&shellparam); Modified: stable/8/bin/sh/exec.c ============================================================================== --- stable/8/bin/sh/exec.c Sun Oct 11 16:23:11 2009 (r197958) +++ stable/8/bin/sh/exec.c Sun Oct 11 16:35:12 2009 (r197959) @@ -286,7 +286,7 @@ printentry(struct tblentry *cmdp, int ve out1fmt("function %s", cmdp->cmdname); if (verbose) { INTOFF; - name = commandtext(cmdp->param.func); + name = commandtext(getfuncnode(cmdp->param.func)); out1c(' '); out1str(name); ckfree(name); @@ -583,7 +583,7 @@ deletefuncs(void) while ((cmdp = *pp) != NULL) { if (cmdp->cmdtype == CMDFUNCTION) { *pp = cmdp->next; - freefunc(cmdp->param.func); + unreffunc(cmdp->param.func); ckfree(cmdp); } else { pp = &cmdp->next; @@ -670,7 +670,7 @@ addcmdentry(char *name, struct cmdentry INTOFF; cmdp = cmdlookup(name, 1); if (cmdp->cmdtype == CMDFUNCTION) { - freefunc(cmdp->param.func); + unreffunc(cmdp->param.func); } cmdp->cmdtype = entry->cmdtype; cmdp->param = entry->u; @@ -705,7 +705,7 @@ unsetfunc(char *name) struct tblentry *cmdp; if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->cmdtype == CMDFUNCTION) { - freefunc(cmdp->param.func); + unreffunc(cmdp->param.func); delete_cmd_entry(); return (0); } Modified: stable/8/bin/sh/exec.h ============================================================================== --- stable/8/bin/sh/exec.h Sun Oct 11 16:23:11 2009 (r197958) +++ stable/8/bin/sh/exec.h Sun Oct 11 16:35:12 2009 (r197959) @@ -46,11 +46,12 @@ enum { TYPECMD_TYPE /* type */ }; +union node; struct cmdentry { int cmdtype; union param { int index; - union node *func; + struct funcdef *func; } u; int special; }; Modified: stable/8/bin/sh/mknodes.c ============================================================================== --- stable/8/bin/sh/mknodes.c Sun Oct 11 16:23:11 2009 (r197958) +++ stable/8/bin/sh/mknodes.c Sun Oct 11 16:35:12 2009 (r197959) @@ -248,8 +248,11 @@ output(char *file) fputs("\tstruct nodelist *next;\n", hfile); fputs("\tunion node *n;\n", hfile); fputs("};\n\n\n", hfile); - fputs("union node *copyfunc(union node *);\n", hfile); - fputs("void freefunc(union node *);\n", hfile); + fputs("struct funcdef;\n", hfile); + fputs("struct funcdef *copyfunc(union node *);\n", hfile); + fputs("union node *getfuncnode(struct funcdef *);\n", hfile); + fputs("void reffunc(struct funcdef *);\n", hfile); + fputs("void unreffunc(struct funcdef *);\n", hfile); fputs(writer, cfile); while (fgets(line, sizeof line, patfile) != NULL) { Modified: stable/8/bin/sh/nodes.c.pat ============================================================================== --- stable/8/bin/sh/nodes.c.pat Sun Oct 11 16:23:11 2009 (r197958) +++ stable/8/bin/sh/nodes.c.pat Sun Oct 11 16:35:12 2009 (r197959) @@ -35,6 +35,7 @@ #include #include +#include /* * Routine for dealing with parsed shell commands. */ @@ -60,25 +61,40 @@ STATIC struct nodelist *copynodelist(str STATIC char *nodesavestr(char *); +struct funcdef { + unsigned int refcount; + union node n; +}; /* * Make a copy of a parse tree. */ -union node * +struct funcdef * copyfunc(union node *n) { + struct funcdef *fn; + if (n == NULL) return NULL; - funcblocksize = 0; + funcblocksize = offsetof(struct funcdef, n); funcstringsize = 0; calcsize(n); - funcblock = ckmalloc(funcblocksize + funcstringsize); - funcstring = (char *)funcblock + funcblocksize; - return copynode(n); + fn = ckmalloc(funcblocksize + funcstringsize); + fn->refcount = 1; + funcblock = (char *)fn + offsetof(struct funcdef, n); + funcstring = (char *)fn + funcblocksize; + copynode(n); + return fn; } +union node * +getfuncnode(struct funcdef *fn) +{ + return fn == NULL ? NULL : &fn->n; +} + STATIC void calcsize(union node *n) @@ -144,14 +160,26 @@ nodesavestr(char *s) } +void +reffunc(struct funcdef *fn) +{ + if (fn) + fn->refcount++; +} + /* - * Free a parse tree. + * Decrement the reference count of a function definition, freeing it + * if it falls to 0. */ void -freefunc(union node *n) +unreffunc(struct funcdef *fn) { - if (n) - ckfree(n); + if (fn) { + fn->refcount--; + if (fn->refcount > 0) + return; + ckfree(fn); + } } Copied: stable/8/tools/regression/bin/sh/execution/func1.0 (from r196483, head/tools/regression/bin/sh/execution/func1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/execution/func1.0 Sun Oct 11 16:35:12 2009 (r197959, copy of r196483, head/tools/regression/bin/sh/execution/func1.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +MALLOC_OPTIONS=J sh -c 'g() { g() { :; }; :; }; g' && +MALLOC_OPTIONS=J sh -c 'g() { unset -f g; :; }; g' Copied: stable/8/tools/regression/bin/sh/execution/func2.0 (from r196634, head/tools/regression/bin/sh/execution/func2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/execution/func2.0 Sun Oct 11 16:35:12 2009 (r197959, copy of r196634, head/tools/regression/bin/sh/execution/func2.0) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +f() { } +f +hash -v f >/dev/null +f() { { }; } +f +hash -v f >/dev/null +f() { { } } +f +hash -v f >/dev/null From simon at FreeBSD.org Sun Oct 11 16:39:17 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Sun Oct 11 16:39:23 2009 Subject: svn commit: r197960 - stable/7/share/man/man4 Message-ID: <200910111639.n9BGdHot016343@svn.freebsd.org> Author: simon Date: Sun Oct 11 16:39:16 2009 New Revision: 197960 URL: http://svn.freebsd.org/changeset/base/197960 Log: MFC r197835: - Document that 'Dell PowerEdge R710' has bce(4) supported NIC. - Bump document date. Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/bce.4 Modified: stable/7/share/man/man4/bce.4 ============================================================================== --- stable/7/share/man/man4/bce.4 Sun Oct 11 16:35:12 2009 (r197959) +++ stable/7/share/man/man4/bce.4 Sun Oct 11 16:39:16 2009 (r197960) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2009 +.Dd October 7, 2009 .Dt BCE 4 .Os .Sh NAME @@ -165,6 +165,8 @@ Dell PowerEdge 1950 integrated BCM5708 N .It Dell PowerEdge 2950 integrated BCM5708 NIC .It +Dell PowerEdge R710 integrated BCM5709 NIC +.It HP NC370F Multifunction Gigabit Server Adapter .It HP NC370T Multifunction Gigabit Server Adapter From nwhitehorn at FreeBSD.org Sun Oct 11 16:41:39 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Oct 11 16:41:46 2009 Subject: svn commit: r197961 - head/sys/powerpc/aim Message-ID: <200910111641.n9BGfd3d016422@svn.freebsd.org> Author: nwhitehorn Date: Sun Oct 11 16:41:39 2009 New Revision: 197961 URL: http://svn.freebsd.org/changeset/base/197961 Log: Correct a typo here and actually save DSISR instead of overwriting it. Modified: head/sys/powerpc/aim/trap_subr.S Modified: head/sys/powerpc/aim/trap_subr.S ============================================================================== --- head/sys/powerpc/aim/trap_subr.S Sun Oct 11 16:39:16 2009 (r197960) +++ head/sys/powerpc/aim/trap_subr.S Sun Oct 11 16:41:39 2009 (r197961) @@ -451,7 +451,7 @@ disitrap: lwz %r30,(PC_TEMPSAVE+CPUSAVE_AIM_DAR)(%r1) /* get DAR */ stw %r30,(PC_DBSAVE +CPUSAVE_AIM_DAR)(%r1) /* save DAR */ lwz %r30,(PC_TEMPSAVE+CPUSAVE_AIM_DSISR)(%r1) /* get DSISR */ - lwz %r30,(PC_DBSAVE +CPUSAVE_AIM_DSISR)(%r1) /* save DSISR */ + stw %r30,(PC_DBSAVE +CPUSAVE_AIM_DSISR)(%r1) /* save DSISR */ lwz %r30,(PC_DISISAVE+CPUSAVE_R28)(%r1) /* get r28 */ stw %r30,(PC_DBSAVE +CPUSAVE_R28)(%r1) /* save r28 */ lwz %r31,(PC_DISISAVE+CPUSAVE_R29)(%r1) /* get r29 */ From nwhitehorn at FreeBSD.org Sun Oct 11 16:44:59 2009 From: nwhitehorn at FreeBSD.org (Nathan Whitehorn) Date: Sun Oct 11 16:45:05 2009 Subject: svn commit: r197962 - head/sys/powerpc/aim Message-ID: <200910111644.n9BGiwgj016518@svn.freebsd.org> Author: nwhitehorn Date: Sun Oct 11 16:44:58 2009 New Revision: 197962 URL: http://svn.freebsd.org/changeset/base/197962 Log: Correct another typo. Actually save the condition register instead of overwriting r12 by mistake. Modified: head/sys/powerpc/aim/swtch.S Modified: head/sys/powerpc/aim/swtch.S ============================================================================== --- head/sys/powerpc/aim/swtch.S Sun Oct 11 16:41:39 2009 (r197961) +++ head/sys/powerpc/aim/swtch.S Sun Oct 11 16:44:58 2009 (r197962) @@ -171,7 +171,7 @@ ENTRY(savectx) mr %r12,%r2 stmw %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */ mfcr %r4 /* Save the condition register */ - stw %r4,PCB_CONTEXT(%r3) + stw %r4,PCB_CR(%r3) blr /* From kib at FreeBSD.org Sun Oct 11 16:49:31 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 11 16:49:43 2009 Subject: svn commit: r197963 - in head/sys: kern sys Message-ID: <200910111649.n9BGnUmJ016709@svn.freebsd.org> Author: kib Date: Sun Oct 11 16:49:30 2009 New Revision: 197963 URL: http://svn.freebsd.org/changeset/base/197963 Log: Currently, when signal is delivered to the process and there is a thread not blocking the signal, signal is placed on the thread sigqueue. If the selected thread is in kernel executing thr_exit() or sigprocmask() syscalls, then signal might be not delivered to usermode for arbitrary amount of time, and for exiting thread it is lost. Put process-directed signals to the process queue unconditionally, selecting the thread to deliver the signal only by the thread returning to usermode, since only then the thread can handle delivery of signal reliably. For exiting thread or thread that has blocked some signals, check whether the newly blocked signal is queued for the process, and try to find a thread to wakeup for delivery, in reschedule_signal(). For exiting thread, assume that all signals are blocked. Change cursig() and postsig() to look both into the thread and process signal queues. When there is a signal that thread returning to usermode could consume, TDF_NEEDSIGCHK flag is not neccessary set now. Do unlocked read of p_siglist and p_pendingcnt to check for queued signals. Note that thread that has a signal unblocked might get spurious wakeup and EINTR from the interruptible system call now, due to the possibility of being selected by reschedule_signals(), while other thread returned to usermode earlier and removed the signal from process queue. This should not cause compliance issues, since the thread has not blocked a signal and thus should be ready to receive it anyway. Reported by: Justin Teller Reviewed by: davidxu, jilles MFC after: 1 month Modified: head/sys/kern/kern_sig.c head/sys/kern/kern_thr.c head/sys/kern/subr_trap.c head/sys/sys/signalvar.h Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/kern/kern_sig.c Sun Oct 11 16:49:30 2009 (r197963) @@ -220,6 +220,8 @@ static int sigproptbl[NSIG] = { SA_KILL|SA_PROC, /* SIGUSR2 */ }; +static void reschedule_signals(struct proc *p, sigset_t block); + static void sigqueue_start(void) { @@ -581,20 +583,11 @@ void signotify(struct thread *td) { struct proc *p; - sigset_t set; p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); - /* - * If our mask changed we may have to move signal that were - * previously masked by all threads to our sigqueue. - */ - set = p->p_sigqueue.sq_signals; - SIGSETNAND(set, td->td_sigmask); - if (! SIGISEMPTY(set)) - sigqueue_move_set(&p->p_sigqueue, &td->td_sigqueue, &set); if (SIGPENDING(td)) { thread_lock(td); td->td_flags |= TDF_NEEDSIGCHK | TDF_ASTPENDING; @@ -976,24 +969,28 @@ execsigs(struct proc *p) * Manipulate signal mask. */ int -kern_sigprocmask(td, how, set, oset, old) - struct thread *td; - int how; - sigset_t *set, *oset; - int old; +kern_sigprocmask(struct thread *td, int how, sigset_t *set, sigset_t *oset, + int old) { + sigset_t new_block, oset1; + struct proc *p; int error; - PROC_LOCK(td->td_proc); + p = td->td_proc; + PROC_LOCK(p); if (oset != NULL) *oset = td->td_sigmask; error = 0; + SIGEMPTYSET(new_block); if (set != NULL) { switch (how) { case SIG_BLOCK: SIG_CANTMASK(*set); + oset1 = td->td_sigmask; SIGSETOR(td->td_sigmask, *set); + new_block = td->td_sigmask; + SIGSETNAND(new_block, oset1); break; case SIG_UNBLOCK: SIGSETNAND(td->td_sigmask, *set); @@ -1001,10 +998,13 @@ kern_sigprocmask(td, how, set, oset, old break; case SIG_SETMASK: SIG_CANTMASK(*set); + oset1 = td->td_sigmask; if (old) SIGSETLO(td->td_sigmask, *set); else td->td_sigmask = *set; + new_block = td->td_sigmask; + SIGSETNAND(new_block, oset1); signotify(td); break; default: @@ -1012,7 +1012,20 @@ kern_sigprocmask(td, how, set, oset, old break; } } - PROC_UNLOCK(td->td_proc); + + /* + * The new_block set contains signals that were not previosly + * blocked, but are blocked now. + * + * In case we block any signal that was not previously blocked + * for td, and process has the signal pending, try to schedule + * signal delivery to some thread that does not block the signal, + * possibly waking it up. + */ + if (p->p_numthreads != 1) + reschedule_signals(p, new_block); + + PROC_UNLOCK(p); return (error); } @@ -1985,17 +1998,9 @@ tdsignal(struct proc *p, struct thread * KNOTE_LOCKED(&p->p_klist, NOTE_SIGNAL | sig); prop = sigprop(sig); - /* - * If the signal is blocked and not destined for this thread, then - * assign it to the process so that we can find it later in the first - * thread that unblocks it. Otherwise, assign it to this thread now. - */ if (td == NULL) { td = sigtd(p, sig, prop); - if (SIGISMEMBER(td->td_sigmask, sig)) - sigqueue = &p->p_sigqueue; - else - sigqueue = &td->td_sigqueue; + sigqueue = &p->p_sigqueue; } else { KASSERT(td->td_proc == p, ("invalid thread")); sigqueue = &td->td_sigqueue; @@ -2392,6 +2397,62 @@ stopme: return (td->td_xsig); } +static void +reschedule_signals(struct proc *p, sigset_t block) +{ + struct sigacts *ps; + struct thread *td; + int i; + + PROC_LOCK_ASSERT(p, MA_OWNED); + + ps = p->p_sigacts; + for (i = 1; !SIGISEMPTY(block); i++) { + if (!SIGISMEMBER(block, i)) + continue; + SIGDELSET(block, i); + if (!SIGISMEMBER(p->p_siglist, i)) + continue; + + td = sigtd(p, i, 0); + signotify(td); + mtx_lock(&ps->ps_mtx); + if (p->p_flag & P_TRACED || SIGISMEMBER(ps->ps_sigcatch, i)) + tdsigwakeup(td, i, SIG_CATCH, + (SIGISMEMBER(ps->ps_sigintr, i) ? EINTR : + ERESTART)); + mtx_unlock(&ps->ps_mtx); + } +} + +void +tdsigcleanup(struct thread *td) +{ + struct proc *p; + sigset_t unblocked; + + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + + sigqueue_flush(&td->td_sigqueue); + if (p->p_numthreads == 1) + return; + + /* + * Since we cannot handle signals, notify signal post code + * about this by filling the sigmask. + * + * Also, if needed, wake up thread(s) that do not block the + * same signals as the exiting thread, since the thread might + * have been selected for delivery and woken up. + */ + SIGFILLSET(unblocked); + SIGSETNAND(unblocked, td->td_sigmask); + SIGFILLSET(td->td_sigmask); + reschedule_signals(p, unblocked); + +} + /* * If the current process has received a signal (should be caught or cause * termination, should interrupt current syscall), return the signal number. @@ -2409,8 +2470,9 @@ issignal(struct thread *td, int stop_all { struct proc *p; struct sigacts *ps; + struct sigqueue *queue; sigset_t sigpending; - int sig, prop, newsig; + int sig, prop, newsig, signo; p = td->td_proc; ps = p->p_sigacts; @@ -2420,6 +2482,7 @@ issignal(struct thread *td, int stop_all int traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG); sigpending = td->td_sigqueue.sq_signals; + SIGSETOR(sigpending, p->p_sigqueue.sq_signals); SIGSETNAND(sigpending, td->td_sigmask); if (p->p_flag & P_PPWAIT) @@ -2440,6 +2503,7 @@ issignal(struct thread *td, int stop_all */ if (SIGISMEMBER(ps->ps_sigignore, sig) && (traced == 0)) { sigqueue_delete(&td->td_sigqueue, sig); + sigqueue_delete(&p->p_sigqueue, sig); continue; } if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) { @@ -2452,12 +2516,18 @@ issignal(struct thread *td, int stop_all if (sig != newsig) { ksiginfo_t ksi; + + queue = &td->td_sigqueue; /* * clear old signal. * XXX shrug off debugger, it causes siginfo to * be thrown away. */ - sigqueue_get(&td->td_sigqueue, sig, &ksi); + if (sigqueue_get(queue, sig, &ksi) == 0) { + queue = &p->p_sigqueue; + signo = sigqueue_get(queue, sig, &ksi); + KASSERT(signo == sig, ("signo != sig")); + } /* * If parent wants us to take the signal, @@ -2472,7 +2542,7 @@ issignal(struct thread *td, int stop_all * Put the new signal into td_sigqueue. If the * signal is being masked, look for other signals. */ - SIGADDSET(td->td_sigqueue.sq_signals, sig); + SIGADDSET(queue->sq_signals, sig); if (SIGISMEMBER(td->td_sigmask, sig)) continue; signotify(td); @@ -2567,6 +2637,7 @@ issignal(struct thread *td, int stop_all return (sig); } sigqueue_delete(&td->td_sigqueue, sig); /* take the signal! */ + sigqueue_delete(&p->p_sigqueue, sig); } /* NOTREACHED */ } @@ -2613,7 +2684,9 @@ postsig(sig) ps = p->p_sigacts; mtx_assert(&ps->ps_mtx, MA_OWNED); ksiginfo_init(&ksi); - sigqueue_get(&td->td_sigqueue, sig, &ksi); + if (sigqueue_get(&td->td_sigqueue, sig, &ksi) == 0 && + sigqueue_get(&p->p_sigqueue, sig, &ksi) == 0) + return; ksi.ksi_signo = sig; if (ksi.ksi_code == SI_TIMER) itimer_accept(p, ksi.ksi_timerid, &ksi); Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/kern/kern_thr.c Sun Oct 11 16:49:30 2009 (r197963) @@ -282,7 +282,7 @@ thr_exit(struct thread *td, struct thr_e } PROC_LOCK(p); - sigqueue_flush(&td->td_sigqueue); + tdsigcleanup(td); PROC_SLOCK(p); /* Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/kern/subr_trap.c Sun Oct 11 16:49:30 2009 (r197963) @@ -90,6 +90,7 @@ userret(struct thread *td, struct trapfr CTR3(KTR_SYSC, "userret: thread %p (pid %d, %s)", td, p->p_pid, td->td_name); +#if 0 #ifdef DIAGNOSTIC /* Check that we called signotify() enough. */ PROC_LOCK(p); @@ -100,6 +101,7 @@ userret(struct thread *td, struct trapfr thread_unlock(td); PROC_UNLOCK(p); #endif +#endif #ifdef KTRACE KTRUSERRET(td); #endif @@ -218,7 +220,14 @@ ast(struct trapframe *framep) ktrcsw(0, 1); #endif } - if (flags & TDF_NEEDSIGCHK) { + + /* + * Check for signals. Unlocked reads of p_pendingcnt or + * p_siglist might cause process-directed signal to be handled + * later. + */ + if (flags & TDF_NEEDSIGCHK || p->p_pendingcnt > 0 || + !SIGISEMPTY(p->p_siglist)) { PROC_LOCK(p); mtx_lock(&p->p_sigacts->ps_mtx); while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0) Modified: head/sys/sys/signalvar.h ============================================================================== --- head/sys/sys/signalvar.h Sun Oct 11 16:44:58 2009 (r197962) +++ head/sys/sys/signalvar.h Sun Oct 11 16:49:30 2009 (r197963) @@ -252,9 +252,10 @@ typedef struct sigqueue { /* Return nonzero if process p has an unmasked pending signal. */ #define SIGPENDING(td) \ - (!SIGISEMPTY((td)->td_siglist) && \ - !sigsetmasked(&(td)->td_siglist, &(td)->td_sigmask)) - + ((!SIGISEMPTY((td)->td_siglist) && \ + !sigsetmasked(&(td)->td_siglist, &(td)->td_sigmask)) || \ + (!SIGISEMPTY((td)->td_proc->p_siglist) && \ + !sigsetmasked(&(td)->td_proc->p_siglist, &(td)->td_sigmask))) /* * Return the value of the pseudo-expression ((*set & ~*mask) != 0). This * is an optimized version of SIGISEMPTY() on a temporary variable @@ -336,6 +337,7 @@ void sigexit(struct thread *td, int sign int sig_ffs(sigset_t *set); void siginit(struct proc *p); void signotify(struct thread *td); +void tdsigcleanup(struct thread *td); int tdsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi); void trapsignal(struct thread *td, ksiginfo_t *); From simon at FreeBSD.org Sun Oct 11 16:52:25 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Sun Oct 11 16:52:32 2009 Subject: svn commit: r197964 - stable/8/share/man/man4 Message-ID: <200910111652.n9BGqPMj016968@svn.freebsd.org> Author: simon Date: Sun Oct 11 16:52:24 2009 New Revision: 197964 URL: http://svn.freebsd.org/changeset/base/197964 Log: MFC r197835: - Document that 'Dell PowerEdge R710' has bce(4) supported NIC. - Bump document date. Approved by: re (kib) Modified: stable/8/share/man/man4/ (props changed) stable/8/share/man/man4/bce.4 Modified: stable/8/share/man/man4/bce.4 ============================================================================== --- stable/8/share/man/man4/bce.4 Sun Oct 11 16:49:30 2009 (r197963) +++ stable/8/share/man/man4/bce.4 Sun Oct 11 16:52:24 2009 (r197964) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2009 +.Dd October 7, 2009 .Dt BCE 4 .Os .Sh NAME @@ -165,6 +165,8 @@ Dell PowerEdge 1950 integrated BCM5708 N .It Dell PowerEdge 2950 integrated BCM5708 NIC .It +Dell PowerEdge R710 integrated BCM5709 NIC +.It HP NC370F Multifunction Gigabit Server Adapter .It HP NC370T Multifunction Gigabit Server Adapter From kib at FreeBSD.org Sun Oct 11 17:04:14 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Oct 11 17:04:26 2009 Subject: svn commit: r197965 - in head/tools/regression/sigqueue: sigqtest1 sigqtest2 Message-ID: <200910111704.n9BH4DMu017945@svn.freebsd.org> Author: kib Date: Sun Oct 11 17:04:13 2009 New Revision: 197965 URL: http://svn.freebsd.org/changeset/base/197965 Log: Tweaks for sigqueue tests: - slightly adjust code for style, sort headers. - in sigqtest2, print received signals, to make it easy to see why test failed. - in sigqtest2, job_control_test(), cover a race by adding sleep after child stopped itself to allow for SIGCHLD due to stop and exit to not be coalesced. MFC after: 2 weeks Modified: head/tools/regression/sigqueue/sigqtest1/sigqtest1.c head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Modified: head/tools/regression/sigqueue/sigqtest1/sigqtest1.c ============================================================================== --- head/tools/regression/sigqueue/sigqtest1/sigqtest1.c Sun Oct 11 16:52:24 2009 (r197964) +++ head/tools/regression/sigqueue/sigqtest1/sigqtest1.c Sun Oct 11 17:04:13 2009 (r197965) @@ -1,12 +1,14 @@ /* $FreeBSD$ */ -#include -#include #include #include +#include +#include +#include int received; -void handler(int sig, siginfo_t *si, void *ctx) +void +handler(int sig, siginfo_t *si, void *ctx) { if (si->si_code != SI_QUEUE) errx(1, "si_code != SI_QUEUE"); @@ -15,7 +17,8 @@ void handler(int sig, siginfo_t *si, voi received++; } -int main() +int +main() { struct sigaction sa; union sigval val; Modified: head/tools/regression/sigqueue/sigqtest2/sigqtest2.c ============================================================================== --- head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Sun Oct 11 16:52:24 2009 (r197964) +++ head/tools/regression/sigqueue/sigqtest2/sigqtest2.c Sun Oct 11 17:04:13 2009 (r197965) @@ -1,24 +1,29 @@ /* $FreeBSD$ */ -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include int stop_received; int exit_received; int cont_received; -void job_handler(int sig, siginfo_t *si, void *ctx) +void +job_handler(int sig, siginfo_t *si, void *ctx) { int status; int ret; if (si->si_code == CLD_STOPPED) { + printf("%d: stop received\n", si->si_pid); stop_received = 1; kill(si->si_pid, SIGCONT); } else if (si->si_code == CLD_EXITED) { + printf("%d: exit received\n", si->si_pid); ret = waitpid(si->si_pid, &status, 0); if (ret == -1) errx(1, "waitpid"); @@ -26,11 +31,13 @@ void job_handler(int sig, siginfo_t *si, errx(1, "!WIFEXITED(status)"); exit_received = 1; } else if (si->si_code == CLD_CONTINUED) { + printf("%d: cont received\n", si->si_pid); cont_received = 1; } } -void job_control_test() +void +job_control_test(void) { struct sigaction sa; pid_t pid; @@ -43,9 +50,12 @@ void job_control_test() stop_received = 0; cont_received = 0; exit_received = 0; + fflush(stdout); pid = fork(); if (pid == 0) { + printf("child %d\n", getpid()); kill(getpid(), SIGSTOP); + sleep(2); exit(1); } @@ -60,11 +70,13 @@ void job_control_test() printf("job control test OK.\n"); } -void rtsig_handler(int sig, siginfo_t *si, void *ctx) +void +rtsig_handler(int sig, siginfo_t *si, void *ctx) { } -int main() +int +main() { struct sigaction sa; sigset_t set; From trasz at FreeBSD.org Sun Oct 11 18:14:19 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sun Oct 11 18:14:36 2009 Subject: svn commit: r197966 - stable/8/share/man/man4 Message-ID: <200910111814.n9BIEIpQ023569@svn.freebsd.org> Author: trasz Date: Sun Oct 11 18:14:18 2009 New Revision: 197966 URL: http://svn.freebsd.org/changeset/base/197966 Log: MFC r196700: Manual page for mfiutil(8) is in section 8 now. Approved by: re (kib) Modified: stable/8/share/man/man4/ (props changed) stable/8/share/man/man4/mfi.4 Modified: stable/8/share/man/man4/mfi.4 ============================================================================== --- stable/8/share/man/man4/mfi.4 Sun Oct 11 17:04:13 2009 (r197965) +++ stable/8/share/man/man4/mfi.4 Sun Oct 11 18:14:18 2009 (r197966) @@ -102,9 +102,9 @@ management interface An attempt was made to remove a mounted volume. .El .Sh SEE ALSO -.Xr mfiutil 1 , .Xr amr 4 , -.Xr pci 4 +.Xr pci 4 , +.Xr mfiutil 8 .Sh HISTORY The .Nm From jilles at FreeBSD.org Sun Oct 11 20:19:46 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Sun Oct 11 20:19:58 2009 Subject: svn commit: r197968 - in head/lib: libc/include libc/sys libthr libthr/thread Message-ID: <200910112019.n9BKJjM1028235@svn.freebsd.org> Author: jilles Date: Sun Oct 11 20:19:45 2009 New Revision: 197968 URL: http://svn.freebsd.org/changeset/base/197968 Log: Make openat(2) a cancellation point. This is required by POSIX and matches open(2). Reviewed by: kib, jhb MFC after: 1 month Modified: head/lib/libc/include/namespace.h head/lib/libc/include/un-namespace.h head/lib/libc/sys/Symbol.map head/lib/libthr/pthread.map head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_syscalls.c Modified: head/lib/libc/include/namespace.h ============================================================================== --- head/lib/libc/include/namespace.h Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libc/include/namespace.h Sun Oct 11 20:19:45 2009 (r197968) @@ -80,6 +80,7 @@ #define listen _listen #define nanosleep _nanosleep #define open _open +#define openat _openat #define poll _poll #define pthread_atfork _pthread_atfork #define pthread_attr_destroy _pthread_attr_destroy Modified: head/lib/libc/include/un-namespace.h ============================================================================== --- head/lib/libc/include/un-namespace.h Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libc/include/un-namespace.h Sun Oct 11 20:19:45 2009 (r197968) @@ -61,6 +61,7 @@ #undef listen #undef nanosleep #undef open +#undef openat #undef poll #undef pthread_atfork #undef pthread_attr_destroy Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libc/sys/Symbol.map Sun Oct 11 20:19:45 2009 (r197968) @@ -769,6 +769,8 @@ FBSDprivate_1.0 { __sys_olio_listio; _open; __sys_open; + _openat; + __sys_openat; _pathconf; __sys_pathconf; _pipe; Modified: head/lib/libthr/pthread.map ============================================================================== --- head/lib/libthr/pthread.map Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libthr/pthread.map Sun Oct 11 20:19:45 2009 (r197968) @@ -195,6 +195,7 @@ FBSDprivate_1.0 { __msync; __nanosleep; __open; + __openat; __poll; __pthread_cond_timedwait; __pthread_cond_wait; @@ -406,3 +407,7 @@ FBSD_1.1 { pthread_mutex_setspinloops_np; pthread_mutex_setyieldloops_np; }; + +FBSD_1.2 { + openat; +}; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libthr/thread/thr_private.h Sun Oct 11 20:19:45 2009 (r197968) @@ -668,6 +668,7 @@ void _pthread_cleanup_pop(int); #ifdef _SYS_FCNTL_H_ int __sys_fcntl(int, int, ...); int __sys_open(const char *, int, ...); +int __sys_openat(int, const char *, int, ...); #endif /* #include */ Modified: head/lib/libthr/thread/thr_syscalls.c ============================================================================== --- head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 18:21:55 2009 (r197967) +++ head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 20:19:45 2009 (r197968) @@ -139,6 +139,7 @@ int __fsync(int); int __msync(void *, size_t, int); int __nanosleep(const struct timespec *, struct timespec *); int __open(const char *, int,...); +int __openat(int, const char *, int,...); int __poll(struct pollfd *, unsigned int, int); ssize_t __read(int, void *buf, size_t); ssize_t __readv(int, const struct iovec *, int); @@ -341,6 +342,33 @@ __open(const char *path, int flags,...) return ret; } +__weak_reference(__openat, openat); + +int +__openat(int fd, const char *path, int flags, ...) +{ + struct pthread *curthread = _get_curthread(); + int ret; + int mode = 0; + va_list ap; + + _thr_cancel_enter(curthread); + + /* Check if the file is being created: */ + if (flags & O_CREAT) { + /* Get the creation mode: */ + va_start(ap, flags); + mode = va_arg(ap, int); + va_end(ap); + } + + ret = __sys_openat(fd, path, flags, mode); + + _thr_cancel_leave(curthread); + + return ret; +} + __weak_reference(__poll, poll); int From marcel at FreeBSD.org Sun Oct 11 20:42:27 2009 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Sun Oct 11 20:42:43 2009 Subject: svn commit: r197969 - head/sys/conf Message-ID: <200910112042.n9BKgRCQ029985@svn.freebsd.org> Author: marcel Date: Sun Oct 11 20:42:26 2009 New Revision: 197969 URL: http://svn.freebsd.org/changeset/base/197969 Log: Scan for option ROMs on i386 and amd64 only. Modified: head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Oct 11 20:19:45 2009 (r197968) +++ head/sys/conf/files Sun Oct 11 20:42:26 2009 (r197969) @@ -1919,7 +1919,6 @@ gnu/fs/reiserfs/reiserfs_vnops.c optiona isa/isa_if.m standard isa/isa_common.c optional isa isa/isahint.c optional isa -isa/orm.c optional isa isa/pnp.c optional isa isapnp isa/pnpparse.c optional isa isapnp fs/cd9660/cd9660_bmap.c optional cd9660 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Oct 11 20:19:45 2009 (r197968) +++ head/sys/conf/files.amd64 Sun Oct 11 20:42:26 2009 (r197969) @@ -228,6 +228,7 @@ dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_amd64.c optional uart dev/wpi/if_wpi.c optional wpi isa/atrtc.c standard +isa/orm.c optional isa isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/link_elf_obj.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sun Oct 11 20:19:45 2009 (r197968) +++ head/sys/conf/files.i386 Sun Oct 11 20:42:26 2009 (r197969) @@ -362,6 +362,7 @@ i386/svr4/svr4_locore.s optional compat i386/svr4/svr4_machdep.c optional compat_svr4 # isa/atrtc.c optional atpic +isa/orm.c optional isa isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_aout.c optional compat_aout From rwatson at FreeBSD.org Sun Oct 11 20:55:09 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Sun Oct 11 20:55:20 2009 Subject: svn commit: r197949 - head/lib/libc/sys In-Reply-To: <200910110008.n9B08tQc095922@svn.freebsd.org> References: <200910110008.n9B08tQc095922@svn.freebsd.org> Message-ID: On Sun, 11 Oct 2009, David Schultz wrote: > Log: > Document errno codes added in r144530. Thanks! Seeing this MFC'd for 8.0 wouldn't be such a bad thing either. Robert > Modified: > head/lib/libc/sys/intro.2 > > Modified: head/lib/libc/sys/intro.2 > ============================================================================== > --- head/lib/libc/sys/intro.2 Sat Oct 10 22:29:34 2009 (r197948) > +++ head/lib/libc/sys/intro.2 Sun Oct 11 00:08:55 2009 (r197949) > @@ -456,6 +456,14 @@ The specified extended attribute does no > .It Er 88 EDOOFUS Em "Programming error" . > A function or API is being abused in a way which could only be detected > at run-time. > +.It Er 89 EBADMSG Em "Bad message" . > +A corrupted message was detected. > +.It Er 90 EMULTIHOP Em "Multihop attempted" . > +This error code is unused, but present for compatibility with other systems. > +.It Er 91 ENOLINK Em "Link has been severed" . > +This error code is unused, but present for compatibility with other systems. > +.It Er 92 EPROTO Em "Protocol error" . > +A device or socket encountered an unrecoverable protocol error. > .It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . > An operation on a capability file descriptor requires greater privilege than > the capability allows. > From rpaulo at FreeBSD.org Mon Oct 12 10:08:59 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Oct 12 10:09:11 2009 Subject: svn commit: r197975 - head/sys/net80211 Message-ID: <200910121008.n9CA8wId052976@svn.freebsd.org> Author: rpaulo Date: Mon Oct 12 10:08:58 2009 New Revision: 197975 URL: http://svn.freebsd.org/changeset/base/197975 Log: Another 3.03 draft bit that I missed in the previous 802.11s stack update. The Mesh Configuration IE has changed quite a bit. Refactor the code to handle this change. MFC after: 3 days Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Mon Oct 12 07:29:50 2009 (r197974) +++ head/sys/net80211/ieee80211_hwmp.c Mon Oct 12 10:08:58 2009 (r197975) @@ -192,7 +192,7 @@ static ieee80211_recv_action_func hwmp_r static struct ieee80211_mesh_proto_path mesh_proto_hwmp = { .mpp_descr = "HWMP", - .mpp_ie = IEEE80211_MESHCONF_HWMP, + .mpp_ie = IEEE80211_MESHCONF_PATH_HWMP, .mpp_discover = hwmp_discover, .mpp_peerdown = hwmp_peerdown, .mpp_vattach = hwmp_vattach, Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Mon Oct 12 07:29:50 2009 (r197974) +++ head/sys/net80211/ieee80211_mesh.c Mon Oct 12 10:08:58 2009 (r197975) @@ -132,7 +132,7 @@ static ieee80211_send_action_func mesh_s static const struct ieee80211_mesh_proto_metric mesh_metric_airtime = { .mpm_descr = "AIRTIME", - .mpm_ie = IEEE80211_MESHCONF_AIRTIME, + .mpm_ie = IEEE80211_MESHCONF_METRIC_AIRTIME, .mpm_metric = mesh_airtime_calc, }; @@ -344,18 +344,18 @@ int ieee80211_mesh_register_proto_path(const struct ieee80211_mesh_proto_path *mpp) { int i, firstempty = -1; - static const uint8_t emptyie[4] = { 0, 0, 0, 0 }; for (i = 0; i < N(mesh_proto_paths); i++) { - if (memcmp(mpp->mpp_ie, mesh_proto_paths[i].mpp_ie, 4) == 0) + if (strncmp(mpp->mpp_descr, mesh_proto_paths[i].mpp_descr, + IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; - if (memcmp(mesh_proto_paths[i].mpp_ie, emptyie, 4) == 0 && - firstempty == -1) + if (!mesh_proto_paths[i].mpp_active && firstempty == -1) firstempty = i; } if (firstempty < 0) return ENOSPC; memcpy(&mesh_proto_paths[firstempty], mpp, sizeof(*mpp)); + mesh_proto_paths[firstempty].mpp_active = 1; return 0; } @@ -364,18 +364,18 @@ ieee80211_mesh_register_proto_metric(con ieee80211_mesh_proto_metric *mpm) { int i, firstempty = -1; - static const uint8_t emptyie[4] = { 0, 0, 0, 0 }; for (i = 0; i < N(mesh_proto_metrics); i++) { - if (memcmp(mpm->mpm_ie, mesh_proto_metrics[i].mpm_ie, 4) == 0) + if (strncmp(mpm->mpm_descr, mesh_proto_metrics[i].mpm_descr, + IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; - if (memcmp(mesh_proto_metrics[i].mpm_ie, emptyie, 4) == 0 && - firstempty == -1) + if (!mesh_proto_metrics[i].mpm_active && firstempty == -1) firstempty = i; } if (firstempty < 0) return ENOSPC; memcpy(&mesh_proto_metrics[firstempty], mpm, sizeof(*mpm)); + mesh_proto_metrics[firstempty].mpm_active = 1; return 0; } @@ -2282,51 +2282,40 @@ mesh_verify_meshid(struct ieee80211vap * static int mesh_verify_meshconf(struct ieee80211vap *vap, const uint8_t *ie) { - static const uint8_t null[4] = IEEE80211_MESHCONF_NULL; const struct ieee80211_meshconf_ie *meshconf = (const struct ieee80211_meshconf_ie *) ie; const struct ieee80211_mesh_state *ms = vap->iv_mesh; if (meshconf == NULL) return 1; - if (meshconf->conf_ver != IEEE80211_MESHCONF_VERSION) { + if (meshconf->conf_pselid != ms->ms_ppath->mpp_ie) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "wrong mesh conf version: %d\n", meshconf->conf_ver); + "unknown path selection algorithm: 0x%x\n", + meshconf->conf_pselid); return 1; } - if (memcmp(meshconf->conf_pselid, ms->ms_ppath->mpp_ie, 4) != 0) { + if (meshconf->conf_pmetid != ms->ms_pmetric->mpm_ie) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown path selection algorithm: 0x%x%x%x%x\n", - meshconf->conf_pselid[0], meshconf->conf_pselid[1], - meshconf->conf_pselid[2], meshconf->conf_pselid[3]); + "unknown path metric algorithm: 0x%x\n", + meshconf->conf_pmetid); return 1; } - if (memcmp(meshconf->conf_pmetid, ms->ms_pmetric->mpm_ie, 4) != 0) { + if (meshconf->conf_ccid != 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown path metric algorithm: 0x%x%x%x%x\n", - meshconf->conf_pmetid[0], meshconf->conf_pmetid[1], - meshconf->conf_pmetid[2], meshconf->conf_pmetid[3]); + "unknown congestion control algorithm: 0x%x\n", + meshconf->conf_ccid); return 1; } - if (memcmp(meshconf->conf_ccid, null, 4) != 0) { + if (meshconf->conf_syncid != IEEE80211_MESHCONF_SYNC_NEIGHOFF) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown congestion sig algorithm: 0x%x%x%x%x\n", - meshconf->conf_ccid[0], meshconf->conf_ccid[1], - meshconf->conf_ccid[2], meshconf->conf_ccid[3]); + "unknown sync algorithm: 0x%x\n", + meshconf->conf_syncid); return 1; } - if (memcmp(meshconf->conf_syncid, null, 4) != 0) { + if (meshconf->conf_authid != 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown sync algorithm: 0x%x%x%x%x\n", - meshconf->conf_syncid[0], meshconf->conf_syncid[1], - meshconf->conf_syncid[2], meshconf->conf_syncid[3]); - return 1; - } - if (memcmp(meshconf->conf_authid, null, 4) != 0) { - IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH, - "unknown auth auth algorithm: 0x%x%x%x%x\n", - meshconf->conf_pselid[0], meshconf->conf_pselid[1], - meshconf->conf_pselid[2], meshconf->conf_pselid[3]); + "unknown auth auth algorithm: 0x%x\n", + meshconf->conf_pselid); return 1; } /* Not accepting peers */ @@ -2394,24 +2383,16 @@ uint8_t * ieee80211_add_meshconf(uint8_t *frm, struct ieee80211vap *vap) { const struct ieee80211_mesh_state *ms = vap->iv_mesh; - static const uint8_t null[4] = IEEE80211_MESHCONF_NULL; KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a MBSS vap")); *frm++ = IEEE80211_ELEMID_MESHCONF; *frm++ = sizeof(struct ieee80211_meshconf_ie) - 2; - *frm++ = IEEE80211_MESHCONF_VERSION; - memcpy(frm, ms->ms_ppath->mpp_ie, 4); /* path selection */ - frm += 4; - memcpy(frm, ms->ms_pmetric->mpm_ie, 4); /* link metric */ - frm += 4; - /* XXX null for now */ - memcpy(frm, null, 4); /* congestion control */ - frm += 4; - memcpy(frm, null, 4); /* sync */ - frm += 4; - memcpy(frm, null, 4); /* auth */ - frm += 4; + *frm++ = ms->ms_ppath->mpp_ie; /* path selection */ + *frm++ = ms->ms_pmetric->mpm_ie; /* link metric */ + *frm++ = IEEE80211_MESHCONF_CC_DISABLED; + *frm++ = IEEE80211_MESHCONF_SYNC_NEIGHOFF; + *frm++ = IEEE80211_MESHCONF_AUTH_DISABLED; /* NB: set the number of neighbors before the rest */ *frm = (ms->ms_neighbors > 15 ? 15 : ms->ms_neighbors) << 1; if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL) @@ -2440,7 +2421,7 @@ ieee80211_add_meshpeer(uint8_t *frm, uin *frm++ = IEEE80211_ELEMID_MESHPEER; switch (subtype) { case IEEE80211_MESH_PEER_LINK_OPEN: - *frm++ = 6; /* length */ + frm++ = 6; /* length */ memcpy(frm, meshpeerproto, 4); frm += 4; ADDSHORT(frm, localid); /* local ID */ Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Mon Oct 12 07:29:50 2009 (r197974) +++ head/sys/net80211/ieee80211_mesh.h Mon Oct 12 10:08:58 2009 (r197975) @@ -43,47 +43,27 @@ struct ieee80211_meshconf_ie { uint8_t conf_ie; /* IEEE80211_ELEMID_MESHCONF */ uint8_t conf_len; - uint8_t conf_ver; - uint8_t conf_pselid[4]; /* Active Path Sel. Proto. ID */ - uint8_t conf_pmetid[4]; /* APS Metric Identifier */ - uint8_t conf_ccid[4]; /* Congestion Control Mode ID */ - uint8_t conf_syncid[4]; /* Sync. Protocol ID */ - uint8_t conf_authid[4]; /* Auth. Protocol ID */ + uint8_t conf_pselid; /* Active Path Sel. Proto. ID */ + uint8_t conf_pmetid; /* Active Metric Identifier */ + uint8_t conf_ccid; /* Congestion Control Mode ID */ + uint8_t conf_syncid; /* Sync. Protocol ID */ + uint8_t conf_authid; /* Auth. Protocol ID */ uint8_t conf_form; /* Formation Information */ uint8_t conf_cap; } __packed; -#define IEEE80211_MESHCONF_VERSION 1 -/* Null Protocol */ -#define IEEE80211_MESHCONF_NULL_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_NULL_VALUE 0xff -#define IEEE80211_MESHCONF_NULL { IEEE80211_MESHCONF_NULL_OUI, \ - IEEE80211_MESHCONF_NULL_VALUE } /* Hybrid Wireless Mesh Protocol */ -#define IEEE80211_MESHCONF_HWMP_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_HWMP_VALUE 0x00 -#define IEEE80211_MESHCONF_HWMP { IEEE80211_MESHCONF_HWMP_OUI, \ - IEEE80211_MESHCONF_HWMP_VALUE } +#define IEEE80211_MESHCONF_PATH_HWMP 0x00 /* Airtime Link Metric */ -#define IEEE80211_MESHCONF_AIRTIME_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_AIRTIME_VALUE 0x00 -#define IEEE80211_MESHCONF_AIRTIME { IEEE80211_MESHCONF_AIRTIME_OUI, \ - IEEE80211_MESHCONF_AIRTIME_VALUE } -/* Congestion Control Signaling */ -#define IEEE80211_MESHCONF_CCSIG_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_CCSIG_VALUE 0x00 -#define IEEE80211_MESHCONF_CCSIG { IEEE80211_MESHCONF_CCSIG_OUI,\ - IEEE80211_MESHCONF_CCSIG_VALUE } +#define IEEE80211_MESHCONF_METRIC_AIRTIME 0x00 +/* Congestion Control */ +#define IEEE80211_MESHCONF_CC_DISABLED 0x00 +#define IEEE80211_MESHCONF_CC_SIG 0x01 /* Neighbour Offset */ -#define IEEE80211_MESHCONF_NEIGHOFF_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_NEIGHOFF_VALUE 0x00 -#define IEEE80211_MESHCONF_NEIGHOFF { IEEE80211_MESHCONF_NEIGHOFF_OUI, \ - IEEE80211_MESHCONF_NEIGHOFF_VALUE } +#define IEEE80211_MESHCONF_SYNC_NEIGHOFF 0x00 +#define IEEE80211_MESHCONF_AUTH_DISABLED 0x00 /* Simultaneous Authenticaction of Equals */ -#define IEEE80211_MESHCONF_SAE_OUI 0x00, 0x0f, 0xac -#define IEEE80211_MESHCONF_SAE_VALUE 0x01 -#define IEEE80211_MESHCONF_SAE { IEEE80211_MESHCONF_SAE_OUI, \ - IEEE80211_MESHCONF_SAE_VALUE } +#define IEEE80211_MESHCONF_AUTH_SAE 0x01 #define IEEE80211_MESHCONF_FORM_MP 0x01 /* Connected to Portal */ #define IEEE80211_MESHCONF_FORM_NNEIGH_MASK 0x04 /* Number of Neighbours */ #define IEEE80211_MESHCONF_CAP_AP 0x01 /* Accepting Peers */ @@ -390,8 +370,9 @@ struct ieee80211_mesh_route { */ enum ieee80211_state; struct ieee80211_mesh_proto_path { + uint8_t mpp_active; char mpp_descr[IEEE80211_MESH_PROTO_DSZ]; - uint8_t mpp_ie[4]; + uint8_t mpp_ie; struct ieee80211_node * (*mpp_discover)(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], @@ -411,8 +392,9 @@ struct ieee80211_mesh_proto_path { * Mesh Link Metric Report Protocol. */ struct ieee80211_mesh_proto_metric { + uint8_t mpm_active; char mpm_descr[IEEE80211_MESH_PROTO_DSZ]; - uint8_t mpm_ie[4]; + uint8_t mpm_ie; uint32_t (*mpm_metric)(struct ieee80211_node *); }; From kib at FreeBSD.org Mon Oct 12 10:09:48 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Oct 12 10:09:55 2009 Subject: svn commit: r197976 - head/sys/kern Message-ID: <200910121009.n9CA9mMm053031@svn.freebsd.org> Author: kib Date: Mon Oct 12 10:09:48 2009 New Revision: 197976 URL: http://svn.freebsd.org/changeset/base/197976 Log: Fix typo. Submitted by: rdivacky MFC after: 1 month Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Oct 12 10:08:58 2009 (r197975) +++ head/sys/kern/kern_sig.c Mon Oct 12 10:09:48 2009 (r197976) @@ -1014,7 +1014,7 @@ kern_sigprocmask(struct thread *td, int } /* - * The new_block set contains signals that were not previosly + * The new_block set contains signals that were not previously * blocked, but are blocked now. * * In case we block any signal that was not previously blocked From rpaulo at FreeBSD.org Mon Oct 12 10:30:15 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Oct 12 10:30:21 2009 Subject: svn commit: r197977 - head/sys/net80211 Message-ID: <200910121030.n9CAUFUK053419@svn.freebsd.org> Author: rpaulo Date: Mon Oct 12 10:30:15 2009 New Revision: 197977 URL: http://svn.freebsd.org/changeset/base/197977 Log: Fix a wrong initialization that snuck in the latest commit. MFC after: 3 days Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Mon Oct 12 10:09:48 2009 (r197976) +++ head/sys/net80211/ieee80211_mesh.c Mon Oct 12 10:30:15 2009 (r197977) @@ -2421,7 +2421,7 @@ ieee80211_add_meshpeer(uint8_t *frm, uin *frm++ = IEEE80211_ELEMID_MESHPEER; switch (subtype) { case IEEE80211_MESH_PEER_LINK_OPEN: - frm++ = 6; /* length */ + *frm++ = 6; /* length */ memcpy(frm, meshpeerproto, 4); frm += 4; ADDSHORT(frm, localid); /* local ID */ From alan.bsd at gmail.com Mon Oct 12 10:54:03 2009 From: alan.bsd at gmail.com (Alan R. S. Bueno) Date: Mon Oct 12 10:54:36 2009 Subject: svn commit: r197949 - head/lib/libc/sys In-Reply-To: References: <200910110008.n9B08tQc095922@svn.freebsd.org> Message-ID: On Sun, Oct 11, 2009 at 5:55 PM, Robert Watson wrote: > > On Sun, 11 Oct 2009, David Schultz wrote: > >> Log: >> ?Document errno codes added in r144530. > > Thanks! ?Seeing this MFC'd for 8.0 wouldn't be such a bad thing either. > > Robert > > > >> Modified: >> ?head/lib/libc/sys/intro.2 >> >> Modified: head/lib/libc/sys/intro.2 >> >> ============================================================================== >> --- head/lib/libc/sys/intro.2 ? Sat Oct 10 22:29:34 2009 ? ? ? ?(r197948) >> +++ head/lib/libc/sys/intro.2 ? Sun Oct 11 00:08:55 2009 ? ? ? ?(r197949) >> @@ -456,6 +456,14 @@ The specified extended attribute does no >> .It Er 88 EDOOFUS Em "Programming error" . >> A function or API is being abused in a way which could only be detected >> at run-time. >> +.It Er 89 EBADMSG Em "Bad message" . >> +A corrupted message was detected. >> +.It Er 90 EMULTIHOP Em "Multihop attempted" . >> +This error code is unused, but present for compatibility with other >> systems. >> +.It Er 91 ENOLINK Em "Link has been severed" . >> +This error code is unused, but present for compatibility with other >> systems. >> +.It Er 92 EPROTO Em "Protocol error" . >> +A device or socket encountered an unrecoverable protocol error. >> .It Er 93 ENOTCAPABLE Em "Capabilities insufficient" . >> An operation on a capability file descriptor requires greater privilege >> than >> the capability allows. >> Hi, That modification also imply modifying the template NLS catalog and the translations (or maybe translators should be advised to update their files (I don't know if they are aware of the change)). The patch to C.msg: Index: C.msg =================================================================== RCS file: /home/ncvs/src/lib/libc/nls/C.msg,v retrieving revision 1.1 diff -u -r1.1 C.msg --- C.msg 27 Feb 2005 17:59:39 -0000 1.1 +++ C.msg 12 Oct 2009 10:14:33 -0000 @@ -181,6 +181,16 @@ 87 Attribute not found $ EDOOFUS 88 Programming error +$ EBADMSG +89 Bad message +$ EMULTIHOP +90 Multihop attempted +$ ENOLINK +91 Link has been severed +$ EPROTO +92 Protocol error +$ ENOTCAPABLE +93 Capabilities insufficient $ $ strsignal() support catalog $ Thanks! From brueffer at FreeBSD.org Mon Oct 12 12:21:37 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Mon Oct 12 12:21:44 2009 Subject: svn commit: r197978 - in stable/7/sbin/geom: . class/label class/nop class/part misc Message-ID: <200910121221.n9CCLbX4061260@svn.freebsd.org> Author: brueffer Date: Mon Oct 12 12:21:37 2009 New Revision: 197978 URL: http://svn.freebsd.org/changeset/base/197978 Log: MFC: r197274 Fix the example, -w is the right switch for write failure probability. Modified: stable/7/sbin/geom/ (props changed) stable/7/sbin/geom/class/label/ (props changed) stable/7/sbin/geom/class/nop/gnop.8 stable/7/sbin/geom/class/part/ (props changed) stable/7/sbin/geom/misc/ (props changed) Modified: stable/7/sbin/geom/class/nop/gnop.8 ============================================================================== --- stable/7/sbin/geom/class/nop/gnop.8 Mon Oct 12 10:30:15 2009 (r197977) +++ stable/7/sbin/geom/class/nop/gnop.8 Mon Oct 12 12:21:37 2009 (r197978) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 8, 2006 +.Dd September 17, 2009 .Dt GNOP 8 .Os .Sh NAME @@ -147,9 +147,9 @@ Exit status is 0 on success, and 1 if th .Sh EXAMPLES The following example shows how to create a transparent provider for disk .Pa /dev/da0 -with 50% failure probability, and how to destroy it. +with 50% write failure probability, and how to destroy it. .Bd -literal -offset indent -gnop create -v -f 50 da0 +gnop create -v -w 50 da0 gnop destroy -v da0.nop .Ed .Pp From brueffer at FreeBSD.org Mon Oct 12 12:54:35 2009 From: brueffer at FreeBSD.org (Christian Brueffer) Date: Mon Oct 12 12:54:46 2009 Subject: svn commit: r197979 - in stable/7: lib/libc lib/libc/sys sbin/ipfw Message-ID: <200910121254.n9CCsYag063385@svn.freebsd.org> Author: brueffer Date: Mon Oct 12 12:54:34 2009 New Revision: 197979 URL: http://svn.freebsd.org/changeset/base/197979 Log: MFC: r197312 Fix setfib(1) section number. Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/sys/setfib.2 stable/7/sbin/ipfw/ (props changed) stable/7/sbin/ipfw/ipfw.8 Modified: stable/7/lib/libc/sys/setfib.2 ============================================================================== --- stable/7/lib/libc/sys/setfib.2 Mon Oct 12 12:21:37 2009 (r197978) +++ stable/7/lib/libc/sys/setfib.2 Mon Oct 12 12:54:34 2009 (r197979) @@ -65,8 +65,8 @@ if the argument is greater than the current system maximum. .El .Sh SEE ALSO -.Xr setsockopt 2 , -.Xr setfib 8 +.Xr setfib 1 , +.Xr setsockopt 2 .Sh STANDARDS The .Fn setfib Modified: stable/7/sbin/ipfw/ipfw.8 ============================================================================== --- stable/7/sbin/ipfw/ipfw.8 Mon Oct 12 12:21:37 2009 (r197978) +++ stable/7/sbin/ipfw/ipfw.8 Mon Oct 12 12:54:34 2009 (r197979) @@ -864,7 +864,7 @@ The packet is tagged so as to use the FI .Ar fibnum in any subsequent forwarding decisions. Initially this is limited to the values 0 through 15. See -.Xr setfib 8 . +.Xr setfib 1 . Processing continues at the next rule. .El .Ss RULE BODY From rpaulo at FreeBSD.org Mon Oct 12 14:51:20 2009 From: rpaulo at FreeBSD.org (Rui Paulo) Date: Mon Oct 12 14:51:31 2009 Subject: svn commit: r197980 - head/sbin/ifconfig Message-ID: <200910121451.n9CEpJb4070288@svn.freebsd.org> Author: rpaulo Date: Mon Oct 12 14:51:19 2009 New Revision: 197980 URL: http://svn.freebsd.org/changeset/base/197980 Log: Update for latest 802.11s changes in meshconf format. MFC after: 3 days Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Mon Oct 12 12:54:34 2009 (r197979) +++ head/sbin/ifconfig/ifieee80211.c Mon Oct 12 14:51:19 2009 (r197980) @@ -2624,25 +2624,31 @@ do { \ if (verbose) { const struct ieee80211_meshconf_ie *mconf = (const struct ieee80211_meshconf_ie *)ie; - const uint8_t null[4] = IEEE80211_MESHCONF_NULL; - const uint8_t hwmp[4] = IEEE80211_MESHCONF_HWMP; - const uint8_t airtime[4] = IEEE80211_MESHCONF_AIRTIME; - const uint8_t ccsig[4] = IEEE80211_MESHCONF_CCSIG; - const uint8_t sae[4] = IEEE80211_MESHCONF_SAE; - const uint8_t neighoff[4] = IEEE80211_MESHCONF_SAE; - printf("conf_ver); - MATCHOUI(mconf->conf_pselid, hwmp, "HWMP"); + printf("conf_pselid == IEEE80211_MESHCONF_PATH_HWMP) + printf("HWMP"); + else + printf("UNKNOWN"); printf(" LINK:"); - MATCHOUI(mconf->conf_pmetid, airtime, "AIRTIME"); + if (mconf->conf_pmetid == IEEE80211_MESHCONF_METRIC_AIRTIME) + printf("AIRTIME"); + else + printf("UNKNOWN"); printf(" CONGESTION:"); - MATCHOUI(mconf->conf_ccid, ccsig, "SIG"); - MATCHOUI(mconf->conf_ccid, null, "NULL"); + if (mconf->conf_ccid == IEEE80211_MESHCONF_CC_DISABLED) + printf("DISABLED"); + else + printf("UNKNOWN"); printf(" SYNC:"); - MATCHOUI(mconf->conf_syncid, neighoff, "NEIGHOFF"); - MATCHOUI(mconf->conf_syncid, null, "NULL"); + if (mconf->conf_syncid == IEEE80211_MESHCONF_SYNC_NEIGHOFF) + printf("NEIGHOFF"); + else + printf("UNKNOWN"); printf(" AUTH:"); - MATCHOUI(mconf->conf_authid, sae, "SAE"); - MATCHOUI(mconf->conf_authid, null, "NULL"); + if (mconf->conf_authid == IEEE80211_MESHCONF_AUTH_DISABLED) + printf("DISABLED"); + else + printf("UNKNOWN"); printf(" FORM:0x%x CAPS:0x%x>", mconf->conf_form, mconf->conf_cap); } From attilio at FreeBSD.org Mon Oct 12 15:32:01 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Oct 12 15:32:13 2009 Subject: svn commit: r197981 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern sys Message-ID: <200910121532.n9CFW0QT072702@svn.freebsd.org> Author: attilio Date: Mon Oct 12 15:32:00 2009 New Revision: 197981 URL: http://svn.freebsd.org/changeset/base/197981 Log: MFC r197643, r197735: When releasing a read/shared lock we need to use a write memory barrier in order to avoid, on architectures which doesn't have strong ordered writes, CPU instructions reordering. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/kern_lock.c stable/8/sys/kern/kern_rwlock.c stable/8/sys/kern/kern_sx.c stable/8/sys/sys/rwlock.h stable/8/sys/sys/sx.h Modified: stable/8/sys/kern/kern_lock.c ============================================================================== --- stable/8/sys/kern/kern_lock.c Mon Oct 12 14:51:19 2009 (r197980) +++ stable/8/sys/kern/kern_lock.c Mon Oct 12 15:32:00 2009 (r197981) @@ -238,7 +238,7 @@ wakeupshlk(struct lock *lk, const char * * and return. */ if (LK_SHARERS(x) > 1) { - if (atomic_cmpset_ptr(&lk->lk_lock, x, + if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, x - LK_ONE_SHARER)) break; continue; @@ -251,7 +251,7 @@ wakeupshlk(struct lock *lk, const char * if ((x & LK_ALL_WAITERS) == 0) { MPASS((x & ~LK_EXCLUSIVE_SPINNERS) == LK_SHARERS_LOCK(1)); - if (atomic_cmpset_ptr(&lk->lk_lock, x, LK_UNLOCKED)) + if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, LK_UNLOCKED)) break; continue; } @@ -277,7 +277,7 @@ wakeupshlk(struct lock *lk, const char * queue = SQ_SHARED_QUEUE; } - if (!atomic_cmpset_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x, + if (!atomic_cmpset_rel_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x, v)) { sleepq_release(&lk->lock_object); continue; Modified: stable/8/sys/kern/kern_rwlock.c ============================================================================== --- stable/8/sys/kern/kern_rwlock.c Mon Oct 12 14:51:19 2009 (r197980) +++ stable/8/sys/kern/kern_rwlock.c Mon Oct 12 15:32:00 2009 (r197981) @@ -538,7 +538,7 @@ _rw_runlock(struct rwlock *rw, const cha */ x = rw->rw_lock; if (RW_READERS(x) > 1) { - if (atomic_cmpset_ptr(&rw->rw_lock, x, + if (atomic_cmpset_rel_ptr(&rw->rw_lock, x, x - RW_ONE_READER)) { if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR4(KTR_LOCK, @@ -556,7 +556,8 @@ _rw_runlock(struct rwlock *rw, const cha if (!(x & RW_LOCK_WAITERS)) { MPASS((x & ~RW_LOCK_WRITE_SPINNER) == RW_READERS_LOCK(1)); - if (atomic_cmpset_ptr(&rw->rw_lock, x, RW_UNLOCKED)) { + if (atomic_cmpset_rel_ptr(&rw->rw_lock, x, + RW_UNLOCKED)) { if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p last succeeded", __func__, rw); @@ -594,7 +595,7 @@ _rw_runlock(struct rwlock *rw, const cha x |= (v & RW_LOCK_READ_WAITERS); } else queue = TS_SHARED_QUEUE; - if (!atomic_cmpset_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | v, + if (!atomic_cmpset_rel_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | v, x)) { turnstile_chain_unlock(&rw->lock_object); continue; Modified: stable/8/sys/kern/kern_sx.c ============================================================================== --- stable/8/sys/kern/kern_sx.c Mon Oct 12 14:51:19 2009 (r197980) +++ stable/8/sys/kern/kern_sx.c Mon Oct 12 15:32:00 2009 (r197981) @@ -928,7 +928,7 @@ _sx_sunlock_hard(struct sx *sx, const ch * so, just drop one and return. */ if (SX_SHARERS(x) > 1) { - if (atomic_cmpset_ptr(&sx->sx_lock, x, + if (atomic_cmpset_rel_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER)) { if (LOCK_LOG_TEST(&sx->lock_object, 0)) CTR4(KTR_LOCK, @@ -946,8 +946,8 @@ _sx_sunlock_hard(struct sx *sx, const ch */ if (!(x & SX_LOCK_EXCLUSIVE_WAITERS)) { MPASS(x == SX_SHARERS_LOCK(1)); - if (atomic_cmpset_ptr(&sx->sx_lock, SX_SHARERS_LOCK(1), - SX_LOCK_UNLOCKED)) { + if (atomic_cmpset_rel_ptr(&sx->sx_lock, + SX_SHARERS_LOCK(1), SX_LOCK_UNLOCKED)) { if (LOCK_LOG_TEST(&sx->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p last succeeded", __func__, sx); @@ -970,7 +970,7 @@ _sx_sunlock_hard(struct sx *sx, const ch * Note that the state of the lock could have changed, * so if it fails loop back and retry. */ - if (!atomic_cmpset_ptr(&sx->sx_lock, + if (!atomic_cmpset_rel_ptr(&sx->sx_lock, SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS, SX_LOCK_UNLOCKED)) { sleepq_release(&sx->lock_object); Modified: stable/8/sys/sys/rwlock.h ============================================================================== --- stable/8/sys/sys/rwlock.h Mon Oct 12 14:51:19 2009 (r197980) +++ stable/8/sys/sys/rwlock.h Mon Oct 12 15:32:00 2009 (r197981) @@ -55,13 +55,6 @@ * * When the lock is not locked by any thread, it is encoded as a read lock * with zero waiters. - * - * A note about memory barriers. Write locks need to use the same memory - * barriers as mutexes: _acq when acquiring a write lock and _rel when - * releasing a write lock. Read locks also need to use an _acq barrier when - * acquiring a read lock. However, since read locks do not update any - * locked data (modulo bugs of course), no memory barrier is needed when - * releasing a read lock. */ #define RW_LOCK_READ 0x01 Modified: stable/8/sys/sys/sx.h ============================================================================== --- stable/8/sys/sys/sx.h Mon Oct 12 14:51:19 2009 (r197980) +++ stable/8/sys/sys/sx.h Mon Oct 12 15:32:00 2009 (r197981) @@ -63,13 +63,6 @@ * * When the lock is not locked by any thread, it is encoded as a * shared lock with zero waiters. - * - * A note about memory barriers. Exclusive locks need to use the same - * memory barriers as mutexes: _acq when acquiring an exclusive lock - * and _rel when releasing an exclusive lock. On the other side, - * shared lock needs to use an _acq barrier when acquiring the lock - * but, since they don't update any locked data, no memory barrier is - * needed when releasing a shared lock. */ #define SX_LOCK_SHARED 0x01 @@ -200,7 +193,7 @@ __sx_sunlock(struct sx *sx, const char * uintptr_t x = sx->sx_lock; if (x == (SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS) || - !atomic_cmpset_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER)) + !atomic_cmpset_rel_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER)) _sx_sunlock_hard(sx, file, line); } From rdivacky at FreeBSD.org Mon Oct 12 15:46:18 2009 From: rdivacky at FreeBSD.org (Roman Divacky) Date: Mon Oct 12 15:46:23 2009 Subject: svn commit: r197982 - stable/8/contrib/tcsh Message-ID: <200910121546.n9CFkHYh073466@svn.freebsd.org> Author: rdivacky Date: Mon Oct 12 15:46:17 2009 New Revision: 197982 URL: http://svn.freebsd.org/changeset/base/197982 Log: MFC r197812: Fix tcsh losing history when tcsh terminates because the pty beneath it is closed. Diagnosed by Ted Anderson: New signal queuing logic was introduced in 6.15 and allows the signal handlers to be run explicitly by calling handle_pending_signals, instead of immediately when the signal is delivered. This function is called at various places, typically when receiving a EINTR from a slow system call such as read or write. In the pty exit case, it was called from xwrite, called from flush, while printing the "exit" message after receiving EOF when reading from the pty (note that the read did not return EINTR but zero bytes, indicating EOF). The SIGHUP handler, phup(), called rechist, which opened the history file and began writing the merged history to it. This process invoked flush recursively to actually write the data. In this case, however, the flush noticed it was being called recursively and decided fail by calling stderror. My conclusion was that the signal was being handled at a bad time. But whether to fix flush not to care about the recursive call, or to handle the signal some other time and when to handle it, was unclear to me. However, by adding an extra call to handle_pending_signals, just after process() returns to main(), I was able to avoid the truncated history after network outages and similar failures. I verified this fix in version 6.17. Approved by: re (kib) Modified: stable/8/contrib/tcsh/ (props changed) stable/8/contrib/tcsh/sh.c Modified: stable/8/contrib/tcsh/sh.c ============================================================================== --- stable/8/contrib/tcsh/sh.c Mon Oct 12 15:32:00 2009 (r197981) +++ stable/8/contrib/tcsh/sh.c Mon Oct 12 15:46:17 2009 (r197982) @@ -1291,6 +1291,8 @@ main(int argc, char **argv) /* * Mop-up. */ + /* Take care of these (especially HUP) here instead of inside flush. */ + handle_pending_signals(); if (intty) { if (loginsh) { xprintf("logout\n"); From jkoshy at FreeBSD.org Mon Oct 12 15:49:49 2009 From: jkoshy at FreeBSD.org (Joseph Koshy) Date: Mon Oct 12 15:50:00 2009 Subject: svn commit: r197983 - head/sys/kern Message-ID: <200910121549.n9CFnm9Q073871@svn.freebsd.org> Author: jkoshy Date: Mon Oct 12 15:49:48 2009 New Revision: 197983 URL: http://svn.freebsd.org/changeset/base/197983 Log: Improve the description of sysctl "kern.sugid_coredump". Submitted by: Mel Flynn on -hackers Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Oct 12 15:46:17 2009 (r197982) +++ head/sys/kern/kern_sig.c Mon Oct 12 15:49:48 2009 (r197983) @@ -162,7 +162,7 @@ SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDE int sugid_coredump; SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, - &sugid_coredump, 0, "Enable coredumping set user/group ID processes"); + &sugid_coredump, 0, "Allow setuid and setgid processes to dump core"); static int do_coredump = 1; SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, From attilio at FreeBSD.org Mon Oct 12 15:56:29 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Oct 12 15:56:38 2009 Subject: svn commit: r197984 - in stable/7/sys: . contrib/pf kern sys Message-ID: <200910121556.n9CFuRfq074098@svn.freebsd.org> Author: attilio Date: Mon Oct 12 15:56:27 2009 New Revision: 197984 URL: http://svn.freebsd.org/changeset/base/197984 Log: MFC r1979643: When releasing a read/shared lock we need to use a write memory barrier in order to avoid, on architectures which doesn't have strong ordered writes, CPU instructions reordering. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_rwlock.c stable/7/sys/kern/kern_sx.c stable/7/sys/sys/rwlock.h stable/7/sys/sys/sx.h Modified: stable/7/sys/kern/kern_rwlock.c ============================================================================== --- stable/7/sys/kern/kern_rwlock.c Mon Oct 12 15:49:48 2009 (r197983) +++ stable/7/sys/kern/kern_rwlock.c Mon Oct 12 15:56:27 2009 (r197984) @@ -455,7 +455,7 @@ _rw_runlock(struct rwlock *rw, const cha */ x = rw->rw_lock; if (RW_READERS(x) > 1) { - if (atomic_cmpset_ptr(&rw->rw_lock, x, + if (atomic_cmpset_rel_ptr(&rw->rw_lock, x, x - RW_ONE_READER)) { if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR4(KTR_LOCK, @@ -492,8 +492,8 @@ _rw_runlock(struct rwlock *rw, const cha * to the multiple read locks case. */ MPASS(x == RW_READERS_LOCK(1)); - if (atomic_cmpset_ptr(&rw->rw_lock, RW_READERS_LOCK(1), - RW_UNLOCKED)) { + if (atomic_cmpset_rel_ptr(&rw->rw_lock, + RW_READERS_LOCK(1), RW_UNLOCKED)) { if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p last succeeded", __func__, rw); @@ -530,7 +530,7 @@ _rw_runlock(struct rwlock *rw, const cha * acquired a read lock, so drop the turnstile lock and * restart. */ - if (!atomic_cmpset_ptr(&rw->rw_lock, + if (!atomic_cmpset_rel_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | RW_LOCK_WRITE_WAITERS, RW_UNLOCKED)) { turnstile_chain_unlock(&rw->lock_object); continue; Modified: stable/7/sys/kern/kern_sx.c ============================================================================== --- stable/7/sys/kern/kern_sx.c Mon Oct 12 15:49:48 2009 (r197983) +++ stable/7/sys/kern/kern_sx.c Mon Oct 12 15:56:27 2009 (r197984) @@ -829,7 +829,7 @@ _sx_sunlock_hard(struct sx *sx, const ch * so, just drop one and return. */ if (SX_SHARERS(x) > 1) { - if (atomic_cmpset_ptr(&sx->sx_lock, x, + if (atomic_cmpset_rel_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER)) { if (LOCK_LOG_TEST(&sx->lock_object, 0)) CTR4(KTR_LOCK, @@ -847,8 +847,8 @@ _sx_sunlock_hard(struct sx *sx, const ch */ if (!(x & SX_LOCK_EXCLUSIVE_WAITERS)) { MPASS(x == SX_SHARERS_LOCK(1)); - if (atomic_cmpset_ptr(&sx->sx_lock, SX_SHARERS_LOCK(1), - SX_LOCK_UNLOCKED)) { + if (atomic_cmpset_rel_ptr(&sx->sx_lock, + SX_SHARERS_LOCK(1), SX_LOCK_UNLOCKED)) { if (LOCK_LOG_TEST(&sx->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p last succeeded", __func__, sx); @@ -871,7 +871,7 @@ _sx_sunlock_hard(struct sx *sx, const ch * Note that the state of the lock could have changed, * so if it fails loop back and retry. */ - if (!atomic_cmpset_ptr(&sx->sx_lock, + if (!atomic_cmpset_rel_ptr(&sx->sx_lock, SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS, SX_LOCK_UNLOCKED)) { sleepq_release(&sx->lock_object); Modified: stable/7/sys/sys/rwlock.h ============================================================================== --- stable/7/sys/sys/rwlock.h Mon Oct 12 15:49:48 2009 (r197983) +++ stable/7/sys/sys/rwlock.h Mon Oct 12 15:56:27 2009 (r197984) @@ -54,13 +54,6 @@ * * When the lock is not locked by any thread, it is encoded as a read lock * with zero waiters. - * - * A note about memory barriers. Write locks need to use the same memory - * barriers as mutexes: _acq when acquiring a write lock and _rel when - * releasing a write lock. Read locks also need to use an _acq barrier when - * acquiring a read lock. However, since read locks do not update any - * locked data (modulo bugs of course), no memory barrier is needed when - * releasing a read lock. */ #define RW_LOCK_READ 0x01 Modified: stable/7/sys/sys/sx.h ============================================================================== --- stable/7/sys/sys/sx.h Mon Oct 12 15:49:48 2009 (r197983) +++ stable/7/sys/sys/sx.h Mon Oct 12 15:56:27 2009 (r197984) @@ -62,13 +62,6 @@ * * When the lock is not locked by any thread, it is encoded as a * shared lock with zero waiters. - * - * A note about memory barriers. Exclusive locks need to use the same - * memory barriers as mutexes: _acq when acquiring an exclusive lock - * and _rel when releasing an exclusive lock. On the other side, - * shared lock needs to use an _acq barrier when acquiring the lock - * but, since they don't update any locked data, no memory barrier is - * needed when releasing a shared lock. */ #define SX_LOCK_SHARED 0x01 @@ -201,7 +194,7 @@ __sx_sunlock(struct sx *sx, const char * uintptr_t x = sx->sx_lock; if (x == (SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS) || - !atomic_cmpset_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER)) + !atomic_cmpset_rel_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER)) _sx_sunlock_hard(sx, file, line); } From attilio at FreeBSD.org Mon Oct 12 16:05:31 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Oct 12 16:05:38 2009 Subject: svn commit: r197985 - in stable/8/sys: . amd64/include amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/include Message-ID: <200910121605.n9CG5Vhw074679@svn.freebsd.org> Author: attilio Date: Mon Oct 12 16:05:31 2009 New Revision: 197985 URL: http://svn.freebsd.org/changeset/base/197985 Log: MFC r197803, r197824, r197910: Per their definition, atomic instructions used in conjuction with memory barriers should also ensure that the compiler doesn't reorder paths where they are used. GCC, however, does that aggressively, even in presence of volatile operands. The most reliable way GCC offers for avoid instructions reordering is clobbering "memory". Not all our memory barriers, right now, clobber memory for GCC-like compilers. Fix these cases. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/atomic.h stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/i386/include/atomic.h Modified: stable/8/sys/amd64/include/atomic.h ============================================================================== --- stable/8/sys/amd64/include/atomic.h Mon Oct 12 15:56:27 2009 (r197984) +++ stable/8/sys/amd64/include/atomic.h Mon Oct 12 16:05:31 2009 (r197985) @@ -32,9 +32,9 @@ #error this file needs sys/cdefs.h as a prerequisite #endif -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") +#define mb() __asm __volatile("mfence;" : : : "memory") +#define wmb() __asm __volatile("sfence;" : : : "memory") +#define rmb() __asm __volatile("lfence;" : : : "memory") /* * Various simple operations on memory, each of which is atomic in the @@ -73,7 +73,8 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src); @@ -97,8 +98,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -108,6 +110,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -205,18 +216,23 @@ atomic_fetchadd_long(volatile u_long *p, * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile ("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile ("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -247,7 +263,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -327,44 +344,43 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int #define atomic_cmpset_acq_int atomic_cmpset_int #define atomic_cmpset_rel_int atomic_cmpset_int -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long Modified: stable/8/sys/i386/include/atomic.h ============================================================================== --- stable/8/sys/i386/include/atomic.h Mon Oct 12 15:56:27 2009 (r197984) +++ stable/8/sys/i386/include/atomic.h Mon Oct 12 16:05:31 2009 (r197985) @@ -73,7 +73,8 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); @@ -95,8 +96,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -106,6 +108,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -194,18 +205,23 @@ atomic_fetchadd_int(volatile u_int *p, u * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -236,7 +252,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -331,44 +348,43 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int #define atomic_cmpset_acq_int atomic_cmpset_int #define atomic_cmpset_rel_int atomic_cmpset_int -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long From attilio at FreeBSD.org Mon Oct 12 16:11:25 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Oct 12 16:11:37 2009 Subject: svn commit: r197986 - in stable/7/sys: . amd64/include contrib/pf i386/include Message-ID: <200910121611.n9CGBPdF075255@svn.freebsd.org> Author: attilio Date: Mon Oct 12 16:11:25 2009 New Revision: 197986 URL: http://svn.freebsd.org/changeset/base/197986 Log: MFC r197803, r197824, r197910: Per their definition, atomic instructions used in conjuction with memory barriers should also ensure that the compiler doesn't reorder paths where they are used. GCC, however, does that aggressively, even in presence of volatile operands. The most reliable way GCC offers for avoid instructions reordering is clobbering "memory". Not all our memory barriers, right now, clobber memory for GCC-like compilers. Fix these cases. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/include/atomic.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/include/atomic.h Modified: stable/7/sys/amd64/include/atomic.h ============================================================================== --- stable/7/sys/amd64/include/atomic.h Mon Oct 12 16:05:31 2009 (r197985) +++ stable/7/sys/amd64/include/atomic.h Mon Oct 12 16:11:25 2009 (r197986) @@ -69,7 +69,8 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src); @@ -93,8 +94,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -104,6 +106,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -201,18 +212,23 @@ atomic_fetchadd_long(volatile u_long *p, * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile ("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile ("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -243,7 +259,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -323,44 +340,43 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int #define atomic_cmpset_acq_int atomic_cmpset_int #define atomic_cmpset_rel_int atomic_cmpset_int -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long Modified: stable/7/sys/i386/include/atomic.h ============================================================================== --- stable/7/sys/i386/include/atomic.h Mon Oct 12 16:05:31 2009 (r197985) +++ stable/7/sys/i386/include/atomic.h Mon Oct 12 16:11:25 2009 (r197986) @@ -69,7 +69,8 @@ */ #if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM) #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ -void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ +void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); @@ -91,8 +92,9 @@ void atomic_store_rel_##TYPE(volatile u #endif /* - * The assembly is volatilized to demark potential before-and-after side - * effects if an interrupt or SMP collision were to occur. + * The assembly is volatilized to avoid code chunk removal by the compiler. + * GCC aggressively reorders operations and memory clobbering is necessary + * in order to avoid that for memory barriers. */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ static __inline void \ @@ -102,6 +104,15 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE : "=m" (*p) \ : CONS (V), "m" (*p)); \ } \ + \ +static __inline void \ +atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile(MPLOCKED OP \ + : "=m" (*p) \ + : CONS (V), "m" (*p) \ + : "memory"); \ +} \ struct __hack /* @@ -190,18 +201,23 @@ atomic_fetchadd_int(volatile u_int *p, u * PentiumPro or higher, reads may pass writes, so for that case we have * to use a serializing instruction (i.e. with LOCK) to do the load in * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we don't need any memory barriers. + * is always consistent, so we only need to take care of compiler. */ #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ - return (*p); \ + u_##TYPE tmp; \ + \ + tmp = *p; \ + __asm __volatile("" : : : "memory"); \ + return (tmp); \ } \ \ static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ + __asm __volatile("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -232,7 +248,8 @@ atomic_store_rel_##TYPE(volatile u_##TYP __asm __volatile(SOP \ : "=m" (*p), /* 0 */ \ "+r" (v) /* 1 */ \ - : "m" (*p)); /* 2 */ \ + : "m" (*p) /* 2 */ \ + : "memory"); \ } \ struct __hack @@ -327,44 +344,43 @@ u_long atomic_readandclear_long(volatile #endif /* __GNUCLIKE_ASM */ -/* Acquire and release variants are identical to the normal ones. */ -#define atomic_set_acq_char atomic_set_char -#define atomic_set_rel_char atomic_set_char -#define atomic_clear_acq_char atomic_clear_char -#define atomic_clear_rel_char atomic_clear_char -#define atomic_add_acq_char atomic_add_char -#define atomic_add_rel_char atomic_add_char -#define atomic_subtract_acq_char atomic_subtract_char -#define atomic_subtract_rel_char atomic_subtract_char - -#define atomic_set_acq_short atomic_set_short -#define atomic_set_rel_short atomic_set_short -#define atomic_clear_acq_short atomic_clear_short -#define atomic_clear_rel_short atomic_clear_short -#define atomic_add_acq_short atomic_add_short -#define atomic_add_rel_short atomic_add_short -#define atomic_subtract_acq_short atomic_subtract_short -#define atomic_subtract_rel_short atomic_subtract_short - -#define atomic_set_acq_int atomic_set_int -#define atomic_set_rel_int atomic_set_int -#define atomic_clear_acq_int atomic_clear_int -#define atomic_clear_rel_int atomic_clear_int -#define atomic_add_acq_int atomic_add_int -#define atomic_add_rel_int atomic_add_int -#define atomic_subtract_acq_int atomic_subtract_int -#define atomic_subtract_rel_int atomic_subtract_int +#define atomic_set_acq_char atomic_set_barr_char +#define atomic_set_rel_char atomic_set_barr_char +#define atomic_clear_acq_char atomic_clear_barr_char +#define atomic_clear_rel_char atomic_clear_barr_char +#define atomic_add_acq_char atomic_add_barr_char +#define atomic_add_rel_char atomic_add_barr_char +#define atomic_subtract_acq_char atomic_subtract_barr_char +#define atomic_subtract_rel_char atomic_subtract_barr_char + +#define atomic_set_acq_short atomic_set_barr_short +#define atomic_set_rel_short atomic_set_barr_short +#define atomic_clear_acq_short atomic_clear_barr_short +#define atomic_clear_rel_short atomic_clear_barr_short +#define atomic_add_acq_short atomic_add_barr_short +#define atomic_add_rel_short atomic_add_barr_short +#define atomic_subtract_acq_short atomic_subtract_barr_short +#define atomic_subtract_rel_short atomic_subtract_barr_short + +#define atomic_set_acq_int atomic_set_barr_int +#define atomic_set_rel_int atomic_set_barr_int +#define atomic_clear_acq_int atomic_clear_barr_int +#define atomic_clear_rel_int atomic_clear_barr_int +#define atomic_add_acq_int atomic_add_barr_int +#define atomic_add_rel_int atomic_add_barr_int +#define atomic_subtract_acq_int atomic_subtract_barr_int +#define atomic_subtract_rel_int atomic_subtract_barr_int #define atomic_cmpset_acq_int atomic_cmpset_int #define atomic_cmpset_rel_int atomic_cmpset_int -#define atomic_set_acq_long atomic_set_long -#define atomic_set_rel_long atomic_set_long -#define atomic_clear_acq_long atomic_clear_long -#define atomic_clear_rel_long atomic_clear_long -#define atomic_add_acq_long atomic_add_long -#define atomic_add_rel_long atomic_add_long -#define atomic_subtract_acq_long atomic_subtract_long -#define atomic_subtract_rel_long atomic_subtract_long +#define atomic_set_acq_long atomic_set_barr_long +#define atomic_set_rel_long atomic_set_barr_long +#define atomic_clear_acq_long atomic_clear_barr_long +#define atomic_clear_rel_long atomic_clear_barr_long +#define atomic_add_acq_long atomic_add_barr_long +#define atomic_add_rel_long atomic_add_barr_long +#define atomic_subtract_acq_long atomic_subtract_barr_long +#define atomic_subtract_rel_long atomic_subtract_barr_long #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long From bland at FreeBSD.org Mon Oct 12 17:10:51 2009 From: bland at FreeBSD.org (Alexander Nedotsukov) Date: Mon Oct 12 17:10:57 2009 Subject: svn commit: r197995 - in head/kerberos5/lib: libgssapi_krb5 libgssapi_spnego Message-ID: <200910121710.n9CHApOl078521@svn.freebsd.org> Author: bland (ports committer) Date: Mon Oct 12 17:10:51 2009 New Revision: 197995 URL: http://svn.freebsd.org/changeset/base/197995 Log: Link GSS mechanics modules against libgssapi so they will not fail due unresolved symbol errors when in turn libgssapi was loaded with RTLD_LOCAL flag set (which is the default). Reviewed by: dfr, jhb MFC after: 3 days Modified: head/kerberos5/lib/libgssapi_krb5/Makefile head/kerberos5/lib/libgssapi_spnego/Makefile Modified: head/kerberos5/lib/libgssapi_krb5/Makefile ============================================================================== --- head/kerberos5/lib/libgssapi_krb5/Makefile Mon Oct 12 17:09:35 2009 (r197994) +++ head/kerberos5/lib/libgssapi_krb5/Makefile Mon Oct 12 17:10:51 2009 (r197995) @@ -2,8 +2,8 @@ LIB= gssapi_krb5 LDFLAGS= -Wl,-Bsymbolic -LDADD= -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt -DPADD= ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ +LDADD= -lgssapi -lkrb5 -lhx509 -lcrypto -lroken -lasn1 -lcom_err -lcrypt +DPADD= ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBCRYPTO} ${LIBROKEN} ${LIBASN1} \ ${LIBCOM_ERR} ${LIBCRYPT} INCS= ${KRB5DIR}/lib/gssapi/gssapi/gssapi_krb5.h Modified: head/kerberos5/lib/libgssapi_spnego/Makefile ============================================================================== --- head/kerberos5/lib/libgssapi_spnego/Makefile Mon Oct 12 17:09:35 2009 (r197994) +++ head/kerberos5/lib/libgssapi_spnego/Makefile Mon Oct 12 17:10:51 2009 (r197995) @@ -2,8 +2,8 @@ LIB= gssapi_spnego LDFLAGS= -Wl,-Bsymbolic -LDADD= -lasn1 -DPADD= ${LIBASN1} +LDADD= -lgssapi -lasn1 +DPADD= ${LIBGSSAPI} ${LIBASN1} SRCS= accept_sec_context.c \ compat.c \ From rmacklem at uoguelph.ca Mon Oct 12 17:45:28 2009 From: rmacklem at uoguelph.ca (Rick Macklem) Date: Mon Oct 12 17:45:35 2009 Subject: svn commit: r197995 - in head/kerberos5/lib: libgssapi_krb5 libgssapi_spnego In-Reply-To: <200910121710.n9CHApOl078521@svn.freebsd.org> References: <200910121710.n9CHApOl078521@svn.freebsd.org> Message-ID: On Mon, 12 Oct 2009, Alexander Nedotsukov wrote: > Author: bland (ports committer) > Date: Mon Oct 12 17:10:51 2009 > New Revision: 197995 > URL: http://svn.freebsd.org/changeset/base/197995 > > Log: > Link GSS mechanics modules against libgssapi so they will not fail due > unresolved symbol errors when in turn libgssapi was loaded with RTLD_LOCAL > flag set (which is the default). > Thanks a lot for dealing with this, rick From hrs at FreeBSD.org Mon Oct 12 18:54:03 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Oct 12 18:54:09 2009 Subject: svn commit: r197996 - head/sys/netinet6 Message-ID: <200910121854.n9CIs2hg080743@svn.freebsd.org> Author: hrs Date: Mon Oct 12 18:54:02 2009 New Revision: 197996 URL: http://svn.freebsd.org/changeset/base/197996 Log: - Do not assign a link-local address when ND6_IFF_IFDISABLED. Adding a tentative address is useless. - Comment out a confused warning message when in6_ifattach_linklocal() fails. This can occur when the interface does not support ioctl(SIOCAIFADDR) (interfaces associated with 802.11 wireless network device drivers, for example). Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Mon Oct 12 17:10:51 2009 (r197995) +++ head/sys/netinet6/in6_ifattach.c Mon Oct 12 18:54:02 2009 (r197996) @@ -751,16 +751,19 @@ in6_ifattach(struct ifnet *ifp, struct i * assign a link-local address, if there's none. */ if (ifp->if_type != IFT_BRIDGE && + !(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) { int error; ia = in6ifa_ifpforlinklocal(ifp, 0); if (ia == NULL) { error = in6_ifattach_linklocal(ifp, altifp); +#if 0 if (error) log(LOG_NOTICE, "in6_ifattach_linklocal: " "failed to add a link-local addr to %s\n", if_name(ifp)); +#endif } else ifa_free(&ia->ia_ifa); } From rwatson at FreeBSD.org Mon Oct 12 18:58:43 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 12 18:58:49 2009 Subject: svn commit: r197997 - head/sys/nfsclient Message-ID: <200910121858.n9CIwhCx080881@svn.freebsd.org> Author: rwatson Date: Mon Oct 12 18:58:42 2009 New Revision: 197997 URL: http://svn.freebsd.org/changeset/base/197997 Log: Add a MODULE_DEPEND() on the NFS client from dtnfsclient so that dtnfsclient can access NFS client symbols. MFC after: 3 days Discussed with: kib Reported by: markm Modified: head/sys/nfsclient/nfs_kdtrace.c Modified: head/sys/nfsclient/nfs_kdtrace.c ============================================================================== --- head/sys/nfsclient/nfs_kdtrace.c Mon Oct 12 18:54:02 2009 (r197996) +++ head/sys/nfsclient/nfs_kdtrace.c Mon Oct 12 18:58:42 2009 (r197997) @@ -543,3 +543,4 @@ DEV_MODULE(dtnfsclient, dtnfsclient_mode MODULE_VERSION(dtnfsclient, 1); MODULE_DEPEND(dtnfsclient, dtrace, 1, 1, 1); MODULE_DEPEND(dtnfsclient, opensolaris, 1, 1, 1); +MODULE_DEPEND(dtnfsclient, nfs, 1, 1, 1); From rwatson at FreeBSD.org Mon Oct 12 18:59:32 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Mon Oct 12 18:59:44 2009 Subject: svn commit: r197998 - head/sys/modules/nfsclient Message-ID: <200910121859.n9CIxVfa080932@svn.freebsd.org> Author: rwatson Date: Mon Oct 12 18:59:31 2009 New Revision: 197998 URL: http://svn.freebsd.org/changeset/base/197998 Log: Export DTrace symbols from nfsclient so that dtnfsclient can get to them. This fixes DTrace with nfsclient built as a module. MFC after: 3 days Reported by: markm Modified: head/sys/modules/nfsclient/Makefile Modified: head/sys/modules/nfsclient/Makefile ============================================================================== --- head/sys/modules/nfsclient/Makefile Mon Oct 12 18:58:42 2009 (r197997) +++ head/sys/modules/nfsclient/Makefile Mon Oct 12 18:59:31 2009 (r197998) @@ -41,4 +41,14 @@ NFS_ROOT= 1 SRCS+= nfs_diskless.c .endif +EXPORT_SYMS= \ + dtrace_nfsclient_accesscache_flush_done_probe \ + dtrace_nfsclient_accesscache_get_hit_probe \ + dtrace_nfsclient_accesscache_get_miss_probe \ + dtrace_nfsclient_accesscache_load_done_probe \ + nfsclient_accesscache_flush_done_id \ + nfsclient_accesscache_get_hit_id \ + nfsclient_accesscache_get_miss_id \ + nfsclient_accesscache_load_done_id + .include From hrs at FreeBSD.org Mon Oct 12 19:19:09 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Oct 12 19:19:21 2009 Subject: svn commit: r197999 - head/sys/dev/usb/input Message-ID: <200910121919.n9CJJ9LW083155@svn.freebsd.org> Author: hrs Date: Mon Oct 12 19:19:08 2009 New Revision: 197999 URL: http://svn.freebsd.org/changeset/base/197999 Log: Fix the 106/109 USB Japanese keyboard "underscore" issue. Sun Type 6 USB keyboard support added in rev 1.46 conflicted with some scan codes used in Japanese keyboards because the scan code conversion routine was ambiguous for the overlapped codes. PR: ports/134005 Submitted by: YAMASHIRO Jun Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Mon Oct 12 18:59:31 2009 (r197998) +++ head/sys/dev/usb/input/ukbd.c Mon Oct 12 19:19:08 2009 (r197999) @@ -247,8 +247,8 @@ static const uint8_t ukbd_trtab[256] = { NN, NN, NN, NN, NN, NN, NN, NN, /* 68 - 6F */ NN, NN, NN, NN, 115, 108, 111, 113, /* 70 - 77 */ 109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */ - 121, 120, NN, NN, NN, NN, NN, 115, /* 80 - 87 */ - 112, 125, 121, 123, NN, NN, NN, NN, /* 88 - 8F */ + 121, 120, NN, NN, NN, NN, NN, 123, /* 80 - 87 */ + 124, 125, 126, 127, 128, NN, NN, NN, /* 88 - 8F */ NN, NN, NN, NN, NN, NN, NN, NN, /* 90 - 97 */ NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */ NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */ @@ -1636,20 +1636,59 @@ static int ukbd_key2scan(struct ukbd_softc *sc, int code, int shift, int up) { static const int scan[] = { - 0x1c, 0x1d, 0x35, - 0x37 | SCAN_PREFIX_SHIFT, /* PrintScreen */ - 0x38, 0x47, 0x48, 0x49, 0x4b, 0x4d, 0x4f, - 0x50, 0x51, 0x52, 0x53, - 0x46, /* XXX Pause/Break */ - 0x5b, 0x5c, 0x5d, + /* 89 */ + 0x11c, /* Enter */ + /* 90-99 */ + 0x11d, /* Ctrl-R */ + 0x135, /* Divide */ + 0x137 | SCAN_PREFIX_SHIFT, /* PrintScreen */ + 0x138, /* Alt-R */ + 0x147, /* Home */ + 0x148, /* Up */ + 0x149, /* PageUp */ + 0x14b, /* Left */ + 0x14d, /* Right */ + 0x14f, /* End */ + /* 100-109 */ + 0x150, /* Down */ + 0x151, /* PageDown */ + 0x152, /* Insert */ + 0x153, /* Delete */ + 0x146, /* XXX Pause/Break */ + 0x15b, /* Win_L(Super_L) */ + 0x15c, /* Win_R(Super_R) */ + 0x15d, /* Application(Menu) */ + /* SUN TYPE 6 USB KEYBOARD */ - 0x68, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, - 0x64, 0x65, 0x66, 0x67, 0x25, 0x1f, 0x1e, - 0x20, + 0x168, /* Sun Type 6 Help */ + 0x15e, /* Sun Type 6 Stop */ + /* 110 - 119 */ + 0x15f, /* Sun Type 6 Again */ + 0x160, /* Sun Type 6 Props */ + 0x161, /* Sun Type 6 Undo */ + 0x162, /* Sun Type 6 Front */ + 0x163, /* Sun Type 6 Copy */ + 0x164, /* Sun Type 6 Open */ + 0x165, /* Sun Type 6 Paste */ + 0x166, /* Sun Type 6 Find */ + 0x167, /* Sun Type 6 Cut */ + 0x125, /* Sun Type 6 Mute */ + /* 120 - 128 */ + 0x11f, /* Sun Type 6 VolumeDown */ + 0x11e, /* Sun Type 6 VolumeUp */ + 0x120, /* Sun Type 6 PowerDown */ + + /* Japanese 106/109 keyboard */ + 0x73, /* Keyboard Intl' 1 (backslash / underscore) */ + 0x70, /* Keyboard Intl' 2 (Katakana / Hiragana) */ + 0x7d, /* Keyboard Intl' 3 (Yen sign) (Not using in jp106/109) */ + 0x79, /* Keyboard Intl' 4 (Henkan) */ + 0x7b, /* Keyboard Intl' 5 (Muhenkan) */ + 0x5c, /* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */ }; if ((code >= 89) && (code < (89 + (sizeof(scan) / sizeof(scan[0]))))) { - code = scan[code - 89] | SCAN_PREFIX_E0; + code = scan[code - 89]; } /* Pause/Break */ if ((code == 104) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R)))) { From pjd at FreeBSD.org Mon Oct 12 20:36:55 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Oct 12 20:37:07 2009 Subject: svn commit: r198001 - in stable/8/sys: . amd64/include/xen cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/a... Message-ID: <200910122036.n9CKatDW084962@svn.freebsd.org> Author: pjd Date: Mon Oct 12 20:36:55 2009 New Revision: 198001 URL: http://svn.freebsd.org/changeset/base/198001 Log: MFC r197831,r197842,r197843,r197860,r197861: r197831: Fix situation where Mac OS X NFS client creates a file and when it tries to set ownership and mode in the same setattr operation, the mode was overwritten by secpolicy_vnode_setattr(). PR: kern/118320 Submitted by: Mark Thompson r197842: Fix white-spaces. r197843: On FreeBSD it is enough to report provider removal when orphan event is received, we don't have to do it on every ENXIO error in I/O path. Solaris has no GEOM so they have to handle it in a less clean way. r197860: File system owner is when uid matches and jail matches. r197861: Allow file system owner to modify system flags i