svn commit: r347243 - head/contrib/llvm/lib/Target/ARM
Author: dim Date: Wed May 8 05:45:00 2019 New Revision: 347243 URL: https://svnweb.freebsd.org/changeset/base/347243 Log: Pull in r360099 from upstream llvm trunk (by Eli Friedman): [ARM] Glue register copies to tail calls. This generally follows what other targets do. I don't completely understand why the special case for tail calls existed in the first place; even when the code was committed in r105413, call lowering didn't work in the way described in the comments. Stack protector lowering breaks if the register copies are not glued to a tail call: we have to insert the stack protector check before the tail call, and we choose the location based on the assumption that all physical register dependencies of a tail call are adjacent to the tail call. (See FindSplitPointForStackProtector.) This is sort of fragile, but I don't see any reason to break that assumption. I'm guessing nobody has seen this before just because it's hard to convince the scheduler to actually schedule the code in a way that breaks; even without the glue, the only computation that could actually be scheduled after the register copies is the computation of the call address, and the scheduler usually prefers to schedule that before the copies anyway. Fixes https://bugs.llvm.org/show_bug.cgi?id=41417 Differential Revision: https://reviews.llvm.org/D60427 This should fix several instances of "Bad machine code: Using an undefined physical register", when compiling ports such as multimedia/vlc, audio/alsa-lib and devel/avro-c for armv6, with -fstack-protector-strong. Reported by: jbeich PR: 237074, 237783, 237784 MFC after:3 days Modified: head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Modified: head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp == --- head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cppWed May 8 03:15:22 2019(r347242) +++ head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cppWed May 8 05:45:00 2019(r347243) @@ -1984,32 +1984,10 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLower // Build a sequence of copy-to-reg nodes chained together with token chain // and flag operands which copy the outgoing args into the appropriate regs. SDValue InFlag; - // Tail call byval lowering might overwrite argument registers so in case of - // tail call optimization the copies to registers are lowered later. - if (!isTailCall) -for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { - Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, - RegsToPass[i].second, InFlag); - InFlag = Chain.getValue(1); -} - - // For tail calls lower the arguments to the 'real' stack slot. - if (isTailCall) { -// Force all the incoming stack arguments to be loaded from the stack -// before any new outgoing arguments are stored to the stack, because the -// outgoing stack slots may alias the incoming argument stack slots, and -// the alias isn't otherwise explicit. This is slightly more conservative -// than necessary, because it means that each store effectively depends -// on every argument instead of just those arguments it would clobber. - -// Do not flag preceding copytoreg stuff together with the following stuff. -InFlag = SDValue(); -for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { - Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, - RegsToPass[i].second, InFlag); - InFlag = Chain.getValue(1); -} -InFlag = SDValue(); + for (unsigned i = 0, e = RegsToPass.size(); i != e; ++i) { +Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].first, + RegsToPass[i].second, InFlag); +InFlag = Chain.getValue(1); } // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347221 - head/sys/net
Hi Marius, This change seems to break LINT-NOIP tinderbox builds; one reference to tcp_lro_free() is covered by #if defined(INET) || defined(INET6), but the one added in iflib_rx_structures_free() is not. On Tue, May 7, 2019 at 1:28 AM Marius Strobl wrote: > > Author: marius > Date: Tue May 7 08:28:35 2019 > New Revision: 347221 > URL: https://svnweb.freebsd.org/changeset/base/347221 > ... > Modified: head/sys/net/iflib.c > == > --- head/sys/net/iflib.cTue May 7 08:14:30 2019(r347220) > +++ head/sys/net/iflib.cTue May 7 08:28:35 2019(r347221) > ... The one below is protected by INET or INET6 define: > @@ -5627,14 +5668,14 @@ iflib_rx_structures_setup(if_ctx_t ctx) > #if defined(INET6) || defined(INET) > fail: > /* > -* Free RX software descriptors allocated so far, we will only handle > +* Free LRO resources allocated so far, we will only handle > * the rings that completed, the failing case will have > -* cleaned up for itself. 'q' failed, so its the terminus. > +* cleaned up for itself. 'q' failed, so its the terminus. > */ > rxq = ctx->ifc_rxqs; > for (i = 0; i < q; ++i, rxq++) { > - iflib_rx_sds_free(rxq); > - rxq->ifr_cq_cidx = 0; > + if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) > + tcp_lro_free(>ifr_lc); <<< > } > return (err); > #endif <<< But the following one is not: > @@ -5649,9 +5690,12 @@ static void > iflib_rx_structures_free(if_ctx_t ctx) > { > iflib_rxq_t rxq = ctx->ifc_rxqs; > + int i; > > - for (int i = 0; i < ctx->ifc_softc_ctx.isc_nrxqsets; i++, rxq++) { > + for (i = 0; i < ctx->ifc_softc_ctx.isc_nrxqsets; i++, rxq++) { > iflib_rx_sds_free(rxq); > + if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) > + tcp_lro_free(>ifr_lc); ^^^ > } > free(ctx->ifc_rxqs, M_IFLIB); > ctx->ifc_rxqs = NULL; This fails to compile on kernels without INET and INET6 (which is something we still support, for reasons I cannot fathom) because netinet/tcp_lro.c is conditional on option inet | inet6 in sys/conf/files. Best, Conrad ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347242 - head/sys/powerpc/ofw
Author: jhibbits Date: Wed May 8 03:15:22 2019 New Revision: 347242 URL: https://svnweb.freebsd.org/changeset/base/347242 Log: powerpc: hide innocuous printf behind bootverbose NUMA associativity, and OFW node existence, is completely optional, and shouldn't warn always. Modified: head/sys/powerpc/ofw/ofw_pcibus.c Modified: head/sys/powerpc/ofw/ofw_pcibus.c == --- head/sys/powerpc/ofw/ofw_pcibus.c Wed May 8 02:32:11 2019 (r347241) +++ head/sys/powerpc/ofw/ofw_pcibus.c Wed May 8 03:15:22 2019 (r347242) @@ -393,7 +393,8 @@ ofw_pcibus_parse_associativity(device_t dev, int *doma int res; if ((node = ofw_bus_get_node(dev)) == -1) { - device_printf(dev, "no ofw node found\n"); + if (bootverbose) + device_printf(dev, "no ofw node found\n"); return (ENXIO); } res = OF_getproplen(node, "ibm,associativity"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347241 - in head: . sbin/ifconfig share/man/man4 sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules sys/modules/if_tap sys/modules/if_tun sys/m...
Author: kevans Date: Wed May 8 02:32:11 2019 New Revision: 347241 URL: https://svnweb.freebsd.org/changeset/base/347241 Log: tun/tap: merge and rename to `tuntap` tun(4) and tap(4) share the same general management interface and have a lot in common. Bugs exist in tap(4) that have been fixed in tun(4), and vice-versa. Let's reduce the maintenance requirements by merging them together and using flags to differentiate between the three interface types (tun, tap, vmnet). This fixes a couple of tap(4)/vmnet(4) issues right out of the gate: - tap devices may no longer be destroyed while they're open [0] - VIMAGE issues already addressed in tun by kp [0] emaste had removed an easy-panic-button in r240938 due to devdrn blocking. A naive glance over this leads me to believe that this isn't quite complete -- destroy_devl will only block while executing d_* functions, but doesn't block the device from being destroyed while a process has it open. The latter is the intent of the condvar in tun, so this is "fixed" (for certain definitions of the word -- it wasn't really broken in tap, it just wasn't quite ideal). ifconfig(8) also grew the ability to map an interface name to a kld, so that `ifconfig {tun,tap}0` can continue to autoload the correct module, and `ifconfig vmnet0 create` will now autoload the correct module. This is a low overhead addition. (MFC commentary) This may get MFC'd if many bugs in tun(4)/tap(4) are discovered after this, and how critical they are. Changes after this are likely easily MFC'd without taking this merge, but the merge will be easier. I have no plans to do this MFC as of now. Reviewed by: bcr (manpages), tuexen (testing, syzkaller/packetdrill) Input also from: melifaro Relnotes: yes Differential Revision:https://reviews.freebsd.org/D20044 Added: head/sys/modules/if_tuntap/ head/sys/modules/if_tuntap/Makefile (contents, props changed) head/sys/net/if_tuntap.c - copied, changed from r347240, head/sys/net/if_tun.c Deleted: head/sys/modules/if_tap/Makefile head/sys/modules/if_tun/Makefile head/sys/net/if_tap.c head/sys/net/if_tapvar.h head/sys/net/if_tun.c Modified: head/UPDATING head/sbin/ifconfig/ifconfig.c head/share/man/man4/tap.4 head/share/man/man4/tun.4 head/sys/amd64/conf/GENERIC head/sys/amd64/conf/MINIMAL head/sys/arm/conf/DOCKSTAR head/sys/arm/conf/DREAMPLUG-1001 head/sys/arm/conf/EFIKA_MX head/sys/arm/conf/IMX53 head/sys/arm/conf/IMX6 head/sys/arm/conf/TEGRA124 head/sys/arm64/conf/GENERIC head/sys/conf/NOTES head/sys/conf/files head/sys/i386/conf/GENERIC head/sys/i386/conf/MINIMAL head/sys/mips/conf/ERL head/sys/mips/conf/OCTEON1 head/sys/modules/Makefile head/sys/net/if_tap.h head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/MPC85XXSPE head/sys/powerpc/conf/QORIQ64 head/sys/riscv/conf/GENERIC head/sys/sparc64/conf/GENERIC Modified: head/UPDATING == --- head/UPDATING Wed May 8 01:35:43 2019(r347240) +++ head/UPDATING Wed May 8 02:32:11 2019(r347241) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190507: + The tap(4) driver has been folded into tun(4), and the module has been + renamed to tuntap. You should update any kld_load="if_tap" or + kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or + if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap + module instead, and "device tap" or "device tun" entries in kernel + config files to select the tuntap device instead. + 20190418: The following knobs have been added related to tradeoffs between safe use of the random device and availability in the absence of Modified: head/sbin/ifconfig/ifconfig.c == --- head/sbin/ifconfig/ifconfig.c Wed May 8 01:35:43 2019 (r347240) +++ head/sbin/ifconfig/ifconfig.c Wed May 8 02:32:11 2019 (r347241) @@ -130,6 +130,25 @@ struct ifa_order_elt { TAILQ_HEAD(ifa_queue, ifa_order_elt); +static struct module_map_entry { + const char *ifname; + const char *kldname; +} module_map[] = { + { + .ifname = "tun", + .kldname = "if_tuntap", + }, + { + .ifname = "tap", + .kldname = "if_tuntap", + }, + { + .ifname = "vmnet", + .kldname = "if_tuntap", + }
svn commit: r347240 - head/cddl/contrib/opensolaris/cmd/zfs
Author: mav Date: Wed May 8 01:35:43 2019 New Revision: 347240 URL: https://svnweb.freebsd.org/changeset/base/347240 Log: Fix dataset name comparison in zfs_compare(). The code never returned match comparing two datasets (not snapshots). As result, uu_avl_find(), called from zfs_callback(), never succeeded, allowing to add same dataset into the list multiple times, for example: # zfs get name pers pers pers@z pers@z NAMEPROPERTY VALUE SOURCE persname pers- persname pers- pers@z name pers@z - With the patch: # zfs get name pers pers pers@z pers@z NAMEPROPERTY VALUE SOURCE persname pers- pers@z name pers@z - MFC after:1 week Sponsored by: iXsystems, Inc. Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c == --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.cWed May 8 00:45:16 2019(r347239) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.cWed May 8 01:35:43 2019(r347240) @@ -225,7 +225,7 @@ zfs_compare(const void *larg, const void *rarg, void * *rat = '\0'; ret = strcmp(lname, rname); - if (ret == 0) { + if (ret == 0 && (lat != NULL || rat != NULL)) { /* * If we're comparing a dataset to one of its snapshots, we * always make the full dataset first. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r346645 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys
Hi, > On May 7, 2019, at 9:13 PM, Conrad Meyer wrote: > > Hi Tycho, > > On Wed, Apr 24, 2019 at 1:31 PM Tycho Nightingale wrote: >> >> Author: tychon >> Date: Wed Apr 24 20:30:45 2019 >> New Revision: 346645 >> URL: https://svnweb.freebsd.org/changeset/base/346645 >> >> Log: >> LinuxKPI should use bus_dma(9) to be compatible with an IOMMU >> >> Reviewed by: hselasky, kib >> Tested by:greg@unrelenting.technology >> Sponsored by: Dell EMC Isilon >> Differential Revision:https://reviews.freebsd.org/D19845 >> ... >> Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c >> == >> --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 19:56:02 >> 2019(r346644) >> +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 20:30:45 >> 2019(r346645) >> ... >> +linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) >> +{ >> ... >> + nseg = -1; >> + mtx_lock(>dma_lock); >> + if (_bus_dmamap_load_phys(priv->dmat, obj->dmamap, phys, len, >> + BUS_DMA_NOWAIT, , ) != 0) { >> + bus_dmamap_destroy(priv->dmat, obj->dmamap); >> + mtx_unlock(>dma_lock); >> + uma_zfree(linux_dma_obj_zone, obj); >> + return (0); >> + } >> + mtx_unlock(>dma_lock); >> + >> + KASSERT(++nseg == 1, ("More than one segment (nseg=%d)", nseg)); > > This construct is a bit odd. Coverity produces the (perhaps spurious) > warning (CID 1401319) that the KASSERT (which can be compiled out in > !INVARIANTS builds) has a side effect (++nseg). While true, nseg is > never used afterwards, so perhaps we can use the equivalent expression > with no side effect instead? I.e., something like: > > KASSERT(nseg == 0, ("More than one segment (nseg=%d)", nseg + 1)); > > Does that make sense? It is a false positive of sorts, but performing > side effects in compiled-out assert is a pretty strong antipattern so > I'd just as soon "fix" the warning. The construct is indeed a little odd and mimics how other callers of _bus_dmamap_load_phys() handle the bizarre way nseg is treated. There isn’t any reason for it and in hindsight I prefer your version — especially if it eliminates this Coverity issue. Tycho ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r346645 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys
Hi Tycho, On Wed, Apr 24, 2019 at 1:31 PM Tycho Nightingale wrote: > > Author: tychon > Date: Wed Apr 24 20:30:45 2019 > New Revision: 346645 > URL: https://svnweb.freebsd.org/changeset/base/346645 > > Log: > LinuxKPI should use bus_dma(9) to be compatible with an IOMMU > > Reviewed by: hselasky, kib > Tested by:greg@unrelenting.technology > Sponsored by: Dell EMC Isilon > Differential Revision:https://reviews.freebsd.org/D19845 >... > Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c > == > --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 19:56:02 > 2019(r346644) > +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 20:30:45 > 2019(r346645) > ... > +linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) > +{ > ... > + nseg = -1; > + mtx_lock(>dma_lock); > + if (_bus_dmamap_load_phys(priv->dmat, obj->dmamap, phys, len, > + BUS_DMA_NOWAIT, , ) != 0) { > + bus_dmamap_destroy(priv->dmat, obj->dmamap); > + mtx_unlock(>dma_lock); > + uma_zfree(linux_dma_obj_zone, obj); > + return (0); > + } > + mtx_unlock(>dma_lock); > + > + KASSERT(++nseg == 1, ("More than one segment (nseg=%d)", nseg)); This construct is a bit odd. Coverity produces the (perhaps spurious) warning (CID 1401319) that the KASSERT (which can be compiled out in !INVARIANTS builds) has a side effect (++nseg). While true, nseg is never used afterwards, so perhaps we can use the equivalent expression with no side effect instead? I.e., something like: KASSERT(nseg == 0, ("More than one segment (nseg=%d)", nseg + 1)); Does that make sense? It is a false positive of sorts, but performing side effects in compiled-out assert is a pretty strong antipattern so I'd just as soon "fix" the warning. Thanks, Conrad ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347066 - in head: sbin/fsck_ffs sys/ufs/ufs
Hi Kirk, Coverity points out that namlen may be used uninitialized in the following sequence (CID 1401317): On Fri, May 3, 2019 at 2:54 PM Kirk McKusick wrote: > > Author: mckusick > Date: Fri May 3 21:54:14 2019 > New Revision: 347066 > URL: https://svnweb.freebsd.org/changeset/base/347066 > > Log: > This update eliminates a kernel stack disclosure bug in UFS/FFS > directory entries that is caused by uninitialized directory entry > padding written to the disk. > ... > --- head/sbin/fsck_ffs/dir.cFri May 3 21:48:42 2019(r347065) > +++ head/sbin/fsck_ffs/dir.cFri May 3 21:54:14 2019(r347066) > ... > @@ -209,15 +230,39 @@ dircheck(struct inodesc *idesc, struct direct *dp) > char *cp; > u_char type; > u_int8_t namlen; > - int spaceleft; > + int spaceleft, modified, unused; > > + modified = 0; > spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); > if (dp->d_reclen == 0 || > dp->d_reclen > spaceleft || > - (dp->d_reclen & 0x3) != 0) > + (dp->d_reclen & (DIR_ROUNDUP - 1)) != 0) > goto bad; > - if (dp->d_ino == 0) > - return (1); > + if (dp->d_ino == 0) { In this case, namlen may never be initialized. > + /* > +* Special case of an unused directory entry. Normally > +* the kernel would coalesce unused space with the previous > +* entry by extending its d_reclen, but there are situations > +* (e.g. fsck) where that doesn't occur. > +* If we're clearing out directory cruft (-z flag), then make > +* sure this entry gets fully cleared as well. > +*/ > + if (zflag && fswritefd >= 0) { > + if (dp->d_type != 0) { > + dp->d_type = 0; > + modified = 1; > + } > + if (dp->d_namlen != 0) { > + dp->d_namlen = 0; > + modified = 1; > + } > + if (dp->d_name[0] != '\0') { > + dp->d_name[0] = '\0'; > + modified = 1; > + } > + } > + goto good; Then we jump 'good'. > + } > size = DIRSIZ(0, dp); > namlen = dp->d_namlen; > type = dp->d_type; > @@ -231,7 +276,37 @@ dircheck(struct inodesc *idesc, struct direct *dp) > goto bad; > if (*cp != '\0') > goto bad; > + > +good: > + if (zflag && fswritefd >= 0) { > + /* > +* Clear unused directory entry space, including the d_name > +* padding. > +*/ > + /* First figure the number of pad bytes. */ > + unused = roundup2(namlen + 1, DIR_ROUNDUP) - (namlen + 1); And here we access uninitialized 'namlen'. Best, Conrad ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347239 - head/sys/dev/random
Author: cem Date: Wed May 8 00:45:16 2019 New Revision: 347239 URL: https://svnweb.freebsd.org/changeset/base/347239 Log: random: x86 driver: Prefer RDSEED over RDRAND when available Per https://software.intel.com/en-us/blogs/2012/11/17/the-difference-between-rdrand-and-rdseed , RDRAND is a PRNG seeded from the same source as RDSEED. The source is more suitable as PRNG seed material, so prefer it when the RDSEED intrinsic is available (indicated in CPU feature bits). Reviewed by: delphij, jhb, imp (earlier version) Approved by: secteam(delphij) Security: yes Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D20192 Modified: head/sys/dev/random/ivy.c Modified: head/sys/dev/random/ivy.c == --- head/sys/dev/random/ivy.c Wed May 8 00:40:08 2019(r347238) +++ head/sys/dev/random/ivy.c Wed May 8 00:45:16 2019(r347239) @@ -44,11 +44,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #defineRETRY_COUNT 10 +static bool has_rdrand, has_rdseed; static u_int random_ivy_read(void *, u_int); static struct random_source random_ivy = { @@ -57,10 +59,9 @@ static struct random_source random_ivy = { .rs_read = random_ivy_read }; -static inline int -ivy_rng_store(u_long *buf) +static int +x86_rdrand_store(u_long *buf) { -#ifdef __GNUCLIKE_ASM u_long rndval; int retry; @@ -75,11 +76,40 @@ ivy_rng_store(u_long *buf) : "+r" (retry), "=r" (rndval) : : "cc"); *buf = rndval; return (retry); -#else /* __GNUCLIKE_ASM */ - return (0); -#endif } +static int +x86_rdseed_store(u_long *buf) +{ + u_long rndval; + int retry; + + retry = RETRY_COUNT; + __asm __volatile( + "1:\n\t" + "rdseed %1\n\t" /* read randomness into rndval */ + "jc 2f\n\t" /* CF is set on success, exit retry loop */ + "dec%0\n\t" /* otherwise, retry-- */ + "jne1b\n\t" /* and loop if retries are not exhausted */ + "2:" + : "+r" (retry), "=r" (rndval) : : "cc"); + *buf = rndval; + return (retry); +} + +DEFINE_IFUNC(static, int, x86_rng_store, (u_long *buf), static) +{ + has_rdrand = (cpu_feature2 & CPUID2_RDRAND); + has_rdseed = (cpu_stdext_feature & CPUID_STDEXT_RDSEED); + + if (has_rdseed) + return (x86_rdseed_store); + else if (has_rdrand) + return (x86_rdrand_store); + else + return (NULL); +} + /* It is required that buf length is a multiple of sizeof(u_long). */ static u_int random_ivy_read(void *buf, u_int c) @@ -90,7 +120,7 @@ random_ivy_read(void *buf, u_int c) KASSERT(c % sizeof(*b) == 0, ("partial read %d", c)); b = buf; for (count = c; count > 0; count -= sizeof(*b)) { - if (ivy_rng_store() == 0) + if (x86_rng_store() == 0) break; *b++ = rndval; } @@ -104,14 +134,14 @@ rdrand_modevent(module_t mod, int type, void *unused) switch (type) { case MOD_LOAD: - if (cpu_feature2 & CPUID2_RDRAND) { + if (has_rdrand || has_rdseed) { random_source_register(_ivy); printf("random: fast provider: \"%s\"\n", random_ivy.rs_ident); } break; case MOD_UNLOAD: - if (cpu_feature2 & CPUID2_RDRAND) + if (has_rdrand || has_rdseed) random_source_deregister(_ivy); break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347238 - head/sys/amd64/vmm
Author: cem Date: Wed May 8 00:40:08 2019 New Revision: 347238 URL: https://svnweb.freebsd.org/changeset/base/347238 Log: vmm(4): Pass through RDSEED feature bit to guests Reviewed by: jhb Approved by: #bhyve (jhb) MFC after:2 leapseconds Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D20194 Modified: head/sys/amd64/vmm/x86.c Modified: head/sys/amd64/vmm/x86.c == --- head/sys/amd64/vmm/x86.cWed May 8 00:09:10 2019(r347237) +++ head/sys/amd64/vmm/x86.cWed May 8 00:40:08 2019(r347238) @@ -432,6 +432,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, CPUID_STDEXT_AVX2 | CPUID_STDEXT_BMI2 | CPUID_STDEXT_ERMS | CPUID_STDEXT_RTM | CPUID_STDEXT_AVX512F | + CPUID_STDEXT_RDSEED | CPUID_STDEXT_AVX512PF | CPUID_STDEXT_AVX512ER | CPUID_STDEXT_AVX512CD | CPUID_STDEXT_SHA); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347237 - in head/sys/dev: mpr mps
Author: imp Date: Wed May 8 00:09:10 2019 New Revision: 347237 URL: https://svnweb.freebsd.org/changeset/base/347237 Log: Add missing newline to debug printf. Modified: head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mps/mps_sas_lsi.c Modified: head/sys/dev/mpr/mpr_sas_lsi.c == --- head/sys/dev/mpr/mpr_sas_lsi.c Tue May 7 22:38:13 2019 (r347236) +++ head/sys/dev/mpr/mpr_sas_lsi.c Wed May 8 00:09:10 2019 (r347237) @@ -1206,7 +1206,7 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 han * reset */ mpr_dprint(sc, MPR_INFO|MPR_FAULT|MPR_MAPPING, - "Request for SATA PASSTHROUGH page completed with error %d", + "Request for SATA PASSTHROUGH page completed with error %d\n", error); error = ENXIO; goto out; Modified: head/sys/dev/mps/mps_sas_lsi.c == --- head/sys/dev/mps/mps_sas_lsi.c Tue May 7 22:38:13 2019 (r347236) +++ head/sys/dev/mps/mps_sas_lsi.c Wed May 8 00:09:10 2019 (r347237) @@ -979,7 +979,7 @@ mpssas_get_sata_identify(struct mps_softc *sc, u16 han * reset */ mps_dprint(sc, MPS_INFO|MPS_FAULT|MPS_MAPPING, - "Request for SATA PASSTHROUGH page completed with error %d", + "Request for SATA PASSTHROUGH page completed with error %d\n", error); error = ENXIO; goto out; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347235 - head/lib/libsbuf
Author: cem Date: Tue May 7 21:15:11 2019 New Revision: 347235 URL: https://svnweb.freebsd.org/changeset/base/347235 Log: Fix libsbuf sbuf_printf_drain symbol version (Introduced incorrectly in r347229 earlier today.) As pointed out by kevans, 1.6 should be used for FreeBSD 13, like r340383. Submitted by: kevans Reported by: kib Reviewed by: jilles X-MFC-with:r347229 Differential Revision:https://reviews.freebsd.org/D20187 Modified: head/lib/libsbuf/Symbol.map head/lib/libsbuf/Version.def Modified: head/lib/libsbuf/Symbol.map == --- head/lib/libsbuf/Symbol.map Tue May 7 20:39:39 2019(r347234) +++ head/lib/libsbuf/Symbol.map Tue May 7 21:15:11 2019(r347235) @@ -37,6 +37,9 @@ FBSD_1.4 { FBSD_1.5 { sbuf_putbuf; - sbuf_printf_drain; }; +/* Added in FreeBSD 13.x */ +FBSD_1.6 { + sbuf_printf_drain; +}; Modified: head/lib/libsbuf/Version.def == --- head/lib/libsbuf/Version.defTue May 7 20:39:39 2019 (r347234) +++ head/lib/libsbuf/Version.defTue May 7 21:15:11 2019 (r347235) @@ -11,3 +11,7 @@ FBSD_1.4 { FBSD_1.5 { } FBSD_1.4; + +# This version was first added to 13.0-current. +FBSD_1.6 { +} FBSD_1.5; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347234 - head/lib/libpam/modules/pam_login_access
Author: cy Date: Tue May 7 20:39:39 2019 New Revision: 347234 URL: https://svnweb.freebsd.org/changeset/base/347234 Log: Improve the legibility of the login.access.5 man page by separating each argument into its own paragraph. MFC after:3 days Modified: head/lib/libpam/modules/pam_login_access/login.access.5 Modified: head/lib/libpam/modules/pam_login_access/login.access.5 == --- head/lib/libpam/modules/pam_login_access/login.access.5 Tue May 7 20:28:12 2019(r347233) +++ head/lib/libpam/modules/pam_login_access/login.access.5 Tue May 7 20:39:39 2019(r347234) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 13, 2006 +.Dd May 7, 2019 .Dt LOGIN.ACCESS 5 .Os .Sh NAME @@ -29,8 +29,10 @@ character: .Pp The first field should be a "+" (access granted) or "-" (access denied) character. +.Pp The second field should be a list of one or more login names, group names, or ALL (always matches). +.Pp The third field should be a list of one or more tty names (for non-networked logins), host names, domain names (begin with "."), host addresses, internet network numbers (end ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347233 - head/sys/dev/virtio/network
Author: tuexen Date: Tue May 7 20:28:12 2019 New Revision: 347233 URL: https://svnweb.freebsd.org/changeset/base/347233 Log: Remove non-functional SCTP checksum offload support for virtio. Checksum offloading for SCTP is not currently specified for virtio. If the hypervisor announces checksum offloading support, it means TCP and UDP checksum offload. If an SCTP packet is sent and the host announced checksum offload support, the hypervisor inserts the IP checksum (16-bit) at the correct offset, but this is not the right checksum, which is a CRC32c. This results in all outgoing packets having the wrong checksum and therefore breaking SCTP based communications. This patch removes SCTP checksum offloading support from the virtio network interface. Thanks to Felix Weinrank for making me aware of the issue. Reviewed by: bryanv@ MFC after:1 week Differential Revision:https://reviews.freebsd.org/D20147 Modified: head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/network/if_vtnetvar.h Modified: head/sys/dev/virtio/network/if_vtnet.c == --- head/sys/dev/virtio/network/if_vtnet.c Tue May 7 19:48:39 2019 (r347232) +++ head/sys/dev/virtio/network/if_vtnet.c Tue May 7 20:28:12 2019 (r347233) @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -1525,9 +1524,6 @@ vtnet_rxq_csum_by_offset(struct vtnet_rxq *rxq, struct m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0x; break; - case offsetof(struct sctphdr, checksum): - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; - break; default: sc->vtnet_stats.rx_csum_bad_offset++; return (1); @@ -1584,11 +1580,6 @@ vtnet_rxq_csum_by_parse(struct vtnet_rxq *rxq, struct return (1); m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0x; - break; - case IPPROTO_SCTP: - if (__predict_false(m->m_len < offset + sizeof(struct sctphdr))) - return (1); - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; break; default: /* Modified: head/sys/dev/virtio/network/if_vtnetvar.h == --- head/sys/dev/virtio/network/if_vtnetvar.h Tue May 7 19:48:39 2019 (r347232) +++ head/sys/dev/virtio/network/if_vtnetvar.h Tue May 7 20:28:12 2019 (r347233) @@ -268,8 +268,8 @@ struct vtnet_mac_filter { CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); #define VTNET_TX_TIMEOUT 5 -#define VTNET_CSUM_OFFLOAD (CSUM_TCP | CSUM_UDP | CSUM_SCTP) -#define VTNET_CSUM_OFFLOAD_IPV6(CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6) +#define VTNET_CSUM_OFFLOAD (CSUM_TCP | CSUM_UDP) +#define VTNET_CSUM_OFFLOAD_IPV6(CSUM_TCP_IPV6 | CSUM_UDP_IPV6) #define VTNET_CSUM_ALL_OFFLOAD \ (VTNET_CSUM_OFFLOAD | VTNET_CSUM_OFFLOAD_IPV6 | CSUM_TSO) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347232 - stable/12/crypto/openssh
Author: emaste Date: Tue May 7 19:48:39 2019 New Revision: 347232 URL: https://svnweb.freebsd.org/changeset/base/347232 Log: MFC r345576: Merge r345574 from vendor-crypto: upstream: when checking that filenames sent by the server side match what the client requested, be prepared to handle shell-style brace alternations, e.g. "{foo,bar}". "looks good to me" millert@ + in snaps for the last week courtesy deraadt@ OpenBSD-Commit-ID: 3b1ce7639b0b25b2248e3a30f561a548f6815f3e PR: 234965 Discussed with: des Obtained from:OpenSSH-portable 3d896c157c722bc47adca51a58dca859225b5874 Modified: stable/12/crypto/openssh/scp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/crypto/openssh/scp.c == --- stable/12/crypto/openssh/scp.c Tue May 7 19:06:41 2019 (r347231) +++ stable/12/crypto/openssh/scp.c Tue May 7 19:48:39 2019 (r347232) @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.203 2019/01/27 07:14:11 jmc Exp $ */ +/* $OpenBSD: scp.c,v 1.204 2019/02/10 11:15:52 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -626,6 +626,253 @@ parse_scp_uri(const char *uri, char **userp, char **ho return r; } +/* Appends a string to an array; returns 0 on success, -1 on alloc failure */ +static int +append(char *cp, char ***ap, size_t *np) +{ + char **tmp; + + if ((tmp = reallocarray(*ap, *np + 1, sizeof(*tmp))) == NULL) + return -1; + tmp[(*np)] = cp; + (*np)++; + *ap = tmp; + return 0; +} + +/* + * Finds the start and end of the first brace pair in the pattern. + * returns 0 on success or -1 for invalid patterns. + */ +static int +find_brace(const char *pattern, int *startp, int *endp) +{ + int i; + int in_bracket, brace_level; + + *startp = *endp = -1; + in_bracket = brace_level = 0; + for (i = 0; i < INT_MAX && *endp < 0 && pattern[i] != '\0'; i++) { + switch (pattern[i]) { + case '\\': + /* skip next character */ + if (pattern[i + 1] != '\0') + i++; + break; + case '[': + in_bracket = 1; + break; + case ']': + in_bracket = 0; + break; + case '{': + if (in_bracket) + break; + if (pattern[i + 1] == '}') { + /* Protect a single {}, for find(1), like csh */ + i++; /* skip */ + break; + } + if (*startp == -1) + *startp = i; + brace_level++; + break; + case '}': + if (in_bracket) + break; + if (*startp < 0) { + /* Unbalanced brace */ + return -1; + } + if (--brace_level <= 0) + *endp = i; + break; + } + } + /* unbalanced brackets/braces */ + if (*endp < 0 && (*startp >= 0 || in_bracket)) + return -1; + return 0; +} + +/* + * Assembles and records a successfully-expanded pattern, returns -1 on + * alloc failure. + */ +static int +emit_expansion(const char *pattern, int brace_start, int brace_end, +int sel_start, int sel_end, char ***patternsp, size_t *npatternsp) +{ + char *cp; + int o = 0, tail_len = strlen(pattern + brace_end + 1); + + if ((cp = malloc(brace_start + (sel_end - sel_start) + + tail_len + 1)) == NULL) + return -1; + + /* Pattern before initial brace */ + if (brace_start > 0) { + memcpy(cp, pattern, brace_start); + o = brace_start; + } + /* Current braced selection */ + if (sel_end - sel_start > 0) { + memcpy(cp + o, pattern + sel_start, + sel_end - sel_start); + o += sel_end - sel_start; + } + /* Remainder of pattern after closing brace */ + if (tail_len > 0) { + memcpy(cp + o, pattern + brace_end + 1, tail_len); + o += tail_len; + } + cp[o] = '\0'; + if (append(cp, patternsp, npatternsp) != 0) { + free(cp); + return -1; + } + return 0; +} + +/* + * Expand the first encountered brace in pattern, appending the expanded + * patterns it yielded to the *patternsp array. + * + * Returns
svn commit: r347231 - head/sys/amd64/linux
Author: trasz Date: Tue May 7 19:06:41 2019 New Revision: 347231 URL: https://svnweb.freebsd.org/changeset/base/347231 Log: Support PTRACE_GETREGSET w/ NT_PRSTATUS in Linux ptrace(2). While Linux strace(1) doesn't strictly require it - it has a fallback to PTRACE_GETREGS - it's a newer interface, so we better support it before the old one is deprecated. Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20152 Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Tue May 7 18:10:21 2019 (r347230) +++ head/sys/amd64/linux/linux_ptrace.c Tue May 7 19:06:41 2019 (r347231) @@ -131,6 +131,36 @@ struct linux_pt_reg { l_ulong ss; }; +struct linux_pt_regset { + l_ulong r15; + l_ulong r14; + l_ulong r13; + l_ulong r12; + l_ulong rbp; + l_ulong rbx; + l_ulong r11; + l_ulong r10; + l_ulong r9; + l_ulong r8; + l_ulong rax; + l_ulong rcx; + l_ulong rdx; + l_ulong rsi; + l_ulong rdi; + l_ulong orig_rax; + l_ulong rip; + l_ulong cs; + l_ulong eflags; + l_ulong rsp; + l_ulong ss; + l_ulong fs_base; + l_ulong gs_base; + l_ulong ds; + l_ulong es; + l_ulong fs; + l_ulong gs; +}; + /* * Translate amd64 ptrace registers between Linux and FreeBSD formats. * The translation is pretty straighforward, for all registers but @@ -164,6 +194,40 @@ map_regs_to_linux(struct reg *b_reg, struct linux_pt_r } static void +map_regs_to_linux_regset(struct reg *b_reg, unsigned long fs_base, +unsigned long gs_base, struct linux_pt_regset *l_regset) +{ + + l_regset->r15 = b_reg->r_r15; + l_regset->r14 = b_reg->r_r14; + l_regset->r13 = b_reg->r_r13; + l_regset->r12 = b_reg->r_r12; + l_regset->rbp = b_reg->r_rbp; + l_regset->rbx = b_reg->r_rbx; + l_regset->r11 = b_reg->r_r11; + l_regset->r10 = b_reg->r_r10; + l_regset->r9 = b_reg->r_r9; + l_regset->r8 = b_reg->r_r8; + l_regset->rax = b_reg->r_rax; + l_regset->rcx = b_reg->r_rcx; + l_regset->rdx = b_reg->r_rdx; + l_regset->rsi = b_reg->r_rsi; + l_regset->rdi = b_reg->r_rdi; + l_regset->orig_rax = b_reg->r_rax; + l_regset->rip = b_reg->r_rip; + l_regset->cs = b_reg->r_cs; + l_regset->eflags = b_reg->r_rflags; + l_regset->rsp = b_reg->r_rsp; + l_regset->ss = b_reg->r_ss; + l_regset->fs_base = fs_base; + l_regset->gs_base = gs_base; + l_regset->ds = b_reg->r_ds; + l_regset->es = b_reg->r_es; + l_regset->fs = b_reg->r_fs; + l_regset->gs = b_reg->r_gs; +} + +static void map_regs_from_linux(struct reg *b_reg, struct linux_pt_reg *l_reg) { b_reg->r_r15 = l_reg->r15; @@ -306,14 +370,75 @@ linux_ptrace_setregs(struct thread *td, pid_t pid, voi } static int +linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) +{ + struct ptrace_lwpinfo lwpinfo; + struct reg b_reg; + struct linux_pt_regset l_regset; + struct iovec iov; + struct pcb *pcb; + unsigned long fsbase, gsbase; + size_t len; + int error; + + error = copyin((const void *)data, , sizeof(iov)); + if (error != 0) { + printf("%s: copyin error %d\n", __func__, error); + return (error); + } + + error = kern_ptrace(td, PT_GETREGS, pid, _reg, 0); + if (error != 0) + return (error); + + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + fsbase = pcb->pcb_fsbase; + gsbase = pcb->pcb_gsbase; + + map_regs_to_linux_regset(_reg, fsbase, gsbase, _regset); + + /* +* The strace(1) utility depends on RAX being set to -ENOSYS +* on syscall entry; otherwise it loops printing those: +* +* [ Process PID=928 runs in 64 bit mode. ] +* [ Process PID=928 runs in x32 mode. ] +*/ + error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); + if (error != 0) { + printf("%s: PT_LWPINFO failed with error %d\n", + __func__, error); + return (error); + } + if (lwpinfo.pl_flags & PL_FLAG_SCE) + l_regset.rax = -38; // XXX: Don't hardcode? + + len = MIN(iov.iov_len, sizeof(l_regset)); + error = copyout(_regset, (void *)iov.iov_base, len); + if (error != 0) { + printf("%s: copyout error %d\n", __func__, error); + return (error); + } + + iov.iov_len -= len; + error = copyout(, (void *)data, sizeof(iov)); + if (error != 0) { +
Re: svn commit: r347229 - in head: lib/libsbuf lib/libsbuf/tests share/man/man9 sys/kern sys/sys
On Tue, May 07, 2019 at 05:47:20PM +, Conrad Meyer wrote: > Author: cem > Date: Tue May 7 17:47:20 2019 > New Revision: 347229 > URL: https://svnweb.freebsd.org/changeset/base/347229 > > Log: > device_printf: Use sbuf for more coherent prints on SMP > > device_printf does multiple calls to printf allowing other console messages > to > be inserted between the device name, and the rest of the message. This > change > uses sbuf to compose to two into a single buffer, and prints it all at once. > > It exposes an sbuf drain function (drain-to-printf) for common use. > > Update documentation to match; some unit tests included. > > Submitted by: jmg > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D16690 > > Modified: > head/lib/libsbuf/Symbol.map > head/lib/libsbuf/tests/sbuf_core_test.c > head/lib/libsbuf/tests/sbuf_stdio_test.c > head/share/man/man9/Makefile > head/share/man/man9/sbuf.9 > head/sys/kern/kern_sysctl.c > head/sys/kern/subr_bus.c > head/sys/kern/subr_prf.c > head/sys/sys/sbuf.h > > Modified: head/lib/libsbuf/Symbol.map > == > --- head/lib/libsbuf/Symbol.map Tue May 7 16:17:33 2019 > (r347228) > +++ head/lib/libsbuf/Symbol.map Tue May 7 17:47:20 2019 > (r347229) > @@ -37,5 +37,6 @@ FBSD_1.4 { > > FBSD_1.5 { > sbuf_putbuf; > + sbuf_printf_drain; > }; The version is wrong. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347228 - head/sys/kern
On Tue, 7 May 2019 at 13:00, Ravi Pokala wrote: > > > + # Avoid a literal generated file tag here. > > + generated = "@" "generated"; > > + > > Why is that needed here, but not in r347224? It is, see https://reviews.freebsd.org/D20182 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347229 - in head: lib/libsbuf lib/libsbuf/tests share/man/man9 sys/kern sys/sys
One correction On Tue, May 7, 2019 at 10:47 AM Conrad Meyer wrote: > Author: cem > Date: Tue May 7 17:47:20 2019 > New Revision: 347229 > URL: https://svnweb.freebsd.org/changeset/base/347229 > > Log: > device_printf: Use sbuf for more coherent prints on SMP > > device_printf does multiple calls to printf allowing other console > messages to > be inserted between the device name, and the rest of the message. This > change > uses sbuf to compose to two into a single buffer, and prints it all at > once. > > It exposes an sbuf drain function (drain-to-printf) for common use. > > Update documentation to match; some unit tests included. > > Submitted by: jmg > Sponsored by: Dell EMC Isilon ^^^ Sorry, I added this on autopilot. It was fully jmg@‘s work. > Differential Revision:https://reviews.freebsd.org/D16690 > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347230 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/freebsd32 i386/linux kern sys
Author: emaste Date: Tue May 7 18:10:21 2019 New Revision: 347230 URL: https://svnweb.freebsd.org/changeset/base/347230 Log: make sysent after r347228 Regenerate to add @generated tag in generated files. Modified: head/sys/amd64/linux/linux_proto.h head/sys/amd64/linux/linux_syscall.h head/sys/amd64/linux/linux_syscalls.c head/sys/amd64/linux/linux_sysent.c head/sys/amd64/linux/linux_systrace_args.c head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/arm64/linux/linux_proto.h head/sys/arm64/linux/linux_syscall.h head/sys/arm64/linux/linux_syscalls.c head/sys/arm64/linux/linux_sysent.c head/sys/arm64/linux/linux_systrace_args.c head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/amd64/linux/linux_proto.h == --- head/sys/amd64/linux/linux_proto.h Tue May 7 17:47:20 2019 (r347229) +++ head/sys/amd64/linux/linux_proto.h Tue May 7 18:10:21 2019 (r347230) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: head/sys/amd64/linux/linux_syscall.h == --- head/sys/amd64/linux/linux_syscall.hTue May 7 17:47:20 2019 (r347229) +++ head/sys/amd64/linux/linux_syscall.hTue May 7 18:10:21 2019 (r347230) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: head/sys/amd64/linux/linux_syscalls.c == --- head/sys/amd64/linux/linux_syscalls.c Tue May 7 17:47:20 2019 (r347229) +++ head/sys/amd64/linux/linux_syscalls.c Tue May 7 18:10:21 2019 (r347230) @@ -1,7 +1,7 @@ /* * System call names. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: head/sys/amd64/linux/linux_sysent.c == --- head/sys/amd64/linux/linux_sysent.c Tue May 7 17:47:20 2019 (r347229) +++ head/sys/amd64/linux/linux_sysent.c Tue May 7 18:10:21 2019 (r347230) @@ -1,7 +1,7 @@ /* * System call switch table. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: head/sys/amd64/linux/linux_systrace_args.c == --- head/sys/amd64/linux/linux_systrace_args.c Tue May 7 17:47:20 2019 (r347229) +++ head/sys/amd64/linux/linux_systrace_args.c Tue May 7 18:10:21 2019 (r347230) @@ -1,7 +1,7 @@ /* * System call argument to DTrace register array converstion. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ Modified: head/sys/amd64/linux32/linux32_proto.h == --- head/sys/amd64/linux32/linux32_proto.h Tue May 7 17:47:20 2019 (r347229) +++ head/sys/amd64/linux32/linux32_proto.h Tue May 7 18:10:21 2019 (r347230) @@ -1,7 +1,7 @@ /* * System call prototypes. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified: head/sys/amd64/linux32/linux32_syscall.h == --- head/sys/amd64/linux32/linux32_syscall.hTue May 7 17:47:20 2019 (r347229) +++ head/sys/amd64/linux32/linux32_syscall.hTue May 7 18:10:21 2019 (r347230) @@ -1,7 +1,7 @@ /* * System call numbers. * - * DO NOT EDIT-- this file is automatically generated. + * DO NOT EDIT-- this file is automatically @generated. * $FreeBSD$ */ Modified:
Re: svn commit: r347229 - in head: lib/libsbuf lib/libsbuf/tests share/man/man9 sys/kern sys/sys
> Author: cem > Date: Tue May 7 17:47:20 2019 > New Revision: 347229 > URL: https://svnweb.freebsd.org/changeset/base/347229 > > Log: > device_printf: Use sbuf for more coherent prints on SMP > > device_printf does multiple calls to printf allowing other console messages > to > be inserted between the device name, and the rest of the message. This > change > uses sbuf to compose to two into a single buffer, and prints it all at once. > > It exposes an sbuf drain function (drain-to-printf) for common use. > > Update documentation to match; some unit tests included. > > Submitted by: jmg > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D16690 Thank you! this has been annoying me for a while, I knew it was going on, but wasnt sure where it was coming from. Does this code MFC back to 12 and 11 easily? > Modified: > head/lib/libsbuf/Symbol.map > head/lib/libsbuf/tests/sbuf_core_test.c > head/lib/libsbuf/tests/sbuf_stdio_test.c > head/share/man/man9/Makefile > head/share/man/man9/sbuf.9 > head/sys/kern/kern_sysctl.c > head/sys/kern/subr_bus.c > head/sys/kern/subr_prf.c > head/sys/sys/sbuf.h > > Modified: head/lib/libsbuf/Symbol.map > == > --- head/lib/libsbuf/Symbol.map Tue May 7 16:17:33 2019 > (r347228) > +++ head/lib/libsbuf/Symbol.map Tue May 7 17:47:20 2019 > (r347229) > @@ -37,5 +37,6 @@ FBSD_1.4 { > > FBSD_1.5 { > sbuf_putbuf; > + sbuf_printf_drain; > }; > > > Modified: head/lib/libsbuf/tests/sbuf_core_test.c > == > --- head/lib/libsbuf/tests/sbuf_core_test.c Tue May 7 16:17:33 2019 > (r347228) > +++ head/lib/libsbuf/tests/sbuf_core_test.c Tue May 7 17:47:20 2019 > (r347229) > @@ -63,6 +63,9 @@ ATF_TC_BODY(sbuf_clear_test, tc) >*/ > child_proc = atf_utils_fork(); > if (child_proc == 0) { > + ATF_REQUIRE_EQ_MSG(0, sbuf_finish(sb), "sbuf_finish failed: %s", > + strerror(errno)); > + > sbuf_putbuf(sb); > exit(0); > } > @@ -100,6 +103,34 @@ ATF_TC_BODY(sbuf_done_and_sbuf_finish_test, tc) > sbuf_delete(sb); > } > > +static int > +drain_ret0(void *arg, const char *data, int len) > +{ > + > + (void)arg; > + (void)data; > + (void)len; > + > + return (0); > +} > + > +ATF_TC_WITHOUT_HEAD(sbuf_drain_ret0_test); > +ATF_TC_BODY(sbuf_drain_ret0_test, tc) > +{ > + struct sbuf *sb; > + > + sb = sbuf_new_auto(); > + > + sbuf_set_drain(sb, drain_ret0, NULL); > + > + sbuf_cat(sb, test_string); > + > + ATF_CHECK_EQ_MSG(-1, sbuf_finish(sb), > + "required to return error when drain func returns 0"); > + ATF_CHECK_EQ_MSG(EDEADLK, errno, > + "errno required to be EDEADLK when drain func returns 0"); > +} > + > ATF_TC_WITHOUT_HEAD(sbuf_len_test); > ATF_TC_BODY(sbuf_len_test, tc) > { > @@ -131,6 +162,34 @@ ATF_TC_BODY(sbuf_len_test, tc) > sbuf_delete(sb); > } > > +ATF_TC_WITHOUT_HEAD(sbuf_new_fixedlen); > +ATF_TC_BODY(sbuf_new_fixedlen, tc) > +{ > + char buf[strlen(test_string) + 1]; > + struct sbuf sb; > + pid_t child_proc; > + > + sbuf_new(, buf, sizeof(buf), SBUF_FIXEDLEN); > + > + sbuf_cat(, test_string); > + > + child_proc = atf_utils_fork(); > + if (child_proc == 0) { > + ATF_REQUIRE_EQ_MSG(0, sbuf_finish(), "sbuf_finish failed: > %s", > + strerror(errno)); > + > + sbuf_putbuf(); > + exit(0); > + } > + atf_utils_wait(child_proc, 0, test_string, ""); > + > + sbuf_putc(, ' '); > + > + ATF_CHECK_EQ_MSG(-1, sbuf_finish(), "failed to return error on > overflow"); > + > + sbuf_delete(); > +} > + > ATF_TC_WITHOUT_HEAD(sbuf_setpos_test); > ATF_TC_BODY(sbuf_setpos_test, tc) > { > @@ -190,7 +249,9 @@ ATF_TP_ADD_TCS(tp) > > ATF_TP_ADD_TC(tp, sbuf_clear_test); > ATF_TP_ADD_TC(tp, sbuf_done_and_sbuf_finish_test); > + ATF_TP_ADD_TC(tp, sbuf_drain_ret0_test); > ATF_TP_ADD_TC(tp, sbuf_len_test); > + ATF_TP_ADD_TC(tp, sbuf_new_fixedlen); > #if 0 > /* TODO */ > #ifdef HAVE_SBUF_CLEAR_FLAGS > > Modified: head/lib/libsbuf/tests/sbuf_stdio_test.c > == > --- head/lib/libsbuf/tests/sbuf_stdio_test.c Tue May 7 16:17:33 2019 > (r347228) > +++ head/lib/libsbuf/tests/sbuf_stdio_test.c Tue May 7 17:47:20 2019 > (r347229) > @@ -59,6 +59,60 @@ sbuf_vprintf_helper(struct sbuf *sb, const char * rest > return (rc); > } > > +ATF_TC_WITHOUT_HEAD(sbuf_printf_drain_null_test); > +ATF_TC_BODY(sbuf_printf_drain_null_test, tc) > +{ > + struct sbuf *sb; > + char buf[2]; > + pid_t child_proc; > + > + sb = sbuf_new(NULL,
svn commit: r347229 - in head: lib/libsbuf lib/libsbuf/tests share/man/man9 sys/kern sys/sys
Author: cem Date: Tue May 7 17:47:20 2019 New Revision: 347229 URL: https://svnweb.freebsd.org/changeset/base/347229 Log: device_printf: Use sbuf for more coherent prints on SMP device_printf does multiple calls to printf allowing other console messages to be inserted between the device name, and the rest of the message. This change uses sbuf to compose to two into a single buffer, and prints it all at once. It exposes an sbuf drain function (drain-to-printf) for common use. Update documentation to match; some unit tests included. Submitted by: jmg Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D16690 Modified: head/lib/libsbuf/Symbol.map head/lib/libsbuf/tests/sbuf_core_test.c head/lib/libsbuf/tests/sbuf_stdio_test.c head/share/man/man9/Makefile head/share/man/man9/sbuf.9 head/sys/kern/kern_sysctl.c head/sys/kern/subr_bus.c head/sys/kern/subr_prf.c head/sys/sys/sbuf.h Modified: head/lib/libsbuf/Symbol.map == --- head/lib/libsbuf/Symbol.map Tue May 7 16:17:33 2019(r347228) +++ head/lib/libsbuf/Symbol.map Tue May 7 17:47:20 2019(r347229) @@ -37,5 +37,6 @@ FBSD_1.4 { FBSD_1.5 { sbuf_putbuf; + sbuf_printf_drain; }; Modified: head/lib/libsbuf/tests/sbuf_core_test.c == --- head/lib/libsbuf/tests/sbuf_core_test.c Tue May 7 16:17:33 2019 (r347228) +++ head/lib/libsbuf/tests/sbuf_core_test.c Tue May 7 17:47:20 2019 (r347229) @@ -63,6 +63,9 @@ ATF_TC_BODY(sbuf_clear_test, tc) */ child_proc = atf_utils_fork(); if (child_proc == 0) { + ATF_REQUIRE_EQ_MSG(0, sbuf_finish(sb), "sbuf_finish failed: %s", + strerror(errno)); + sbuf_putbuf(sb); exit(0); } @@ -100,6 +103,34 @@ ATF_TC_BODY(sbuf_done_and_sbuf_finish_test, tc) sbuf_delete(sb); } +static int +drain_ret0(void *arg, const char *data, int len) +{ + + (void)arg; + (void)data; + (void)len; + + return (0); +} + +ATF_TC_WITHOUT_HEAD(sbuf_drain_ret0_test); +ATF_TC_BODY(sbuf_drain_ret0_test, tc) +{ + struct sbuf *sb; + + sb = sbuf_new_auto(); + + sbuf_set_drain(sb, drain_ret0, NULL); + + sbuf_cat(sb, test_string); + + ATF_CHECK_EQ_MSG(-1, sbuf_finish(sb), + "required to return error when drain func returns 0"); + ATF_CHECK_EQ_MSG(EDEADLK, errno, + "errno required to be EDEADLK when drain func returns 0"); +} + ATF_TC_WITHOUT_HEAD(sbuf_len_test); ATF_TC_BODY(sbuf_len_test, tc) { @@ -131,6 +162,34 @@ ATF_TC_BODY(sbuf_len_test, tc) sbuf_delete(sb); } +ATF_TC_WITHOUT_HEAD(sbuf_new_fixedlen); +ATF_TC_BODY(sbuf_new_fixedlen, tc) +{ + char buf[strlen(test_string) + 1]; + struct sbuf sb; + pid_t child_proc; + + sbuf_new(, buf, sizeof(buf), SBUF_FIXEDLEN); + + sbuf_cat(, test_string); + + child_proc = atf_utils_fork(); + if (child_proc == 0) { + ATF_REQUIRE_EQ_MSG(0, sbuf_finish(), "sbuf_finish failed: %s", + strerror(errno)); + + sbuf_putbuf(); + exit(0); + } + atf_utils_wait(child_proc, 0, test_string, ""); + + sbuf_putc(, ' '); + + ATF_CHECK_EQ_MSG(-1, sbuf_finish(), "failed to return error on overflow"); + + sbuf_delete(); +} + ATF_TC_WITHOUT_HEAD(sbuf_setpos_test); ATF_TC_BODY(sbuf_setpos_test, tc) { @@ -190,7 +249,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, sbuf_clear_test); ATF_TP_ADD_TC(tp, sbuf_done_and_sbuf_finish_test); + ATF_TP_ADD_TC(tp, sbuf_drain_ret0_test); ATF_TP_ADD_TC(tp, sbuf_len_test); + ATF_TP_ADD_TC(tp, sbuf_new_fixedlen); #if 0 /* TODO */ #ifdef HAVE_SBUF_CLEAR_FLAGS Modified: head/lib/libsbuf/tests/sbuf_stdio_test.c == --- head/lib/libsbuf/tests/sbuf_stdio_test.cTue May 7 16:17:33 2019 (r347228) +++ head/lib/libsbuf/tests/sbuf_stdio_test.cTue May 7 17:47:20 2019 (r347229) @@ -59,6 +59,60 @@ sbuf_vprintf_helper(struct sbuf *sb, const char * rest return (rc); } +ATF_TC_WITHOUT_HEAD(sbuf_printf_drain_null_test); +ATF_TC_BODY(sbuf_printf_drain_null_test, tc) +{ + struct sbuf *sb; + char buf[2]; + pid_t child_proc; + + sb = sbuf_new(NULL, buf, sizeof(buf), SBUF_FIXEDLEN); + ATF_REQUIRE_MSG(sb != NULL, "sbuf_new_auto failed: %s", + strerror(errno)); + + child_proc = atf_utils_fork(); + if (child_proc == 0) { + sbuf_set_drain(sb, sbuf_printf_drain, NULL); + + ATF_REQUIRE_EQ_MSG(0, sbuf_cat(sb, test_string), + "sbuf_cat failed"); + + ATF_CHECK_EQ(0,
Re: svn commit: r347063 - head/sys/kern
On Tue, 7 May 2019, John Baldwin wrote: On 5/7/19 8:45 AM, Bruce Evans wrote: On Mon, 6 May 2019, John Baldwin wrote: On 5/6/19 11:45 AM, Mark Johnston wrote: On Mon, May 06, 2019 at 11:07:18AM -0700, John Baldwin wrote: On 5/3/19 2:26 PM, Mark Johnston wrote: Author: markj Date: Fri May 3 21:26:44 2019 New Revision: 347063 URL: https://svnweb.freebsd.org/changeset/base/347063 Log: Disallow excessively small times of day in clock_settime(2). This actually disallows negative timespecs in clock_settime(), with collateral disallowment for small positive times. FWIW, clock_settime already disallows negative times due to the existing check in the previous two lines: if (ats->tv_nsec < 0 || ats->tv_nsec >= 10 || ats->tv_sec < 0) return (EINVAL); I would probably lean towards not disallowing negative times as I said in one of my earlier replies, but given we have that blanket check already in place, the current patch doesn't seem to make things much worse. This check was correctly missing in FreeBSD-5. This check doesn't actually work. I rememeber another detail in my test program. It sets the time to INT_MAX - 2 == INT32_MAX - 2 to get an overflow 2 seconds later with 32-bit time_t. This is how I got a file time of 1901. The check for large times on the line after the above is broken in another way. It has an upper limit of approx. 8000ULL years. This limit is unreachable for 32-bit time_t (except for the unsign extension bug for negative times which is unreachable due to the above check). So the check only works to prevent overflow to a negative time with 64-bit time_t. Other parts of the system are or were more careful about this: - setitimer() and alarm() used to have a limit of 10**8 seconds to prevent overflow of 32-bit time_t when adding this number to the current time. 10**8 seconds is 3.16 years, so this works up to about 2035. This was broken by silently removing the check for 10**8 in itimerfix() as part of implementing POSIX itimers but the man pages still document the limit. This is not allowed by POSIX. POSIX requires times to work up to the limit of a time_t. Some APIs return the residual time after a timeout, so this cannot be implemented by clamping the time to a reasonably small value. POSIX itimers have a different implementation that is closer to not needing this limit and more broken having it. setitimer() is also broken for negative times (doesn't allow them). IIRC, POSIX requires this bug. This just give more work for applications. Small negative differences can easily occur as the result of subtracting times. Applications must either check for them after calculating differences, or handle the error for them from setimer(). Usually the correct handling is to treat negative timeouts as 0. - sbintimes have 32 bits for the seconds part, so they have similar problems to 32-bit time_t. Some places handle these problems by limiting the timeouts to INT32_MAX / 2. The timeout is sometimes added to the current time, but since the current time is the monotonic time it is at most a few years so the limit for the timeout could be a bit larger than INT32_MAX / 2. Oops, sbintimes are now used for for setitimer(), and setitimer() is one of the few places with the INT32_MAX / 2 limit. This gives the following bugs for setitimer() and alarm(): - these syscalls still have a limit which is not allowed by POSIX - the limit is INT32_MAX / 2 seconds (+ maximal usec?), not the documented one. 64_bit time_t's mostly just increase the overflow bugs. Applications can probe for bugs using INT64_MAX in tv_sec. This overflows all 32-bit calculations and most signed 64-bit calculations. The kernel has to reduce to 32 bits in seconds for all uses of sbintimes. The kernel does do this for nanosleep(). Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347228 - head/sys/kern
> + # Avoid a literal generated file tag here. > + generated = "@" "generated"; > + Why is that needed here, but not in r347224? -Ravi (rpokala@) -Original Message- From: on behalf of Ed Maste Date: 2019-05-07, Tuesday at 09:17 To: , , Subject: svn commit: r347228 - head/sys/kern Author: emaste Date: Tue May 7 16:17:33 2019 New Revision: 347228 URL: https://svnweb.freebsd.org/changeset/base/347228 Log: makesyscalls: use @generated tag in generated files Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in generated files). Use the @generated tag in makesyscalls.sh as we've done for other generated files. Reviewed by: cem MFC after:1 month Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20183 Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh == --- head/sys/kern/makesyscalls.sh Tue May 7 15:03:26 2019 (r347227) +++ head/sys/kern/makesyscalls.sh Tue May 7 16:17:33 2019 (r347228) @@ -142,18 +142,21 @@ sed -e ' capenabled_string = \"$capenabled\" "' + # Avoid a literal generated file tag here. + generated = "@" "generated"; + split(capenabled_string, capenabled, ","); printf "\n/* The casts are bogus but will do for now. */\n" > sysent printf "struct sysent %s[] = {\n",switchname > sysent printf "/*\n * System call switch table.\n *\n" > syssw - printf " * DO NOT EDIT-- this file is automatically generated.\n" > syssw + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > syssw printf " * $%s$\n", "FreeBSD" > syssw printf " */\n\n" > syssw printf "/*\n * System call prototypes.\n *\n" > sysarg - printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarg + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > sysarg printf " * $%s$\n", "FreeBSD" > sysarg printf " */\n\n" > sysarg printf "#ifndef %s\n", sysproto_h > sysarg @@ -187,23 +190,23 @@ sed -e ' printf "\n#ifdef %s\n\n", compat11 > syscompat11 printf "/*\n * System call names.\n *\n" > sysnames - printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > sysnames printf " * $%s$\n", "FreeBSD" > sysnames printf " */\n\n" > sysnames printf "const char *%s[] = {\n", namesname > sysnames printf "/*\n * System call numbers.\n *\n" > syshdr - printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > syshdr printf " * $%s$\n", "FreeBSD" > syshdr printf " */\n\n" > syshdr printf "# FreeBSD system call object files.\n" > sysmk - printf "# DO NOT EDIT-- this file is automatically generated.\n" > sysmk + printf "# DO NOT EDIT-- this file is automatically " generated ".\n" > sysmk printf "# $%s$\n", "FreeBSD" > sysmk printf "MIASM = " > sysmk printf "/*\n * System call argument to DTrace register array converstion.\n *\n" > systrace - printf " * DO NOT EDIT-- this file is automatically generated.\n" > systrace + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > systrace printf " * $%s$\n", "FreeBSD" > systrace printf " * This file is part of the DTrace syscall provider.\n */\n\n" > systrace printf "static void\nsystrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)\n{\n" > systrace ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347063 - head/sys/kern
On 5/7/19 8:45 AM, Bruce Evans wrote: > On Mon, 6 May 2019, John Baldwin wrote: > >> On 5/6/19 11:45 AM, Mark Johnston wrote: >>> On Mon, May 06, 2019 at 11:07:18AM -0700, John Baldwin wrote: On 5/3/19 2:26 PM, Mark Johnston wrote: > Author: markj > Date: Fri May 3 21:26:44 2019 > New Revision: 347063 > URL: https://svnweb.freebsd.org/changeset/base/347063 > > Log: > Disallow excessively small times of day in clock_settime(2). > > This actually disallows negative timespecs in clock_settime(), with > collateral disallowment for small positive times. FWIW, clock_settime already disallows negative times due to the existing check in the previous two lines: if (ats->tv_nsec < 0 || ats->tv_nsec >= 10 || ats->tv_sec < 0) return (EINVAL); I would probably lean towards not disallowing negative times as I said in one of my earlier replies, but given we have that blanket check already in place, the current patch doesn't seem to make things much worse. -- John Baldwin ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347228 - head/sys/kern
Author: emaste Date: Tue May 7 16:17:33 2019 New Revision: 347228 URL: https://svnweb.freebsd.org/changeset/base/347228 Log: makesyscalls: use @generated tag in generated files Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in generated files). Use the @generated tag in makesyscalls.sh as we've done for other generated files. Reviewed by: cem MFC after:1 month Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20183 Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh == --- head/sys/kern/makesyscalls.sh Tue May 7 15:03:26 2019 (r347227) +++ head/sys/kern/makesyscalls.sh Tue May 7 16:17:33 2019 (r347228) @@ -142,18 +142,21 @@ sed -e ' capenabled_string = \"$capenabled\" "' + # Avoid a literal generated file tag here. + generated = "@" "generated"; + split(capenabled_string, capenabled, ","); printf "\n/* The casts are bogus but will do for now. */\n" > sysent printf "struct sysent %s[] = {\n",switchname > sysent printf "/*\n * System call switch table.\n *\n" > syssw - printf " * DO NOT EDIT-- this file is automatically generated.\n" > syssw + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > syssw printf " * $%s$\n", "FreeBSD" > syssw printf " */\n\n" > syssw printf "/*\n * System call prototypes.\n *\n" > sysarg - printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarg + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > sysarg printf " * $%s$\n", "FreeBSD" > sysarg printf " */\n\n" > sysarg printf "#ifndef %s\n", sysproto_h > sysarg @@ -187,23 +190,23 @@ sed -e ' printf "\n#ifdef %s\n\n", compat11 > syscompat11 printf "/*\n * System call names.\n *\n" > sysnames - printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > sysnames printf " * $%s$\n", "FreeBSD" > sysnames printf " */\n\n" > sysnames printf "const char *%s[] = {\n", namesname > sysnames printf "/*\n * System call numbers.\n *\n" > syshdr - printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > syshdr printf " * $%s$\n", "FreeBSD" > syshdr printf " */\n\n" > syshdr printf "# FreeBSD system call object files.\n" > sysmk - printf "# DO NOT EDIT-- this file is automatically generated.\n" > sysmk + printf "# DO NOT EDIT-- this file is automatically " generated ".\n" > sysmk printf "# $%s$\n", "FreeBSD" > sysmk printf "MIASM = " > sysmk printf "/*\n * System call argument to DTrace register array converstion.\n *\n" > systrace - printf " * DO NOT EDIT-- this file is automatically generated.\n" > systrace + printf " * DO NOT EDIT-- this file is automatically " generated ".\n" > systrace printf " * $%s$\n", "FreeBSD" > systrace printf " * This file is part of the DTrace syscall provider.\n */\n\n" > systrace printf "static void\nsystrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)\n{\n" > systrace ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347063 - head/sys/kern
On Mon, 6 May 2019, John Baldwin wrote: On 5/6/19 11:45 AM, Mark Johnston wrote: On Mon, May 06, 2019 at 11:07:18AM -0700, John Baldwin wrote: On 5/3/19 2:26 PM, Mark Johnston wrote: Author: markj Date: Fri May 3 21:26:44 2019 New Revision: 347063 URL: https://svnweb.freebsd.org/changeset/base/347063 Log: Disallow excessively small times of day in clock_settime(2). This actually disallows negative timespecs in clock_settime(), with collateral disallowment for small positive times. I don't like disallowing either. The bounds checking in the clock code is badly implemented, so it crashes on such times even if the clock hardware supports them, but clock_settime() is privileged and root never makes mistakes. This breaks: - testing of setting negative times - my enclosed test to demonstrate bugs in the bounds checking. Reported by: syzkaller Reviewed by: cem, kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20151 Modified: head/sys/kern/kern_time.c Modified: head/sys/kern/kern_time.c == --- head/sys/kern/kern_time.c Fri May 3 21:13:09 2019(r347062) +++ head/sys/kern/kern_time.c Fri May 3 21:26:44 2019(r347063) @@ -412,7 +412,9 @@ kern_clock_settime(struct thread *td, clockid_t clock_ if (ats->tv_nsec < 0 || ats->tv_nsec >= 10 || ats->tv_sec < 0) return (EINVAL); - if (!allow_insane_settime && ats->tv_sec > 8000ULL * 365 * 24 * 60 * 60) + if (!allow_insane_settime && + (ats->tv_sec > 8000ULL * 365 * 24 * 60 * 60 || + ats->tv_sec < utc_offset())) return (EINVAL); The test of the upper bound is broken. It not only uses the long long abomination, but uses large unsigned type which gives unsigned poisoning for all supported sizes of time_t. So negative times were already broken here (without allow_insane_settime). They are converted to large positive times so are treated as insanely large. utc_offset() uses a too-small signed type with no bounds checking so it has overflow bugs but doesn't give unsigned poisoning. time_t is signed on all supported arches. It could be uint32_t so as to work until 2106 on 32-bit arches, but this would give unsigned poisoning and there is too much broken code for changing it to that to just work. So the new code doesn't have unsigned poisoning, and it disallows most negative values even when utc_offset() is negative. /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(, ats); Pardon my ignorance, but I can't see why you are checking against utc_offset() vs some small constant? None of the discussion in the review mentioned the reason for using this particular value, and I didn't see any comparisons against utc_offset or kernadjtz in kern_clock_setttime() or settime() that would have underflowed or panicked. Can you give a bit more detail on why utc_offset() is the lower bound? Thanks. I chose it because we subtract utc_offset() from the time passed in to clock_settime(); see settime_task_func(). That subtraction caused the underflow that later caused the observed panics. Not underflow, but overflow. Underflow is when rounding a small nonzero floating point value gives a denormal value of 0. This was the main overflow bug demonstrated by my test program. Ok, thanks. A few things I didn't see anyone else note in the review then: 1) This subtraction is actually not done for all rtc drivers, so it seems like we might block small times for RTC clocks that set CLOCKF_GETTIME_NO_ADJ. It is probably bogus to check it for them. The check is misplaced for them -- this level can't know the details. 2) utc_offset can be negative for machines using local time in timezones "before" UTC. This is why it is less bad to check utc_offset() than 0. Otherwise, it would be impossible to test setting the time to the Epoch in these timezones. Hmm, the offset is confusing, especially its sign. In these timezones, when the time is the Epoch, the local time is before the Epoch so the RTC hardware needs to be able to represent year 1969 even if utc_offset() is sane. But some clock drivers convery 1969 to 2069, and the sanity check in clock_ct_to_ts() is insane -- it doesn't allow years before 1970, although signed time_t has no problems before year 1901. So testing of setting the time to the Epoch in such timezones would show that even if the RTC can be set to 1969, the kernel time can't be restored to the Epoch from the RTC. I don't know of any panics from buggy bounds checks for this. The worst that can happen is that adjkerntz is preposterous. Then utc_offset() is preposterous and adding it can change a 32-bit time_t to anything and a 64-bit time_t by a lot I suppose we don't think any FreeBSD machines actually need to set the running clock
svn commit: r347227 - head/sys/kern
Author: markj Date: Tue May 7 15:03:26 2019 New Revision: 347227 URL: https://svnweb.freebsd.org/changeset/base/347227 Log: Simplify the test against maxproc in fork1(). Previously nprocs_new would be tested against maxprocs twice when nprocs_new < maxprocs - 10. Eliminate the unnecessary comparison. Submitted by: Wuyang Chung GitHub PR:https://github.com/freebsd/freebsd/pull/397 MFC after:1 week Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c == --- head/sys/kern/kern_fork.c Tue May 7 14:32:17 2019(r347226) +++ head/sys/kern/kern_fork.c Tue May 7 15:03:26 2019(r347227) @@ -883,18 +883,20 @@ fork1(struct thread *td, struct fork_req *fr) * processes; don't let root exceed the limit. */ nprocs_new = atomic_fetchadd_int(, 1) + 1; - if ((nprocs_new >= maxproc - 10 && - priv_check_cred(td->td_ucred, PRIV_MAXPROC) != 0) || - nprocs_new >= maxproc) { - error = EAGAIN; - sx_xlock(_lock); - if (ppsratecheck(, , 1)) { - printf("maxproc limit exceeded by uid %u (pid %d); " - "see tuning(7) and login.conf(5)\n", - td->td_ucred->cr_ruid, p1->p_pid); + if (nprocs_new >= maxproc - 10) { + if (priv_check_cred(td->td_ucred, PRIV_MAXPROC) != 0 || + nprocs_new >= maxproc) { + error = EAGAIN; + sx_xlock(_lock); + if (ppsratecheck(, , 1)) { + printf("maxproc limit exceeded by uid %u " + "(pid %d); see tuning(7) and " + "login.conf(5)\n", + td->td_ucred->cr_ruid, p1->p_pid); + } + sx_xunlock(_lock); + goto fail2; } - sx_xunlock(_lock); - goto fail2; } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347226 - head/sys/riscv/riscv
Author: br Date: Tue May 7 14:32:17 2019 New Revision: 347226 URL: https://svnweb.freebsd.org/changeset/base/347226 Log: Disable interrupts first and then set spinlock_count to 1. Otherwise interrupt can be generated just after setting spinlock_count and before disabling interrupts. Sponsored by: DARPA, AFRL Modified: head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/riscv/machdep.c == --- head/sys/riscv/riscv/machdep.c Tue May 7 13:41:43 2019 (r347225) +++ head/sys/riscv/riscv/machdep.c Tue May 7 14:32:17 2019 (r347226) @@ -457,11 +457,13 @@ void spinlock_enter(void) { struct thread *td; + register_t reg; td = curthread; if (td->td_md.md_spinlock_count == 0) { + reg = intr_disable(); td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_sstatus_ie = intr_disable(); + td->td_md.md_saved_sstatus_ie = reg; } else td->td_md.md_spinlock_count++; critical_enter(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347225 - in head/sys: conf riscv/include riscv/riscv
Author: br Date: Tue May 7 13:41:43 2019 New Revision: 347225 URL: https://svnweb.freebsd.org/changeset/base/347225 Log: Provide a template for busdma code for RISC-V. RISC-V ISA specifies no cache management instructions so leave cache operations in cpufunc.h as no-op for now. Note some new hardware comes with their own memory-mapped cache management controller. Tested on HiFive Unleashed board with cgem(4). Reviewed by: markj Obtained from:arm64 Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D20126 Added: head/sys/riscv/include/bus_dma_impl.h (contents, props changed) head/sys/riscv/riscv/busdma_bounce.c (contents, props changed) Modified: head/sys/conf/files.riscv head/sys/riscv/include/bus_dma.h head/sys/riscv/include/cpufunc.h head/sys/riscv/riscv/busdma_machdep.c head/sys/riscv/riscv/machdep.c Modified: head/sys/conf/files.riscv == --- head/sys/conf/files.riscv Tue May 7 13:04:26 2019(r347224) +++ head/sys/conf/files.riscv Tue May 7 13:41:43 2019(r347225) @@ -28,6 +28,7 @@ libkern/memset.c standard riscv/riscv/autoconf.c standard riscv/riscv/bus_machdep.c standard riscv/riscv/bus_space_asm.Sstandard +riscv/riscv/busdma_bounce.cstandard riscv/riscv/busdma_machdep.c standard riscv/riscv/clock.cstandard riscv/riscv/copyinout.Sstandard Modified: head/sys/riscv/include/bus_dma.h == --- head/sys/riscv/include/bus_dma.hTue May 7 13:04:26 2019 (r347224) +++ head/sys/riscv/include/bus_dma.hTue May 7 13:41:43 2019 (r347225) @@ -3,7 +3,139 @@ #ifndef _MACHINE_BUS_DMA_H_ #define_MACHINE_BUS_DMA_H_ +#define WANT_INLINE_DMAMAP #include -#include + +#include + +/* + * Allocate a handle for mapping from kva/uva/physical + * address space into bus device space. + */ +static inline int +bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + return (tc->impl->map_create(dmat, flags, mapp)); +} + +/* + * Destroy a handle for mapping from kva/uva/physical + * address space into bus device space. + */ +static inline int +bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + return (tc->impl->map_destroy(dmat, map)); +} + +/* + * Allocate a piece of memory that can be efficiently mapped into + * bus device space based on the constraints listed in the dma tag. + * A dmamap to for use with dmamap_load is also allocated. + */ +static inline int +bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, +bus_dmamap_t *mapp) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + return (tc->impl->mem_alloc(dmat, vaddr, flags, mapp)); +} + +/* + * Free a piece of memory and it's allociated dmamap, that was allocated + * via bus_dmamem_alloc. Make the same choice for free/contigfree. + */ +static inline void +bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + tc->impl->mem_free(dmat, vaddr, map); +} + +/* + * Release the mapping held by map. + */ +static inline void +bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + tc->impl->map_unload(dmat, map); +} + +static inline void +bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + tc->impl->map_sync(dmat, map, op); +} + +static inline int +_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf, +bus_size_t buflen, int flags, bus_dma_segment_t *segs, int *segp) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + return (tc->impl->load_phys(dmat, map, buf, buflen, flags, segs, + segp)); +} + +static inline int +_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, struct vm_page **ma, +bus_size_t tlen, int ma_offs, int flags, bus_dma_segment_t *segs, +int *segp) +{ + struct bus_dma_tag_common *tc; + + tc = (struct bus_dma_tag_common *)dmat; + return (tc->impl->load_ma(dmat, map, ma, tlen, ma_offs, flags, + segs, segp)); +} + +static inline int +_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, +bus_size_t buflen, struct pmap *pmap, int flags, bus_dma_segment_t *segs, +int *segp) +{ + struct bus_dma_tag_common *tc; + + tc = (struct
svn commit: r347224 - head/sys/tools
Author: emaste Date: Tue May 7 13:04:26 2019 New Revision: 347224 URL: https://svnweb.freebsd.org/changeset/base/347224 Log: Use @generated tag in generated files Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in generated files). Use the @generated tag in makeobjops.awk and vnode_if.awk as we've done for other generated files. Sponsored by: The FreeBSD Foundation Modified: head/sys/tools/makeobjops.awk head/sys/tools/vnode_if.awk Modified: head/sys/tools/makeobjops.awk == --- head/sys/tools/makeobjops.awk Tue May 7 10:01:45 2019 (r347223) +++ head/sys/tools/makeobjops.awk Tue May 7 13:04:26 2019 (r347224) @@ -424,7 +424,7 @@ for (file_i = 0; file_i < num_files; file_i++) { common_head = \ "/*\n" \ - " * This file is produced automatically.\n" \ + " * This file is @generated automatically.\n" \ " * Do not modify anything in here by hand.\n" \ " *\n" \ " * Created from source file\n" \ Modified: head/sys/tools/vnode_if.awk == --- head/sys/tools/vnode_if.awk Tue May 7 10:01:45 2019(r347223) +++ head/sys/tools/vnode_if.awk Tue May 7 13:04:26 2019(r347224) @@ -141,7 +141,7 @@ if (!srcfile) common_head = \ "/*\n" \ -" * This file is produced automatically.\n" \ +" * This file is @generated automatically.\n" \ " * Do not modify anything in here by hand.\n" \ " *\n" \ " * Created from $FreeBSD$\n" \ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347218 - head/sys/compat/linsysfs
On 07/05/19 02:45, Dmitry Chagin wrote: > вт, 7 мая 2019 г. в 08:32, Rodney W. Grimes : > >>> Author: dchagin >>> Date: Tue May 7 05:08:13 2019 >>> New Revision: 347218 >>> URL: https://svnweb.freebsd.org/changeset/base/347218 >>> >>> Log: >>> Remove wrong copyright line. Discussed with Carlos Neira. >>> >>> Reported by:Rodney W. Grimes >> normally just use a committers username, aka rgrimes or rgrimes@ >> for these types of things. >> >> > ah, I see only: Rodney W. Grimes > > > >>> MFC after: 2 weeks >>> Differential Revision: https://reviews.freebsd.org/D13656 >> >> Hang on, now you removed his copyright? >> I see he said that was ok, but that was not the desired intent here. >> It would of been fine to have the copyright read: >> >> * Copyright (c) 2006 IronPort Systems >> * All rights reserved. >> * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com >> >> As a heads up to other committers you should never insert your >> copyright between another copyright and the "All rights reserved." text, >> if you wish to assert the all rights reserved you should duplicate >> it like: >> >> * Copyright (c) 2006 IronPort Systems >> * All rights reserved. >> * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com >> * All rights reserved. >> >> preferably on the line with your copyright as in: >> * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com All rights >> reserved. >> >> But if at all possible it would be best if we could not add any >> more of these, and remove them when possible. >> >> > and that actually I did. thanks Rod was saying to remove "All rights reserved" when possible, not the Copyright line. -- Renato Botelho ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347223 - head/stand/common
Author: tsoome Date: Tue May 7 10:01:45 2019 New Revision: 347223 URL: https://svnweb.freebsd.org/changeset/base/347223 Log: command_bcache() does not use argv Therefore mark argv __unused. Modified: head/stand/common/bcache.c Modified: head/stand/common/bcache.c == --- head/stand/common/bcache.c Tue May 7 08:31:54 2019(r347222) +++ head/stand/common/bcache.c Tue May 7 10:01:45 2019(r347223) @@ -467,7 +467,7 @@ bcache_invalidate(struct bcache *bc, daddr_t blkno) COMMAND_SET(bcachestat, "bcachestat", "get disk block cache stats", command_bcache); static int -command_bcache(int argc, char *argv[]) +command_bcache(int argc, char *argv[] __unused) { if (argc != 1) { command_errmsg = "wrong number of arguments"; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347222 - head/sys/dev/e1000
Author: marius Date: Tue May 7 08:31:54 2019 New Revision: 347222 URL: https://svnweb.freebsd.org/changeset/base/347222 Log: o Avoid determining the MAC class (LEM/EM or IGB) - possibly even multiple times - on every interrupt by using an own set of device methods for the IGB class. This translates to introducing igb_if_intr_{disable,enable}() and igb_if_{rx,tx}_queue_intr_enable() with that IGB-specific code moved out of their EM counterparts and otherwise continuing to use the EM IFDI methods also for IGB. Note that igb_if_intr_{disable,enable}() also issue E1000_WRITE_FLUSH as lost with the conversion of igb(4) to iflib(4). Also note, that the em_if_{disable,enable}_intr() methods are renamed to em_if_intr_{disable,enable}() for consistency with the names used in the interface declaration. o In em_intr(): - Don't bother to bail out if the interrupt type is "legacy", i. e. INTx or MSI, as iflib(4) doesn't use ift_legacy_intr methods for MSI-X. All other iflib(4)-based drivers avoid this check, too. - Given that only the MSI-X interrupts have one-shot behavior (by taking advantage of the EIAC register), explicitly disable interrupts. Hence, em_intr() now matches what {em,igb}_irq_fast() previously did (in case of igb(4) supposedly also to work around MSI message reordering errata on certain systems). o In em_if_intr_disable(): - Clear the EIAC register unconditionally for 82574 and not just in case of MSI-X, matching em_if_intr_enable() and bringing back the last hunk of r206437 lost with the iflib(4) conversion. - Write to EM_EIAC for clearing said register instead of to the IGB-only E1000_EIAC used ever since the iflib(4) conversion. Reviewed by: shurd Differential Revision:https://reviews.freebsd.org/D20176 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Tue May 7 08:28:35 2019(r347221) +++ head/sys/dev/e1000/if_em.c Tue May 7 08:31:54 2019(r347222) @@ -261,10 +261,14 @@ static intem_setup_msix(if_ctx_t ctx); static voidem_initialize_transmit_unit(if_ctx_t ctx); static voidem_initialize_receive_unit(if_ctx_t ctx); -static voidem_if_enable_intr(if_ctx_t ctx); -static voidem_if_disable_intr(if_ctx_t ctx); +static voidem_if_intr_enable(if_ctx_t ctx); +static voidem_if_intr_disable(if_ctx_t ctx); +static voidigb_if_intr_enable(if_ctx_t ctx); +static voidigb_if_intr_disable(if_ctx_t ctx); static int em_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid); static int em_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid); +static int igb_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid); +static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid); static voidem_if_multi_set(if_ctx_t ctx); static voidem_if_update_admin_status(if_ctx_t ctx); static voidem_if_debug(if_ctx_t ctx); @@ -375,8 +379,8 @@ static device_method_t em_if_methods[] = { DEVMETHOD(ifdi_init, em_if_init), DEVMETHOD(ifdi_stop, em_if_stop), DEVMETHOD(ifdi_msix_intr_assign, em_if_msix_intr_assign), - DEVMETHOD(ifdi_intr_enable, em_if_enable_intr), - DEVMETHOD(ifdi_intr_disable, em_if_disable_intr), + DEVMETHOD(ifdi_intr_enable, em_if_intr_enable), + DEVMETHOD(ifdi_intr_disable, em_if_intr_disable), DEVMETHOD(ifdi_tx_queues_alloc, em_if_tx_queues_alloc), DEVMETHOD(ifdi_rx_queues_alloc, em_if_rx_queues_alloc), DEVMETHOD(ifdi_queues_free, em_if_queues_free), @@ -398,14 +402,47 @@ static device_method_t em_if_methods[] = { DEVMETHOD_END }; -/* - * note that if (adapter->msix_mem) is replaced by: - * if (adapter->intr_type == IFLIB_INTR_MSIX) - */ static driver_t em_if_driver = { "em_if", em_if_methods, sizeof(struct adapter) }; +static device_method_t igb_if_methods[] = { + DEVMETHOD(ifdi_attach_pre, em_if_attach_pre), + DEVMETHOD(ifdi_attach_post, em_if_attach_post), + DEVMETHOD(ifdi_detach, em_if_detach), + DEVMETHOD(ifdi_shutdown, em_if_shutdown), + DEVMETHOD(ifdi_suspend, em_if_suspend), + DEVMETHOD(ifdi_resume, em_if_resume), + DEVMETHOD(ifdi_init, em_if_init), + DEVMETHOD(ifdi_stop, em_if_stop), + DEVMETHOD(ifdi_msix_intr_assign, em_if_msix_intr_assign), + DEVMETHOD(ifdi_intr_enable, igb_if_intr_enable), + DEVMETHOD(ifdi_intr_disable, igb_if_intr_disable), + DEVMETHOD(ifdi_tx_queues_alloc, em_if_tx_queues_alloc), + DEVMETHOD(ifdi_rx_queues_alloc, em_if_rx_queues_alloc), + DEVMETHOD(ifdi_queues_free, em_if_queues_free), + DEVMETHOD(ifdi_update_admin_status, em_if_update_admin_status), + DEVMETHOD(ifdi_multi_set, em_if_multi_set), + DEVMETHOD(ifdi_media_status,
svn commit: r347221 - head/sys/net
Author: marius Date: Tue May 7 08:28:35 2019 New Revision: 347221 URL: https://svnweb.freebsd.org/changeset/base/347221 Log: o Use iflib_fast_intr_rxtx() also for "legacy" interrupts, i. e. INTx and MSI. Unlike as with iflib_fast_intr_ctx(), the former will also enqueue _task_fn_tx() in addition to _task_fn_rx() if appropriate, bringing TCP TX throughput of EM-class devices on par with the MSI-X case and, thus, close to wirespeed/pre-iflib(4) times again. [1] Note that independently of the interrupt type, the UDP performance with these MACs still is abysmal and nowhere near to where it was before the conversion of em(4) to iflib(4). o In iflib_init_locked(), announce which free list failed to set up. o In _task_fn_tx() when running netmap(4), issue ifdi_intr_enable instead of the ifdi_tx_queue_intr_enable method in case of a "legacy" interrupt as the latter is valid with MSI-X only. o Instead of adding the missing - and apparently convoluted enough that a DBG_COUNTER_INC was put into a wrong spot in _task_fn_rx() - checks for ifdi_{r,t}x_queue_intr_enable being available in the MSI-X case also to iflib_fast_intr_rxtx(), factor these out to iflib_device_register() and make the checks fail gracefully rather than panic. This avoids invoking the checks at runtime over and over again in iflib_fast_intr_rxtx() and _task_fn_{r,t}x() - even if it's just in case of INVARIANTS - and makes these functions more readable. o In iflib_rx_structures_setup(), only initialize LRO resources if device and driver have LRO capability in order to not waste memory. Also, free the LRO resources again if setting them up fails for one of the queues. However, don't bother invoking iflib_rx_sds_free() in that case because iflib_rx_structures_setup() doesn't call iflib_rxsd_alloc() either (and iflib_{device,pseudo}_register() will issue iflib_rx_sds_free() in case of failure via iflib_rx_structures_free(), but there definitely is some asymmetry left to be fixed, though). o Similarly, free LRO resources again in iflib_rx_structures_free(). o In iflib_irq_set_affinity(), handle get_core_offset() errors gracefully instead of panicing (but only in case of INVARIANTS). This is a follow- up to r344132, as such driver bugs shouldn't be fatal. o Likewise, handle unknown iflib_intr_type_t in iflib_irq_alloc_generic() gracefully, too. o Bring yet more sanity to iflib_msix_init(): - If the device doesn't provide enough MSI-X vectors or not all vectors can be allocate so the expected number of queues in addition to admin interrupts can't be supported, try MSI next (and then INTx) as proper MSI-X vector distribution can't be assured in such cases. In essence, this change brings r254008 forward to iflib(4). Also, this is the fix alluded to in the commit message of r343934. - If the MSI-X allocation has failed, don't prematurely announce MSI is going to be used as the latter in fact may not be available either. - When falling back to MSI, only release the MSI-X table resource again if it was allocated in iflib_msix_init(), i. e. isn't supplied by the driver, in the first place. o In mp_ndesc_handler(), handle unknown type arguments gracefully, too. PR: 235031 (likely) [1] Reviewed by: shurd Differential Revision:https://reviews.freebsd.org/D20175 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue May 7 08:14:30 2019(r347220) +++ head/sys/net/iflib.cTue May 7 08:28:35 2019(r347221) @@ -1461,6 +1461,7 @@ iflib_fast_intr_rxtx(void *arg) void *sc; int i, cidx, result; qidx_t txqid; + bool intr_enable, intr_legacy; if (!iflib_started) return (FILTER_STRAY); @@ -1474,6 +1475,8 @@ iflib_fast_intr_rxtx(void *arg) ctx = rxq->ifr_ctx; sc = ctx->ifc_softc; + intr_enable = false; + intr_legacy = !!(ctx->ifc_flags & IFC_LEGACY); MPASS(rxq->ifr_ntxqirq); for (i = 0; i < rxq->ifr_ntxqirq; i++) { txqid = rxq->ifr_txqid[i]; @@ -1481,7 +1484,10 @@ iflib_fast_intr_rxtx(void *arg) bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, BUS_DMASYNC_POSTREAD); if (!ctx->isc_txd_credits_update(sc, txqid, false)) { - IFDI_TX_QUEUE_INTR_ENABLE(ctx, txqid); + if (intr_legacy) + intr_enable = true; + else + IFDI_TX_QUEUE_INTR_ENABLE(ctx, txqid); continue; } GROUPTASK_ENQUEUE(>ift_task); @@ -1493,9 +1499,14 @@ iflib_fast_intr_rxtx(void *arg) if
svn commit: r347220 - head/stand/common
Author: tsoome Date: Tue May 7 08:14:30 2019 New Revision: 347220 URL: https://svnweb.freebsd.org/changeset/base/347220 Log: loader: bcache code does not need to check argument for free() Modified: head/stand/common/bcache.c Modified: head/stand/common/bcache.c == --- head/stand/common/bcache.c Tue May 7 07:46:40 2019(r347219) +++ head/stand/common/bcache.c Tue May 7 08:14:30 2019(r347220) @@ -426,10 +426,8 @@ static void bcache_free_instance(struct bcache *bc) { if (bc != NULL) { - if (bc->bcache_ctl) - free(bc->bcache_ctl); - if (bc->bcache_data) - free(bc->bcache_data); + free(bc->bcache_ctl); + free(bc->bcache_data); free(bc); } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347219 - head/stand/common
Author: tsoome Date: Tue May 7 07:46:40 2019 New Revision: 347219 URL: https://svnweb.freebsd.org/changeset/base/347219 Log: loader: use safer DPRINTF body for non-debug case Modified: head/stand/common/bcache.c Modified: head/stand/common/bcache.c == --- head/stand/common/bcache.c Tue May 7 05:08:13 2019(r347218) +++ head/stand/common/bcache.c Tue May 7 07:46:40 2019(r347219) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #ifdef BCACHE_DEBUG # define DPRINTF(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) #else -# define DPRINTF(fmt, args...) +# define DPRINTF(fmt, args...) ((void)0) #endif struct bcachectl ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347218 - head/sys/compat/linsysfs
вт, 7 мая 2019 г. в 08:32, Rodney W. Grimes : > > Author: dchagin > > Date: Tue May 7 05:08:13 2019 > > New Revision: 347218 > > URL: https://svnweb.freebsd.org/changeset/base/347218 > > > > Log: > > Remove wrong copyright line. Discussed with Carlos Neira. > > > > Reported by:Rodney W. Grimes > normally just use a committers username, aka rgrimes or rgrimes@ > for these types of things. > > ah, I see only: Rodney W. Grimes > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D13656 > > Hang on, now you removed his copyright? > I see he said that was ok, but that was not the desired intent here. > It would of been fine to have the copyright read: > > * Copyright (c) 2006 IronPort Systems > * All rights reserved. > * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com > > As a heads up to other committers you should never insert your > copyright between another copyright and the "All rights reserved." text, > if you wish to assert the all rights reserved you should duplicate > it like: > > * Copyright (c) 2006 IronPort Systems > * All rights reserved. > * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com > * All rights reserved. > > preferably on the line with your copyright as in: > * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com All rights > reserved. > > But if at all possible it would be best if we could not add any > more of these, and remove them when possible. > > and that actually I did. thanks > For those wishing to save space the (c) is unneeded when you > spell out the word "Copyright". > > > > > Modified: > > head/sys/compat/linsysfs/linsysfs.c > > > > Modified: head/sys/compat/linsysfs/linsysfs.c > > > == > > --- head/sys/compat/linsysfs/linsysfs.c Tue May 7 01:27:23 2019 > (r347217) > > +++ head/sys/compat/linsysfs/linsysfs.c Tue May 7 05:08:13 2019 > (r347218) > > @@ -2,7 +2,6 @@ > > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > * > > * Copyright (c) 2006 IronPort Systems > > - * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com > > * All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > > > > > -- > Rod Grimes > rgri...@freebsd.org > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"