]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoConst-poison the cam_sim_* convenience accessor functions.
Warner Losh [Thu, 9 Jan 2020 16:34:54 +0000 (16:34 +0000)]
Const-poison the cam_sim_* convenience accessor functions.

These don't modify the cam_sim, so make that parameter const.

4 years agoFix typo: MANGAEMENT_PROTOCOL_OUT -> MANAGEMENT_PROTOCOL_OUT.
Gleb Popov [Thu, 9 Jan 2020 15:21:42 +0000 (15:21 +0000)]
Fix typo: MANGAEMENT_PROTOCOL_OUT -> MANAGEMENT_PROTOCOL_OUT.

Approved by: allanjude

4 years agoChange malloc_domain() to return the allocation size to the caller.
Mark Johnston [Thu, 9 Jan 2020 15:02:48 +0000 (15:02 +0000)]
Change malloc_domain() to return the allocation size to the caller.

Otherwise the malloc type accounting in malloc_domainset(9) is wrong
after r355203.

Reviewed by: rlibby
Reported by: kaktus
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23095

4 years agolagg: Further cleanup of the rr_limit option.
Mark Johnston [Thu, 9 Jan 2020 14:58:41 +0000 (14:58 +0000)]
lagg: Further cleanup of the rr_limit option.

Add an option flag so that arbitrary updates to a lagg's configuration
do not clear sc_stride.  Preseve compatibility for old ifconfig
binaries.  Update ifconfig to use the new flag and improve the casting
used when parsing the option parameter.

Modify the RR transmit function to avoid locklessly reading sc_stride
twice.  Ensure that sc_stride is always 1 or greater.

Reviewed by: hselasky
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23092

4 years agoRevert r356515 - add LLVM_LIBUNWIND back to sparc64 BROKEN_OPTIONS
Ed Maste [Thu, 9 Jan 2020 14:12:57 +0000 (14:12 +0000)]
Revert r356515 - add LLVM_LIBUNWIND back to sparc64 BROKEN_OPTIONS

r356552 reverted the untested build fix for LLVM libunwind on sparc64,
so mark it broken again.

4 years agorevert r356513: libunwind: untested attempt to fix sparc64 build
Ed Maste [Thu, 9 Jan 2020 14:10:11 +0000 (14:10 +0000)]
revert r356513: libunwind: untested attempt to fix sparc64 build

The patch is untested and is almost certainly insufficient. Per the
author's request, revert until someone with access to sparc64 hardware
can test and report.

4 years agoarp(8): avoid segfaulting due to out-of-bounds memory access
Eugene Grosbein [Thu, 9 Jan 2020 11:58:26 +0000 (11:58 +0000)]
arp(8): avoid segfaulting due to out-of-bounds memory access

Fix obvious mistake that sometimes results in reading memory
past end of an array.

PR: 240825
MFC after: 1 week

4 years agoAdd atomic_testandset/clear on arm64.
Andrew Turner [Thu, 9 Jan 2020 10:26:36 +0000 (10:26 +0000)]
Add atomic_testandset/clear on arm64.

These will reportedly be used in future uma changes.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D23019

4 years agortld: Return error if $ORIGIN for a dlopen-ed library cannot be resolved ...
Konstantin Belousov [Thu, 9 Jan 2020 10:05:45 +0000 (10:05 +0000)]
rtld: Return error if $ORIGIN for a dlopen-ed library cannot be resolved ...

instead of killing the process.  The same behaviour of terminating
image activation if the $ORIGIN cannot be resolved for the main
object, is kept.

Reported by: Greg V <greg@unrelenting.technology>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23053

4 years agoResolve relative argv0 for direct exec mode to absolute path for AT_EXECPATH.
Konstantin Belousov [Thu, 9 Jan 2020 10:00:24 +0000 (10:00 +0000)]
Resolve relative argv0 for direct exec mode to absolute path for AT_EXECPATH.

We know the binary relative name and can reliably calculate cwd path.
Because realpath(3) was already linked into ld-elf.so.1, reuse it
there to resolve dots and dotdots making the path more canonical.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23014

4 years agoFix a XHCI driver issue with Intel's Gemini Lake SOC.
Hans Petter Selasky [Thu, 9 Jan 2020 09:29:24 +0000 (09:29 +0000)]
Fix a XHCI driver issue with Intel's Gemini Lake SOC.

Do not configure any endpoint twice, but instead keep track of which
endpoints are configured on a per device basis, and use an evaluate
endpoint context command instead. When changing the configuration make
sure all endpoints get deconfigured and the configured endpoint mask
is reset.

This fixes an issue where an endpoint might stop working if there is
an error and the endpoint needs to be reconfigured as a part of the
error recovery mechanism in the FreeBSD USB stack.

Tested by: Shichun.Ma@dell.com
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agokern/Makefile: systrace_args.c is also generated
Kyle Evans [Thu, 9 Jan 2020 06:10:25 +0000 (06:10 +0000)]
kern/Makefile: systrace_args.c is also generated

4 years agomd(4): improve documentation of preloading
Kyle Evans [Thu, 9 Jan 2020 04:39:37 +0000 (04:39 +0000)]
md(4): improve documentation of preloading

It's not immediately clear by what mechanism loader(8) will be loading the
preloaded file. Specifically name-drop loader.conf(5) with a pointer to the
module loading section and a description of what the 'name' should look
like, because that certainly isn't clear from the loader.conf(5) standpoint.

The default loader.conf already has a pointer to md(4) where it appears and
the reference to loader.conf in the new version of this manpage should make
it more clear that this is where one should look for information.

Reported by: swills
Reviewed by: swills, manpages (bcr)
With revision by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D22844

4 years agostand/fdt: Scale blob size better as overlays apply
Kyle Evans [Thu, 9 Jan 2020 04:34:42 +0000 (04:34 +0000)]
stand/fdt: Scale blob size better as overlays apply

