Re: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
on 27/08/2013 02:03 Xin Li said the following: > On 08/26/13 08:35, Andriy Gapon wrote: >> on 26/08/2013 01:15 Jeremie Le Hen said the following: >>> Hi Xin, >>> >>> On Tue, Aug 20, 2013 at 10:31:14PM +, Xin LI wrote: [snip] @@ zfs_rename(vnode_t *sdvp, char *snm, vno if (VOP_REALVP(tdvp, &realvp, ct) == 0) tdvp = realvp; - if (tdvp->v_vfsp != sdvp->v_vfsp || zfsctl_is_node(tdvp)) { + tdzp = VTOZ(tdvp); > >> The problem with this change, at least on FreeBSD, is that tdvp may >> not belong to ZFS. In that case VTOZ(tdvp) does not make any sense >> and would produce garbage or trigger an assert. Previously >> tdvp->v_vfsp != sdvp->v_vfsp check would catch that situations. Two >> side notes: - v_vfsp is actually v_mount on FreeBSD > > Ah that's good point. Any objection in putting a change to their > _freebsd_ counterpart (zfs_freebsd_rename and zfs_freebsd_link) as > attached? I think that at least the change to zfs_freebsd_rename as it is now would break locking and reference counting semantics for the vnodes involved -- vreles and vputs have to be done even in the error case. Also, look at the check at the start of ufs_rename, it also considers tvp when it's not NULL. I am not sure if it is possible to have a situation where fvp and tdvp are from the same fs, but tvp is from a different one. I've been also tempted to place the check in the common code in kern_renameat. That should cover the system calls. But could be insufficient for direct calls to VOP_RENAME in other places. diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index a7cb87a..cfa4d93 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3608,6 +3608,14 @@ kern_renameat(struct thread *td, int oldfd, char *old, int newfd, char *new, error = EINVAL; goto out; } + + /* Check for cross-device rename. */ + if ((fvp->v_mount != tdvp->v_mount) || + (tvp && (fvp->v_mount != tvp->v_mount))) { + error = EXDEV; + goto out; + } + /* * If the source is the same as the destination (that is, if they * are links to the same vnode), then there is nothing to do. >> - VOP_REALVP is a glorified nop on FreeBSD > > It's not clear to me what was the intention for having a macro instead > of just ifdef'ing the code out -- maybe to prevent unwanted conflict > with upstream? These two VOP's are the only consumers of VOP_REALVP > in tree. Yes. Personally I would just ifdef out the calls. >> Another unrelated problem that existed before this change and has >> been noted by Davide Italiano is that sdvp is not locked and so it >> can potentially be recycled before ZFS_ENTER() enter and for that >> reason sdzp and zfsvfs could be invalid. Because sdvp is >> referenced, this problem can currently occur only if a forced >> unmount runs concurrently to zfs_rename. tdvp should be locked and >> thus could be used instead of sdvp as a source for zfsvfs. > > I think this would need more work, I'll take a look after we have this > regression fixed. Thank you. -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
on 27/08/2013 06:41 Jeremie Le Hen said the following: > On Mon, Aug 26, 2013 at 04:03:08PM -0700, Xin Li wrote: >> Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c >> === >> --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c >> (revision 254924) >> +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c >> (working copy) >> @@ -6250,6 +6250,9 @@ zfs_freebsd_rename(ap) >> ASSERT(ap->a_fcnp->cn_flags & (SAVENAME|SAVESTART)); >> ASSERT(ap->a_tcnp->cn_flags & (SAVENAME|SAVESTART)); >> >> +if (fdvp->v_mount != tdvp->v_mount) >> +return (EXDEV); >> + >> error = zfs_rename(fdvp, ap->a_fcnp->cn_nameptr, tdvp, >> ap->a_tcnp->cn_nameptr, ap->a_fcnp->cn_cred, NULL, 0); > > I think this won't work with my setup where the target directory stands on a > nullfs-mounted zfs dataset. I don't know anything about the VFS, but > here is what I see with kgdb(1): > > (kgdb) print *tdvp > $1 = {v_tag = 0x80f5 "null", v_op = 0x81235a80, > v_data = 0xf800adbb5440, v_mount = 0xf80015af5990, v_nmntvnodes > = { > [...] > v_holdcnt = 3, v_usecount = 2, v_iflag = 512, v_vflag = 0, v_writecount > = 0, > v_hash = 4723827, v_type = VDIR} > > (kgdb) print *fdvp > $2 = {v_tag = 0x819a37a5 "zfs", v_op = 0x819b5f80, > v_data = 0xf80023ba3b80, v_mount = 0xf80011eae000, v_nmntvnodes > = { > [...] > v_holdcnt = 4, v_usecount = 2, v_iflag = 512, v_vflag = 0, v_writecount > = 0, > v_hash = 2337681, v_type = VDIR} So what exactly do you think won't work? And why exactly do you think it won't work? > > Also, I got another panic. I don't know if this is the same problem, > but the bottom of the stacktrace is pretty similar though: > > Unread portion of the kernel message buffer: > panic: solaris assert: tx->tx_objset == NULL || dn->dn_objset == > tx->tx_objset, file: > /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c, > line: 818 > cpuid = 1 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2e/frame > 0xfe00e5ccbe50 > kdb_backtrace() at kdb_backtrace+0x54/frame 0xfe00e5ccbf00 > vpanic() at vpanic+0x1bf/frame 0xfe00e5ccbf70 > kproc_shutdown() at kproc_shutdown/frame 0xfe00e5ccbfd0 > assfail() at assfail+0x2c/frame 0xfe00e5ccc000 > dmu_tx_dirty_buf() at dmu_tx_dirty_buf+0xcf/frame 0xfe00e5ccc0b0 > dbuf_dirty() at dbuf_dirty+0xf2/frame 0xfe00e5ccc2a0 > dbuf_will_dirty() at dbuf_will_dirty+0x11a/frame 0xfe00e5ccc2e0 > sa_attr_op() at sa_attr_op+0x2be/frame 0xfe00e5ccc350 > sa_bulk_update_impl() at sa_bulk_update_impl+0x105/frame > 0xfe00e5ccc3b0 > sa_bulk_update() at sa_bulk_update+0x81/frame 0xfe00e5ccc3f0 > zfs_link_create() at zfs_link_create+0x3f6/frame 0xfe00e5ccc5b0 > zfs_rename() at zfs_rename+0xc3c/frame 0xfe00e5ccc6e0 > zfs_freebsd_rename() at zfs_freebsd_rename+0x116/frame 0xfe00e5ccc730 > VOP_RENAME_APV() at VOP_RENAME_APV+0x22e/frame 0xfe00e5ccc790 > VOP_RENAME() at VOP_RENAME+0x69/frame 0xfe00e5ccc810 > kern_renameat() at kern_renameat+0x41e/frame 0xfe00e5ccca30 > kern_rename() at kern_rename+0x33/frame 0xfe00e5ccca60 > sys_rename() at sys_rename+0x2a/frame 0xfe00e5ccca80 > syscallenter() at syscallenter+0x46e/frame 0xfe00e5cccaf0 > amd64_syscall() at amd64_syscall+0x1f/frame 0xfe00e5cccbf0 > Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfe00e5cccbf0 > --- syscall (128, FreeBSD ELF64, sys_rename), rip = 0x80088a40a, rsp = > 0x7fffd0a8, rbp = 0x7fffd790 --- > KDB: enter: panic > > > (kgdb) frame 16 > #16 0x818340ff in dmu_tx_dirty_buf (tx=0xf80008610600, > db=0xf800c1627d20) > at > /usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c:818 > 818 ASSERT(tx->tx_objset == NULL || dn->dn_objset == > tx->tx_objset); > (kgdb) print tx->tx_objset > $3 = (objset_t *) 0xf800046e4000 > (kgdb) print dn->dn_objset > $4 = (struct objset *) 0xf800045fcc00 It may or may not be the same problem. My current guess is that it is not. -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
On Tue, Aug 27, 2013 at 11:01:30AM +0300, Andriy Gapon wrote: > on 27/08/2013 06:41 Jeremie Le Hen said the following: > > On Mon, Aug 26, 2013 at 04:03:08PM -0700, Xin Li wrote: > >> Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > >> === > >> --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > >> (revision 254924) > >> +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > >> (working copy) > >> @@ -6250,6 +6250,9 @@ zfs_freebsd_rename(ap) > >>ASSERT(ap->a_fcnp->cn_flags & (SAVENAME|SAVESTART)); > >>ASSERT(ap->a_tcnp->cn_flags & (SAVENAME|SAVESTART)); > >> > >> + if (fdvp->v_mount != tdvp->v_mount) > >> + return (EXDEV); > >> + > >>error = zfs_rename(fdvp, ap->a_fcnp->cn_nameptr, tdvp, > >>ap->a_tcnp->cn_nameptr, ap->a_fcnp->cn_cred, NULL, 0); > > > > I think this won't work with my setup where the target directory stands on a > > nullfs-mounted zfs dataset. I don't know anything about the VFS, but > > here is what I see with kgdb(1): > > > > (kgdb) print *tdvp > > $1 = {v_tag = 0x80f5 "null", v_op = 0x81235a80, > > v_data = 0xf800adbb5440, v_mount = 0xf80015af5990, > > v_nmntvnodes = { > > [...] > > v_holdcnt = 3, v_usecount = 2, v_iflag = 512, v_vflag = 0, > > v_writecount = 0, > > v_hash = 4723827, v_type = VDIR} > > > > (kgdb) print *fdvp > > $2 = {v_tag = 0x819a37a5 "zfs", v_op = 0x819b5f80, > > v_data = 0xf80023ba3b80, v_mount = 0xf80011eae000, > > v_nmntvnodes = { > > [...] > > v_holdcnt = 4, v_usecount = 2, v_iflag = 512, v_vflag = 0, > > v_writecount = 0, > > v_hash = 2337681, v_type = VDIR} > > > So what exactly do you think won't work? > And why exactly do you think it won't work? My naive reading of this was that fdvp->v_mount != tdvp->v_mount in my case, so rename(2) will return EXDEV and mv(1) will fail. But glancing at mv(1)'s source it seems it will catch it. So that's probably fine. Sorry for the noise. -- Jeremie Le Hen Scientists say the world is made up of Protons, Neutrons and Electrons. They forgot to mention Morons. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
On Tue, Aug 27, 2013 at 10:00 AM, Andriy Gapon wrote: > on 27/08/2013 02:03 Xin Li said the following: >> On 08/26/13 08:35, Andriy Gapon wrote: >>> on 26/08/2013 01:15 Jeremie Le Hen said the following: Hi Xin, On Tue, Aug 20, 2013 at 10:31:14PM +, Xin LI wrote: > [snip] > @@ zfs_rename(vnode_t *sdvp, char *snm, vno if > (VOP_REALVP(tdvp, &realvp, ct) == 0) tdvp = realvp; > > - if (tdvp->v_vfsp != sdvp->v_vfsp || zfsctl_is_node(tdvp)) { + > tdzp = VTOZ(tdvp); >> >>> The problem with this change, at least on FreeBSD, is that tdvp may >>> not belong to ZFS. In that case VTOZ(tdvp) does not make any sense >>> and would produce garbage or trigger an assert. Previously >>> tdvp->v_vfsp != sdvp->v_vfsp check would catch that situations. Two >>> side notes: - v_vfsp is actually v_mount on FreeBSD >> >> Ah that's good point. Any objection in putting a change to their >> _freebsd_ counterpart (zfs_freebsd_rename and zfs_freebsd_link) as >> attached? > > I think that at least the change to zfs_freebsd_rename as it is now would > break > locking and reference counting semantics for the vnodes involved -- vreles and > vputs have to be done even in the error case. > > Also, look at the check at the start of ufs_rename, it also considers tvp when > it's not NULL. I am not sure if it is possible to have a situation where fvp > and tdvp are from the same fs, but tvp is from a different one. > > I've been also tempted to place the check in the common code in kern_renameat. > That should cover the system calls. But could be insufficient for direct > calls > to VOP_RENAME in other places. > > diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c > index a7cb87a..cfa4d93 100644 > --- a/sys/kern/vfs_syscalls.c > +++ b/sys/kern/vfs_syscalls.c > @@ -3608,6 +3608,14 @@ kern_renameat(struct thread *td, int oldfd, char *old, > int newfd, char *new, > error = EINVAL; > goto out; > } > + > + /* Check for cross-device rename. */ > + if ((fvp->v_mount != tdvp->v_mount) || > + (tvp && (fvp->v_mount != tvp->v_mount))) { > + error = EXDEV; > + goto out; > + } > + > /* > * If the source is the same as the destination (that is, if they > * are links to the same vnode), then there is nothing to do. > >>> - VOP_REALVP is a glorified nop on FreeBSD >> >> It's not clear to me what was the intention for having a macro instead >> of just ifdef'ing the code out -- maybe to prevent unwanted conflict >> with upstream? These two VOP's are the only consumers of VOP_REALVP >> in tree. > > Yes. Personally I would just ifdef out the calls. > >>> Another unrelated problem that existed before this change and has >>> been noted by Davide Italiano is that sdvp is not locked and so it >>> can potentially be recycled before ZFS_ENTER() enter and for that >>> reason sdzp and zfsvfs could be invalid. Because sdvp is >>> referenced, this problem can currently occur only if a forced >>> unmount runs concurrently to zfs_rename. tdvp should be locked and >>> thus could be used instead of sdvp as a source for zfsvfs. >> >> I think this would need more work, I'll take a look after we have this >> regression fixed. > > Thank you. > > -- > Andriy Gapon I've written a patch that attempts to fix the second problem. http://people.freebsd.org/~davide/review/zfsrename_recycle.diff The culprit is that we're dereferencing sdvp without the vnode lock held, so data-stability is not guaranteed. tdvp, instead, is locked at the entry point of VOP_RENAME() (at least according to vop_rename_pre()) so it can be safely used. As pointed out by Andriy ZFS has some different mechanisms wrt other file systems that allow the vnode to not be recycled when it's referenced (ZFS_ENTER), so once we get zfsvfs_t * from tdzp we can call ZFS_ENTER and dereference sdvp in a safe manner. Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254955 - head/usr.sbin/rtadvd
Author: hrs Date: Tue Aug 27 11:50:33 2013 New Revision: 254955 URL: http://svnweb.freebsd.org/changeset/base/254955 Log: Fix a crash when reloading the configuration file. Spotted by: des Modified: head/usr.sbin/rtadvd/config.c Modified: head/usr.sbin/rtadvd/config.c == --- head/usr.sbin/rtadvd/config.c Tue Aug 27 06:50:46 2013 (r254954) +++ head/usr.sbin/rtadvd/config.c Tue Aug 27 11:50:33 2013 (r254955) @@ -296,10 +296,8 @@ rm_rainfo(struct rainfo *rai) if (rai->rai_ra_data != NULL) free(rai->rai_ra_data); - while ((pfx = TAILQ_FIRST(&rai->rai_prefix)) != NULL) { - TAILQ_REMOVE(&rai->rai_prefix, pfx, pfx_next); - free(pfx); - } + while ((pfx = TAILQ_FIRST(&rai->rai_prefix)) != NULL) + delete_prefix(pfx); while ((sol = TAILQ_FIRST(&rai->rai_soliciter)) != NULL) { TAILQ_REMOVE(&rai->rai_soliciter, sol, sol_next); free(sol); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254956 - head/sys/net80211
Author: adrian Date: Tue Aug 27 14:37:13 2013 New Revision: 254956 URL: http://svnweb.freebsd.org/changeset/base/254956 Log: Create a new function to complete 802.11 mbuf transmission. The aim of this function is to eventually be the completion entry point for all 802.11 encapsulated mbufs. All the wifi drivers end up doing what is in this function so it's an easy win to turn it into a net80211 method and abstract out this code. Ideally the drivers will all eventually be modified to queue up completed mbufs and call this function with all the driver locks not held. This will allow for some much more interesting software queue handling in the future (like net80211 based A-MSDU, fast-frames, A-MPDU aggregation and retransmission.) Tested: * ath(4), iwn(4) Modified: head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211_output.c == --- head/sys/net80211/ieee80211_output.cTue Aug 27 11:50:33 2013 (r254955) +++ head/sys/net80211/ieee80211_output.cTue Aug 27 14:37:13 2013 (r254956) @@ -3353,3 +3353,34 @@ ieee80211_ff_encap1(struct ieee80211vap mtod(m, struct ether_header *)->ether_type = htons(payload); return m; } + +/* + * Complete an mbuf transmission. + * + * For now, this simply processes a completed frame after the + * driver has completed it's transmission and/or retransmission. + * It assumes the frame is an 802.11 encapsulated frame. + * + * Later on it will grow to become the exit path for a given frame + * from the driver and, depending upon how it's been encapsulated + * and already transmitted, it may end up doing A-MPDU retransmission, + * power save requeuing, etc. + * + * In order for the above to work, the driver entry point to this + * must not hold any driver locks. Thus, the driver needs to delay + * any actual mbuf completion until it can release said locks. + * + * This frees the mbuf and if the mbuf has a node reference, + * the node reference will be freed. + */ +void +ieee80211_tx_complete(struct ieee80211_node *ni, struct mbuf *m, int status) +{ + + if (ni != NULL) { + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, status); + ieee80211_free_node(ni); + } + m_freem(m); +} Modified: head/sys/net80211/ieee80211_proto.h == --- head/sys/net80211/ieee80211_proto.h Tue Aug 27 11:50:33 2013 (r254955) +++ head/sys/net80211/ieee80211_proto.h Tue Aug 27 14:37:13 2013 (r254956) @@ -127,6 +127,8 @@ int ieee80211_send_probereq(struct ieee8 const uint8_t *ssid, size_t ssidlen); struct mbuf * ieee80211_ff_encap1(struct ieee80211vap *, struct mbuf *, const struct ether_header *); +void ieee80211_tx_complete(struct ieee80211_node *, + struct mbuf *, int); /* * The formation of ProbeResponse frames requires guidance to ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254957 - head/sys/dev/ath
Author: adrian Date: Tue Aug 27 14:39:37 2013 New Revision: 254957 URL: http://svnweb.freebsd.org/changeset/base/254957 Log: Use the new ieee80211_tx_complete() function. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Tue Aug 27 14:37:13 2013(r254956) +++ head/sys/dev/ath/if_ath.c Tue Aug 27 14:39:37 2013(r254957) @@ -4581,17 +4581,8 @@ ath_tx_freebuf(struct ath_softc *sc, str /* Free the buffer, it's not needed any longer */ ath_freebuf(sc, bf); - if (ni != NULL) { - /* -* Do any callback and reclaim the node reference. -*/ - if (m0->m_flags & M_TXCB) - ieee80211_process_callback(ni, m0, status); - ieee80211_free_node(ni); - } - - /* Finally, we don't need this mbuf any longer */ - m_freem(m0); + /* Pass the buffer back to net80211 - completing it */ + ieee80211_tx_complete(ni, m0, status); } static struct ath_buf * ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254958 - head/share/mk
Author: dteske Date: Tue Aug 27 14:48:01 2013 New Revision: 254958 URL: http://svnweb.freebsd.org/changeset/base/254958 Log: It was brought to my attention that SVN r252862 was incomplete. It needed to also make this change, to completely deprecate WITH_BSDCONFIG. Modified: head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.own.mk == --- head/share/mk/bsd.own.mkTue Aug 27 14:39:37 2013(r254957) +++ head/share/mk/bsd.own.mkTue Aug 27 14:48:01 2013(r254958) @@ -369,7 +369,6 @@ __DEFAULT_NO_OPTIONS = \ BIND_LIBS \ BIND_SIGCHASE \ BIND_XML \ -BSDCONFIG \ BSD_GREP \ CLANG_EXTRAS \ CTF \ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254959 - head/usr.sbin/crashinfo
Author: gavin Date: Tue Aug 27 15:06:39 2013 New Revision: 254959 URL: http://svnweb.freebsd.org/changeset/base/254959 Log: Allow more space for interface names. MFC after:1 week Modified: head/usr.sbin/crashinfo/crashinfo.sh Modified: head/usr.sbin/crashinfo/crashinfo.sh == --- head/usr.sbin/crashinfo/crashinfo.shTue Aug 27 14:48:01 2013 (r254958) +++ head/usr.sbin/crashinfo/crashinfo.shTue Aug 27 15:06:39 2013 (r254959) @@ -268,9 +268,9 @@ netstat -M $VMCORE -N $KERNEL -m echo echo "" -echo "netstat -id" +echo "netstat -idW" echo -netstat -M $VMCORE -N $KERNEL -id +netstat -M $VMCORE -N $KERNEL -idW echo echo "" ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254960 - in head: contrib/pam_modules/pam_passwdqc lib/libpam/modules/pam_passwdqc
Author: will Date: Tue Aug 27 15:50:26 2013 New Revision: 254960 URL: http://svnweb.freebsd.org/changeset/base/254960 Log: Make the PAM password strength checking module WARNS=2 safe. lib/libpam/modules/pam_passwdqc/Makefile: Bump WARNS to 2. contrib/pam_modules/pam_passwdqc/pam_passwdqc.c: Bump _XOPEN_SOURCE and _XOPEN_VERSION from 500 to 600 so that vsnprint() is declared. Use the two new union types (pam_conv_item_t and pam_text_item_t) to resolve strict aliasing violations caused by casts to comply with the pam_get_item() API taking a "const void **" for all item types. Warnings are generated for casts that create "type puns" (pointers of conflicting sized types that are set to access the same memory location) since these pointers may be used in ways that violate C's strict aliasing rules. Casts to a new type must be performed through a union in order to be compliant, and access must be performed through only one of the union's data types during the lifetime of the union instance. Handle strict-aliasing warnings through pointer assignments, which drastically simplifies this change. Correct a CLANG "printf-like function with more arguments than format" error. Submitted by: gibbs Sponsored by: Spectra Logic Modified: head/contrib/pam_modules/pam_passwdqc/pam_passwdqc.c head/lib/libpam/modules/pam_passwdqc/Makefile Modified: head/contrib/pam_modules/pam_passwdqc/pam_passwdqc.c == --- head/contrib/pam_modules/pam_passwdqc/pam_passwdqc.cTue Aug 27 15:06:39 2013(r254959) +++ head/contrib/pam_modules/pam_passwdqc/pam_passwdqc.cTue Aug 27 15:50:26 2013(r254960) @@ -2,9 +2,9 @@ * Copyright (c) 2000-2002 by Solar Designer. See LICENSE. */ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE_EXTENDED -#define _XOPEN_VERSION 500 +#define _XOPEN_VERSION 600 #include #include #include @@ -132,17 +132,19 @@ static params_t defaults = { static int converse(pam_handle_t *pamh, int style, lo_const char *text, struct pam_response **resp) { - struct pam_conv *conv; + pam_item_t item; + lo_const struct pam_conv *conv; struct pam_message msg, *pmsg; int status; - status = pam_get_item(pamh, PAM_CONV, (pam_item_t *)&conv); + status = pam_get_item(pamh, PAM_CONV, &item); if (status != PAM_SUCCESS) return status; + conv = item; pmsg = &msg; msg.msg_style = style; - msg.msg = text; + msg.msg = (char *)text; *resp = NULL; return conv->conv(1, (lo_const struct pam_message **)&pmsg, resp, @@ -294,8 +296,11 @@ static int parse(params_t *params, pam_h } if (argc) { - say(pamh, PAM_ERROR_MSG, getuid() != 0 ? - MESSAGE_MISCONFIGURED : MESSAGE_INVALID_OPTION, *argv); + if (getuid() != 0) { + say(pamh, PAM_ERROR_MSG, MESSAGE_MISCONFIGURED); + } else { + say(pamh, PAM_ERROR_MSG, MESSAGE_INVALID_OPTION, *argv); + } return PAM_ABORT; } @@ -311,7 +316,9 @@ PAM_EXTERN int pam_sm_chauthtok(pam_hand #ifdef HAVE_SHADOW struct spwd *spw; #endif - char *user, *oldpass, *newpass, *randompass; + pam_item_t item; + lo_const char *user, *oldpass, *curpass; + char *newpass, *randompass; const char *reason; int ask_oldauthtok; int randomonly, enforce, retries_left, retry_wanted; @@ -353,17 +360,19 @@ PAM_EXTERN int pam_sm_chauthtok(pam_hand if (flags & PAM_PRELIM_CHECK) return status; - status = pam_get_item(pamh, PAM_USER, (pam_item_t *)&user); + status = pam_get_item(pamh, PAM_USER, &item); if (status != PAM_SUCCESS) return status; + user = item; - status = pam_get_item(pamh, PAM_OLDAUTHTOK, (pam_item_t *)&oldpass); + status = pam_get_item(pamh, PAM_OLDAUTHTOK, &item); if (status != PAM_SUCCESS) return status; + oldpass = item; if (params.flags & F_NON_UNIX) { pw = &fake_pw; - pw->pw_name = user; + pw->pw_name = (char *)user; pw->pw_gecos = ""; } else { pw = getpwnam(user); @@ -405,13 +414,13 @@ PAM_EXTERN int pam_sm_chauthtok(pam_hand enforce = params.flags & F_ENFORCE_ROOT; if (params.flags & F_USE_AUTHTOK) { - status = pam_get_item(pamh, PAM_AUTHTOK, - (pam_item_t *)&newpass); + status = pam_get_item(pamh, PAM_AUTHTOK, &item); if (status != PAM_SUCCESS) return status; -
svn commit: r254961 - head
Author: dteske Date: Tue Aug 27 16:10:44 2013 New Revision: 254961 URL: http://svnweb.freebsd.org/changeset/base/254961 Log: Add note/reminder about dialog(1) regression in HEAD/10.0-C so that we don't forget about it in the multi-month run of things to fix prior to 10.0-R. Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Tue Aug 27 15:50:26 2013(r254960) +++ head/UPDATING Tue Aug 27 16:10:44 2013(r254961) @@ -31,6 +31,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20130827: +Thomas Dickey (vendor author thereof) reports that dialog(1) since +2011/10/18 has a bug in handling --hline. Testers and I noticed the +--hline is not ignored but displayed as a NULL string, regardless of +value. This will cause confusion in some bsdconfig dialogs where the +--hline is used to inform users which keybindings to use. This will +likewise affect any other persons relying on --hline. It also looks +rather strange seeing "[]" at the bottom of dialog(1) widgets when +passing --hline "anything". Thomas said he will have a look in a few +weeks. NOTE: The "[]" brackets appear with the left-edge where it +would normally appear given the width of text to display, but the +displayed text is not there (part of the bug). + 20130821: The PADLOCK_RNG and RDRAND_RNG kernel options are now devices. Thus "device padlock_rng" and "device rdrand_rng" should be ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254962 - in head: share/man/man5 tools/build/options
Author: dteske Date: Tue Aug 27 16:30:50 2013 New Revision: 254962 URL: http://svnweb.freebsd.org/changeset/base/254962 Log: Formally remove WITH_BSDCONFIG build option and re-generate src.conf.5 NOTE: Should have been inline with revisions 252862 and 254958. Deleted: head/tools/build/options/WITH_BSDCONFIG Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Tue Aug 27 16:10:44 2013 (r254961) +++ head/share/man/man5/src.conf.5 Tue Aug 27 16:30:50 2013 (r254962) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 253304 2013-07-12 23:08:44Z bapt .\" $FreeBSD$ -.Dd August 26, 2013 +.Dd August 27, 2013 .Dt SRC.CONF 5 .Os .Sh NAME @@ -704,9 +704,9 @@ and On amd64, set to not build 32-bit library set and a .Nm ld-elf32.so.1 runtime linker. -.It Va WITHOUT_LIBCPLUSPLUS -.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBCPLUSPLUS 246262 2013-02-02 22:42:46Z dim -Set to avoid building libcxxrt and libc++. +.It Va WITH_LIBCPLUSPLUS +.\" from FreeBSD: head/tools/build/options/WITH_LIBCPLUSPLUS 228082 2011-11-28 17:56:46Z dim +Set to build libcxxrt and libc++. .It Va WITH_LIBICONV_COMPAT .\" from FreeBSD: head/tools/build/options/WITH_LIBICONV_COMPAT 254919 2013-08-26 17:15:56Z antoine Set to build libiconv API and link time compatibility. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254963 - head/sys/net
Author: alfred Date: Tue Aug 27 16:45:00 2013 New Revision: 254963 URL: http://svnweb.freebsd.org/changeset/base/254963 Log: Remove include opt_ofed.h since OFED is unifdef'd. Pointed out by: glebius Modified: head/sys/net/if_llatbl.h Modified: head/sys/net/if_llatbl.h == --- head/sys/net/if_llatbl.hTue Aug 27 16:30:50 2013(r254962) +++ head/sys/net/if_llatbl.hTue Aug 27 16:45:00 2013(r254963) @@ -30,8 +30,6 @@ __FBSDID("$FreeBSD$"); #ifndef_NET_IF_LLATBL_H_ #define_NET_IF_LLATBL_H_ -#include "opt_ofed.h" - #include #include ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254964 - head/sys/amd64/vmm
Author: neel Date: Tue Aug 27 16:49:20 2013 New Revision: 254964 URL: http://svnweb.freebsd.org/changeset/base/254964 Log: Add support for emulating the byte move instruction "mov r/m8, r8". This emulation is required when dumping MMIO space via the ddb "examine" command. Modified: head/sys/amd64/vmm/vmm_instruction_emul.c Modified: head/sys/amd64/vmm/vmm_instruction_emul.c == --- head/sys/amd64/vmm/vmm_instruction_emul.c Tue Aug 27 16:45:00 2013 (r254963) +++ head/sys/amd64/vmm/vmm_instruction_emul.c Tue Aug 27 16:49:20 2013 (r254964) @@ -77,6 +77,10 @@ static const struct vie_op one_byte_opco .op_byte = 0x89, .op_type = VIE_OP_TYPE_MOV, }, + [0x8A] = { + .op_byte = 0x8A, + .op_type = VIE_OP_TYPE_MOV, + }, [0x8B] = { .op_byte = 0x8B, .op_type = VIE_OP_TYPE_MOV, @@ -268,13 +272,18 @@ emulate_mov(void *vm, int vcpuid, uint64 error = memwrite(vm, vcpuid, gpa, val, size, arg); } break; + case 0x8A: case 0x8B: /* * MOV from mem (ModRM:r/m) to reg (ModRM:reg) +* 8A/r:mov r/m8, r8 +* REX + 8A/r: mov r/m8, r8 * 8B/r:mov r32, r/m32 * REX.W 8B/r: mov r64, r/m64 */ - if (vie->rex_w) + if (vie->op.op_byte == 0x8A) + size = 1; + else if (vie->rex_w) size = 8; error = memread(vm, vcpuid, gpa, &val, size, arg); if (error == 0) { @@ -688,7 +697,6 @@ decode_modrm(struct vie *vie) vie->base_register = VM_REG_GUEST_RIP; else vie->base_register = VM_REG_LAST; - } break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254965 - head/usr.sbin/bhyve
Author: neel Date: Tue Aug 27 16:50:48 2013 New Revision: 254965 URL: http://svnweb.freebsd.org/changeset/base/254965 Log: Allow single byte reads of the emulated MSI-X tables. This is not required by the PCI specification but needed to dump MMIO space from "ddb" in the guest. Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c == --- head/usr.sbin/bhyve/pci_emul.c Tue Aug 27 16:49:20 2013 (r254964) +++ head/usr.sbin/bhyve/pci_emul.c Tue Aug 27 16:50:48 2013 (r254965) @@ -245,8 +245,12 @@ pci_emul_msix_tread(struct pci_devinst * int tab_index; uint64_t retval = ~0; - /* support only 4 or 8 byte reads */ - if (size != 4 && size != 8) + /* +* The PCI standard only allows 4 and 8 byte accesses to the MSI-X +* table but we also allow 1 byte access to accomodate reads from +* ddb. +*/ + if (size != 1 && size != 4 && size != 8) return (retval); msix_entry_offset = offset % MSIX_TABLE_ENTRY_SIZE; @@ -263,7 +267,9 @@ pci_emul_msix_tread(struct pci_devinst * dest = (char *)(pi->pi_msix.table + tab_index); dest += msix_entry_offset; - if (size == 4) + if (size == 1) + retval = *((uint8_t *)dest); + else if (size == 4) retval = *((uint32_t *)dest); else retval = *((uint64_t *)dest); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r254963 - head/sys/net
Garrett had posted some patches to get OFED to build as modules. http://lists.freebsd.org/pipermail/freebsd-questions/2013-June/251521.html After these changes (r254823, r254963) and with the patches above, is it possible to build the kernel parts of OFED as modules that would work with GENERIC? Regards, Navdeep On 08/27/13 09:45, Alfred Perlstein wrote: > Author: alfred > Date: Tue Aug 27 16:45:00 2013 > New Revision: 254963 > URL: http://svnweb.freebsd.org/changeset/base/254963 > > Log: > Remove include opt_ofed.h since OFED is unifdef'd. > > Pointed out by: glebius > > Modified: > head/sys/net/if_llatbl.h > > Modified: head/sys/net/if_llatbl.h > == > --- head/sys/net/if_llatbl.h Tue Aug 27 16:30:50 2013(r254962) > +++ head/sys/net/if_llatbl.h Tue Aug 27 16:45:00 2013(r254963) > @@ -30,8 +30,6 @@ __FBSDID("$FreeBSD$"); > #ifndef _NET_IF_LLATBL_H_ > #define _NET_IF_LLATBL_H_ > > -#include "opt_ofed.h" > - > #include > #include > > ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254967 - in head/sys: conf modules/linux
Author: rdivacky Date: Tue Aug 27 18:35:04 2013 New Revision: 254967 URL: http://svnweb.freebsd.org/changeset/base/254967 Log: Assemble linux32_locore.s and ia32_sigtramp.S with clang integrated assembler. Support for .code32 and .code64 in llvm was implemented more than 2 years ago. Tested by: Dan McGregor Modified: head/sys/conf/Makefile.amd64 head/sys/modules/linux/Makefile Modified: head/sys/conf/Makefile.amd64 == --- head/sys/conf/Makefile.amd64Tue Aug 27 18:16:50 2013 (r254966) +++ head/sys/conf/Makefile.amd64Tue Aug 27 18:35:04 2013 (r254967) @@ -41,8 +41,6 @@ MKMODULESENV+= MACHINE=amd64 # XXX: clang integrated-as doesn't grok .codeNN directives yet ASM_CFLAGS.acpi_wakecode.S=${CLANG_NO_IAS} -ASM_CFLAGS.ia32_sigtramp.S=${CLANG_NO_IAS} -ASM_CFLAGS.linux32_locore.s= ${CLANG_NO_IAS} ASM_CFLAGS.mpboot.S= ${CLANG_NO_IAS} ASM_CFLAGS+= ${ASM_CFLAGS.${.IMPSRC:T}} Modified: head/sys/modules/linux/Makefile == --- head/sys/modules/linux/Makefile Tue Aug 27 18:16:50 2013 (r254966) +++ head/sys/modules/linux/Makefile Tue Aug 27 18:35:04 2013 (r254967) @@ -64,7 +64,3 @@ CFLAGS+= -DKTR .endif .include - -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS.linux32_locore.s= ${CLANG_NO_IAS} -CFLAGS+= ${CFLAGS.${.IMPSRC:T}} ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254968 - head/sys/dev/xen/blkfront
Author: cperciva Date: Tue Aug 27 19:10:36 2013 New Revision: 254968 URL: http://svnweb.freebsd.org/changeset/base/254968 Log: Remove duplicate dev.xbd.*.max_requests sysctl added in r252260. Approved by: gibbs Modified: head/sys/dev/xen/blkfront/blkfront.c Modified: head/sys/dev/xen/blkfront/blkfront.c == --- head/sys/dev/xen/blkfront/blkfront.cTue Aug 27 18:35:04 2013 (r254967) +++ head/sys/dev/xen/blkfront/blkfront.cTue Aug 27 19:10:36 2013 (r254968) @@ -878,10 +878,6 @@ xbd_setup_sysctl(struct xbd_softc *xbd) "maximum outstanding requests (negotiated)"); SYSCTL_ADD_UINT(sysctl_ctx, children, OID_AUTO, - "max_requests", CTLFLAG_RD, &xbd->xbd_max_requests, -1, - "maximum outstanding requests (negotiated)"); - - SYSCTL_ADD_UINT(sysctl_ctx, children, OID_AUTO, "max_request_segments", CTLFLAG_RD, &xbd->xbd_max_request_segments, 0, "maximum number of pages per requests (negotiated)"); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254969 - head/lib/msun/src
Author: kargl Date: Tue Aug 27 19:46:56 2013 New Revision: 254969 URL: http://svnweb.freebsd.org/changeset/base/254969 Log: * s_erf.c: . Use integer literal constants instead of double literal constants. * s_erff.c: . Use integer literal constants instead of casting double literal constants to float. . Update the threshold values from those carried over from erf() to values appropriate for float. . New sets of polynomial coefficients for the rational approximations. These coefficients have little, but positive, effect on the maximum error in ULP in the four intervals, but do improve the overall speed of execution. . Remove redundant GET_FLOAT_WORD(ix,x) as hx already contained the contents that is packed into ix. . Update the mask that is used to zero-out lower-order bits in x in the intervals [1.25, 2.857143] and [2.857143, 12]. In tests on amd64, this change improves the maximum error in ULP from 6.27739 and 63.8095 to 3.16774 and 2.92095 on these intervals for erffc(). Reviewed by: bde Modified: head/lib/msun/src/s_erf.c head/lib/msun/src/s_erff.c Modified: head/lib/msun/src/s_erf.c == --- head/lib/msun/src/s_erf.c Tue Aug 27 19:10:36 2013(r254968) +++ head/lib/msun/src/s_erf.c Tue Aug 27 19:46:56 2013(r254969) @@ -201,7 +201,7 @@ erf(double x) if(ix < 0x3feb) { /* |x|<0.84375 */ if(ix < 0x3e30) { /* |x|<2**-28 */ if (ix < 0x0080) - return 0.125*(8.0*x+efx8*x); /*avoid underflow */ + return (8*x+efx8*x)/8; /* avoid spurious underflow */ return x + efx*x; } z = x*x; Modified: head/lib/msun/src/s_erff.c == --- head/lib/msun/src/s_erff.c Tue Aug 27 19:10:36 2013(r254968) +++ head/lib/msun/src/s_erff.c Tue Aug 27 19:46:56 2013(r254969) @@ -24,75 +24,59 @@ tiny= 1e-30, half= 5.00e-01, /* 0x3F00 */ one = 1.00e+00, /* 0x3F80 */ two = 2.00e+00, /* 0x4000 */ - /* c = (subfloat)0.84506291151 */ -erx = 8.4506291151e-01, /* 0x3f58560b */ /* - * Coefficients for approximation to erf on [0,0.84375] + * Coefficients for approximation to erf on [0,0.84375] */ efx = 1.2837916613e-01, /* 0x3e0375d4 */ efx8= 1.0270333290e+00, /* 0x3f8375d4 */ -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ -pp1 = -3.2504209876e-01, /* 0xbea66beb */ -pp2 = -2.8481749818e-02, /* 0xbce9528f */ -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ -qq2 = 6.5022252500e-02, /* 0x3d852a63 */ -qq3 = 5.0813062117e-03, /* 0x3ba68116 */ -qq4 = 1.3249473704e-04, /* 0x390aee49 */ -qq5 = -3.9602282413e-06, /* 0xb684e21a */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Domain [0, 0.84375], range ~[-5.4446e-10,5.5197e-10]: + * |(erf(x) - x)/x - p(x)/q(x)| < 2**-31. */ -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ -pa1 = 4.1485610604e-01, /* 0x3ed46805 */ -pa2 = -3.7220788002e-01, /* 0xbebe9208 */ -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ -qa4 = 1.2617121637e-01, /* 0x3e013307 */ -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ +pp0 = 1.28379166e-01F, /* 0x1.06eba8p-3 */ +pp1 = -3.36030394e-01F, /* -0x1.58185ap-2 */ +pp2 = -1.86260219e-03F, /* -0x1.e8451ep-10 */ +qq1 = 3.12324286e-01F, /* 0x1.3fd1f0p-2 */ +qq2 = 2.16070302e-02F, /* 0x1.620274p-6 */ +qq3 = -1.98859419e-03F, /* -0x1.04a626p-9 */ /* - * Coefficients for approximation to erfc in [1.25,1/0.35] + * Domain [0.84375, 1.25], range ~[-1.953e-11,1.940e-11]: + * |(erf(x) - erx) - p(x)/q(x)| < 2**-36. */ -ra0 = -9.8649440333e-03, /* 0xbc21a093 */ -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ -ra2 = -1.0558626175e+01, /* 0xc128f022 */ -ra3 = -6.2375331879e+01, /* 0xc2798057 */ -ra4 = -1.6239666748e+02, /* 0xc322658c */ -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ -ra6 = -8.1287437439e+01, /* 0xc2a2932b */ -ra7 = -9.8143291473e+00, /* 0xc11d077e */ -sa1 = 1.9651271820e+01, /* 0x419d35ce */ -sa2 = 1.3765776062e+02, /* 0x4309a863 */ -sa3 = 4.3456588745e+02, /* 0x43d9486f */ -sa4 = 6.4538726807e+02, /* 0x442158c9 */ -sa5 = 4.2900814819e+02, /* 0x43d6810b */ -sa6 = 1.0863500214e+02, /* 0x42d9451f */ -sa7 = 6.5702495575e+00, /* 0x40d23f7c */ -sa8 = -6.0424413532e-02, /* 0xbd777f97 */ +erx = 8.42697144e-01F, /* 0x1.af7600p-1. erf(1) rounded to 16 bits. */ +pa0 = 3.649
svn commit: r254970 - head/sys/cam/scsi
Author: ken Date: Tue Aug 27 19:47:03 2013 New Revision: 254970 URL: http://svnweb.freebsd.org/changeset/base/254970 Log: If a drive returns ASC/ASCQ 0x04,0x11 "Logical unit not ready, notify (enable spinup) required", instead of doing the normal retries, poll for a change in status. We will poll every half second for a minute for the status to change. Hitachi drives (and likely other SAS drives) return that ASC/ASCQ when they are waiting to spin up. What it means is that they are waiting for the SAS expander to send them the SAS NOTIFY (ENABLE SPINUP) primitive. That primitive is the mechanism expanders/enclosures use to sequence drive spinup to avoid overloading power supplies. Sponsored by: Spectra Logic MFC after:3 days Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c == --- head/sys/cam/scsi/scsi_all.cTue Aug 27 19:46:56 2013 (r254969) +++ head/sys/cam/scsi/scsi_all.cTue Aug 27 19:47:03 2013 (r254970) @@ -1118,7 +1118,7 @@ static struct asc_table_entry asc_table[ { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x11, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY, "Logical unit not ready, notify (enable spinup) required") }, /*MV */ { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254973 - in head/sys: kern sys
Author: andre Date: Tue Aug 27 20:52:02 2013 New Revision: 254973 URL: http://svnweb.freebsd.org/changeset/base/254973 Log: Pad m_hdr on 32bit architectures to to prevent alignment and padding problems with the way MLEN, MHLEN, and struct mbuf are set up. CTASSERT's are provided to detect such issues at compile time in the future. The #define MLEN and MHLEN calculation do not take actual compiler- induced alignment and padding inside the complete struct mbuf into account. Accordingly appropriate attention is required when changing members of struct mbuf. Ideally one would calculate MLEN as (MSIZE - sizeof(((struct mbuf *)0)->m_hdr) but that doesn't work as the compiler refuses to operate on an as of yet incomplete structure. In particular ARM 32bit has more strict alignment requirements which caused 4 bytes of padding between m_hdr and pkthdr in struct mbuf because of the 64bit members in pkthdr. This wasn't picked up by MLEN and MHLEN causing an overflow of the mbuf provided data storage by overestimating its size. I386 didn't show this problem because it handles unaligned access just fine, albeit at a small performance penalty. On 64bit architectures the struct mbuf layout is 64bit aligned in all places. Reported by: Thomas Skibo Tested by:tuexen, ian, Thomas Skibo (extended patch) Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_mbuf.c == --- head/sys/kern/uipc_mbuf.c Tue Aug 27 20:43:27 2013(r254972) +++ head/sys/kern/uipc_mbuf.c Tue Aug 27 20:52:02 2013(r254973) @@ -85,6 +85,14 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, m_defrag #endif /* + * Ensure the correct size of various mbuf parameters. It could be off due + * to compiler-induced padding and alignment artifacts. + */ +CTASSERT(sizeof(struct mbuf) == MSIZE); +CTASSERT(MSIZE - offsetof(struct mbuf, m_dat) == MLEN); +CTASSERT(MSIZE - offsetof(struct mbuf, m_pktdat) == MHLEN); + +/* * m_get2() allocates minimum mbuf that would fit "size" argument. */ struct mbuf * Modified: head/sys/sys/mbuf.h == --- head/sys/sys/mbuf.h Tue Aug 27 20:43:27 2013(r254972) +++ head/sys/sys/mbuf.h Tue Aug 27 20:52:02 2013(r254973) @@ -53,6 +53,10 @@ * externally and attach it to the mbuf in a way similar to that of mbuf * clusters. * + * NB: These calculation do not take actual compiler-induced alignment and + * padding inside the complete struct mbuf into account. Appropriate + * attention is required when changing members of struct mbuf. + * * MLEN is data length in a normal mbuf. * MHLEN is data length in an mbuf with pktheader. * MINCLSIZE is a smallest amount of data that should be put into cluster. @@ -84,7 +88,7 @@ struct mb_args { /* * Header present at the beginning of every mbuf. - * Size ILP32: 20 + * Size ILP32: 24 * LP64: 32 */ struct m_hdr { @@ -94,6 +98,9 @@ struct m_hdr { int32_t mh_len;/* amount of data in this mbuf */ uint32_t mh_type:8, /* type of data in this mbuf */ mh_flags:24; /* flags; see below */ +#if !defined(__LP64__) + uint32_t mh_pad;/* pad for 64bit alignment */ +#endif }; /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254974 - in head: etc/defaults etc/periodic/monthly etc/periodic/security etc/periodic/weekly share/man/man5
Author: jlh Date: Tue Aug 27 21:20:28 2013 New Revision: 254974 URL: http://svnweb.freebsd.org/changeset/base/254974 Log: Make the period of each periodic security script configurable. There are now six additional variables weekly_status_security_enable weekly_status_security_inline weekly_status_security_output monthly_status_security_enable monthly_status_security_inline monthly_status_security_output alongside their existing daily counterparts. They all have the same default values. All other "daily_status_security_${scriptname}_${whatever}" variables have been renamed to "security_status_${name}_${whatever}". A compatibility shim has been introduced for the old variable names, which we will be able to remove in 11.0-RELEASE. "security_status_${name}_enable" is still a boolean but a new "security_status_${name}_period" allows to define the period of each script. The value is one of "daily" (the default for backward compatibility), "weekly", "monthly" and "NO". Note that when the security periodic scripts are run directly from crontab(5) (as opposed to being called by daily or weekly periodic scripts), they will run unless the test is explicitely disabled with a "NO", either for in the "_enable" or the "_period" variable. When the security output is not inlined, the mail subject has been changed from "$host $arg run output" to "$host $arg $period run output". For instance: myfbsd security run output -> myfbsd security daily run output I don't think this is considered as a stable API, but feel free to correct me if I'm wrong. Finally, I will rearrange periodic.conf(5) and default/periodic.conf to put the security options in their own section. I left them in place for this commit to make reviewing easier. Reviewed by: hackers@ Added: head/etc/periodic/monthly/450.status-security (contents, props changed) head/etc/periodic/weekly/450.status-security (contents, props changed) Modified: head/etc/defaults/periodic.conf head/etc/periodic/security/100.chksetuid head/etc/periodic/security/110.neggrpperm head/etc/periodic/security/200.chkmounts head/etc/periodic/security/300.chkuid0 head/etc/periodic/security/400.passwdless head/etc/periodic/security/410.logincheck head/etc/periodic/security/460.chkportsum head/etc/periodic/security/500.ipfwdenied head/etc/periodic/security/510.ipfdenied head/etc/periodic/security/520.pfdenied head/etc/periodic/security/550.ipfwlimit head/etc/periodic/security/610.ipf6denied head/etc/periodic/security/700.kernelmsg head/etc/periodic/security/800.loginfail head/etc/periodic/security/900.tcpwrap head/etc/periodic/security/security.functions head/etc/periodic/weekly/Makefile head/share/man/man5/periodic.conf.5 Modified: head/etc/defaults/periodic.conf == --- head/etc/defaults/periodic.conf Tue Aug 27 20:52:02 2013 (r254973) +++ head/etc/defaults/periodic.conf Tue Aug 27 21:20:28 2013 (r254974) @@ -128,7 +128,9 @@ daily_status_include_submit_mailq="YES" # 450.status-security daily_status_security_enable="YES" # Security check -# See "Security options" below for more options +# See also "Security options" below for more options +daily_status_security_inline="NO" # Run inline ? +daily_status_security_output="root"# user or /file # 460.status-mail-rejects daily_status_mail_rejects_enable="YES" # Check mail rejects @@ -163,59 +165,78 @@ daily_local="/etc/daily.local" # Loca # Security options # These options are used by the security periodic(8) scripts spawned in -# 450.status-security above. -daily_status_security_inline="NO" # Run inline ? -daily_status_security_output="root"# user or /file -daily_status_security_logdir="/var/log"# Directory for logs -daily_status_security_diff_flags="-b -u" # flags for diff output +# daily and weekly 450.status-security. +security_status_logdir="/var/log" # Directory for logs +security_status_diff_flags="-b -u" # flags for diff output + +# Each of the security_status_*_enable options below can have one of the +# following values: +# - NO +# - daily: only run during the daily security status +# - weekly: only run during the weekly security status # 100.chksetuid -daily_status_security_chksetuid_enable="YES" +security_status_chksetuid_enable="YES" +security_status_chksetuid_period="daily" # 110.neggrpperm -daily_status_security_neggrpperm_enable="YES" +security_status_neggrpperm_enable="YES" +security_status_neggrpperm_period="daily" # 200.chkmounts -daily_status_security_chkmounts_enable="YES" -#daily_status_security_chkmounts_ignore="^amd:"#
svn commit: r254975 - head/etc/periodic/monthly
Author: jlh Date: Tue Aug 27 21:28:12 2013 New Revision: 254975 URL: http://svnweb.freebsd.org/changeset/base/254975 Log: Install 450.status-security. Modified: head/etc/periodic/monthly/Makefile Modified: head/etc/periodic/monthly/Makefile == --- head/etc/periodic/monthly/Makefile Tue Aug 27 21:20:28 2013 (r254974) +++ head/etc/periodic/monthly/Makefile Tue Aug 27 21:28:12 2013 (r254975) @@ -2,7 +2,8 @@ .include -FILES= 999.local +FILES= 450.status-security \ + 999.LOCAL # NB: keep these sorted by MK_* knobs ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254976 - head/sys/dev/qlxgbe
Author: davidcs Date: Tue Aug 27 21:29:21 2013 New Revision: 254976 URL: http://svnweb.freebsd.org/changeset/base/254976 Log: Fix bug in Flash access code Submitted by: David C Somayajulu Modified: head/sys/dev/qlxgbe/ql_misc.c Modified: head/sys/dev/qlxgbe/ql_misc.c == --- head/sys/dev/qlxgbe/ql_misc.c Tue Aug 27 21:28:12 2013 (r254975) +++ head/sys/dev/qlxgbe/ql_misc.c Tue Aug 27 21:29:21 2013 (r254976) @@ -321,7 +321,7 @@ qla_get_fdt(qla_host_t *ha) } while ((count < 1) && (data32 != 0x6)); - if (count == 0 && data32 != 0x6) { + if (data32 != 0x6) { qla_sem_unlock(ha, Q8_FLASH_UNLOCK); device_printf(ha->pci_dev, "%s: Poll Q8_FLASH_STATUS failed\n", @@ -401,7 +401,7 @@ qla_flash_write_enable(qla_host_t *ha, i } while ((count < 1) && (data32 != 0x6)); - if (count == 0 && data32 != 0x6) { + if (data32 != 0x6) { device_printf(ha->pci_dev, "%s: Poll Q8_FLASH_STATUS failed\n", __func__); @@ -432,7 +432,7 @@ qla_erase_flash_sector(qla_host_t *ha, u } while (((count++) < 1000) && (data32 != 0x6)); - if (count == 0 && data32 != 0x6) { + if (data32 != 0x6) { device_printf(ha->pci_dev, "%s: Poll Q8_FLASH_STATUS failed\n", __func__); @@ -479,7 +479,7 @@ qla_erase_flash_sector(qla_host_t *ha, u } while (((count++) < 1000) && (data32 != 0x6)); - if (count == 0 && data32 != 0x6) { + if (data32 != 0x6) { device_printf(ha->pci_dev, "%s: Poll Q8_FLASH_STATUS failed\n", __func__); @@ -575,7 +575,7 @@ qla_wr_flash32(qla_host_t *ha, uint32_t } while ((count < 1) && (data32 != 0x6)); - if (count == 0 && data32 != 0x6) { + if (data32 != 0x6) { device_printf(ha->pci_dev, "%s: Poll Q8_FLASH_STATUS failed\n", __func__); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r254974 - in head: etc/defaults etc/periodic/monthly etc/periodic/security etc/periodic/weekly share/man/man5
On Tue, Aug 27, 2013 at 09:20:29PM +, Jeremie Le Hen wrote: > Author: jlh > Date: Tue Aug 27 21:20:28 2013 > New Revision: 254974 > URL: http://svnweb.freebsd.org/changeset/base/254974 > > Log: > Make the period of each periodic security script configurable. > > There are now six additional variables > weekly_status_security_enable > weekly_status_security_inline > weekly_status_security_output > monthly_status_security_enable > monthly_status_security_inline > monthly_status_security_output > alongside their existing daily counterparts. They all have the same > default values. > > All other "daily_status_security_${scriptname}_${whatever}" > variables have been renamed to "security_status_${name}_${whatever}". > A compatibility shim has been introduced for the old variable names, > which we will be able to remove in 11.0-RELEASE. > > "security_status_${name}_enable" is still a boolean but a new > "security_status_${name}_period" allows to define the period of > each script. The value is one of "daily" (the default for backward > compatibility), "weekly", "monthly" and "NO". > > Note that when the security periodic scripts are run directly from > crontab(5) (as opposed to being called by daily or weekly periodic > scripts), they will run unless the test is explicitely disabled with a > "NO", either for in the "_enable" or the "_period" variable. > > When the security output is not inlined, the mail subject has been > changed from "$host $arg run output" to "$host $arg $period run output". > For instance: > myfbsd security run output -> myfbsd security daily run output > I don't think this is considered as a stable API, but feel free to > correct me if I'm wrong. > > Finally, I will rearrange periodic.conf(5) and default/periodic.conf > to put the security options in their own section. I left them in > place for this commit to make reviewing easier. In summary, just add the following lines to periodic.conf(5) to avoid running those I/O-expensive scripts daily. security_status_chksetuid_period="weekly" security_status_neggrpperm_period="weekly" -- Jeremie Le Hen Scientists say the world is made up of Protons, Neutrons and Electrons. They forgot to mention Morons. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254977 - head/lib/libc/gen
Author: jilles Date: Tue Aug 27 21:47:01 2013 New Revision: 254977 URL: http://svnweb.freebsd.org/changeset/base/254977 Log: wordexp(): Avoid leaking the pipe file descriptors to a parallel fork/exec. This uses the new pipe2() system call added on May 1 (r250159). Modified: head/lib/libc/gen/wordexp.c Modified: head/lib/libc/gen/wordexp.c == --- head/lib/libc/gen/wordexp.c Tue Aug 27 21:29:21 2013(r254976) +++ head/lib/libc/gen/wordexp.c Tue Aug 27 21:47:01 2013(r254977) @@ -121,7 +121,7 @@ we_askshell(const char *words, wordexp_t serrno = errno; - if (pipe(pdes) < 0) + if (pipe2(pdes, O_CLOEXEC) < 0) return (WRDE_NOSPACE); /* XXX */ (void)sigemptyset(&newsigblock); (void)sigaddset(&newsigblock, SIGCHLD); @@ -140,10 +140,10 @@ we_askshell(const char *words, wordexp_t * builtin on `words'. */ (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); - _close(pdes[0]); - if (_dup2(pdes[1], STDOUT_FILENO) < 0) + if ((pdes[1] != STDOUT_FILENO ? + _dup2(pdes[1], STDOUT_FILENO) : + _fcntl(pdes[1], F_SETFD, 0)) < 0) _exit(1); - _close(pdes[1]); execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u", "-c", "eval \"$1\";eval \"wordexp $2\"", "", flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254978 - head/etc/periodic/monthly
Author: jkim Date: Tue Aug 27 22:37:29 2013 New Revision: 254978 URL: http://svnweb.freebsd.org/changeset/base/254978 Log: Fix a typo introduced in r254975. Modified: head/etc/periodic/monthly/Makefile Modified: head/etc/periodic/monthly/Makefile == --- head/etc/periodic/monthly/Makefile Tue Aug 27 21:47:01 2013 (r254977) +++ head/etc/periodic/monthly/Makefile Tue Aug 27 22:37:29 2013 (r254978) @@ -3,7 +3,7 @@ .include FILES= 450.status-security \ - 999.LOCAL + 999.local # NB: keep these sorted by MK_* knobs ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254980 - head/share/mk
Author: sjg Date: Tue Aug 27 23:09:34 2013 New Revision: 254980 URL: http://svnweb.freebsd.org/changeset/base/254980 Log: Use .SHELL to tell bmake to use 'set -e' when running scripts since most FreeBSD makefiles it is in effect. Move the other bmake compatability knobs out of the POSIX block. Reviewed by: obrien Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk == --- head/share/mk/sys.mkTue Aug 27 23:02:20 2013(r254979) +++ head/share/mk/sys.mkTue Aug 27 23:09:34 2013(r254980) @@ -332,12 +332,6 @@ SHELL= ${__MAKE_SHELL} .SHELL: path=${__MAKE_SHELL} .endif -# Tell bmake to expand -V VAR by default -.MAKE.EXPAND_VARIABLES= yes - -# Tell bmake the makefile preference -.MAKE.MAKEFILE_PREFERENCE= BSDmakefile makefile Makefile - .if !defined(.PARSEDIR) # We are not bmake, which is more aggressive about searching .PATH # It is sometime necessary to curb its enthusiasm with .NOPATH @@ -351,4 +345,24 @@ SHELL= ${__MAKE_SHELL} .endif +.if defined(.PARSEDIR) +# Tell bmake to expand -V VAR by default +.MAKE.EXPAND_VARIABLES= yes + +# Tell bmake the makefile preference +.MAKE.MAKEFILE_PREFERENCE= BSDmakefile makefile Makefile + +# By default bmake does *not* use set -e +# when running target scripts, this is a problem for many makefiles here. +# So define a shell that will do what FreeBSD expects. +.ifndef WITHOUT_SHELL_ERRCTL +.SHELL: name=sh \ + quiet="set -" echo="set -v" filter="set -" \ + hasErrCtl=yes check="set -e" ignore="set +e" \ + echoFlag=v errFlag=e \ + path=${__MAKE_SHELL:U/bin/sh} +.endif + +.endif + .include ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254981 - head/share/man/man5
Author: zeising (doc,ports committer) Date: Tue Aug 27 23:30:02 2013 New Revision: 254981 URL: http://svnweb.freebsd.org/changeset/base/254981 Log: Really regen after r254962. This removes the WITH_BSDCONFIG description alltogether, since this option is removed. At the same time, fix the WITHOUT_LIBCPLUSPLUS option that had gotten inverted. Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Tue Aug 27 23:09:34 2013 (r254980) +++ head/share/man/man5/src.conf.5 Tue Aug 27 23:30:02 2013 (r254981) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 253304 2013-07-12 23:08:44Z bapt .\" $FreeBSD$ -.Dd August 27, 2013 +.Dd August 28, 2013 .Dt SRC.CONF 5 .Os .Sh NAME @@ -235,9 +235,6 @@ This option will be removed in due time. .It Va WITHOUT_BOOT .\" from FreeBSD: head/tools/build/options/WITHOUT_BOOT 156932 2006-03-21 07:50:50Z ru Set to not build the boot blocks and loader. -.It Va WITH_BSDCONFIG -.\" from FreeBSD: head/tools/build/options/WITH_BSDCONFIG 238448 2012-07-14 10:17:47Z zeising -Set to install bsdconfig(8), a BSD-licensed configuration/management utility. .It Va WITHOUT_BSD_CPIO .\" from FreeBSD: head/tools/build/options/WITHOUT_BSD_CPIO 179813 2008-06-16 05:48:15Z dougb Set to not build the BSD licensed version of cpio based on @@ -704,9 +701,9 @@ and On amd64, set to not build 32-bit library set and a .Nm ld-elf32.so.1 runtime linker. -.It Va WITH_LIBCPLUSPLUS -.\" from FreeBSD: head/tools/build/options/WITH_LIBCPLUSPLUS 228082 2011-11-28 17:56:46Z dim -Set to build libcxxrt and libc++. +.It Va WITHOUT_LIBCPLUSPLUS +.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBCPLUSPLUS 246262 2013-02-02 22:42:46Z dim +Set to avoid building libcxxrt and libc++. .It Va WITH_LIBICONV_COMPAT .\" from FreeBSD: head/tools/build/options/WITH_LIBICONV_COMPAT 254919 2013-08-26 17:15:56Z antoine Set to build libiconv API and link time compatibility. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254982 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: delphij Date: Wed Aug 28 00:39:47 2013 New Revision: 254982 URL: http://svnweb.freebsd.org/changeset/base/254982 Log: Previously, both zfs_rename and zfs_link does a check on whether the passed vnode belongs to the same mount point (v_vfsp or also known as v_mount in FreeBSD). This check prevents the code from proceeding further on vnodes that do not belong to ZFS, for instance, on UFS or NULLFS. The recent change (merged as r254585) on upstream changes the check of v_vfsp to instead check the znode's z_zfsvfs. On Illumos this would work because when the vnode comes from lofs, the VOP_REALVP() would give the right vnode, this is not true on FreeBSD where our VOP_REALVP is a no-op, and as such tdvp is not guaranteed to be a ZFS vnode, and will later trigger a failed assertion when verifying the vnode. This changeset modifies our local shims (zfs_freebsd_rename and zfs_freebsd_link) to check if v_mount matches before proceeding further. Reported by: many Diagnostic work by: avg 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 Tue Aug 27 23:30:02 2013(r254981) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 28 00:39:47 2013(r254982) @@ -6250,8 +6250,11 @@ zfs_freebsd_rename(ap) ASSERT(ap->a_fcnp->cn_flags & (SAVENAME|SAVESTART)); ASSERT(ap->a_tcnp->cn_flags & (SAVENAME|SAVESTART)); - error = zfs_rename(fdvp, ap->a_fcnp->cn_nameptr, tdvp, - ap->a_tcnp->cn_nameptr, ap->a_fcnp->cn_cred, NULL, 0); + if (fdvp->v_mount == tdvp->v_mount) + error = zfs_rename(fdvp, ap->a_fcnp->cn_nameptr, tdvp, + ap->a_tcnp->cn_nameptr, ap->a_fcnp->cn_cred, NULL, 0); + else + error = EXDEV; if (tdvp == tvp) VN_RELE(tdvp); @@ -6308,10 +6311,15 @@ zfs_freebsd_link(ap) } */ *ap; { struct componentname *cnp = ap->a_cnp; + vnode_t *vp = ap->a_vp; + vnode_t *tdvp = ap->a_tdvp; + + if (tdvp->v_mount != vp->v_mount) + return (EXDEV); ASSERT(cnp->cn_flags & SAVENAME); - return (zfs_link(ap->a_tdvp, ap->a_vp, cnp->cn_nameptr, cnp->cn_cred, NULL, 0)); + return (zfs_link(tdvp, vp, cnp->cn_nameptr, cnp->cn_cred, NULL, 0)); } static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 08/27/13 01:59, Davide Italiano wrote: > On Tue, Aug 27, 2013 at 10:00 AM, Andriy Gapon > wrote: >> on 27/08/2013 02:03 Xin Li said the following: >>> On 08/26/13 08:35, Andriy Gapon wrote: on 26/08/2013 01:15 Jeremie Le Hen said the following: > Hi Xin, > > On Tue, Aug 20, 2013 at 10:31:14PM +, Xin LI wrote: >> [snip] >> @@ zfs_rename(vnode_t *sdvp, char *snm, vno if >> (VOP_REALVP(tdvp, &realvp, ct) == 0) tdvp = realvp; >> >> - if (tdvp->v_vfsp != sdvp->v_vfsp || >> zfsctl_is_node(tdvp)) { + tdzp = VTOZ(tdvp); >>> The problem with this change, at least on FreeBSD, is that tdvp may not belong to ZFS. In that case VTOZ(tdvp) does not make any sense and would produce garbage or trigger an assert. Previously tdvp->v_vfsp != sdvp->v_vfsp check would catch that situations. Two side notes: - v_vfsp is actually v_mount on FreeBSD >>> >>> Ah that's good point. Any objection in putting a change to >>> their _freebsd_ counterpart (zfs_freebsd_rename and >>> zfs_freebsd_link) as attached? >> >> I think that at least the change to zfs_freebsd_rename as it is >> now would break locking and reference counting semantics for the >> vnodes involved -- vreles and vputs have to be done even in the >> error case. >> >> Also, look at the check at the start of ufs_rename, it also >> considers tvp when it's not NULL. I am not sure if it is >> possible to have a situation where fvp and tdvp are from the same >> fs, but tvp is from a different one. >> >> I've been also tempted to place the check in the common code in >> kern_renameat. That should cover the system calls. But could be >> insufficient for direct calls to VOP_RENAME in other places. >> >> diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c >> index a7cb87a..cfa4d93 100644 --- a/sys/kern/vfs_syscalls.c +++ >> b/sys/kern/vfs_syscalls.c @@ -3608,6 +3608,14 @@ >> kern_renameat(struct thread *td, int oldfd, char *old, int newfd, >> char *new, error = EINVAL; goto out; } + + /* Check for >> cross-device rename. */ + if ((fvp->v_mount != >> tdvp->v_mount) || + (tvp && (fvp->v_mount != >> tvp->v_mount))) { + error = EXDEV; + >> goto out; + } + /* * If the source is the same as the >> destination (that is, if they * are links to the same vnode), >> then there is nothing to do. >> - VOP_REALVP is a glorified nop on FreeBSD >>> >>> It's not clear to me what was the intention for having a macro >>> instead of just ifdef'ing the code out -- maybe to prevent >>> unwanted conflict with upstream? These two VOP's are the only >>> consumers of VOP_REALVP in tree. >> >> Yes. Personally I would just ifdef out the calls. >> Another unrelated problem that existed before this change and has been noted by Davide Italiano is that sdvp is not locked and so it can potentially be recycled before ZFS_ENTER() enter and for that reason sdzp and zfsvfs could be invalid. Because sdvp is referenced, this problem can currently occur only if a forced unmount runs concurrently to zfs_rename. tdvp should be locked and thus could be used instead of sdvp as a source for zfsvfs. >>> >>> I think this would need more work, I'll take a look after we >>> have this regression fixed. >> >> Thank you. >> >> -- Andriy Gapon > > I've written a patch that attempts to fix the second problem. > http://people.freebsd.org/~davide/review/zfsrename_recycle.diff The > culprit is that we're dereferencing sdvp without the vnode lock > held, so data-stability is not guaranteed. tdvp, instead, is locked > at the entry point of VOP_RENAME() (at least according to > vop_rename_pre()) so it can be safely used. As pointed out by > Andriy ZFS has some different mechanisms wrt other file systems > that allow the vnode to not be recycled when it's referenced > (ZFS_ENTER), so once we get zfsvfs_t * from tdzp we can call > ZFS_ENTER and dereference sdvp in a safe manner. I'm not sure that this is right. Now we have: tdzp = VTOZ(tdvp); ZFS_VERIFY_ZP(tdzp); zfsvfs = tdzp->z_zfsvfs; ZFS_ENTER(zfsvfs); // tdzp's z_zfsvfs entered zilog = zfsvfs->z_log; sdzp = VTOZ(sdvp); ZFS_VERIFY_ZP(sdzp);// (*) Note that in the (*) step, when sdzp is invalid and sdzp have different z_zfsvfs than tdzp (for instance when the node is in the snapshot directory; the code later would test this), we could end up with ZFS_EXIT()'ing the wrong z_zfsvfs. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.21 (FreeBSD) iQEcBAEBCgAGBQJSHUxBAAoJEG80Jeu8UPuzkzEIAKXlfGuTodrPcPkDkxBhhaOj QoxoT06jFwMTplysICuCpslQNyyG2Jxq654u9nMh6q5dww370eTtm2FJ0n2QTxk4 JeWLpZVUu7VHWNXYVJQqrmATaMFHO4wVf5AYpSHn+1iCWo0kQn1MPxPw/oSUt0yw 1628jhWTs8n+rxQaYrYN6
svn commit: r254983 - head/sys/mips/malta
Author: gonzo Date: Wed Aug 28 01:10:51 2013 New Revision: 254983 URL: http://svnweb.freebsd.org/changeset/base/254983 Log: Fix GT PCI controller driver on big-endian hardware Modified: head/sys/mips/malta/gt_pci.c Modified: head/sys/mips/malta/gt_pci.c == --- head/sys/mips/malta/gt_pci.cWed Aug 28 00:39:47 2013 (r254982) +++ head/sys/mips/malta/gt_pci.cWed Aug 28 01:10:51 2013 (r254983) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -91,6 +92,14 @@ __FBSDID("$FreeBSD$"); #define OCW3_POLL_IRQ(x) ((x) & 0x7f) #define OCW3_POLL_PENDING (1U << 7) +/* + * Galileo controller's registers are LE so convert to then + * to/from native byte order. We rely on boot loader or emulator + * to set "swap bytes" configuration correctly for us + */ +#defineGT_PCI_DATA(v) htole32((v)) +#defineGT_HOST_DATA(v) le32toh((v)) + struct gt_pci_softc; struct gt_pci_intr_cookie { @@ -437,20 +446,20 @@ gt_pci_read_config(device_t dev, u_int b return (uint32_t)(-1); /* Clear cause register bits. */ - GT_REGVAL(GT_INTR_CAUSE) = 0; - - GT_REGVAL(GT_PCI0_CFG_ADDR) = (1 << 31) | addr; - data = GT_REGVAL(GT_PCI0_CFG_DATA); + GT_REGVAL(GT_INTR_CAUSE) = GT_PCI_DATA(0); + GT_REGVAL(GT_PCI0_CFG_ADDR) = GT_PCI_DATA((1 << 31) | addr); + /* +* Galileo system controller is special +*/ + if ((bus == 0) && (slot == 0)) + data = GT_PCI_DATA(GT_REGVAL(GT_PCI0_CFG_DATA)); + else + data = GT_REGVAL(GT_PCI0_CFG_DATA); /* Check for master abort. */ - if (GT_REGVAL(GT_INTR_CAUSE) & (GTIC_MASABORT0 | GTIC_TARABORT0)) + if (GT_HOST_DATA(GT_REGVAL(GT_INTR_CAUSE)) & (GTIC_MASABORT0 | GTIC_TARABORT0)) data = (uint32_t) -1; - /* -* XXX: We assume that words readed from GT chip are BE. -* Should we set the mode explicitly during chip -* Initialization? -*/ switch(reg % 4) { case 3: @@ -507,11 +516,6 @@ gt_pci_write_config(device_t dev, u_int { reg_data = gt_pci_read_config(dev, bus, slot, func, reg, 4); - /* - * XXX: We assume that words readed from GT chip are BE. - * Should we set the mode explicitly during chip - * Initialization? - */ shift = 8 * (reg & 3); switch(bytes) @@ -548,10 +552,23 @@ gt_pci_write_config(device_t dev, u_int return; /* Clear cause register bits. */ - GT_REGVAL(GT_INTR_CAUSE) = 0; + GT_REGVAL(GT_INTR_CAUSE) = GT_PCI_DATA(0); + + GT_REGVAL(GT_PCI0_CFG_ADDR) = GT_PCI_DATA((1 << 31) | addr); + + /* +* Galileo system controller is special +*/ + if ((bus == 0) && (slot == 0)) + GT_REGVAL(GT_PCI0_CFG_DATA) = GT_PCI_DATA(data); + else + GT_REGVAL(GT_PCI0_CFG_DATA) = data; + +#if 0 + printf("PCICONF_WRITE(%02x:%02x.%02x[%04x] -> %02x(%d)\n", + bus, slot, func, reg, data, bytes); +#endif - GT_REGVAL(GT_PCI0_CFG_ADDR) = (1 << 31) | addr; - GT_REGVAL(GT_PCI0_CFG_DATA) = data; } static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r254984 - head/share/man/man5
Author: joel (doc committer) Date: Wed Aug 28 05:12:29 2013 New Revision: 254984 URL: http://svnweb.freebsd.org/changeset/base/254984 Log: mdoc fix Modified: head/share/man/man5/periodic.conf.5 Modified: head/share/man/man5/periodic.conf.5 == --- head/share/man/man5/periodic.conf.5 Wed Aug 28 01:10:51 2013 (r254983) +++ head/share/man/man5/periodic.conf.5 Wed Aug 28 05:12:29 2013 (r254984) @@ -1,4 +1,4 @@ -\"- +.\"- .\" Copyright (c) 2000 Brian Somers .\" All rights reserved. .\" ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"