svn commit: r343998 - head/sys/dev/beri/virtio
Author: gonzo Date: Mon Feb 11 07:42:32 2019 New Revision: 343998 URL: https://svnweb.freebsd.org/changeset/base/343998 Log: Fix off-by-one error in BERI virtio driver The hardcoded ident is exactly 20 bytes long but sprintf adds terminating zero, so there is one byte written out of array bounds.As a fix use strncpy it appends \0 only if space allows and its behavior matches virtio spec: When VIRTIO_BLK_T_GET_ID is issued, the device identifier, up to 20 bytes, is written to the buffer. The identifier should be interpreted as an ascii string. It is terminated with \0, unless it is exactly 20 bytes long. PR: 202298 Reviewed by: br MFC after:1 week Differential Revision:https://reviews.freebsd.org/D18852 Modified: head/sys/dev/beri/virtio/virtio_block.c Modified: head/sys/dev/beri/virtio/virtio_block.c == --- head/sys/dev/beri/virtio/virtio_block.c Mon Feb 11 07:09:02 2019 (r343997) +++ head/sys/dev/beri/virtio/virtio_block.c Mon Feb 11 07:42:32 2019 (r343998) @@ -187,7 +187,7 @@ vtblk_proc(struct beri_vtblk_softc *sc, struct vqueue_ break; case VIRTIO_BLK_T_GET_ID: /* Assume a single buffer */ - strlcpy(iov[1].iov_base, sc->ident, + strncpy(iov[1].iov_base, sc->ident, MIN(iov[1].iov_len, sizeof(sc->ident))); err = 0; break; @@ -401,7 +401,7 @@ backend_info(struct beri_vtblk_softc *sc) s+=1; } - sprintf(sc->ident, "Virtio block backend"); + strncpy(sc->ident, "Virtio block backend", sizeof(sc->ident)); return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343985 - head/sys/kern
On Sun, 10 Feb 2019, Conrad Meyer wrote: ... This is the slowest correct fix in the PR followup. kib predicted that I wouldn't like it. It does 2 64-bit divmods (after optimization) and many multiplications per call. Times 2 calls. clang will probably inline this, giving only 3 64-bit divmods instead of 4. Did you measure any of this, or is this speculation? I plugged both versions into Godbolt just for amusement: https://godbolt.org/z/KE_FF8 (GCC 8.2), https://godbolt.org/z/WSepYg (Clang 7.0.0). This was unreadable using lynx. I tested only later versions. Counting divmods is adequate for seeing how slow various methods are. divmod is so slow that branches don't matter. Andrey's version has no branches; yours has two conditional branches as well as a large NOP to align the branch target (GCC); Clang manages only a single branch and doesn't pad the branch target. I doubt that you tested gcc-4.2.1 or 32-bit arches in Godbolt, or the flags that I use. 64-bit division is a libcall on i386. This has many more than 2 branches, and large code just to pass args. I use gcc-4.2 [-m32 -mtune=i386] -Os -fno-inline-functions -fno-inline-functions-called-once, and this avoids all nops for alignment. -Os is also an optimization for time except compared very agressive optimizations for time that I don't want since they are harder to debug using ddb. For makeworld, all of clang's optimizations for time at the cost of space and debugability only gain about 10% sys time or 1% real time relative to my negative optimizations for time. The alignment might be the right thing for optimization. I don't like the __predict*() ugliness much, but here it serves to document the optimization. It says that the compiler should move the 'false' case far away. This might need nops that pessimize it further. Andrey's version has five divs at gcc8.2 -O2, and six imuls. Not too good. My -fno-inline-functions should prevent auto-inlining of the function. In practice, this flag is essential to unbreak gcc-4.2 -Os, and unusable with clang since it breaks inlining of all functions that are explicitly declared as inline, e.g., curthread. Not inlining prevents reuse of common expressions. 5 divs is still a lot. Statically, the committed version has 3 muls, 3 divs and 3 mods per call. I also considered imuls vs muls. Muls are much faster than divs and mods, so this doesn't matter a lot. The code is pessimized by using unsigned types. This makes it hard to use imul instead of mul on x86. x86 has a few more imul instructions than mul instructions. Some of the extras use less registers so should be preferred. In the happy case, your version has two cmp+ja, two divs, and two imuls. In the unhappy case, your version has two cmp+ja, three div, and four imul. Just eyeballing it, your code might be marginally larger, but it's fairly similar. The unhappy case is about 0.01% of cases except for watching all threads in the system where at least the idle threads have large runtimes and are a much larger proportion of all threads than 0.01%. Watching many threads is inherently slow so I don't care much about it. 3 divs is already much faster than 5. div takes about 20 cycles on x86 (slightky slower with 64 bits) and is hard to optimize, so other arches (including x86 floating point) can't be much faster without using too much hardware. Look at the i386 code. It is much larger for other reasons. Mostly for the unhappy case. Does it matter? I doubt it. Modern CPUs are crazy superscalar OOO Not a lot. i386 has enormous pessimizations and it is impossible to recover using micro-optimizations like this. Times for getrusage() on Haswell i386: - FreeBSD-~5.2 Athlon-XP: 2444 cycles - FreeBSD-~11Haswell: 1970 cycles - FreeBSD-cur pae_mode=0 Haswell: 3260 cycles - FreeBSD-cur pae_mode=1 Haswell: 5040 cycles (all anti-spectre, etc. off) The last 2 have my fix with its small optimization. All my other optimizations reduce the 5040 cycles by 500. amd64 in other benchmarks is slightly slower than in FreeBSD-11. magic and as long as there aren't bad data dependencies, it can cruise along. It is already using that to run i386 64-bit code reasonably fast. Dependencies are further apart because there is more to do in between. But there are more branches (2 instead of 1 just to compare 64-bit values), and divs are a larger problem. I haven't noticed any x86 with more than one ALU handling div. Pipelines tend to stall waiting for div. And values that actually need 64 bits need more than 1 div. All values reside in registers and imul isn't much slower than add. I think most non-old x86 have 2 or 3 ALUs for mul, with a throughput of 1 per ALU per cycle and only the latency a bit worse than for add. div is a bit slower, but probably cheaper than an L1 miss. Feel Much slower than add. More like 1 per 20 cycles throughput and latency. But cache misses are
Re: svn commit: r343985 - head/sys/kern
Hi Bruce, On Sun, Feb 10, 2019 at 9:18 PM Bruce Evans wrote: > > On Sun, 10 Feb 2019, Conrad Meyer wrote: > > > Log: > > Prevent overflow for usertime/systime in caclru1 > > > > PR: 76972 and duplicates > ... > I wrote a much better version, > following the hints in my review of PR 76972. Great. If your version is better (and correct), please go ahead and commit it. I noticed this bug had been languishing for over a decade with a reasonable patch attached; verified it was correct; and went ahead and committed it. If there's something even better, fantastic. > This is the slowest correct fix in the PR followup. kib predicted > that I wouldn't like it. It does 2 64-bit divmods (after optimization) > and many multiplications per call. Times 2 calls. clang will probably > inline this, giving only 3 64-bit divmods instead of 4. Did you measure any of this, or is this speculation? I plugged both versions into Godbolt just for amusement: https://godbolt.org/z/KE_FF8 (GCC 8.2), https://godbolt.org/z/WSepYg (Clang 7.0.0). Andrey's version has no branches; yours has two conditional branches as well as a large NOP to align the branch target (GCC); Clang manages only a single branch and doesn't pad the branch target. Andrey's version has five divs at gcc8.2 -O2, and six imuls. In the happy case, your version has two cmp+ja, two divs, and two imuls. In the unhappy case, your version has two cmp+ja, three div, and four imul. Just eyeballing it, your code might be marginally larger, but it's fairly similar. Does it matter? I doubt it. Modern CPUs are crazy superscalar OOO magic and as long as there aren't bad data dependencies, it can cruise along. All values reside in registers and imul isn't much slower than add. div is a bit slower, but probably cheaper than an L1 miss. Feel free to measure and demonstrate a difference if you feel it is important. I don't care, as long as it's correct (which it was not for the past 14 years). Conrad ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343996 - head/sys/netpfil/pf
Author: pkelsey Date: Mon Feb 11 05:39:38 2019 New Revision: 343996 URL: https://svnweb.freebsd.org/changeset/base/343996 Log: Place pf_altq_get_nth_active() under the ALTQ ifdef MFC after:1 week Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c == --- head/sys/netpfil/pf/pf_ioctl.c Mon Feb 11 05:17:31 2019 (r343995) +++ head/sys/netpfil/pf/pf_ioctl.c Mon Feb 11 05:39:38 2019 (r343996) @@ -1360,7 +1360,6 @@ pf_import_kaltq(struct pfioc_altq_v1 *pa, struct pf_al return (0); } -#endif /* ALTQ */ static struct pf_altq * pf_altq_get_nth_active(u_int32_t n) @@ -1383,6 +1382,7 @@ pf_altq_get_nth_active(u_int32_t n) return (NULL); } +#endif /* ALTQ */ static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343985 - head/sys/kern
On Sun, 10 Feb 2019, Conrad Meyer wrote: Log: Prevent overflow for usertime/systime in caclru1 PR:76972 and duplicates Reported by: Dr. Christopher Landauer , Steinar Haug Submitted by: Andrey Zonov (earlier version) MFC after: 2 weeks kib asked me to fix this a couple of days ago. I wrote a much better version, following the hints in my review of PR 76972. Modified: head/sys/kern/kern_resource.c == --- head/sys/kern/kern_resource.c Sun Feb 10 22:33:41 2019 (r343984) +++ head/sys/kern/kern_resource.c Sun Feb 10 23:07:46 2019 (r343985) @@ -863,6 +863,15 @@ rufetchtd(struct thread *td, struct rusage *ru) calcru1(p, >td_rux, >ru_utime, >ru_stime); } +static uint64_t +mul64_by_fraction(uint64_t a, uint64_t b, uint64_t c) +{ + /* +* Compute floor(a * (b / c)) without overflowing, (b / c) <= 1.0. +*/ + return ((a / c) * b + (a % c) * (b / c) + (a % c) * (b % c) / c); +} + This is the slowest correct fix in the PR followup. kib predicted that I wouldn't like it. It does 2 64-bit divmods (after optimization) and many multiplications per call. Times 2 calls. clang will probably inline this, giving only 3 64-bit divmods instead of 4. Better version: + /* +* Subdivide tu. Combine avoiding overflow with reduction to 32-bit +* operands in the multiplications in the usual case of tu <= +* UINT32_MAX usec = 4294 seconds. +*/ + if (__predict_true(tu <= UINT32_MAX && tt <= UINT32_MAX)) { + uu = ((uint64_t)(uint32_t)tu * (uint32_t)ut) / tt; + su = ((uint64_t)(uint32_t)tu * (uint32_t)st) / tt; + } else { + q = tu / tt; + r = tu % tt; + uu = q * ut + (r * ut) / tt; + su = q * st + (r * st) / tt; + } This does 2 32-bit divisions in the usual case, and 1 64-bit divmod and 2 64-bit divs in the slow case. The second clause is directly from Landauer's version. The a = b * q + r method is much easier to understand when written using assignments to variables named q and r. The first clause is from Landauer's version with less magic numbers. I over-optimized it a little and am going to remove the casts. They are only a small optimization for the 32-bit case, and compilers can do them anyway, and the 32-bit udiv/mod libcalls can get closer to doing them. I wrote further fixes and optimizations: - restore the invariant that user + sys time doesn't exceed total time - restore monotonicity of interrupt time (this implies the previous invariant) - merge interrupt time into sys time and make interrupt time 0. Everything becomes simpler and faster and less buggy. - optimize udiv/mod for usec to timeval conversions. Interrupt times became worse than useless with ithreads in SMPng. Sys time for ithreads gives a much better place to record interrupt time than scattered interrupt times in all threads. Interrupt times are now stored in all threads indirectly as tu - uu - su. They are always 0 for non-ithreads, except for bugs. One of the bugs is that rounding down uu and su makes the indirect interrupt time tu - uu - su often 1 (usec) instead of 0. Versions without bugs in invariants and monotonictity had to do complicated adjustments on many later calls to preserve this value as 1. Versions with these bugs have a sticky off-by-1 error instead. I thought that I might have written this overflow bug, but actually it was in 4.4BSD-Lite and I didn't notice it when I cleaned that up. Lite2 does: XX u = sec * 100 + usec; XX st = (u * st) / tot; XX [... similarly for other 2 times] Overflow here. The 64-bit tick counters are useless except for them not needing upcasts here, since they although they don't overflow for billions of years, calculations like this overflow after 108 hours. FreeBSD-1 (Net/2?) doesn't have this problem, since it maintains the times as timevals (very inaccurately but obviously monotonically by incrementing the times in hardclock()). It has lots of overflow bugs 248 days from using signed int tick counters and hz = 100. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343995 - in head/sys: net net/altq netpfil/pf
Author: pkelsey Date: Mon Feb 11 05:17:31 2019 New Revision: 343995 URL: https://svnweb.freebsd.org/changeset/base/343995 Log: Reduce the time it takes the kernel to install a new PF config containing a large number of queues In general, the time savings come from separating the active and inactive queues lists into separate interface and non-interface queue lists, and changing the rule and queue tag management from list-based to hash-bashed. In HFSC, a linear scan of the class table during each queue destroy was also eliminated. There are now two new tunables to control the hash size used for each tag set (default for each is 128): net.pf.queue_tag_hashsize net.pf.rule_tag_hashsize Reviewed by: kp MFC after:1 week Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D19131 Modified: head/sys/net/altq/altq_cbq.c head/sys/net/altq/altq_codel.c head/sys/net/altq/altq_fairq.c head/sys/net/altq/altq_hfsc.c head/sys/net/altq/altq_hfsc.h head/sys/net/altq/altq_priq.c head/sys/net/altq/altq_subr.c head/sys/net/altq/altq_var.h head/sys/net/pfvar.h head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/net/altq/altq_cbq.c == --- head/sys/net/altq/altq_cbq.cMon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_cbq.cMon Feb 11 05:17:31 2019 (r343995) @@ -223,12 +223,11 @@ cbq_pfattach(struct pf_altq *a) } int -cbq_add_altq(struct pf_altq *a) +cbq_add_altq(struct ifnet *ifp, struct pf_altq *a) { cbq_state_t *cbqp; - struct ifnet*ifp; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); Modified: head/sys/net/altq/altq_codel.c == --- head/sys/net/altq/altq_codel.c Mon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_codel.c Mon Feb 11 05:17:31 2019 (r343995) @@ -89,13 +89,12 @@ codel_pfattach(struct pf_altq *a) } int -codel_add_altq(struct pf_altq *a) +codel_add_altq(struct ifnet *ifp, struct pf_altq *a) { struct codel_if *cif; - struct ifnet*ifp; struct codel_opts *opts; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); Modified: head/sys/net/altq/altq_fairq.c == --- head/sys/net/altq/altq_fairq.c Mon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_fairq.c Mon Feb 11 05:17:31 2019 (r343995) @@ -148,12 +148,11 @@ fairq_pfattach(struct pf_altq *a) } int -fairq_add_altq(struct pf_altq *a) +fairq_add_altq(struct ifnet *ifp, struct pf_altq *a) { struct fairq_if *pif; - struct ifnet *ifp; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); Modified: head/sys/net/altq/altq_hfsc.c == --- head/sys/net/altq/altq_hfsc.c Mon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_hfsc.c Mon Feb 11 05:17:31 2019 (r343995) @@ -159,12 +159,11 @@ hfsc_pfattach(struct pf_altq *a) } int -hfsc_add_altq(struct pf_altq *a) +hfsc_add_altq(struct ifnet *ifp, struct pf_altq *a) { struct hfsc_if *hif; - struct ifnet *ifp; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); @@ -506,6 +505,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_ goto err_ret; } } + cl->cl_slot = i; if (flags & HFCF_DEFAULTCLASS) hif->hif_defaultclass = cl; @@ -558,7 +558,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_ static int hfsc_class_destroy(struct hfsc_class *cl) { - int i, s; + int s; if (cl == NULL) return (0); @@ -589,12 +589,7 @@ hfsc_class_destroy(struct hfsc_class *cl) ASSERT(p != NULL); } - for (i = 0; i < HFSC_MAX_CLASSES; i++) - if (cl->cl_hif->hif_class_tbl[i] == cl) { - cl->cl_hif->hif_class_tbl[i] = NULL; - break; - } - + cl->cl_hif->hif_class_tbl[cl->cl_slot] = NULL; cl->cl_hif->hif_classes--; IFQ_UNLOCK(cl->cl_hif->hif_ifq); splx(s); Modified: head/sys/net/altq/altq_hfsc.h
svn commit: r343993 - head/sbin/bectl
Author: kevans Date: Mon Feb 11 04:00:01 2019 New Revision: 343993 URL: https://svnweb.freebsd.org/changeset/base/343993 Log: bectl(8): Add -o flag to destroy to clean up the origin snapshot of BE We can't predict when destruction of origin is needed, and currently we have a precedent for not prompting for things. Leave the decision up to the user of bectl(8) if they want the origin snapshot to be destroyed or not. Emits a warning when -o isn't used and an origin snapshot is left to be cleaned up, for the time being. This is handy when one drops the -o flag but really did want to clean up the origin. A couple of -e ignore's have been sprinkled around the test suite for places that we don't care that the origin's not been cleaned up. -o functionality tests will be added in the future, but are omitted for now to reduce conflicts with work in flight to fix bits of the tests. Reported by: Shawn Webb MFC after:1 week Modified: head/sbin/bectl/bectl.8 head/sbin/bectl/bectl.c Modified: head/sbin/bectl/bectl.8 == --- head/sbin/bectl/bectl.8 Mon Feb 11 00:31:58 2019(r343992) +++ head/sbin/bectl/bectl.8 Mon Feb 11 04:00:01 2019(r343993) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 25, 2018 +.Dd February 10, 2019 .Dt BECTL 8 .Os .Sh NAME @@ -40,7 +40,7 @@ .Ar beName@snapshot .Nm .Cm destroy -.Op Fl F +.Op Fl \ .Brq Ar beName | beName@snapshot .Nm .Cm export @@ -124,7 +124,7 @@ If the flag is given, a recursive boot environment will be made. .It Xo .Cm destroy -.Op Fl F +.Op Fl \ .Brq Ar beName | beName@snapshot .Xc Destroys the given @@ -136,6 +136,14 @@ snapshot without confirmation, unlike in Specifying .Fl F will automatically unmount without confirmation. +.Pp +By default, +.Nm +will warn that it is not destroying the origin of +.Ar beName . +The +.Fl o +flag may be specified to destroy the origin as well. .It Cm export Ar sourceBe Export .Ar sourceBe Modified: head/sbin/bectl/bectl.c == --- head/sbin/bectl/bectl.c Mon Feb 11 00:31:58 2019(r343992) +++ head/sbin/bectl/bectl.c Mon Feb 11 04:00:01 2019(r343993) @@ -341,16 +341,19 @@ bectl_cmd_add(int argc, char *argv[]) static int bectl_cmd_destroy(int argc, char *argv[]) { - char *target; - int opt, err; - bool force; + nvlist_t *props; + char *origin, *target, targetds[BE_MAXPATHLEN]; + int err, flags, opt; - force = false; - while ((opt = getopt(argc, argv, "F")) != -1) { + flags = 0; + while ((opt = getopt(argc, argv, "Fo")) != -1) { switch (opt) { case 'F': - force = true; + flags |= BE_DESTROY_FORCE; break; + case 'o': + flags |= BE_DESTROY_ORIGIN; + break; default: fprintf(stderr, "bectl destroy: unknown option '-%c'\n", optopt); @@ -368,7 +371,24 @@ bectl_cmd_destroy(int argc, char *argv[]) target = argv[0]; - err = be_destroy(be, target, force); + /* We'll emit a notice if there's an origin to be cleaned up */ + if ((flags & BE_DESTROY_ORIGIN) == 0 && strchr(target, '@') == NULL) { + if (be_root_concat(be, target, targetds) != 0) + goto destroy; + if (be_prop_list_alloc() != 0) + goto destroy; + if (be_get_dataset_props(be, targetds, props) != 0) { + be_prop_list_free(props); + goto destroy; + } + if (nvlist_lookup_string(props, "origin", ) == 0) + fprintf(stderr, "bectl destroy: leaving origin '%s' intact\n", + origin); + be_prop_list_free(props); + } + +destroy: + err = be_destroy(be, target, flags); return (err); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343994 - head/sbin/bectl/tests
Author: kevans Date: Mon Feb 11 04:00:42 2019 New Revision: 343994 URL: https://svnweb.freebsd.org/changeset/base/343994 Log: bectl(8): commit missing test modifications from r343993 X-MFC-With: r343993 Modified: head/sbin/bectl/tests/bectl_test.sh Modified: head/sbin/bectl/tests/bectl_test.sh == --- head/sbin/bectl/tests/bectl_test.sh Mon Feb 11 04:00:01 2019 (r343993) +++ head/sbin/bectl/tests/bectl_test.sh Mon Feb 11 04:00:42 2019 (r343994) @@ -110,7 +110,7 @@ bectl_destroy_body() bectl_create_setup ${zpool} ${disk} ${mount} atf_check bectl -r ${zpool}/ROOT create -e default default2 atf_check -o not-empty zfs get mountpoint ${zpool}/ROOT/default2 - atf_check bectl -r ${zpool}/ROOT destroy default2 + atf_check -e ignore bectl -r ${zpool}/ROOT destroy default2 atf_check -e not-empty -s not-exit:0 zfs get mountpoint ${zpool}/ROOT/default2 } bectl_destroy_cleanup() @@ -137,7 +137,7 @@ bectl_export_import_body() atf_check -o save:exported bectl -r ${zpool}/ROOT export default atf_check -x "bectl -r ${zpool}/ROOT import default2 < exported" atf_check -o not-empty zfs get mountpoint ${zpool}/ROOT/default2 - atf_check bectl -r ${zpool}/ROOT destroy default2 + atf_check -e ignore bectl -r ${zpool}/ROOT destroy default2 atf_check -e not-empty -s not-exit:0 zfs get mountpoint \ ${zpool}/ROOT/default2 } @@ -171,7 +171,7 @@ bectl_list_body() atf_check bectl -r ${zpool}/ROOT create -e default default2 atf_check -o save:list.out bectl -r ${zpool}/ROOT list atf_check -o not-empty grep 'default2' list.out - atf_check bectl -r ${zpool}/ROOT destroy default2 + atf_check -e ignore bectl -r ${zpool}/ROOT destroy default2 atf_check -o save:list.out bectl -r ${zpool}/ROOT list atf_check -s not-exit:0 grep 'default2' list.out # XXX TODO: Formatting checks ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343991 - head/sbin/gbde
Author: cem Date: Mon Feb 11 00:11:02 2019 New Revision: 343991 URL: https://svnweb.freebsd.org/changeset/base/343991 Log: gbde(8) - simplify randomisation with arc4random_buf Submitted by: David CARLIER Differential Revision:https://reviews.freebsd.org/D18678 Modified: head/sbin/gbde/gbde.c Modified: head/sbin/gbde/gbde.c == --- head/sbin/gbde/gbde.c Sun Feb 10 23:58:56 2019(r343990) +++ head/sbin/gbde/gbde.c Mon Feb 11 00:11:02 2019(r343991) @@ -174,18 +174,7 @@ g_read_data(struct g_consumer *cp, off_t offset, off_t static void random_bits(void *p, u_int len) { - static int fdr = -1; - int i; - - if (fdr < 0) { - fdr = open("/dev/urandom", O_RDONLY); - if (fdr < 0) - err(1, "/dev/urandom"); - } - - i = read(fdr, p, len); - if (i != (int)len) - err(1, "read from /dev/urandom"); + arc4random_buf(p, len); } /* XXX: not nice */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343990 - in head/sys: dev/malo dev/mwl dev/usb/wlan net80211
Author: avos Date: Sun Feb 10 23:58:56 2019 New Revision: 343990 URL: https://svnweb.freebsd.org/changeset/base/343990 Log: net80211(4): hide casts for 'i_seq' field offset calculation inside ieee80211_getqos() and reuse it in various places. Checked with RTL8188EE, HOSTAP mode + RTL8188CUS, STA mode. MFC after:2 weeks Modified: head/sys/dev/malo/if_malo.c head/sys/dev/mwl/if_mwl.c head/sys/dev/usb/wlan/if_run.c head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_wds.c Modified: head/sys/dev/malo/if_malo.c == --- head/sys/dev/malo/if_malo.c Sun Feb 10 23:47:37 2019(r343989) +++ head/sys/dev/malo/if_malo.c Sun Feb 10 23:58:56 2019(r343990) @@ -1051,13 +1051,9 @@ malo_tx_start(struct malo_softc *sc, struct ieee80211_ copyhdrlen = hdrlen = ieee80211_anyhdrsize(wh); pktlen = m0->m_pkthdr.len; if (IEEE80211_QOS_HAS_SEQ(wh)) { - if (IEEE80211_IS_DSTODS(wh)) { - qos = *(uint16_t *) - (((struct ieee80211_qosframe_addr4 *) wh)->i_qos); + qos = *(uint16_t *)ieee80211_getqos(wh); + if (IEEE80211_IS_DSTODS(wh)) copyhdrlen -= sizeof(qos); - } else - qos = *(uint16_t *) - (((struct ieee80211_qosframe *) wh)->i_qos); } else qos = 0; @@ -1952,7 +1948,6 @@ malo_rx_proc(void *arg, int npending) struct malo_rxdesc *ds; struct mbuf *m, *mnew; struct ieee80211_qosframe *wh; - struct ieee80211_qosframe_addr4 *wh4; struct ieee80211_node *ni; int off, len, hdrlen, pktlen, rssi, ntodo; uint8_t *data, status; @@ -2062,15 +2057,8 @@ malo_rx_proc(void *arg, int npending) /* NB: don't need to do this sometimes but ... */ /* XXX special case so we can memcpy after m_devget? */ ovbcopy(data + sizeof(uint16_t), wh, hdrlen); - if (IEEE80211_QOS_HAS_SEQ(wh)) { - if (IEEE80211_IS_DSTODS(wh)) { - wh4 = mtod(m, - struct ieee80211_qosframe_addr4*); - *(uint16_t *)wh4->i_qos = ds->qosctrl; - } else { - *(uint16_t *)wh->i_qos = ds->qosctrl; - } - } + if (IEEE80211_QOS_HAS_SEQ(wh)) + *(uint16_t *)ieee80211_getqos(wh) = ds->qosctrl; if (ieee80211_radiotap_active(ic)) { sc->malo_rx_th.wr_flags = 0; sc->malo_rx_th.wr_rate = ds->rate; Modified: head/sys/dev/mwl/if_mwl.c == --- head/sys/dev/mwl/if_mwl.c Sun Feb 10 23:47:37 2019(r343989) +++ head/sys/dev/mwl/if_mwl.c Sun Feb 10 23:58:56 2019(r343990) @@ -2614,7 +2614,6 @@ mwl_rx_proc(void *arg, int npending) struct mwl_rxdesc *ds; struct mbuf *m; struct ieee80211_qosframe *wh; - struct ieee80211_qosframe_addr4 *wh4; struct ieee80211_node *ni; struct mwl_node *mn; int off, len, hdrlen, pktlen, rssi, ntodo; @@ -2761,15 +2760,8 @@ mwl_rx_proc(void *arg, int npending) /* NB: don't need to do this sometimes but ... */ /* XXX special case so we can memcpy after m_devget? */ ovbcopy(data + sizeof(uint16_t), wh, hdrlen); - if (IEEE80211_QOS_HAS_SEQ(wh)) { - if (IEEE80211_IS_DSTODS(wh)) { - wh4 = mtod(m, - struct ieee80211_qosframe_addr4*); - *(uint16_t *)wh4->i_qos = ds->QosCtrl; - } else { - *(uint16_t *)wh->i_qos = ds->QosCtrl; - } - } + if (IEEE80211_QOS_HAS_SEQ(wh)) + *(uint16_t *)ieee80211_getqos(wh) = ds->QosCtrl; /* * The f/w strips WEP header but doesn't clear * the WEP bit; mark the packet with M_WEP so @@ -3100,13 +3092,9 @@ mwl_tx_start(struct mwl_softc *sc, struct ieee80211_no copyhdrlen = hdrlen; pktlen = m0->m_pkthdr.len; if (IEEE80211_QOS_HAS_SEQ(wh)) { - if (IEEE80211_IS_DSTODS(wh)) { - qos = *(uint16_t *) - (((struct ieee80211_qosframe_addr4 *) wh)->i_qos); + qos = *(uint16_t *)ieee80211_getqos(wh); +
svn commit: r343987 - head/sys/contrib/libnv
Author: oshogbo Date: Sun Feb 10 23:30:54 2019 New Revision: 343987 URL: https://svnweb.freebsd.org/changeset/base/343987 Log: libnv: fix memory leaks Free the data array for NV_TYPE_DESCRIPTOR_ARRAY case. MFC after:2 weeks Modified: head/sys/contrib/libnv/nvpair.c Modified: head/sys/contrib/libnv/nvpair.c == --- head/sys/contrib/libnv/nvpair.c Sun Feb 10 23:28:55 2019 (r343986) +++ head/sys/contrib/libnv/nvpair.c Sun Feb 10 23:30:54 2019 (r343987) @@ -2061,6 +2061,7 @@ nvpair_free(nvpair_t *nvp) case NV_TYPE_DESCRIPTOR_ARRAY: for (i = 0; i < nvp->nvp_nitems; i++) close(((int *)(intptr_t)nvp->nvp_data)[i]); + nv_free((int *)(intptr_t)nvp->nvp_data); break; #endif case NV_TYPE_NVLIST: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343986 - in head: lib/libnv/tests sys/contrib/libnv
Author: oshogbo Date: Sun Feb 10 23:28:55 2019 New Revision: 343986 URL: https://svnweb.freebsd.org/changeset/base/343986 Log: libnv: fix memory leaks nvpair_create_stringv: free the temporary string; this fix affects nvlist_add_stringf() and nvlist_add_stringv(). nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain of nvpairs (as resetting it prevents nvlist_destroy() from freeing it). Note: freeing the chain in nvlist_destroy() is not sufficient, because it would still leak through nvlist_take_nvlist_array(). This affects all nvlist_*_nvlist_array() use Submitted by: Mindaugas Rasiukevicius Reported by: clang/gcc ASAN MFC after:2 weeks Modified: head/lib/libnv/tests/nvlist_send_recv_test.c head/sys/contrib/libnv/nv_impl.h head/sys/contrib/libnv/nvlist.c head/sys/contrib/libnv/nvpair.c Modified: head/lib/libnv/tests/nvlist_send_recv_test.c == --- head/lib/libnv/tests/nvlist_send_recv_test.cSun Feb 10 23:07:46 2019(r343985) +++ head/lib/libnv/tests/nvlist_send_recv_test.cSun Feb 10 23:28:55 2019(r343986) @@ -304,6 +304,8 @@ parent(int sock) name = nvlist_next(nvl, , ); CHECK(name == NULL); + + nvlist_destroy(nvl); } static void Modified: head/sys/contrib/libnv/nv_impl.h == --- head/sys/contrib/libnv/nv_impl.hSun Feb 10 23:07:46 2019 (r343985) +++ head/sys/contrib/libnv/nv_impl.hSun Feb 10 23:28:55 2019 (r343986) @@ -103,6 +103,7 @@ bool nvlist_move_nvpair(nvlist_t *nvl, nvpair_t *nvp); void nvlist_set_parent(nvlist_t *nvl, nvpair_t *parent); void nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele); +nvpair_t *nvlist_get_array_next_nvpair(nvlist_t *nvl); const nvpair_t *nvlist_get_nvpair(const nvlist_t *nvl, const char *name); Modified: head/sys/contrib/libnv/nvlist.c == --- head/sys/contrib/libnv/nvlist.c Sun Feb 10 23:07:46 2019 (r343985) +++ head/sys/contrib/libnv/nvlist.c Sun Feb 10 23:28:55 2019 (r343986) @@ -247,6 +247,15 @@ nvlist_set_array_next(nvlist_t *nvl, nvpair_t *ele) nvl->nvl_array_next = ele; } +nvpair_t * +nvlist_get_array_next_nvpair(nvlist_t *nvl) +{ + + NVLIST_ASSERT(nvl); + + return (nvl->nvl_array_next); +} + bool nvlist_in_array(const nvlist_t *nvl) { Modified: head/sys/contrib/libnv/nvpair.c == --- head/sys/contrib/libnv/nvpair.c Sun Feb 10 23:07:46 2019 (r343985) +++ head/sys/contrib/libnv/nvpair.c Sun Feb 10 23:28:55 2019 (r343986) @@ -229,8 +229,16 @@ nvpair_remove_nvlist_array(nvpair_t *nvp) nvlarray = __DECONST(nvlist_t **, nvpair_get_nvlist_array(nvp, )); for (i = 0; i < count; i++) { - nvlist_set_array_next(nvlarray[i], NULL); - nvlist_set_parent(nvlarray[i], NULL); + nvlist_t *nvl; + nvpair_t *nnvp; + + nvl = nvlarray[i]; + nnvp = nvlist_get_array_next_nvpair(nvl); + if (nnvp != NULL) { + nvpair_free_structure(nnvp); + } + nvlist_set_array_next(nvl, NULL); + nvlist_set_parent(nvl, NULL); } } @@ -1193,8 +1201,7 @@ nvpair_create_stringv(const char *name, const char *va if (len < 0) return (NULL); nvp = nvpair_create_string(name, str); - if (nvp == NULL) - nv_free(str); + nv_free(str); return (nvp); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343985 - head/sys/kern
Author: cem Date: Sun Feb 10 23:07:46 2019 New Revision: 343985 URL: https://svnweb.freebsd.org/changeset/base/343985 Log: Prevent overflow for usertime/systime in caclru1 PR: 76972 and duplicates Reported by: Dr. Christopher Landauer , Steinar Haug Submitted by: Andrey Zonov (earlier version) MFC after:2 weeks Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c == --- head/sys/kern/kern_resource.c Sun Feb 10 22:33:41 2019 (r343984) +++ head/sys/kern/kern_resource.c Sun Feb 10 23:07:46 2019 (r343985) @@ -863,6 +863,15 @@ rufetchtd(struct thread *td, struct rusage *ru) calcru1(p, >td_rux, >ru_utime, >ru_stime); } +static uint64_t +mul64_by_fraction(uint64_t a, uint64_t b, uint64_t c) +{ + /* +* Compute floor(a * (b / c)) without overflowing, (b / c) <= 1.0. +*/ + return ((a / c) * b + (a % c) * (b / c) + (a % c) * (b % c) / c); +} + static void calcru1(struct proc *p, struct rusage_ext *ruxp, struct timeval *up, struct timeval *sp) @@ -892,10 +901,10 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struc * The normal case, time increased. * Enforce monotonicity of bucketed numbers. */ - uu = (tu * ut) / tt; + uu = mul64_by_fraction(tu, ut, tt); if (uu < ruxp->rux_uu) uu = ruxp->rux_uu; - su = (tu * st) / tt; + su = mul64_by_fraction(tu, st, tt); if (su < ruxp->rux_su) su = ruxp->rux_su; } else if (tu + 3 > ruxp->rux_tu || 101 * tu > 100 * ruxp->rux_tu) { @@ -924,8 +933,8 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struc "to %ju usec for pid %d (%s)\n", (uintmax_t)ruxp->rux_tu, (uintmax_t)tu, p->p_pid, p->p_comm); - uu = (tu * ut) / tt; - su = (tu * st) / tt; + uu = mul64_by_fraction(tu, ut, tt); + su = mul64_by_fraction(tu, st, tt); } ruxp->rux_uu = uu; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343981 - in head/bin/sh: . tests/expansion
Author: jilles Date: Sun Feb 10 22:23:05 2019 New Revision: 343981 URL: https://svnweb.freebsd.org/changeset/base/343981 Log: sh: Restore $((x)) error checking after fix for $((-9223372036854775808)) SVN r342880 was designed to fix $((-9223372036854775808)) and things like $((0x8000)) but also broke error detection for values of variables without dollar sign ($((x))). For compatibility, overflow in plain literals continues to be ignored and the value is clamped to the boundary (except 9223372036854775808 which is changed to -9223372036854775808). Reviewed by: se (although he would like error checking to be removed) MFC after:2 weeks X-MFC-with: r342880 Differential Revision:https://reviews.freebsd.org/D18926 Added: head/bin/sh/tests/expansion/arith16.0 (contents, props changed) head/bin/sh/tests/expansion/arith17.0 (contents, props changed) Modified: head/bin/sh/arith_yacc.c head/bin/sh/arith_yacc.h head/bin/sh/arith_yylex.c head/bin/sh/shell.h head/bin/sh/tests/expansion/Makefile Modified: head/bin/sh/arith_yacc.c == --- head/bin/sh/arith_yacc.cSun Feb 10 21:32:39 2019(r343980) +++ head/bin/sh/arith_yacc.cSun Feb 10 22:23:05 2019(r343981) @@ -104,7 +104,7 @@ static arith_t arith_lookupvarint(char *varname) if (str == NULL || *str == '\0') str = "0"; errno = 0; - result = strtoarith_t(str, , 0); + result = strtoarith_t(str, ); if (errno != 0 || *p != '\0') yyerror("variable conversion error"); return result; Modified: head/bin/sh/arith_yacc.h == --- head/bin/sh/arith_yacc.hSun Feb 10 21:32:39 2019(r343980) +++ head/bin/sh/arith_yacc.hSun Feb 10 22:23:05 2019(r343981) @@ -90,4 +90,5 @@ union yystype { extern union yystype yylval; +arith_t strtoarith_t(const char *restrict nptr, char **restrict endptr); int yylex(void); Modified: head/bin/sh/arith_yylex.c == --- head/bin/sh/arith_yylex.c Sun Feb 10 21:32:39 2019(r343980) +++ head/bin/sh/arith_yylex.c Sun Feb 10 22:23:05 2019(r343981) @@ -35,6 +35,8 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include #include #include @@ -50,6 +52,32 @@ __FBSDID("$FreeBSD$"); #error Arithmetic tokens are out of order. #endif +arith_t +strtoarith_t(const char *restrict nptr, char **restrict endptr) +{ + arith_t val; + + while (isspace((unsigned char)*nptr)) + nptr++; + switch (*nptr) { + case '-': + return strtoimax(nptr, endptr, 0); + case '0': + return (arith_t)strtoumax(nptr, endptr, 0); + default: + val = (arith_t)strtoumax(nptr, endptr, 0); + if (val >= 0) + return val; + else if (val == ARITH_MIN) { + errno = ERANGE; + return ARITH_MIN; + } else { + errno = ERANGE; + return ARITH_MAX; + } + } +} + int yylex(void) { @@ -78,7 +106,7 @@ yylex(void) case '7': case '8': case '9': - yylval.val = strtoarith_t(buf, , 0); + yylval.val = strtoarith_t(buf, ); arith_buf = end; return ARITH_NUM; case 'A': Modified: head/bin/sh/shell.h == --- head/bin/sh/shell.h Sun Feb 10 21:32:39 2019(r343980) +++ head/bin/sh/shell.h Sun Feb 10 22:23:05 2019(r343981) @@ -59,7 +59,6 @@ */ typedef intmax_t arith_t; #defineARITH_FORMAT_STR "%" PRIdMAX -#definestrtoarith_t(nptr, endptr, base) (intmax_t)strtoumax(nptr, endptr, base) #defineARITH_MIN INTMAX_MIN #defineARITH_MAX INTMAX_MAX Modified: head/bin/sh/tests/expansion/Makefile == --- head/bin/sh/tests/expansion/MakefileSun Feb 10 21:32:39 2019 (r343980) +++ head/bin/sh/tests/expansion/MakefileSun Feb 10 22:23:05 2019 (r343981) @@ -22,6 +22,8 @@ ${PACKAGE}FILES+= arith12.0 ${PACKAGE}FILES+= arith13.0 ${PACKAGE}FILES+= arith14.0 ${PACKAGE}FILES+= arith15.0 +${PACKAGE}FILES+= arith16.0 +${PACKAGE}FILES+= arith17.0 ${PACKAGE}FILES+= assign1.0 ${PACKAGE}FILES+= cmdsubst1.0 ${PACKAGE}FILES+= cmdsubst2.0 Added: head/bin/sh/tests/expansion/arith16.0
svn commit: r343980 - head/sbin/ifconfig
Author: avos Date: Sun Feb 10 21:32:39 2019 New Revision: 343980 URL: https://svnweb.freebsd.org/changeset/base/343980 Log: ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter MFC after:5 days Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cSun Feb 10 21:27:03 2019 (r343979) +++ head/sbin/ifconfig/ifieee80211.cSun Feb 10 21:32:39 2019 (r343980) @@ -5080,7 +5080,9 @@ end: LINE_CHECK("roam:rssi %u.5", rp->rssi/2); else LINE_CHECK("roam:rssi %u", rp->rssi/2); - LINE_CHECK("roam:rate %u", rp->rate/2); + LINE_CHECK("roam:rate %s%u", + (rp->rate & IEEE80211_RATE_MCS) ? "MCS " : "", + get_rate_value(rp->rate)); } else { LINE_BREAK(); list_roam(s); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343979 - head/sys/opencrypto
Author: marius Date: Sun Feb 10 21:27:03 2019 New Revision: 343979 URL: https://svnweb.freebsd.org/changeset/base/343979 Log: As struct cryptop is wrapped in #ifdef _KERNEL, userland doesn't need to drag in either. Modified: head/sys/opencrypto/cryptodev.h Modified: head/sys/opencrypto/cryptodev.h == --- head/sys/opencrypto/cryptodev.h Sun Feb 10 21:22:55 2019 (r343978) +++ head/sys/opencrypto/cryptodev.h Sun Feb 10 21:27:03 2019 (r343979) @@ -63,10 +63,10 @@ #define _CRYPTO_CRYPTO_H_ #include -#include #ifdef _KERNEL #include +#include #endif /* Some initial values */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343978 - head/sbin/pfctl
Author: kp Date: Sun Feb 10 21:22:55 2019 New Revision: 343978 URL: https://svnweb.freebsd.org/changeset/base/343978 Log: pfctl: Fix ifa_grouplookup() Setting the length of the request got lost in r343287, which means SIOCGIFGMEMB gives us the required length, but does not copy the names of the group members. As a result we don't get a correct list of group members, and 'set skip on ' broke. This produced all sorts of very unexpected results, because we would end up applying 'set skip' to unexpected interfaces. X-MFC-with: r343287 Modified: head/sbin/pfctl/pfctl_parser.c Modified: head/sbin/pfctl/pfctl_parser.c == --- head/sbin/pfctl/pfctl_parser.c Sun Feb 10 21:19:09 2019 (r343977) +++ head/sbin/pfctl/pfctl_parser.c Sun Feb 10 21:22:55 2019 (r343978) @@ -1408,6 +1408,7 @@ ifa_grouplookup(char *ifa_name, int flags) return (NULL); bzero(, sizeof(ifgr)); strlcpy(ifgr.ifgr_name, ifa_name, sizeof(ifgr.ifgr_name)); + ifgr.ifgr_len = len; if ((ifgr.ifgr_groups = calloc(1, len)) == NULL) err(1, "calloc"); if (ioctl(s, SIOCGIFGMEMB, (caddr_t)) == -1) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343977 - head/lib/libbe
Author: kevans Date: Sun Feb 10 21:19:09 2019 New Revision: 343977 URL: https://svnweb.freebsd.org/changeset/base/343977 Log: libbe(3): Add a destroy option for removing the origin Currently origin snapshots are left behind when a BE is destroyed, whether it was an auto-created snapshot or explicitly specified via, for example, `bectl create -e be@mysnap ...`. Removing it automatically could be argued as a POLA violation in some circumstances, so provide a flag to be_destroy for it. An accompanying option will be added to bectl(8) to utilize this. Some minor style/consistency nits in the affected areas also addressed. Reported by: Shawn Webb MFC after:1 week Modified: head/lib/libbe/be.c head/lib/libbe/be.h Modified: head/lib/libbe/be.c == --- head/lib/libbe/be.c Sun Feb 10 21:00:02 2019(r343976) +++ head/lib/libbe/be.c Sun Feb 10 21:19:09 2019(r343977) @@ -203,13 +203,14 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data) int be_destroy(libbe_handle_t *lbh, const char *name, int options) { + char origin[BE_MAXPATHLEN], path[BE_MAXPATHLEN]; zfs_handle_t *fs; - char path[BE_MAXPATHLEN]; char *p; int err, force, mounted; p = path; force = options & BE_DESTROY_FORCE; + *origin = '\0'; be_root_concat(lbh, name, path); @@ -222,17 +223,21 @@ be_destroy(libbe_handle_t *lbh, const char *name, int return (set_error(lbh, BE_ERR_DESTROYACT)); fs = zfs_open(lbh->lzh, p, ZFS_TYPE_FILESYSTEM); + if (fs == NULL) + return (set_error(lbh, BE_ERR_ZFSOPEN)); + if ((options & BE_DESTROY_ORIGIN) != 0 && + zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), + NULL, NULL, 0, 1) != 0) + return (set_error(lbh, BE_ERR_NOORIGIN)); } else { - if (!zfs_dataset_exists(lbh->lzh, path, ZFS_TYPE_SNAPSHOT)) return (set_error(lbh, BE_ERR_NOENT)); fs = zfs_open(lbh->lzh, p, ZFS_TYPE_SNAPSHOT); + if (fs == NULL) + return (set_error(lbh, BE_ERR_ZFSOPEN)); } - if (fs == NULL) - return (set_error(lbh, BE_ERR_ZFSOPEN)); - /* Check if mounted, unmount if force is specified */ if ((mounted = zfs_is_mounted(fs, NULL)) != 0) { if (force) @@ -246,6 +251,17 @@ be_destroy(libbe_handle_t *lbh, const char *name, int if (err == EBUSY) return (set_error(lbh, BE_ERR_DESTROYMNT)); return (set_error(lbh, BE_ERR_UNKNOWN)); + } + + if (*origin != '\0') { + fs = zfs_open(lbh->lzh, origin, ZFS_TYPE_SNAPSHOT); + if (fs == NULL) + return (set_error(lbh, BE_ERR_ZFSOPEN)); + err = zfs_destroy(fs, false); + if (err == EBUSY) + return (set_error(lbh, BE_ERR_DESTROYMNT)); + else if (err != 0) + return (set_error(lbh, BE_ERR_UNKNOWN)); } return (0); Modified: head/lib/libbe/be.h == --- head/lib/libbe/be.h Sun Feb 10 21:00:02 2019(r343976) +++ head/lib/libbe/be.h Sun Feb 10 21:19:09 2019(r343977) @@ -93,7 +93,8 @@ int be_rename(libbe_handle_t *, const char *, const ch /* Bootenv removal functions */ typedef enum { - BE_DESTROY_FORCE = 1 << 0, + BE_DESTROY_FORCE= 1 << 0, + BE_DESTROY_ORIGIN = 1 << 1, } be_destroy_opt_t; int be_destroy(libbe_handle_t *, const char *, int); @@ -102,7 +103,7 @@ int be_destroy(libbe_handle_t *, const char *, int); typedef enum { BE_MNT_FORCE= 1 << 0, - BE_MNT_DEEP = 1 << 1, + BE_MNT_DEEP = 1 << 1, } be_mount_opt_t; int be_mount(libbe_handle_t *, char *, char *, int, char *); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343970 - head/sys/powerpc/conf
Author: jhibbits Date: Sun Feb 10 20:21:20 2019 New Revision: 343970 URL: https://svnweb.freebsd.org/changeset/base/343970 Log: powerpc: Clamp MAXCPU for MPC85XXSPE kernel to 2 SoCs with e500v2 chips only have at most 2 cores, and there are no plans to release any more e500v2-based SoCs. Clamping MAXCPU down to 2 saves 5MB of data, and 1.5MB bss. Modified: head/sys/powerpc/conf/MPC85XXSPE Modified: head/sys/powerpc/conf/MPC85XXSPE == --- head/sys/powerpc/conf/MPC85XXSPESun Feb 10 20:13:59 2019 (r343969) +++ head/sys/powerpc/conf/MPC85XXSPESun Feb 10 20:21:20 2019 (r343970) @@ -16,6 +16,7 @@ makeoptions WITH_CTF=1 makeoptionsWERROR="-Werror -Wno-format -Wno-redundant-decls" optionsFPU_EMU +optionsMAXCPU=2 options_KPOSIX_PRIORITY_SCHEDULING optionsALT_BREAK_TO_DEBUGGER ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343969 - head/sys/mips/cavium/octe
Author: nwhitehorn Date: Sun Feb 10 20:13:59 2019 New Revision: 343969 URL: https://svnweb.freebsd.org/changeset/base/343969 Log: Performance improvements for octe(4): - Distribute RX load across multiple cores, if present. This reverts r217212, which is no longer relevant (I think because of the newer SDK). - Use newer APIs for pinning taskqueue entries to specific cores. - Deepen RX buffers. This more than doubles NAT forwarding throughput on my EdgeRouter Lite from, with typical packet mixture, 90 Mbps to over 200 Mbps. The result matches forwarding throughput in Linux without the UBNT hardware offload on the same hardware, and thus likely reflects hardware limits. Reviewed by: jhibbits Modified: head/sys/mips/cavium/octe/ethernet-defines.h head/sys/mips/cavium/octe/ethernet-rx.c head/sys/mips/cavium/octe/ethernet.c Modified: head/sys/mips/cavium/octe/ethernet-defines.h == --- head/sys/mips/cavium/octe/ethernet-defines.hSun Feb 10 19:20:03 2019(r343968) +++ head/sys/mips/cavium/octe/ethernet-defines.hSun Feb 10 20:13:59 2019(r343969) @@ -38,14 +38,14 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROM * the driver uses the default from below. */ -#define INTERRUPT_LIMIT 1 /* Max interrupts per second per core */ +#define INTERRUPT_LIMIT 1000 /* Max interrupts per second per core */ /*#define INTERRUPT_LIMIT 0 *//* Don't limit the number of interrupts */ #define USE_RED 1 /* Enable Random Early Dropping under load */ #define USE_10MBPS_PREAMBLE_WORKAROUND 1/* Allow SW based preamble removal at 10Mbps to workaround PHYs giving us bad preambles */ #define DONT_WRITEBACK(x) (x) /* Use this to have all FPA frees also tell the L2 not to write data to memory */ /*#define DONT_WRITEBACK(x) 0 *//* Use this to not have FPA frees control L2 */ -#define MAX_RX_PACKETS 120 /* Maximum number of packets to process per interrupt. */ +#define MAX_RX_PACKETS 1024 /* Maximum number of packets to process per interrupt. */ #define MAX_OUT_QUEUE_DEPTH 1000 #define FAU_NUM_PACKET_BUFFERS_TO_FREE (CVMX_FAU_REG_END - sizeof(uint32_t)) Modified: head/sys/mips/cavium/octe/ethernet-rx.c == --- head/sys/mips/cavium/octe/ethernet-rx.c Sun Feb 10 19:20:03 2019 (r343968) +++ head/sys/mips/cavium/octe/ethernet-rx.c Sun Feb 10 20:13:59 2019 (r343969) @@ -57,8 +57,6 @@ extern struct ifnet *cvm_oct_device[]; static struct task cvm_oct_task; static struct taskqueue *cvm_oct_taskq; -static int cvm_oct_rx_active; - /** * Interrupt handler. The interrupt occurs whenever the POW * transitions from 0->1 packets in our group. @@ -77,10 +75,9 @@ int cvm_oct_do_interrupt(void *dev_id) cvmx_write_csr(CVMX_POW_WQ_INT, 0x10001
svn commit: r343968 - head/sys/dev/cxgbe/common
Author: np Date: Sun Feb 10 19:20:03 2019 New Revision: 343968 URL: https://svnweb.freebsd.org/changeset/base/343968 Log: cxgbe(4): Ignore unused interrupts. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c == --- head/sys/dev/cxgbe/common/t4_hw.c Sun Feb 10 19:07:47 2019 (r343967) +++ head/sys/dev/cxgbe/common/t4_hw.c Sun Feb 10 19:20:03 2019 (r343968) @@ -5306,6 +5306,7 @@ void t4_intr_enable(struct adapter *adap) F_EGRESS_SIZE_ERR; t4_set_reg_field(adap, A_SGE_INT_ENABLE3, val, val); t4_write_reg(adap, MYPF_REG(A_PL_PF_INT_ENABLE), PF_INTR_MASK); + t4_set_reg_field(adap, A_PL_INT_ENABLE, F_SF | F_I2CM, 0); t4_set_reg_field(adap, A_PL_INT_MAP0, 0, 1 << adap->pf); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343967 - head/lib/libc/net
Author: pluknet Date: Sun Feb 10 19:07:47 2019 New Revision: 343967 URL: https://svnweb.freebsd.org/changeset/base/343967 Log: Sync "struct addrinfo" declaration with netdb.h. Notably, unlike in OpenBSD, which the man page was copied from, ai_canonname and ai_addr come in different order. PR: 225880 MFC after:1 week Modified: head/lib/libc/net/getaddrinfo.3 Modified: head/lib/libc/net/getaddrinfo.3 == --- head/lib/libc/net/getaddrinfo.3 Sun Feb 10 19:01:05 2019 (r343966) +++ head/lib/libc/net/getaddrinfo.3 Sun Feb 10 19:07:47 2019 (r343967) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 13, 2017 +.Dd February 10, 2019 .Dt GETADDRINFO 3 .Os .Sh NAME @@ -78,14 +78,14 @@ as defined by .Aq Pa netdb.h : .Bd -literal struct addrinfo { - int ai_flags; /* input flags */ - int ai_family; /* address family for socket */ - int ai_socktype;/* socket type */ - int ai_protocol;/* protocol for socket */ - socklen_t ai_addrlen; /* length of socket-address */ - struct sockaddr *ai_addr; /* socket-address for socket */ - char *ai_canonname; /* canonical name for service location */ - struct addrinfo *ai_next; /* pointer to next in list */ +int ai_flags; /* AI_PASSIVE, AI_CANONNAME, .. */ +int ai_family; /* AF_xxx */ +int ai_socktype;/* SOCK_xxx */ +int ai_protocol;/* 0 or IPPROTO_xxx for IPv4 and IPv6 */ +socklen_t ai_addrlen; /* length of ai_addr */ +char*ai_canonname; /* canonical name for hostname */ +struct sockaddr *ai_addr; /* binary address */ +struct addrinfo *ai_next; /* next structure in linked list */ }; .Ed .Pp ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343966 - head/sys/vm
Author: kib Date: Sun Feb 10 19:01:05 2019 New Revision: 343966 URL: https://svnweb.freebsd.org/changeset/base/343966 Log: struct xswdev on amd64 requires compat32 shims after ino64. i386 is the only architecture where uint64_t does not specify 8-bytes alignment, which makes struct xswdev layout not compatible between 64bit and i386. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cSun Feb 10 18:28:37 2019(r343965) +++ head/sys/vm/swap_pager.cSun Feb 10 19:01:05 2019(r343966) @@ -2478,10 +2478,23 @@ struct xswdev11 { }; #endif +#if defined(__amd64__) && defined(COMPAT_FREEBSD32) +struct xswdev32 { + u_int xsw_version; + u_int xsw_dev1, xsw_dev2; + int xsw_flags; + int xsw_nblks; + int xsw_used; +}; +#endif + static int sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) { struct xswdev xs; +#if defined(__amd64__) && defined(COMPAT_FREEBSD32) + struct xswdev32 xs32; +#endif #if defined(COMPAT_FREEBSD11) struct xswdev11 xs11; #endif @@ -2492,6 +2505,18 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) error = swap_dev_info(*(int *)arg1, , NULL, 0); if (error != 0) return (error); +#if defined(__amd64__) && defined(COMPAT_FREEBSD32) + if (req->oldlen == sizeof(xs32)) { + xs32.xsw_version = XSWDEV_VERSION; + xs32.xsw_dev1 = xs.xsw_dev; + xs32.xsw_dev2 = xs.xsw_dev >> 32; + xs32.xsw_flags = xs.xsw_flags; + xs32.xsw_nblks = xs.xsw_nblks; + xs32.xsw_used = xs.xsw_used; + error = SYSCTL_OUT(req, , sizeof(xs32)); + return (error); + } +#endif #if defined(COMPAT_FREEBSD11) if (req->oldlen == sizeof(xs11)) { xs11.xsw_version = XSWDEV_VERSION_11; @@ -2500,9 +2525,10 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) xs11.xsw_nblks = xs.xsw_nblks; xs11.xsw_used = xs.xsw_used; error = SYSCTL_OUT(req, , sizeof(xs11)); - } else + return (error); + } #endif - error = SYSCTL_OUT(req, , sizeof(xs)); + error = SYSCTL_OUT(req, , sizeof(xs)); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343965 - head/sys/arm/arm
Author: mmel Date: Sun Feb 10 18:28:37 2019 New Revision: 343965 URL: https://svnweb.freebsd.org/changeset/base/343965 Log: Fix bug introduced by r343962. DMAMAP_DMAMEM_ALLOC is property of dmamap, not dmatag. MFC after:1 week Reported by: ian Pointy hat: mmel Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c == --- head/sys/arm/arm/busdma_machdep-v6.cSun Feb 10 17:19:45 2019 (r343964) +++ head/sys/arm/arm/busdma_machdep-v6.cSun Feb 10 18:28:37 2019 (r343965) @@ -350,13 +350,13 @@ might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus bus_size_t size) { - KASSERT(dmat->flags & DMAMAP_DMAMEM_ALLOC || + KASSERT(map->flags & DMAMAP_DMAMEM_ALLOC || dmat->alignment <= PAGE_SIZE, ("%s: unsupported alignment (0x%08lx) for buffer not " "allocated by bus_dmamem_alloc()", __func__, dmat->alignment)); - return (!(dmat->flags & DMAMAP_DMAMEM_ALLOC) && + return (!(map->flags & DMAMAP_DMAMEM_ALLOC) && ((dmat->flags & BUS_DMA_EXCL_BOUNCE) || alignment_bounce(dmat, addr) || cacheline_bounce(map, addr, size))); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343964 - in head: sys/amd64/amd64 sys/arm/arm sys/compat/freebsd32 sys/compat/ia32 sys/i386/i386 sys/kern sys/sys sys/vm usr.bin/proccontrol
Author: kib Date: Sun Feb 10 17:19:45 2019 New Revision: 343964 URL: https://svnweb.freebsd.org/changeset/base/343964 Log: Implement Address Space Layout Randomization (ASLR) With this change, randomization can be enabled for all non-fixed mappings. It means that the base address for the mapping is selected with a guaranteed amount of entropy (bits). If the mapping was requested to be superpage aligned, the randomization honours the superpage attributes. Although the value of ASLR is diminshing over time as exploit authors work out simple ASLR bypass techniques, it elimintates the trivial exploitation of certain vulnerabilities, at least in theory. This implementation is relatively small and happens at the correct architectural level. Also, it is not expected to introduce regressions in existing cases when turned off (default for now), or cause any significant maintaince burden. The randomization is done on a best-effort basis - that is, the allocator falls back to a first fit strategy if fragmentation prevents entropy injection. It is trivial to implement a strong mode where failure to guarantee the requested amount of entropy results in mapping request failure, but I do not consider that to be usable. I have not fine-tuned the amount of entropy injected right now. It is only a quantitive change that will not change the implementation. The current amount is controlled by aslr_pages_rnd. To not spoil coalescing optimizations, to reduce the page table fragmentation inherent to ASLR, and to keep the transient superpage promotion for the malloced memory, locality clustering is implemented for anonymous private mappings, which are automatically grouped until fragmentation kicks in. The initial location for the anon group range is, of course, randomized. This is controlled by vm.cluster_anon, enabled by default. The default mode keeps the sbrk area unpopulated by other mappings, but this can be turned off, which gives much more breathing bits on architectures with small address space, such as i386. This is tied with the question of following an application's hint about the mmap(2) base address. Testing shows that ignoring the hint does not affect the function of common applications, but I would expect more demanding code could break. By default sbrk is preserved and mmap hints are satisfied, which can be changed by using the kern.elf{32,64}.aslr.honor_sbrk sysctl. ASLR is enabled on per-ABI basis, and currently it is only allowed on FreeBSD native i386 and amd64 (including compat 32bit) ABIs. Support for additional architectures will be added after further testing. Both per-process and per-image controls are implemented: - procctl(2) adds PROC_ASLR_CTL/PROC_ASLR_STATUS; - NT_FREEBSD_FCTL_ASLR_DISABLE feature control note bit makes it possible to force ASLR off for the given binary. (A tool to edit the feature control note is in development.) Global controls are: - kern.elf{32,64}.aslr.enable - for non-fixed mappings done by mmap(2); - kern.elf{32,64}.aslr.pie_enable - for PIE image activation mappings; - kern.elf{32,64}.aslr.honor_sbrk - allow to use sbrk area for mmap(2); - vm.cluster_anon - enables anon mapping clustering. PR: 208580 (exp runs) Exp-runs done by: antoine Reviewed by: markj (previous version) Discussed with: emaste Tested by:pho MFC after:1 month Sponsored by: The FreeBSD Foundation Differential revision:https://reviews.freebsd.org/D5603 Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/ia32/ia32_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/kern/kern_fork.c head/sys/kern/kern_procctl.c head/sys/sys/imgact.h head/sys/sys/proc.h head/sys/sys/procctl.h head/sys/sys/sysent.h head/sys/vm/vm_map.c head/sys/vm/vm_map.h head/usr.bin/proccontrol/proccontrol.c Modified: head/sys/amd64/amd64/elf_machdep.c == --- head/sys/amd64/amd64/elf_machdep.c Sun Feb 10 14:30:15 2019 (r343963) +++ head/sys/amd64/amd64/elf_machdep.c Sun Feb 10 17:19:45 2019 (r343964) @@ -73,7 +73,8 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_setregs = exec_setregs, .sv_fixlimit= NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP, + .sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_LP64 | SV_SHP | + SV_TIMEKEEP, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, Modified: head/sys/arm/arm/elf_machdep.c
svn commit: r343962 - head/sys/arm/arm
Author: mmel Date: Sun Feb 10 14:25:29 2019 New Revision: 343962 URL: https://svnweb.freebsd.org/changeset/base/343962 Log: Properly handle alignment requests bigger that page size. - for now, alignments bigger that page size is allowed only for buffers allocated by bus_dmamem_alloc(), cover this fact by KASSERT. - never bounce buffers allocated by bus_dmamem_alloc(), these always comply with the required rules (alignment, boundary, address range). MFC after:1 week Reviewed by: jah PR: 235542 Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c == --- head/sys/arm/arm/busdma_machdep-v6.cSun Feb 10 14:02:14 2019 (r343961) +++ head/sys/arm/arm/busdma_machdep-v6.cSun Feb 10 14:25:29 2019 (r343962) @@ -339,16 +339,27 @@ cacheline_bounce(bus_dmamap_t map, bus_addr_t addr, bu * * Note that the addr argument might be either virtual or physical. It doesn't * matter because we only look at the low-order bits, which are the same in both - * address spaces. + * address spaces and maximum alignment of generic buffer is limited up to page + * size. + * Bouncing of buffers allocated by bus_dmamem_alloc()is not necessary, these + * always comply with the required rules (alignment, boundary, and address + * range). */ static __inline int might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, bus_size_t size) { - return ((dmat->flags & BUS_DMA_EXCL_BOUNCE) || + KASSERT(dmat->flags & DMAMAP_DMAMEM_ALLOC || + dmat->alignment <= PAGE_SIZE, + ("%s: unsupported alignment (0x%08lx) for buffer not " + "allocated by bus_dmamem_alloc()", + __func__, dmat->alignment)); + + return (!(dmat->flags & DMAMAP_DMAMEM_ALLOC) && + ((dmat->flags & BUS_DMA_EXCL_BOUNCE) || alignment_bounce(dmat, addr) || - cacheline_bounce(map, addr, size)); + cacheline_bounce(map, addr, size))); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343963 - head/sys/arm/nvidia
Author: mmel Date: Sun Feb 10 14:30:15 2019 New Revision: 343963 URL: https://svnweb.freebsd.org/changeset/base/343963 Log: Don't allocate same clock twice.. MFC after:1 week Reported by: jah Modified: head/sys/arm/nvidia/tegra_sdhci.c Modified: head/sys/arm/nvidia/tegra_sdhci.c == --- head/sys/arm/nvidia/tegra_sdhci.c Sun Feb 10 14:25:29 2019 (r343962) +++ head/sys/arm/nvidia/tegra_sdhci.c Sun Feb 10 14:30:15 2019 (r343963) @@ -313,13 +313,6 @@ tegra_sdhci_attach(device_t dev) rv = clk_get_by_ofw_index(dev, 0, 0, >clk); if (rv != 0) { - - device_printf(dev, "Cannot get clock\n"); - goto fail; - } - - rv = clk_get_by_ofw_index(dev, 0, 0, >clk); - if (rv != 0) { device_printf(dev, "Cannot get clock\n"); goto fail; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343746 - head/sys/conf
> On 10. Feb 2019, at 09:38, Conrad Meyer wrote: > > Hi Michael, > > I don't know. You can 'pkg install amd64-xtoolchain-gcc' and 'make > buildkernel KERNCONF=GENERIC CROSS_TOOLCHAIN=amd64-gcc' if you're > interested in trying it. Hi Conrad, thanks for the instructions. I tested the patch and it ends up in a system I can use. In particular the kcovtrace test program also runs. Best regards Michael > > (I'm not sure enabling coverage globally in GENERIC is appropriate > even if it did not break boot — it's usually expensive, and while > GENERIC is already slow, that doesn't mean we can just make it 10x > slower.) > > Best, > Conrad > > On Sun, Feb 10, 2019 at 12:03 AM Michael Tuexen wrote: >> >>> On 10. Feb 2019, at 08:50, Conrad Meyer wrote: >>> >>> Hi Andrew, >>> >>> This makes it compile, but instead of a build failure the kernel is >>> broken hard at runtime in early boot with GCC < 8.1. E.g., >>> amd64-xtoolchain-gcc standard cross-toolchain is still on GCC 6.4.0. >>> >>> HEAD GENERIC has been broken in one form or another for xtoolchain GCC >>> since r343713 (Feb 3), so I'm going to go ahead and turn this option >>> off in GENERIC. Feel free to reenable when you've tested that it >>> works. >> Hi Conrad, >> >> does https://reviews.freebsd.org/D19135 fix the issue you are observing? >> >> Best regards >> Michael >>> >>> Best, >>> Conrad >>> >>> On Mon, Feb 4, 2019 at 8:55 AM Andrew Turner wrote: Author: andrew Date: Mon Feb 4 16:55:24 2019 New Revision: 343746 URL: https://svnweb.freebsd.org/changeset/base/343746 Log: Only enable trace-cmp on Clang and modern GCC. It's was only added to GCC 8.1 so don't try to enable it for earlier releases. Reported by: lwhsu Sponsored by: DARPA, AFRL Modified: head/sys/conf/files head/sys/conf/kern.pre.mk Modified: head/sys/conf/files == --- head/sys/conf/files Mon Feb 4 16:13:41 2019(r343745) +++ head/sys/conf/files Mon Feb 4 16:55:24 2019(r343746) @@ -3808,7 +3808,7 @@ kern/kern_idle.c standard kern/kern_intr.c standard kern/kern_jail.c standard kern/kern_kcov.c optional kcov \ - compile-with"${NORMAL_C} -fno-sanitize-coverage=trace-pc,trace-cmp" + compile-with"${NORMAL_C} -fno-sanitize=all" kern/kern_khelp.c standard kern/kern_kthread.cstandard kern/kern_ktr.coptional ktr Modified: head/sys/conf/kern.pre.mk == --- head/sys/conf/kern.pre.mk Mon Feb 4 16:13:41 2019(r343745) +++ head/sys/conf/kern.pre.mk Mon Feb 4 16:55:24 2019(r343746) @@ -120,7 +120,12 @@ SAN_CFLAGS+= -fsanitize=undefined COVERAGE_ENABLED!= grep COVERAGE opt_global.h || true ; echo .if !empty(COVERAGE_ENABLED) +.if ${COMPILER_TYPE} == "clang" || \ +(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80100) SAN_CFLAGS+= -fsanitize-coverage=trace-pc,trace-cmp +.else +SAN_CFLAGS+= -fsanitize-coverage=trace-pc +.endif .endif CFLAGS+= ${SAN_CFLAGS} >>> >> smime.p7s Description: S/MIME cryptographic signature
svn commit: r343961 - head/sys/netinet
Author: tuexen Date: Sun Feb 10 14:02:14 2019 New Revision: 343961 URL: https://svnweb.freebsd.org/changeset/base/343961 Log: Fix a locking issue when reporing outbount messages. MFC after:3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sun Feb 10 13:55:32 2019(r343960) +++ head/sys/netinet/sctputil.c Sun Feb 10 14:02:14 2019(r343961) @@ -3946,7 +3946,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16 TAILQ_FOREACH_SAFE(sp, >outqueue, next, nsp) { atomic_subtract_int(>stream_queue_cnt, 1); TAILQ_REMOVE(>outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, holds_lock); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343957 - head/usr.bin/top
Author: dim Date: Sun Feb 10 13:31:08 2019 New Revision: 343957 URL: https://svnweb.freebsd.org/changeset/base/343957 Log: Fix multiple warnings in usr.bin/top about discarded qualifiers from both clang and gcc, by either constifying variables, or when that is not possible, using __DECONST. MFC after:1 week Modified: head/usr.bin/top/Makefile head/usr.bin/top/display.c head/usr.bin/top/display.h head/usr.bin/top/machine.c head/usr.bin/top/top.c head/usr.bin/top/utils.c head/usr.bin/top/utils.h Modified: head/usr.bin/top/Makefile == --- head/usr.bin/top/Makefile Sun Feb 10 12:49:34 2019(r343956) +++ head/usr.bin/top/Makefile Sun Feb 10 13:31:08 2019(r343957) @@ -7,14 +7,9 @@ SRCS= commands.c display.c machine.c screen.c top.c \ username.c utils.c MAN= top.1 -.if ${COMPILER_TYPE} == "gcc" -.if ${COMPILER_VERSION} >= 5 -CFLAGS.gcc=-Wno-error=discarded-qualifiers -Wno-error=incompatible-pointer-types -.else #base gcc +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 5 NO_WERROR= .endif -.endif -CFLAGS.clang=-Wno-error=incompatible-pointer-types-discards-qualifiers LIBADD=ncursesw m kvm jail util sbuf .include Modified: head/usr.bin/top/display.c == --- head/usr.bin/top/display.c Sun Feb 10 12:49:34 2019(r343956) +++ head/usr.bin/top/display.c Sun Feb 10 13:31:08 2019(r343957) @@ -184,7 +184,7 @@ int display_init(struct statics * statics) { int lines; -char **pp; +const char * const *pp; int *ip; int i; @@ -516,8 +516,8 @@ void z_cpustates(void) { int i = 0; -const char **names; -char *thisname; +const char * const *names; +const char *thisname; int cpu, value; for (cpu = 0; cpu < num_cpus; cpu++) { @@ -751,7 +751,7 @@ static int header_length; * allocated area with the trimmed header. */ -const char * +char * trim_header(const char *text) { char *s; Modified: head/usr.bin/top/display.h == --- head/usr.bin/top/display.h Sun Feb 10 12:49:34 2019(r343956) +++ head/usr.bin/top/display.h Sun Feb 10 13:31:08 2019(r343957) @@ -27,7 +27,7 @@ void i_timeofday(time_t *tod); voidi_uptime(struct timeval *bt, time_t *tod); voidnew_message(int type, const char *msgfmt, ...); int readline(char *buffer, int size, int numeric); -const char *trim_header(const char *text); +char *trim_header(const char *text); voidu_arc(int *stats); voidu_carc(int *stats); voidu_cpustates(int *states); Modified: head/usr.bin/top/machine.c == --- head/usr.bin/top/machine.c Sun Feb 10 12:49:34 2019(r343956) +++ head/usr.bin/top/machine.c Sun Feb 10 13:31:08 2019(r343957) @@ -618,7 +618,7 @@ get_old_proc(struct kinfo_proc *pp) pp->ki_udata = NOPROC; return (NULL); } - pp->ki_udata = oldp; + pp->ki_udata = __DECONST(void *, oldp); return (oldp); } @@ -634,7 +634,7 @@ get_io_stats(const struct kinfo_proc *pp, long *inp, l static struct kinfo_proc dummy; long ret; - oldp = get_old_proc(pp); + oldp = get_old_proc(__DECONST(struct kinfo_proc *, pp)); if (oldp == NULL) { memset(, 0, sizeof(dummy)); oldp = Modified: head/usr.bin/top/top.c == --- head/usr.bin/top/top.c Sun Feb 10 12:49:34 2019(r343956) +++ head/usr.bin/top/top.c Sun Feb 10 13:31:08 2019(r343957) @@ -219,7 +219,7 @@ end: } int -main(int argc, char *argv[]) +main(int argc, const char *argv[]) { int i; int active_procs; @@ -306,7 +306,7 @@ main(int argc, char *argv[]) optind = 1; } - while ((i = getopt_long(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:p:Ttw", longopts, NULL)) != EOF) + while ((i = getopt_long(ac, __DECONST(char * const *, av), "CSIHPabijJ:nquvzs:d:U:m:o:p:Ttw", longopts, NULL)) != EOF) { switch(i) { Modified: head/usr.bin/top/utils.c == --- head/usr.bin/top/utils.cSun Feb 10 12:49:34 2019(r343956) +++ head/usr.bin/top/utils.cSun Feb 10 13:31:08 2019(r343957) @@ -146,7 +146,7 @@ string_index(const char *string, const char * const *a * squat about quotes. */ -const char * const * +const char ** argparse(char *line, int *cntp) { const char **ap; Modified: head/usr.bin/top/utils.h == --- head/usr.bin/top/utils.hSun
svn commit: r343960 - head/sys/netinet
Author: tuexen Date: Sun Feb 10 13:55:32 2019 New Revision: 343960 URL: https://svnweb.freebsd.org/changeset/base/343960 Log: Fix a locking issue in the IPPROTO_SCTP level SCTP_PEER_ADDR_THLDS socket option. The problem affects only setsockopt with invalid parameters. This issue was found by syzkaller. MFC after:3 days Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Sun Feb 10 13:44:36 2019 (r343959) +++ head/sys/netinet/sctp_usrreq.c Sun Feb 10 13:55:32 2019 (r343960) @@ -6335,6 +6335,9 @@ sctp_setopt(struct socket *so, int optname, void *optv } } if (thlds->spt_pathcpthld != 0x) { + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } error = EINVAL; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343959 - head/usr.bin/top
Author: dim Date: Sun Feb 10 13:44:36 2019 New Revision: 343959 URL: https://svnweb.freebsd.org/changeset/base/343959 Log: Fix the first couple of AddressSanitizer violations in usr.bin/top. Avoid setting zero bytes beyond the length of the 'thisline' parameters in i_process() and u_process(), and don't attempt to memset a negative number of bytes. MFC after:1 week Modified: head/usr.bin/top/display.c Modified: head/usr.bin/top/display.c == --- head/usr.bin/top/display.c Sun Feb 10 13:34:21 2019(r343958) +++ head/usr.bin/top/display.c Sun Feb 10 13:44:36 2019(r343959) @@ -829,7 +829,11 @@ i_process(int line, char *thisline) } /* truncate the line to conform to our current screen width */ -thisline[screen_width] = '\0'; +int len = strlen(thisline); +if (screen_width < len) +{ + thisline[screen_width] = '\0'; +} /* write the line out */ fputs(thisline, stdout); @@ -839,7 +843,10 @@ i_process(int line, char *thisline) p = stpcpy(base, thisline); /* zero fill the rest of it */ -memset(p, 0, screen_width - (p - base)); +if (p - base < screen_width) +{ + memset(p, 0, screen_width - (p - base)); +} } void @@ -853,7 +860,11 @@ u_process(int line, char *newline) bufferline = [lineindex(line)]; /* truncate the line to conform to our current screen width */ -newline[screen_width] = '\0'; +int len = strlen(newline); +if (screen_width < len) +{ + newline[screen_width] = '\0'; +} /* is line higher than we went on the last display? */ if (line >= last_hi) @@ -878,7 +889,10 @@ u_process(int line, char *newline) optr = stpcpy(bufferline, newline); /* zero fill the rest of it */ - memset(optr, 0, screen_width - (optr - bufferline)); + if (optr - bufferline < screen_width) + { + memset(optr, 0, screen_width - (optr - bufferline)); + } } else { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343958 - head/usr.bin/top
Author: dim Date: Sun Feb 10 13:34:21 2019 New Revision: 343958 URL: https://svnweb.freebsd.org/changeset/base/343958 Log: Fix multiple warnings in usr.bin/top about variables shadowing global declarations from base gcc, by renaming those variables. MFC after:1 week Modified: head/usr.bin/top/Makefile head/usr.bin/top/username.c head/usr.bin/top/utils.c Modified: head/usr.bin/top/Makefile == --- head/usr.bin/top/Makefile Sun Feb 10 13:31:08 2019(r343957) +++ head/usr.bin/top/Makefile Sun Feb 10 13:34:21 2019(r343958) @@ -7,9 +7,5 @@ SRCS= commands.c display.c machine.c screen.c top.c \ username.c utils.c MAN= top.1 -.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 5 -NO_WERROR= -.endif - LIBADD=ncursesw m kvm jail util sbuf .include Modified: head/usr.bin/top/username.c == --- head/usr.bin/top/username.c Sun Feb 10 13:31:08 2019(r343957) +++ head/usr.bin/top/username.c Sun Feb 10 13:34:21 2019(r343958) @@ -70,7 +70,7 @@ username(int uid) } int -userid(char username[]) +userid(char username_[]) { struct passwd *pwd; @@ -78,13 +78,13 @@ userid(char username[]) but for now we just do it simply and remember just the result. */ -if ((pwd = getpwnam(username)) == NULL) +if ((pwd = getpwnam(username_)) == NULL) { return(-1); } /* enter the result in the hash table */ -enter_user(pwd->pw_uid, username, 1); +enter_user(pwd->pw_uid, username_, 1); /* return our result */ return(pwd->pw_uid); Modified: head/usr.bin/top/utils.c == --- head/usr.bin/top/utils.cSun Feb 10 13:31:08 2019(r343957) +++ head/usr.bin/top/utils.cSun Feb 10 13:34:21 2019(r343958) @@ -292,11 +292,11 @@ char * format_k(int64_t amt) { static char retarray[NUM_STRINGS][16]; -static int index = 0; +static int index_ = 0; char *ret; -ret = retarray[index]; - index = (index + 1) % NUM_STRINGS; +ret = retarray[index_]; + index_ = (index_ + 1) % NUM_STRINGS; humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE); return (ret); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343954 - head/sys/netinet
Author: tuexen Date: Sun Feb 10 10:42:16 2019 New Revision: 343954 URL: https://svnweb.freebsd.org/changeset/base/343954 Log: Fix a locking bug in the IPPROTO_SCTP level SCTP_EVENT socket option. This occurs when call setsockopt() with invalid parameters. This issue was found by syzkaller. MFC after:3 days Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Sun Feb 10 08:46:07 2019 (r343953) +++ head/sys/netinet/sctp_usrreq.c Sun Feb 10 10:42:16 2019 (r343954) @@ -6115,6 +6115,10 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_INP_RUNLOCK(inp); } } + } else { + if (stcb) { + SCTP_TCB_UNLOCK(stcb); + } } break; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343953 - head/lib/msun/src
Author: peterj Date: Sun Feb 10 08:46:07 2019 New Revision: 343953 URL: https://svnweb.freebsd.org/changeset/base/343953 Log: Replace calls to sin(x) and cos(x) with a single call to sincos(). Replace calls to sinf(x) and cosf(x) with a single call to sincosf(). Submitted by: Steve Kargl Reviewed by: bde Approved by: grog MFC after:3 days Modified: head/lib/msun/src/e_j0.c head/lib/msun/src/e_j0f.c head/lib/msun/src/e_j1.c head/lib/msun/src/e_j1f.c head/lib/msun/src/e_jn.c Modified: head/lib/msun/src/e_j0.c == --- head/lib/msun/src/e_j0.cSun Feb 10 08:41:52 2019(r343952) +++ head/lib/msun/src/e_j0.cSun Feb 10 08:46:07 2019(r343953) @@ -93,8 +93,7 @@ __ieee754_j0(double x) if(ix>=0x7ff0) return one/(x*x); x = fabs(x); if(ix >= 0x4000) { /* |x| >= 2.0 */ - s = sin(x); - c = cos(x); + sincos(x, , ); ss = s-c; cc = s+c; if(ix<0x7fe0) { /* Make sure x+x does not overflow. */ @@ -173,8 +172,7 @@ __ieee754_y0(double x) * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one. */ -s = sin(x); -c = cos(x); +sincos(x, , ); ss = s-c; cc = s+c; /* Modified: head/lib/msun/src/e_j0f.c == --- head/lib/msun/src/e_j0f.c Sun Feb 10 08:41:52 2019(r343952) +++ head/lib/msun/src/e_j0f.c Sun Feb 10 08:46:07 2019(r343953) @@ -55,8 +55,7 @@ __ieee754_j0f(float x) if(ix>=0x7f80) return one/(x*x); x = fabsf(x); if(ix >= 0x4000) { /* |x| >= 2.0 */ - s = sinf(x); - c = cosf(x); + sincosf(x, , ); ss = s-c; cc = s+c; if(ix<0x7f00) { /* Make sure x+x does not overflow. */ @@ -128,8 +127,7 @@ __ieee754_y0f(float x) * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one. */ -s = sinf(x); -c = cosf(x); +sincosf(x, , ); ss = s-c; cc = s+c; /* Modified: head/lib/msun/src/e_j1.c == --- head/lib/msun/src/e_j1.cSun Feb 10 08:41:52 2019(r343952) +++ head/lib/msun/src/e_j1.cSun Feb 10 08:46:07 2019(r343953) @@ -94,8 +94,7 @@ __ieee754_j1(double x) if(ix>=0x7ff0) return one/x; y = fabs(x); if(ix >= 0x4000) { /* |x| >= 2.0 */ - s = sin(y); - c = cos(y); + sincos(y, , ); ss = -s-c; cc = s-c; if(ix<0x7fe0) { /* make sure y+y not overflow */ @@ -159,8 +158,7 @@ __ieee754_y1(double x) /* y1(x<0) = NaN and raise invalid exception. */ if(hx<0) return vzero/vzero; if(ix >= 0x4000) { /* |x| >= 2.0 */ -s = sin(x); -c = cos(x); +sincos(x, , ); ss = -s-c; cc = s-c; if(ix<0x7fe0) { /* make sure x+x not overflow */ Modified: head/lib/msun/src/e_j1f.c == --- head/lib/msun/src/e_j1f.c Sun Feb 10 08:41:52 2019(r343952) +++ head/lib/msun/src/e_j1f.c Sun Feb 10 08:46:07 2019(r343953) @@ -56,8 +56,7 @@ __ieee754_j1f(float x) if(ix>=0x7f80) return one/x; y = fabsf(x); if(ix >= 0x4000) { /* |x| >= 2.0 */ - s = sinf(y); - c = cosf(y); + sincosf(y, , ); ss = -s-c; cc = s-c; if(ix<0x7f00) { /* make sure y+y not overflow */ @@ -114,8 +113,7 @@ __ieee754_y1f(float x) if(ix==0) return -one/vzero; if(hx<0) return vzero/vzero; if(ix >= 0x4000) { /* |x| >= 2.0 */ -s = sinf(x); -c = cosf(x); +sincosf(x, , ); ss = -s-c; cc = s-c; if(ix<0x7f00) { /* make sure x+x not overflow */ Modified: head/lib/msun/src/e_jn.c == --- head/lib/msun/src/e_jn.cSun Feb 10 08:41:52 2019(r343952) +++ head/lib/msun/src/e_jn.cSun Feb 10 08:46:07 2019(r343953) @@ -54,7 +54,7 @@ double __ieee754_jn(int n, double x) { int32_t i,hx,ix,lx, sgn; - double a, b, temp, di; + double a, b, c, s, temp, di; double z, w; /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) @@ -91,11
svn commit: r343951 - head/sys/netinet
Author: tuexen Date: Sun Feb 10 08:28:56 2019 New Revision: 343951 URL: https://svnweb.freebsd.org/changeset/base/343951 Log: Fix locking for IPPROTO_SCTP level SCTP_DEFAULT_PRINFO socket option. This problem occurred when calling setsockopt() will invalid parameters. This issue was found by running syzkaller. MFC after:3 days Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Sun Feb 10 08:14:06 2019 (r343950) +++ head/sys/netinet/sctp_usrreq.c Sun Feb 10 08:28:56 2019 (r343951) @@ -6209,6 +6209,9 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id); if (info->pr_policy > SCTP_PR_SCTP_MAX) { + if (stcb) { + SCTP_TCB_UNLOCK(stcb); + } SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343949 - in head/sys: amd64/conf arm64/conf
Author: cem Date: Sun Feb 10 07:54:46 2019 New Revision: 343949 URL: https://svnweb.freebsd.org/changeset/base/343949 Log: Revert r343713 temporarily The COVERAGE option breaks xtoolchain-gcc GENERIC kernel early boot extremely badly and hasn't been fixed for the ~week since it was committed. Please enable for GENERIC only when it doesn't do that. Related fallout reported by: lwhsu, tuexen (pr 235611) Modified: head/sys/amd64/conf/GENERIC head/sys/arm64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Sun Feb 10 05:42:01 2019(r343948) +++ head/sys/amd64/conf/GENERIC Sun Feb 10 07:54:46 2019(r343949) @@ -102,8 +102,8 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) optionsVERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel Sanitizers -optionsCOVERAGE# Generic kernel coverage. Used by KCOV -optionsKCOV# Kernel Coverage Sanitizer +#options COVERAGE# Generic kernel coverage. Used by KCOV +#options KCOV# Kernel Coverage Sanitizer # Warning: KUBSAN can result in a kernel too large for loader to load #options KUBSAN # Kernel Undefined Behavior Sanitizer Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Sun Feb 10 05:42:01 2019(r343948) +++ head/sys/arm64/conf/GENERIC Sun Feb 10 07:54:46 2019(r343949) @@ -94,8 +94,8 @@ options USB_DEBUG # enable debug msgs optionsVERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel Sanitizers -optionsCOVERAGE# Generic kernel coverage. Used by KCOV -optionsKCOV# Kernel Coverage Sanitizer +#options COVERAGE# Generic kernel coverage. Used by KCOV +#options KCOV# Kernel Coverage Sanitizer # Warning: KUBSAN can result in a kernel too large for loader to load #options KUBSAN # Kernel Undefined Behavior Sanitizer ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343746 - head/sys/conf
Hi Andrew, This makes it compile, but instead of a build failure the kernel is broken hard at runtime in early boot with GCC < 8.1. E.g., amd64-xtoolchain-gcc standard cross-toolchain is still on GCC 6.4.0. HEAD GENERIC has been broken in one form or another for xtoolchain GCC since r343713 (Feb 3), so I'm going to go ahead and turn this option off in GENERIC. Feel free to reenable when you've tested that it works. Best, Conrad On Mon, Feb 4, 2019 at 8:55 AM Andrew Turner wrote: > > Author: andrew > Date: Mon Feb 4 16:55:24 2019 > New Revision: 343746 > URL: https://svnweb.freebsd.org/changeset/base/343746 > > Log: > Only enable trace-cmp on Clang and modern GCC. > > It's was only added to GCC 8.1 so don't try to enable it for earlier > releases. > > Reported by: lwhsu > Sponsored by: DARPA, AFRL > > Modified: > head/sys/conf/files > head/sys/conf/kern.pre.mk > > Modified: head/sys/conf/files > == > --- head/sys/conf/files Mon Feb 4 16:13:41 2019(r343745) > +++ head/sys/conf/files Mon Feb 4 16:55:24 2019(r343746) > @@ -3808,7 +3808,7 @@ kern/kern_idle.c standard > kern/kern_intr.c standard > kern/kern_jail.c standard > kern/kern_kcov.c optional kcov \ > - compile-with"${NORMAL_C} > -fno-sanitize-coverage=trace-pc,trace-cmp" > + compile-with"${NORMAL_C} -fno-sanitize=all" > kern/kern_khelp.c standard > kern/kern_kthread.cstandard > kern/kern_ktr.coptional ktr > > Modified: head/sys/conf/kern.pre.mk > == > --- head/sys/conf/kern.pre.mk Mon Feb 4 16:13:41 2019(r343745) > +++ head/sys/conf/kern.pre.mk Mon Feb 4 16:55:24 2019(r343746) > @@ -120,7 +120,12 @@ SAN_CFLAGS+= -fsanitize=undefined > > COVERAGE_ENABLED!= grep COVERAGE opt_global.h || true ; echo > .if !empty(COVERAGE_ENABLED) > +.if ${COMPILER_TYPE} == "clang" || \ > +(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80100) > SAN_CFLAGS+= -fsanitize-coverage=trace-pc,trace-cmp > +.else > +SAN_CFLAGS+= -fsanitize-coverage=trace-pc > +.endif > .endif > > CFLAGS+= ${SAN_CFLAGS} > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343746 - head/sys/conf
Hi Michael, I don't know. You can 'pkg install amd64-xtoolchain-gcc' and 'make buildkernel KERNCONF=GENERIC CROSS_TOOLCHAIN=amd64-gcc' if you're interested in trying it. (I'm not sure enabling coverage globally in GENERIC is appropriate even if it did not break boot — it's usually expensive, and while GENERIC is already slow, that doesn't mean we can just make it 10x slower.) Best, Conrad On Sun, Feb 10, 2019 at 12:03 AM Michael Tuexen wrote: > > > On 10. Feb 2019, at 08:50, Conrad Meyer wrote: > > > > Hi Andrew, > > > > This makes it compile, but instead of a build failure the kernel is > > broken hard at runtime in early boot with GCC < 8.1. E.g., > > amd64-xtoolchain-gcc standard cross-toolchain is still on GCC 6.4.0. > > > > HEAD GENERIC has been broken in one form or another for xtoolchain GCC > > since r343713 (Feb 3), so I'm going to go ahead and turn this option > > off in GENERIC. Feel free to reenable when you've tested that it > > works. > Hi Conrad, > > does https://reviews.freebsd.org/D19135 fix the issue you are observing? > > Best regards > Michael > > > > Best, > > Conrad > > > > On Mon, Feb 4, 2019 at 8:55 AM Andrew Turner wrote: > >> > >> Author: andrew > >> Date: Mon Feb 4 16:55:24 2019 > >> New Revision: 343746 > >> URL: https://svnweb.freebsd.org/changeset/base/343746 > >> > >> Log: > >> Only enable trace-cmp on Clang and modern GCC. > >> > >> It's was only added to GCC 8.1 so don't try to enable it for earlier > >> releases. > >> > >> Reported by: lwhsu > >> Sponsored by: DARPA, AFRL > >> > >> Modified: > >> head/sys/conf/files > >> head/sys/conf/kern.pre.mk > >> > >> Modified: head/sys/conf/files > >> == > >> --- head/sys/conf/files Mon Feb 4 16:13:41 2019(r343745) > >> +++ head/sys/conf/files Mon Feb 4 16:55:24 2019(r343746) > >> @@ -3808,7 +3808,7 @@ kern/kern_idle.c standard > >> kern/kern_intr.c standard > >> kern/kern_jail.c standard > >> kern/kern_kcov.c optional kcov \ > >> - compile-with"${NORMAL_C} > >> -fno-sanitize-coverage=trace-pc,trace-cmp" > >> + compile-with"${NORMAL_C} -fno-sanitize=all" > >> kern/kern_khelp.c standard > >> kern/kern_kthread.cstandard > >> kern/kern_ktr.coptional ktr > >> > >> Modified: head/sys/conf/kern.pre.mk > >> == > >> --- head/sys/conf/kern.pre.mk Mon Feb 4 16:13:41 2019(r343745) > >> +++ head/sys/conf/kern.pre.mk Mon Feb 4 16:55:24 2019(r343746) > >> @@ -120,7 +120,12 @@ SAN_CFLAGS+= -fsanitize=undefined > >> > >> COVERAGE_ENABLED!= grep COVERAGE opt_global.h || true ; echo > >> .if !empty(COVERAGE_ENABLED) > >> +.if ${COMPILER_TYPE} == "clang" || \ > >> +(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80100) > >> SAN_CFLAGS+= -fsanitize-coverage=trace-pc,trace-cmp > >> +.else > >> +SAN_CFLAGS+= -fsanitize-coverage=trace-pc > >> +.endif > >> .endif > >> > >> CFLAGS+= ${SAN_CFLAGS} > >> > > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343952 - head/sys/arm/allwinner
Author: ganbold Date: Sun Feb 10 08:41:52 2019 New Revision: 343952 URL: https://svnweb.freebsd.org/changeset/base/343952 Log: Enable necessary bits when activating interrupts. This allows reading some events from the interrupt status registers. These events are reported to devd via system "PMU" and subsystem "Battery", "AC" and "USB" such as plugged/unplugged, absent, charged and charging. Reviewed by: manu Differential Revision:https://reviews.freebsd.org/D19116 Modified: head/sys/arm/allwinner/axp81x.c Modified: head/sys/arm/allwinner/axp81x.c == --- head/sys/arm/allwinner/axp81x.c Sun Feb 10 08:28:56 2019 (r343951) +++ head/sys/arm/allwinner/axp81x.c Sun Feb 10 08:41:52 2019 (r343952) @@ -65,9 +65,13 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8x #define AXP_POWERSRC_ACIN (1 << 7) #define AXP_POWERSRC_VBUS (1 << 5) #define AXP_POWERSRC_VBAT (1 << 3) -#define AXP_POWERSRC_CHARING (1 << 2) +#define AXP_POWERSRC_CHARING (1 << 2)/* Charging Direction */ #define AXP_POWERSRC_SHORTED (1 << 1) #define AXP_POWERSRC_STARTUP (1 << 0) +#defineAXP_POWERMODE 0x01 +#define AXP_POWERMODE_BAT_CHARGING (1 << 6) +#define AXP_POWERMODE_BAT_PRESENT (1 << 5) +#define AXP_POWERMODE_BAT_VALID(1 << 4) #defineAXP_ICTYPE 0x03 #defineAXP_POWERCTL1 0x10 #define AXP_POWERCTL1_DCDC7(1 << 6)/* AXP813/818 only */ @@ -117,14 +121,47 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8x #defineAXP_POWERBAT0x32 #define AXP_POWERBAT_SHUTDOWN (1 << 7) #defineAXP_IRQEN1 0x40 +#define AXP_IRQEN1_ACIN_HI (1 << 6) +#define AXP_IRQEN1_ACIN_LO (1 << 5) +#define AXP_IRQEN1_VBUS_HI (1 << 3) +#define AXP_IRQEN1_VBUS_LO (1 << 2) #defineAXP_IRQEN2 0x41 +#define AXP_IRQEN2_BAT_IN (1 << 7) +#define AXP_IRQEN2_BAT_NO (1 << 6) +#define AXP_IRQEN2_BATCHGC (1 << 3) +#define AXP_IRQEN2_BATCHGD (1 << 2) #defineAXP_IRQEN3 0x42 #defineAXP_IRQEN4 0x43 +#define AXP_IRQEN4_BATLVL_LO1 (1 << 1) +#define AXP_IRQEN4_BATLVL_LO0 (1 << 0) #defineAXP_IRQEN5 0x44 #define AXP_IRQEN5_POKSIRQ (1 << 4) +#define AXP_IRQEN5_POKLIRQ (1 << 3) #defineAXP_IRQEN6 0x45 +#defineAXP_IRQSTAT10x48 +#define AXP_IRQSTAT1_ACIN_HI (1 << 6) +#define AXP_IRQSTAT1_ACIN_LO (1 << 5) +#define AXP_IRQSTAT1_VBUS_HI (1 << 3) +#define AXP_IRQSTAT1_VBUS_LO (1 << 2) +#defineAXP_IRQSTAT20x49 +#define AXP_IRQSTAT2_BAT_IN(1 << 7) +#define AXP_IRQSTAT2_BAT_NO(1 << 6) +#define AXP_IRQSTAT2_BATCHGC (1 << 3) +#define AXP_IRQSTAT2_BATCHGD (1 << 2) +#defineAXP_IRQSTAT30x4a +#defineAXP_IRQSTAT40x4b +#define AXP_IRQSTAT4_BATLVL_LO1(1 << 1) +#define AXP_IRQSTAT4_BATLVL_LO0(1 << 0) #defineAXP_IRQSTAT50x4c #define AXP_IRQSTAT5_POKSIRQ (1 << 4) +#define AXP_IRQEN5_POKLIRQ (1 << 3) +#defineAXP_IRQSTAT60x4d +#defineAXP_BATSENSE_HI 0x78 +#defineAXP_BATSENSE_LO 0x79 +#defineAXP_BATCHG_HI 0x7a +#defineAXP_BATCHG_LO 0x7b +#defineAXP_BATDISCHG_HI0x7c +#defineAXP_BATDISCHG_LO0x7d #defineAXP_GPIO0_CTRL 0x90 #defineAXP_GPIO0LDO_CTRL 0x91 #defineAXP_GPIO1_CTRL 0x92 @@ -138,7 +175,25 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8x #define AXP_GPIO_FUNC_LDO_OFF 4 #defineAXP_GPIO_SIGBIT 0x94 #defineAXP_GPIO_PD 0x97 +#defineAXP_FUEL_GAUGECTL 0xb8 +#define AXP_FUEL_GAUGECTL_EN (1 << 7) +#defineAXP_BAT_CAP 0xb9 +#define AXP_BAT_CAP_VALID (1 << 7) +#define AXP_BAT_CAP_PERCENT0x7f + +#defineAXP_BAT_MAX_CAP_HI 0xe0 +#define AXP_BAT_MAX_CAP_VALID (1 << 7) +#defineAXP_BAT_MAX_CAP_LO 0xe1 + +#defineAXP_BAT_COULOMB_HI 0xe2 +#define AXP_BAT_COULOMB_VALID (1 << 7) +#defineAXP_BAT_COULOMB_LO 0xe3 + +#defineAXP_BAT_CAP_WARN0xe6 +#define AXP_BAT_CAP_WARN_LV1 0xf0/* Bits 4, 5, 6, 7 */ +#define AXP_BAT_CAP_WARN_LV2 0xf /* Bits 0, 1, 2, 3 */ + static const struct { const char *name; uint8_t ctrl_reg; @@ -710,6 +765,68 @@ axp8xx_intr(void
Re: svn commit: r343746 - head/sys/conf
> On 10. Feb 2019, at 08:50, Conrad Meyer wrote: > > Hi Andrew, > > This makes it compile, but instead of a build failure the kernel is > broken hard at runtime in early boot with GCC < 8.1. E.g., > amd64-xtoolchain-gcc standard cross-toolchain is still on GCC 6.4.0. > > HEAD GENERIC has been broken in one form or another for xtoolchain GCC > since r343713 (Feb 3), so I'm going to go ahead and turn this option > off in GENERIC. Feel free to reenable when you've tested that it > works. Hi Conrad, does https://reviews.freebsd.org/D19135 fix the issue you are observing? Best regards Michael > > Best, > Conrad > > On Mon, Feb 4, 2019 at 8:55 AM Andrew Turner wrote: >> >> Author: andrew >> Date: Mon Feb 4 16:55:24 2019 >> New Revision: 343746 >> URL: https://svnweb.freebsd.org/changeset/base/343746 >> >> Log: >> Only enable trace-cmp on Clang and modern GCC. >> >> It's was only added to GCC 8.1 so don't try to enable it for earlier >> releases. >> >> Reported by: lwhsu >> Sponsored by: DARPA, AFRL >> >> Modified: >> head/sys/conf/files >> head/sys/conf/kern.pre.mk >> >> Modified: head/sys/conf/files >> == >> --- head/sys/conf/files Mon Feb 4 16:13:41 2019(r343745) >> +++ head/sys/conf/files Mon Feb 4 16:55:24 2019(r343746) >> @@ -3808,7 +3808,7 @@ kern/kern_idle.c standard >> kern/kern_intr.c standard >> kern/kern_jail.c standard >> kern/kern_kcov.c optional kcov \ >> - compile-with"${NORMAL_C} >> -fno-sanitize-coverage=trace-pc,trace-cmp" >> + compile-with"${NORMAL_C} -fno-sanitize=all" >> kern/kern_khelp.c standard >> kern/kern_kthread.cstandard >> kern/kern_ktr.coptional ktr >> >> Modified: head/sys/conf/kern.pre.mk >> == >> --- head/sys/conf/kern.pre.mk Mon Feb 4 16:13:41 2019(r343745) >> +++ head/sys/conf/kern.pre.mk Mon Feb 4 16:55:24 2019(r343746) >> @@ -120,7 +120,12 @@ SAN_CFLAGS+= -fsanitize=undefined >> >> COVERAGE_ENABLED!= grep COVERAGE opt_global.h || true ; echo >> .if !empty(COVERAGE_ENABLED) >> +.if ${COMPILER_TYPE} == "clang" || \ >> +(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80100) >> SAN_CFLAGS+= -fsanitize-coverage=trace-pc,trace-cmp >> +.else >> +SAN_CFLAGS+= -fsanitize-coverage=trace-pc >> +.endif >> .endif >> >> CFLAGS+= ${SAN_CFLAGS} >> > smime.p7s Description: S/MIME cryptographic signature
svn commit: r343950 - in head/sys: arm64/conf conf
Author: manu Date: Sun Feb 10 08:14:06 2019 New Revision: 343950 URL: https://svnweb.freebsd.org/changeset/base/343950 Log: arm64: Fix compile when removing SOC_ROCKCHIP_* options Make every rockchip file depend on the multiple soc_rockchip options While here make rk_i2c and rk_gpio depend on their device options. Reported by: sbruno Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Sun Feb 10 07:54:46 2019(r343949) +++ head/sys/arm64/conf/GENERIC Sun Feb 10 08:14:06 2019(r343950) @@ -213,6 +213,8 @@ device gpioled device fdt_pinctrl device mv_gpio # Marvell GPIO controller device mvebu_pinctrl # Marvell Pinmux Controller +device rk_gpio # RockChip GPIO Controller +device rk_pinctrl # RockChip Pinmux Controller # I2C device aw_rsb # Allwinner Reduced Serial Bus Modified: head/sys/conf/files.arm64 == --- head/sys/conf/files.arm64 Sun Feb 10 07:54:46 2019(r343949) +++ head/sys/conf/files.arm64 Sun Feb 10 08:14:06 2019(r343950) @@ -263,20 +263,23 @@ cddl/dev/dtrace/aarch64/dtrace_asm.S optional dtrace cddl/dev/dtrace/aarch64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/aarch64/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" -arm64/rockchip/rk_i2c.coptional rk_i2c fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/rk805.c optional rk805 fdt soc_rockchip_rk3328 -arm64/rockchip/rk_grf.coptional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/rk_pinctrl.coptional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/rk_gpio.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/clk/rk_cru.coptional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/clk/rk_clk_armclk.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/clk/rk_clk_composite.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/clk/rk_clk_gate.c optional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/clk/rk_clk_mux.coptional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -arm64/rockchip/clk/rk_clk_pll.coptional fdt soc_rockchip_rk3328 soc_rockchip_rk3399 +# RockChip Drivers +arm64/rockchip/rk_i2c.coptional fdt rk_i2c soc_rockchip_rk3328 | fdt rk_i2c soc_rockchip_rk3399 +arm64/rockchip/rk805.c optional fdt rk805 soc_rockchip_rk3328 | fdt rk805 soc_rockchip_rk3399 +arm64/rockchip/rk_grf.coptional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 +arm64/rockchip/rk_pinctrl.coptional fdt rk_pinctrl soc_rockchip_rk3328 | fdt rk_pinctrl soc_rockchip_rk3399 +arm64/rockchip/rk_gpio.c optional fdt rk_gpio soc_rockchip_rk3328 | fdt rk_gpio soc_rockchip_rk3399 +arm64/rockchip/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 +dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 +dev/dwc/if_dwc_if.moptional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 + +# RockChip Clock support +arm64/rockchip/clk/rk_cru.coptional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 +arm64/rockchip/clk/rk_clk_armclk.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 +arm64/rockchip/clk/rk_clk_composite.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 +arm64/rockchip/clk/rk_clk_gate.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 +arm64/rockchip/clk/rk_clk_mux.coptional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 +arm64/rockchip/clk/rk_clk_pll.coptional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/clk/rk3328_cru.coptional fdt soc_rockchip_rk3328 arm64/rockchip/clk/rk3399_cru.coptional fdt soc_rockchip_rk3399 arm64/rockchip/clk/rk3399_pmucru.c optional fdt soc_rockchip_rk3399 -arm64/rockchip/if_dwc_rk.c optional dwc_rk fdt soc_rockchip_rk3328 soc_rockchip_rk3399 -dev/dwc/if_dwc.c optional dwc_rk -dev/dwc/if_dwc_if.moptional dwc_rk ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"