Currently, our overlay blob will grow to include the size of the complete
overlay blob we're applying. This doesn't scale very well with a lot of
overlays- they tend to include a lot of overhead, and they will generally
only add a fraction of their total size to the blob they're being applied
to.

To combat this, pack the blob as we apply new overlays and keep track of how
many overlays we've applied. Only ubldr has any fixups to be applied after
overlays, so we only need to re-pad the blob in ubldr. Presumably the
allocation won't fail since we just did a lot worse in trying to apply
overlays and succeeded.

I have no intention of removing the padding in make_dtb.sh. There might be
an argument to be had over whether it should be configurable, since ubldr
*is* the only loader that actually has fixups to be applied and we can do
this at runtime, but I'm not too concerned about this.

This diff has been sitting in Phabricator for a year and a half, but I've
decided to flush it as it does make sure that we're scaling the blob
appropriately and leave room at the end for fixups in case of some freak
circumstance where applying overlays leaves us with a blob of insufficient
size.

Reviewed by: gonzo (a long time ago)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14133

4 years agoshmfd: posix_fallocate(2): only take rangelock for section we need
Kyle Evans [Thu, 9 Jan 2020 04:03:17 +0000 (04:03 +0000)]
shmfd: posix_fallocate(2): only take rangelock for section we need

Other mechanisms that resize the shmfd grab a write lock from 0 to OFF_MAX
for safety, so we still get proper synchronization of shmfd->shm_size in
effect. There's no need to block readers/writers of earlier segments when
we're just reserving more space, so narrow the scope -- it would likely be
safe to narrow it completely to just the section of the range that extends
beyond our current size, but this likely isn't worth it since the size isn't
stable until the writelock is granted the first time.

Suggested by: cem (passing comment)

4 years agoif_vmove: return proper error status
Kyle Evans [Thu, 9 Jan 2020 03:52:50 +0000 (03:52 +0000)]
if_vmove: return proper error status

if_vmove can fail if it lost a race and the vnet's already been moved. The
callers (and their callers) can generally cope with this, but right now
success is assumed. Plumb out the ENOENT from if_detach_internal if it
happens so that the error's properly reported to userland.

Reviewed by: bz, kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22780

4 years agouma: unify layout paths and improve efficiency
Ryan Libby [Thu, 9 Jan 2020 02:03:17 +0000 (02:03 +0000)]
uma: unify layout paths and improve efficiency

Unify the keg layout selection paths (keg_small_init, keg_large_init,
keg_cachespread_init), and slightly improve memory efficiecy by:
 - using the padding of the final item to store the slab header,
 - not going OFFPAGE if we have a choice unless it improves efficiency.

Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23048

4 years agouma: reorganize flags
Ryan Libby [Thu, 9 Jan 2020 02:03:03 +0000 (02:03 +0000)]
uma: reorganize flags

 - Garbage collect UMA_ZONE_PAGEABLE & UMA_ZONE_STATIC.
 - Move flag VTOSLAB from public to private.
 - Introduce public NOTPAGE flag and make HASH private.
 - Introduce public NOTOUCH flag and make OFFPAGE private.
 - Update man page.

The net effect of this should be to make the contract with clients more
clear.  Clients should choose constraints, UMA will figure out how to
implement them.  This also breaks the confusing double meaning of
OFFPAGE.

Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23016

4 years agoRun netoptions startup script in vnet jails.
Bjoern A. Zeeb [Wed, 8 Jan 2020 23:34:50 +0000 (23:34 +0000)]
Run netoptions startup script in vnet jails.

People use rc.conf inside vnet jails to configure networking setups.
Presumably because some sysctl were not virtualised up until r356527 the
script was not run for vnet jails leaving the rc.conf options without
effect for non-obvious reasons.  Run the netoptions startup script also
for VNET jails now to make the rc.conf options work.

PR: 243193
MFC after: 2 weeks

4 years agovnet: virtualise more network stack sysctls.
Bjoern A. Zeeb [Wed, 8 Jan 2020 23:30:26 +0000 (23:30 +0000)]
vnet: virtualise more network stack sysctls.

Virtualise tcp_always_keepalive, TCP and UDP log_in_vain.  All three are
set in the netoptions startup script, which we would love to run for VNETs
as well [1].

While virtualising the log_in_vain sysctls seems pointles at first for as
long as the kernel message buffer is not virtualised, it at least allows
an administrator to debug the base system or an individual jail if needed
without turning the logging on for all jails running on a system.

PR: 243193 [1]
MFC after: 2 weeks

4 years agoRemove some trailing whitespace; no functional changes.
Ian Lepore [Wed, 8 Jan 2020 23:06:13 +0000 (23:06 +0000)]
Remove some trailing whitespace; no functional changes.

4 years agoSplit the code to find and add iicbus children out to its own function.
Ian Lepore [Wed, 8 Jan 2020 23:03:47 +0000 (23:03 +0000)]
Split the code to find and add iicbus children out to its own function.
Move the decision to take an early exit from that function after adding
children based on FDT data into the #ifdef FDT block, so that it doesn't
offend coverity's notion of how the code should be written.  (What's the
point of compilers optimizing away dead code if static analyzers won't
let you use the feature in conjuction with an #ifdef block?)

Reported by: coverity via vangyzen@

4 years agobhyve: add wrapper for debug printf statements
Vincenzo Maffione [Wed, 8 Jan 2020 22:55:22 +0000 (22:55 +0000)]
bhyve: add wrapper for debug printf statements

Add printf() wrapper to use CR/CRLF terminators depending on whether
stdio is mapped to a tty open in raw mode.
Try to use the wrapper everywhere.
For now we leave the custom DPRINTF/WPRINTF defined by device
models, but we may remove them in the future.

Reviewed by: grehan, jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22657

4 years agoChange some KASSERT to device_printf + return EINVAL. There's no need to
Ian Lepore [Wed, 8 Jan 2020 22:48:14 +0000 (22:48 +0000)]
Change some KASSERT to device_printf + return EINVAL.  There's no need to
bring the whole kernel down due to a configuration error detected when a
module is loaded, it suffices to just not attach the device.

4 years agoInit sc->maxbus to -1, not 0. It represents the highest array index that
Ian Lepore [Wed, 8 Jan 2020 22:45:32 +0000 (22:45 +0000)]
Init sc->maxbus to -1, not 0.  It represents the highest array index that
has a non-NULL child bus stored in it, so the "none" value can't be zero
since that's a valid array index.  Also, when adding all possible buses
because there is no specific per-bus config, there's no need to reset
sc->maxbus on each loop iteration, it can be set once after the loop.

4 years agoRemove no-longer-used function prototype.
John Baldwin [Wed, 8 Jan 2020 22:16:26 +0000 (22:16 +0000)]
Remove no-longer-used function prototype.

Reported by: amd64-gcc

4 years agoEnsure any reserved gpio pins get released if an early exit is taken
Ian Lepore [Wed, 8 Jan 2020 22:06:31 +0000 (22:06 +0000)]
Ensure any reserved gpio pins get released if an early exit is taken
from the attach function.

4 years agoRetire build support for GCC's DWARF unwinder
Ed Maste [Wed, 8 Jan 2020 21:07:55 +0000 (21:07 +0000)]
Retire build support for GCC's DWARF unwinder

As of r356514 LLVM's libunwind is used as the DWARF unwinder on all
supported CPU architectures, and GCC and its libraries will be removed
soon.  Retire the build infrastructure for GCC's unwinder; from here
if there are any unwinder bugs (on any arch) the path forward is to fix
LLVM's libunwind.

4 years agoRemove prereq lib support for GNU unwinder
Ed Maste [Wed, 8 Jan 2020 20:56:30 +0000 (20:56 +0000)]
Remove prereq lib support for GNU unwinder

LLVM's libunwind is used for all archs, as of r356514.  As GCC 4.2.1
will soon be removed, and with it the GNU unwinder, start simplifying
the prereq/startup lib logic in Makefile.inc1.  From here if there are
any unwinder bugs (on any arch) the path foward is to fix LLVM's
libunwind.

4 years agosrc.opts.mk: Remove sparc64 LLVM_LIBUNWIND BROKEN_OPTIONS
Ed Maste [Wed, 8 Jan 2020 20:51:07 +0000 (20:51 +0000)]
src.opts.mk: Remove sparc64 LLVM_LIBUNWIND BROKEN_OPTIONS

After r356513 it should build.

4 years agosrc.opts.mk: enable LLVM_UNWIND by default for all archs
Ed Maste [Wed, 8 Jan 2020 20:45:18 +0000 (20:45 +0000)]
src.opts.mk: enable LLVM_UNWIND by default for all archs

Only sparc64 did not enable LLVM_LIBUNWIND. After r356513 LLVM_LIBUNWIND
should at least build on sparc64. The old DWARF unwinder will be removed
along with GCC 4.2.1 in the near future, so switch sparc64 to use LLVM's
unwinder in advance of the removal.  Someone with access to the obsolete
sparc64 hardware supported by FreeBSD will have to test, and investigate
any failures. I will gladly help, but I don't have any suitable hardware
myself.

PR: 233405

4 years agolibunwind: untested attempt to fix sparc64 build
Ed Maste [Wed, 8 Jan 2020 20:37:03 +0000 (20:37 +0000)]
libunwind: untested attempt to fix sparc64 build

sparc64 is the only architecture currently using the DWARF unwinder from
GCC 4.2.1.  Old GCC and related libraries are being removed soon; absent
other changes sparc64 would be left with no unwinder when that happens.

Instead, commit these changes which should at least allow the LLVM
unwinder to build.  Someone with access to the obolete sparc64 hardware
supported by FreeBSD will need to test the result.

PR: 233405
Submitted by: cem

4 years agoposixshm: implement posix_fallocate(2)
Kyle Evans [Wed, 8 Jan 2020 19:08:44 +0000 (19:08 +0000)]
posixshm: implement posix_fallocate(2)

Linux expects to be able to use posix_fallocate(2) on a memfd. Other places
would use this with shm_open(2) to act as a smarter ftruncate(2).

Test has been added to go along with this.

Reviewed by: kib (earlier version)
Differential Revision: https://reviews.freebsd.org/D23042

4 years agoBump __FreeBSD_version after r356510
Kyle Evans [Wed, 8 Jan 2020 19:06:22 +0000 (19:06 +0000)]
Bump __FreeBSD_version after r356510

linuxkpi kmod would need to rebuilt at a minimum; fileops layout has
changed.

4 years agoposix_fallocate: push vnop implementation into the fileop layer
Kyle Evans [Wed, 8 Jan 2020 19:05:32 +0000 (19:05 +0000)]
posix_fallocate: push vnop implementation into the fileop layer

This opens the door for other descriptor types to implement
posix_fallocate(2) as needed.

Reviewed by: kib, bcr (manpages)
Differential Revision: https://reviews.freebsd.org/D23042

4 years agoRemove unneeded cdevsw methods and D_NEEDGIANT.
John Baldwin [Wed, 8 Jan 2020 19:05:23 +0000 (19:05 +0000)]
Remove unneeded cdevsw methods and D_NEEDGIANT.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D23079

4 years agoUse falloc_noinstall + finstall for crypto file descriptors.
John Baldwin [Wed, 8 Jan 2020 19:03:24 +0000 (19:03 +0000)]
Use falloc_noinstall + finstall for crypto file descriptors.

Reviewed by: cem, kib
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D23078

4 years agoAdd a reference count to cryptodev sessions.
John Baldwin [Wed, 8 Jan 2020 18:59:23 +0000 (18:59 +0000)]
Add a reference count to cryptodev sessions.

This prevents use-after-free races with crypto requests (which may
sleep) and CIOCFSESSION as well as races from current CIOCFSESSION
requests.

admbugs: 949
Reported by: Yuval Kanarenstein <yuvalk@ssd-disclosure.com>
Reviewed by: cem
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D23077

4 years agoFix copy-paste bug in HMB free code.
Alexander Motin [Wed, 8 Jan 2020 18:26:23 +0000 (18:26 +0000)]
Fix copy-paste bug in HMB free code.

MFC after: 2 weeks
X-MFC-with: r356474

4 years agosrc.conf.5: regen after r356423 and r356499
Ed Maste [Wed, 8 Jan 2020 17:54:44 +0000 (17:54 +0000)]
src.conf.5: regen after r356423 and r356499

riscv now using Clang/lld, riscv64sf reenabled, and googletest adjusted
to avoid only the affected fuse test on mips

4 years agoAdd -mno-relax to CFLAGS in bsd.prog/lib.mk instead of bsd.cpu.mk.
John Baldwin [Wed, 8 Jan 2020 17:49:34 +0000 (17:49 +0000)]
Add -mno-relax to CFLAGS in bsd.prog/lib.mk instead of bsd.cpu.mk.

bsd.cpu.mk is included by bsd.init.mk before bsd.linker.mk, so it
was always setting the flag since LINKER_FEATURES wasn't defined.

Reported by: mhorne
Reviewed by: imp, mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23076

4 years agortld: fix after r356300
Konstantin Belousov [Wed, 8 Jan 2020 17:37:20 +0000 (17:37 +0000)]
rtld: fix after r356300

binpath local was changed from char array to a char pointer, update
strlcpy/strlcat uses.

Reported by: Coverity through vangyzen
CID: 1412239 and 1412240
Reviewed by: emaste, imp, vangyzen
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23090

4 years agoAdd notes for MAKE_OBSOLETE_GCC going away and riscv switching to clang/lld.
John Baldwin [Wed, 8 Jan 2020 17:31:54 +0000 (17:31 +0000)]
Add notes for MAKE_OBSOLETE_GCC going away and riscv switching to clang/lld.

4 years agoRemove a mention of MAKE_OBSOLETE_GCC.
John Baldwin [Wed, 8 Jan 2020 17:31:18 +0000 (17:31 +0000)]
Remove a mention of MAKE_OBSOLETE_GCC.

This should have been included in r356452.

4 years agoUse clang and lld as the default toolchain for RISCV.
John Baldwin [Wed, 8 Jan 2020 17:25:59 +0000 (17:25 +0000)]
Use clang and lld as the default toolchain for RISCV.

- Enable clang and lld as system toolchains.
- Don't use external GCC for universe by default.
- Re-enable riscv64sf since it builds fine with clang + lld.

Reviewed by: emaste, mhorne
Relnotes: yes
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23089

4 years agolinprocfs: Fix some bugs in the maps file implementation.
Mark Johnston [Wed, 8 Jan 2020 16:57:08 +0000 (16:57 +0000)]
linprocfs: Fix some bugs in the maps file implementation.

- Export the offset into the backing object, not the object size.
- Fix a bug where we would print the previous entry's "offset" when a
  map_entry has no object.
- Try to identify shared mappings.  Linux prints "s" when the mapping
  "may be shared".  This attempt is not perfect, for example, we print
  "p" for anonymous memory that may be shared via
  minherit(INHERIT_SHARE).

PR: 240992
Reviewed by: kib
MFC after: 1 week
MFC note: no OBJ_ANON in stable/12
Differential Revision: https://reviews.freebsd.org/D23062

4 years agoo Spell "Redundancy" and "Remember" correctly.
Maxim Konovalov [Wed, 8 Jan 2020 14:01:15 +0000 (14:01 +0000)]
o Spell "Redundancy" and "Remember" correctly.

PR: 243187
Submitted by: mikael.urankar@gmail.com (partially)

4 years agoregulator: fix regnode_method_get_voltage
Emmanuel Vadot [Wed, 8 Jan 2020 11:30:42 +0000 (11:30 +0000)]
regulator: fix regnode_method_get_voltage

This method is supposed to write the voltage into uvolt
and return an errno compatible value.

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D23006

4 years agork805: Add regnode_status method
Emmanuel Vadot [Wed, 8 Jan 2020 11:30:03 +0000 (11:30 +0000)]
rk805: Add regnode_status method

This allow consumers to check if the regulator is enable or not.

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D23005

4 years agork808: Add min/max for the switch regulators
Emmanuel Vadot [Wed, 8 Jan 2020 11:29:22 +0000 (11:29 +0000)]
rk808: Add min/max for the switch regulators

The two switch regulator are always 3.0V.
Add a special case in get_voltage that if min=max we directly
return the value without calculating it.

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D23004

4 years agovtnet: Pre-allocate debugnet data immediately
Kristof Provost [Wed, 8 Jan 2020 10:06:32 +0000 (10:06 +0000)]
vtnet: Pre-allocate debugnet data immediately

Don't wait until the vtnet_debugnet_init() call happens, because at that
point we might already have allocated something from
vtnet_tx_header_zone.

Some systems showed this panic:

        vtnet0: link state changed to UP
        panic: keg vtnet_tx_hdr initialization after use.
        cpuid = 5
        time = 1578427700
        KDB: stack backtrace:
        db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004db427f0
        vpanic() at vpanic+0x17e/frame 0xfffffe004db42850
        panic() at panic+0x43/frame 0xfffffe004db428b0
        uma_zone_reserve() at uma_zone_reserve+0xf6/frame 0xfffffe004db428f0
        vtnet_debugnet_init() at vtnet_debugnet_init+0x77/frame 0xfffffe004db42930
        debugnet_any_ifnet_update() at debugnet_any_ifnet_update+0x42/frame 0xfffffe004db42980
        do_link_state_change() at do_link_state_change+0x1b3/frame 0xfffffe004db429d0
        taskqueue_run_locked() at taskqueue_run_locked+0x178/frame 0xfffffe004db42a30
        taskqueue_run() at taskqueue_run+0x4d/frame 0xfffffe004db42a50
        ithread_loop() at ithread_loop+0x1d6/frame 0xfffffe004db42ab0
        fork_exit() at fork_exit+0x80/frame 0xfffffe004db42af0
        fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004db42af0
        --- trap 0, rip = 0, rsp = 0, rbp = 0 ---
        KDB: enter: panic
        [ thread pid 12 tid 100011 ]
        Stopped at      kdb_enter+0x37: movq    $0,0x1084eb6(%rip)
        db>

Reviewed by: cem, markj
Differential Revision: https://reviews.freebsd.org/D23073

4 years agoSwitch 32-bit arm back to LLVM libunwind.
Michal Meloun [Wed, 8 Jan 2020 07:25:37 +0000 (07:25 +0000)]
Switch 32-bit arm back to LLVM libunwind.
Actual LLVM libunwind passed all testing without issues, switch back to it.

PR: 233664

4 years agoMinor adjustments to r356474 and r356480.
Alexander Motin [Tue, 7 Jan 2020 23:29:54 +0000 (23:29 +0000)]
Minor adjustments to r356474 and r356480.

Reported by: jkim, imp
MFC after: 2 weeks
X-MFC-with: r356474

4 years agoWork around lld's inability to handle undefined weak symbols on risc-v.
John Baldwin [Tue, 7 Jan 2020 23:18:31 +0000 (23:18 +0000)]
Work around lld's inability to handle undefined weak symbols on risc-v.

lld on RISC-V is not yet able to handle undefined weak symbols for
non-PIC code in the code model (medany/medium) used by the RISC-V
kernel.

Both GCC and clang emit an auipc / addi pair of instructions to
generate an address relative to the current PC with a 31-bit offset.
Undefined weak symbols need to have an address of 0, but the kernel
runs with PC values much greater than 2^31, so there is no way to
construct a NULL pointer as a PC-relative value.  The bfd linker
rewrites the instruction pair to use lui / addi with values of 0 to
force a NULL pointer address.  (There are similar cases for 'ld'
becoming auipc / ld that bfd rewrites to lui / ld with an address of
0.)

To work around this, compile the kernel with -fPIE when using lld.
This does not make the kernel position-independent, but it does
force the compiler to indirect address lookups through GOT entries
(so auipc / ld against a GOT entry to fetch the address).  This
adds extra memory indirections for global symbols, so should be
disabled once lld is finally fixed.

A few 'la' instructions in locore that depend on PC-relative
addressing to load physical addresses before paging is enabled have to
use auipc / addi and not indirect via GOT entries, so change those to
use 'lla' which always uses auipc / addi for both PIC and non-PIC.

Submitted by: jrtc27
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23064

4 years agoIncreate HMB limit from 1% to 5%.
Alexander Motin [Tue, 7 Jan 2020 23:10:38 +0000 (23:10 +0000)]
Increate HMB limit from 1% to 5%.

SSD capacity in laptops is growing faster then RAM size, so my original
guess seems too low on second thought.  Hopefully nobody will build large
array of those crappy SSDs.

MFC after: 2 weeks
X-MFC-with: 356474

4 years ago[PowerPC] Fix libllvmminimal build when building from powerpc64 ELFv1.
Brandon Bergren [Tue, 7 Jan 2020 22:45:02 +0000 (22:45 +0000)]
[PowerPC] Fix libllvmminimal build when building from powerpc64 ELFv1.

When bootstrapping on powerpc64 ELFv1, it is necessary to use binutils
ld.bfd from ports for the bootstrap, as this is the only modern linker for
ELFv1 host tools.

As binutils ld.bfd is rather strict in its handling of undefined symbols,
it is necessary to pull in Support/Atomic.cpp to avoid an undefined symbol.

Reviewed by: dim, emaste
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23072

4 years agoDon't fail universe kernel stage for TARGET_ARCHes without a kernel config.
John Baldwin [Tue, 7 Jan 2020 21:56:28 +0000 (21:56 +0000)]
Don't fail universe kernel stage for TARGET_ARCHes without a kernel config.

This fixes a regression in r356418 where the entire universe would
fail early due to an undefined make target when a given TARGET_ARCH
had no associated kernel configs.  This is true for all of the
hard-float mips TARGET_ARCHes currently.

Pointy hat to: me
Reviewed by: emaste
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23071

4 years agoUse a deterministic hash for USDT symbol names.
Mark Johnston [Tue, 7 Jan 2020 21:56:20 +0000 (21:56 +0000)]
Use a deterministic hash for USDT symbol names.

Previously libdtrace used ftok(3), which hashes the inode number of the
input object file.  To increase reproducibility of builds that embed
USDT probes, include a hash of the object file path in the symbol name
instead.

Reported and tested by: bdrewery
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

4 years agolibjail: Handle an error from reallocarray() when trimming the buffer.
Mark Johnston [Tue, 7 Jan 2020 21:44:27 +0000 (21:44 +0000)]
libjail: Handle an error from reallocarray() when trimming the buffer.

There is no API guarantee that realloc() will not fail when the buffer
is shrinking.  Handle it by simply returning the untrimmed buffer.
While this is unlikely to ever happen in practice, it seems worth
handling just to silence static analyzer warnings.

PR: 243106
Submitted by: Hans Christian Woithe <chwoithe@yahoo.com>
MFC after: 1 week

4 years agoFix a typo - passing wrong mbuf pointer to needs_udp_csum(). Will
Gleb Smirnoff [Tue, 7 Jan 2020 21:29:42 +0000 (21:29 +0000)]
Fix a typo - passing wrong mbuf pointer to needs_udp_csum().  Will
trigger panic only on a kernel with RATELIMIT.

Submitted by: rrs

4 years agoAdd Host Memory Buffer support to nvme(4).
Alexander Motin [Tue, 7 Jan 2020 21:17:11 +0000 (21:17 +0000)]
Add Host Memory Buffer support to nvme(4).

This allows cheapest DRAM-less NVMe SSDs to use some of host RAM (about
1MB per 1GB on the devices I have) for its metadata cache, significantly
improving random I/O performance.  Device reports minimal and preferable
size of the buffer.  The code limits it to 1% of physical RAM by default.
If the buffer can not be allocated or below minimal size, the device will
just have to work without it.

MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.

4 years agoFix rtsock route message generation for interface addresses.
Alexander V. Chernikov [Tue, 7 Jan 2020 21:16:30 +0000 (21:16 +0000)]
Fix rtsock route message generation for interface addresses.

Reviewed by: olivier
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D22974

4 years agoAdd #ifdef option-test wrappers around another call to an arm/unwind.c
Ian Lepore [Tue, 7 Jan 2020 21:13:34 +0000 (21:13 +0000)]
Add #ifdef option-test wrappers around another call to an arm/unwind.c
function which is only compiled-in with certain options.

Why is it always the most trivial part of a big commit that takes 3 tries
to get right?

4 years agovfs: handle doomed vnodes in vdefer_inactive
Mateusz Guzik [Tue, 7 Jan 2020 20:24:21 +0000 (20:24 +0000)]
vfs: handle doomed vnodes in vdefer_inactive

vgone dooms the vnode while keeping VI_OWEINACT set and then drops the
interlock.

vputx can pick up the interlock and pass it to vdefer_inactive since the
flag is set.

The race is harmless, just don't defer anything as vgone will take care of it.

Reported by: pho

4 years agoRemove gcclibs libssp build glue
Kyle Evans [Tue, 7 Jan 2020 19:49:31 +0000 (19:49 +0000)]
Remove gcclibs libssp build glue

r356356 started providing libssp based on ^/lib/libc/secure and disconnected
this version from the build. This one did formally provide runtime support
for _FORTIFY_SOURCE, but FreeBSD lacks the build support that would have
been needed to take advantage of it.

MFC after: never

4 years agoDo not define TCPOUTFLAGS in rack_bbr_common
Ed Maste [Tue, 7 Jan 2020 17:57:08 +0000 (17:57 +0000)]
Do not define TCPOUTFLAGS in rack_bbr_common

tcp_outflags isn't used in this source file and compilation failed with
external GCC on sparc64.  I'm not sure why only that case failed (perhaps
inconsistent -Werror config) but it is a legitimate issue to fix.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D23068

4 years agoRevert r355861 because the issue has been fixed in r356443
Li-Wen Hsu [Tue, 7 Jan 2020 17:49:49 +0000 (17:49 +0000)]
Revert r355861 because the issue has been fixed in r356443

PR: 242689
Notified by: markj
Sponsored by: The FreeBSD Foundation

4 years agoVarious cleanups to cryptocheck.
John Baldwin [Tue, 7 Jan 2020 17:07:58 +0000 (17:07 +0000)]
Various cleanups to cryptocheck.

- Rename 'blkcipher' to 'cipher'.  Some of the ciphers being tested
  are stream ciphers.
- Rename 'authenc' to 'eta' as it is only testing ETA chained
  operations and not other combination modes.
- Add a notion of an OCF session and some helper routines to try to
  reduce duplicated code.  This also uses a single session for both
  encrypt and decrypt operations during a single test.
- Add tests to ensure that AEAD algorithms fail decryption with
  EBADMSG when given a corrupted tag.
- Remove the transitional hack for COP_F_CIPHER_FIRST.
- Update block comment to mention plain hashes.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D22940

4 years agoRemove support for using GCC 4.2.1 from make tinderbox.
John Baldwin [Tue, 7 Jan 2020 16:53:51 +0000 (16:53 +0000)]
Remove support for using GCC 4.2.1 from make tinderbox.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D23054

4 years agoDecrease logging severity when adding a device or reading config table.
Mark Johnston [Tue, 7 Jan 2020 16:07:30 +0000 (16:07 +0000)]
Decrease logging severity when adding a device or reading config table.

In PR 243056 a user reports some spam from smartpqi(4).  In particular,
the driver warns about an unrecognized PQI_CONF_TABLE_SECTION_SOFT_RESET
section (not yet defined in the driver, but handled in Linux), but this
doesn't cause any problems.  The Linux driver also does not warn about
unrecognized sections.

Also do not log a warning when a device is added, since this is routine.
Lower severity to DISC, to match pqisrc_remove_device().

PR: 243056
Reviewed by: sbruno
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23023

4 years agortld: Fix segfault in direct exec mode
Ryan Stone [Tue, 7 Jan 2020 16:03:11 +0000 (16:03 +0000)]
rtld: Fix segfault in direct exec mode

When rtld is directly executed with arguments, it has to move the
program arguments, environment and elf aux data up a few slots to
remove its own arguments before the process being executed sees
them.  When copying the environment, rtld was incorrectly testing
whether the location about to be written to currently contained
NULL, when was supposed to check whether it had just copied the
NULL terminator of the environment string.  This had the result
that the ELF aux data was mostly treated as environment variables,
and rtld would quickly crash when it tried to access required
ELF aux data that it didn't think was present.

Differential Revision: https://reviews.freebsd.org/D23008
Reviewed by: kib
MFC after: 1 month

4 years agoDefine a unified pmap structure for i386.
Mark Johnston [Tue, 7 Jan 2020 15:59:31 +0000 (15:59 +0000)]
Define a unified pmap structure for i386.

The overloading of struct pmap for PAE and non-PAE pmaps results in
three distinct layouts for the structure, which is embedded in
struct vmspace.  This causes a large number of duplicate structure
definitions in the i386 kernel's CTF type graph.

Since most pmap fields are the same in the two pmaps, simply provide
side-by-side variants of the fields that are distinct, using fixed-size
types.

PR: 242689
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22896

4 years agoConsistently use pmap_t instead of struct pmap *.
Mark Johnston [Tue, 7 Jan 2020 15:59:02 +0000 (15:59 +0000)]
Consistently use pmap_t instead of struct pmap *.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agovfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT)
Mateusz Guzik [Tue, 7 Jan 2020 15:56:24 +0000 (15:56 +0000)]
vfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT)

The previous behavior of leaving VI_OWEINACT vnodes on the active list without
a hold count is eliminated. Hold count is kept and inactive processing gets
explicitly deferred by setting the VI_DEFINACT flag. The syncer is then
responsible for vdrop.

Reviewed by: kib (previous version)
Tested by: pho (in a larger patch, previous version)
Differential Revision: https://reviews.freebsd.org/D23036

4 years agovfs: trylock in vfs_msync and refactor the func
Mateusz Guzik [Tue, 7 Jan 2020 15:44:19 +0000 (15:44 +0000)]
vfs: trylock in vfs_msync and refactor the func

- use LK_NOWAIT instead of calling VOP_ISLOCKED before deciding to lock
- evaluate flags before looping over vnodes

Reviewed by: kib
Tested by: pho (in a larger patch, previous version)
Differential Revision: https://reviews.freebsd.org/D23035

4 years agovfs: use a dedicated counter for free vnode recycling
Mateusz Guzik [Tue, 7 Jan 2020 15:42:01 +0000 (15:42 +0000)]
vfs: use a dedicated counter for free vnode recycling

Otherwise vlrureclaim activitity is mixed in and it is hard to tell which
vnodes got reclaimed.

4 years agosifive: Fix incorrect tx/rx ctrl defines
Kristof Provost [Tue, 7 Jan 2020 09:02:14 +0000 (09:02 +0000)]
sifive: Fix incorrect tx/rx ctrl defines

Happily these were never used, but they should be correct anyway.

Reported by: Nicholas O'Brien <nickisobrien_gmail.com>
Sponsored by: Axiado

4 years agoprocstat: read lo_name instead of now removed v_tag
Mateusz Guzik [Tue, 7 Jan 2020 05:33:33 +0000 (05:33 +0000)]
procstat: read lo_name instead of now removed v_tag

4 years agozfs: plug a vnode reserve leak in zfs_make_xattrdir
Mateusz Guzik [Tue, 7 Jan 2020 04:34:29 +0000 (04:34 +0000)]
zfs: plug a vnode reserve leak in zfs_make_xattrdir

4 years agovfs: prevent numvnodes and freevnodes re-reads when appropriate
Mateusz Guzik [Tue, 7 Jan 2020 04:34:03 +0000 (04:34 +0000)]
vfs: prevent numvnodes and freevnodes re-reads when appropriate

Otherwise in code like this:
if (numvnodes > desiredvnodes)
vnlru_free_locked(numvnodes - desiredvnodes, NULL);

numvnodes can drop below desiredvnodes prior to the call and if the
compiler generated another read the subtraction would get a negative
value.

4 years agofsck_msdosfs.8: document -M.
Xin LI [Tue, 7 Jan 2020 04:33:14 +0000 (04:33 +0000)]
fsck_msdosfs.8: document -M.

Reported by: mckusick
Reviewed by: mckusick, emaste, bcr
MFC after: 28 days
X-MFC-with: r356313
Differential Revision: https://reviews.freebsd.org/D23049

4 years agovfs: annotate numvnodes and vnode_free_list_mtx with __exclusive_cache_line
Mateusz Guzik [Tue, 7 Jan 2020 04:30:49 +0000 (04:30 +0000)]
vfs: annotate numvnodes and vnode_free_list_mtx with __exclusive_cache_line

4 years agovfs: eliminate v_tag from struct vnode
Mateusz Guzik [Tue, 7 Jan 2020 04:29:34 +0000 (04:29 +0000)]
vfs: eliminate v_tag from struct vnode

There was only one consumer and it was using it incorrectly.

It is given an equivalent hack.

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23037

4 years agovfs: add a helper for allocating marker vnodes
Mateusz Guzik [Tue, 7 Jan 2020 04:27:40 +0000 (04:27 +0000)]
vfs: add a helper for allocating marker vnodes

4 years agoAdd more Arm arm64 CPU identification values
Andrew Turner [Mon, 6 Jan 2020 20:57:59 +0000 (20:57 +0000)]
Add more Arm arm64 CPU identification values

 - Add all the Cortex-A CPU ID register values I can find.
 - Add the Neoverse-N1 ID regiser value [1]
 - Sort macros by register value.

PR: 243065
Submitted by: Ali Saidi <alisaidi AT amazon.com> [1]
Sponsored by: DARPA, AFRL (other than [1])

4 years agokern_sysctl: make sysctl.debug work as intended
Pawel Biernacki [Mon, 6 Jan 2020 19:47:59 +0000 (19:47 +0000)]
kern_sysctl: make sysctl.debug work as intended

r136999 introduced SYSTCL_DEBUG but apparently "opt_sysctl.h" was never
included making the option ignored.

r322954 introduced sysctl.reuse_test with OID number equal to 0, effectively
shadowing the very special sysctl.debug one. Use OID_AUTO as it doesn't need
any special treatment.

Reviewed by: kib (mentor)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D23056

4 years agoloader: update zfsimpl.c from illumos review suggestions
Toomas Soome [Mon, 6 Jan 2020 19:35:22 +0000 (19:35 +0000)]
loader: update zfsimpl.c from illumos review suggestions

Add extra comments and update error handling.

MFH: 1 week

4 years agoRefine fusefs test workaround for mips+llvm
Kyle Evans [Mon, 6 Jan 2020 18:25:58 +0000 (18:25 +0000)]
Refine fusefs test workaround for mips+llvm

This re-enables building the googletest suite by default on mips and instead
specifically doesn't build fusefs tests for mips+clang builds.  clang will
easily spent >= 1.5 hours compiling a single file due to a bug in
optimization (see LLVM PR 43263), so turn these off for now while that's
hashed out.

GCC builds are unaffected and build the fusefs tests as-is. Clang builds
only happen by early adopters attempting to hash out the remaining issues.

The comment has been updated to reflect its new position and use less strong
wording about imposing on people.

Discussed with: ngie, asomers
Reviewed by: ngie

4 years agoUpdate libssp paths in various Makefile.depend* files
Kyle Evans [Mon, 6 Jan 2020 18:15:55 +0000 (18:15 +0000)]
Update libssp paths in various Makefile.depend* files

I've been advised that the model that uses these are fairly resilient, but
we do know the proper path to use (or remove, in the case of ^/targets/...),
so go ahead and update them to reflect that.

4 years agosrc.conf.5: regen after r356419, reenabling powerpc in universe
Ed Maste [Mon, 6 Jan 2020 18:07:54 +0000 (18:07 +0000)]
src.conf.5: regen after r356419, reenabling powerpc in universe

4 years agoSimplify arguments to signal handlers on mips.
John Baldwin [Mon, 6 Jan 2020 18:02:02 +0000 (18:02 +0000)]
Simplify arguments to signal handlers on mips.

- Use ksi_addr directly as si_addr in the siginfo instead of the
  'badvaddr' register.
- Remove a duplicate assignment of si_code.
- Use ksi_addr as the 4th argument to the old-style handler instead of
  'badvaddr'.

Reviewed by: brooks, kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23013

4 years agoEnable powerpc in make tinderbox using clang instead of GCC.
John Baldwin [Mon, 6 Jan 2020 17:36:28 +0000 (17:36 +0000)]
Enable powerpc in make tinderbox using clang instead of GCC.

powerpcspe is disabled for now until clang/llvm issues with spe
have been fixed.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D23031

4 years agoOnly build kernels for enabled TARGET_ARCHes in make universe/tinderbox.
John Baldwin [Mon, 6 Jan 2020 17:34:17 +0000 (17:34 +0000)]
Only build kernels for enabled TARGET_ARCHes in make universe/tinderbox.

Previously, all of the kernels for a given TARGET were built if that
target was enabled.  This was implemented by having each kernel built
via a universe_kernconf_<KERNEL> target that was depended on by a
universe_kernconfs target.  However, this meant that if one did a
build with a limited set of TARGET_ARCH values for a given TARGET,
kernels could be built for which we hadn't built a world or toolchain.
For example, 'make TARGETS=mips TARGET_ARCHES_mips=mips64' would build
mips32 kernels.

Fix this by adding an extra layer of indirection in the kernel make
targets.  universe_kernconf_<KERNEL> is now a dependency of a new
universe_kernconfs_<TARGET_ARCH>.  universe_kernconfs in turn depends
on a list of universe_kernconfs_<target_arch> values, but only the
values enabled in TARGET_ARCHES_<TARGET>.

Reviewed by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23031

4 years agoThis catches rack up in the recent changes to ECN and
Randall Stewart [Mon, 6 Jan 2020 15:29:14 +0000 (15:29 +0000)]
This catches rack up in the recent changes to ECN and
also commonizes the functions that both the freebsd and
rack stack uses.

Sponsored by:Netflix Inc
Differential Revision: https://reviews.freebsd.org/D23052

4 years agoMFV r356415
Martin Matuska [Mon, 6 Jan 2020 13:21:10 +0000 (13:21 +0000)]
MFV r356415
Sync libarchive with vendor

Relevant vendor changes:
  Issue #1302: Re-do fix for archive_write_client_open()

X-MFC-With: r356212,r356365
MFC after: 1 week

4 years agoUpdate vendor/libarchive/dist to git 3f1bad815d02160ab27f7063257aed4b25dbaebe
Martin Matuska [Mon, 6 Jan 2020 13:13:58 +0000 (13:13 +0000)]
Update vendor/libarchive/dist to git 3f1bad815d02160ab27f7063257aed4b25dbaebe

Relevant vendor changes:
  Issue #1302: Re-do fix for archive_write_client_open()

4 years agoThis change adds a small feature to the tcp logging code. Basically
Randall Stewart [Mon, 6 Jan 2020 12:48:06 +0000 (12:48 +0000)]
This change adds a small feature to the tcp logging code. Basically
a connection can now have a separate tag added to the id.

Obtained from: Lawrence Stewart
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D22866

4 years agosysctl: mark more nodes as MPSAFE
Pawel Biernacki [Mon, 6 Jan 2020 10:52:13 +0000 (10:52 +0000)]
sysctl: mark more nodes as MPSAFE

vm.kvm_size and vm.kvm_free are read only and marked as MPSAFE on i386
already. Mark them as that on amd64 and arm64 too to avoid locking Giant.

Reviewed by: kib (mentor)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D23039

4 years agoAdd own counter for cancelled USB transfers.
Hans Petter Selasky [Mon, 6 Jan 2020 09:49:20 +0000 (09:49 +0000)]
Add own counter for cancelled USB transfers.
Do not count these as errors.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix uma boot pages calculations on NUMA machines that also don't have
Jeff Roberson [Mon, 6 Jan 2020 02:51:19 +0000 (02:51 +0000)]
Fix uma boot pages calculations on NUMA machines that also don't have
MD_UMA_SMALL_ALLOC.  This is unusual but not impossible.  Fix the alignemnt
of zones while here.  This was already correct because uz_cpu strongly
aligned the zone structure but the specified alignment did not match
reality and involved redundant defines.

Reviewed by: markj, rlibby
Differential Revision: https://reviews.freebsd.org/D23046