]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agomdmfs(8): use -o reserve with malloc-backed md(4)
kevans [Sat, 16 Feb 2019 23:57:38 +0000 (23:57 +0000)]
mdmfs(8): use -o reserve with malloc-backed md(4)

Mentioned in mdconfig(8), malloc-backed md(4) can be unstable unless
required memory is allocated up front with -o reserve. Furthermore, panics
have been observed with md used in fstab on 12.0-RELEASE. Choose the stable
route and pass -o reserve.

Submitted by: Paul Vixie
MFC after: 1 week

5 years agoFew more corrections to WITHOUT_OFED=1 make delete-old removal:
avos [Sat, 16 Feb 2019 16:34:23 +0000 (16:34 +0000)]
Few more corrections to WITHOUT_OFED=1 make delete-old removal:

- Drop profile libraries; MK_PROFILE=no is set in all Makefile's.
- Correct library path to libmlx5.so.1 and libibverbs.so.1

MFC after: 5 days
MFC with: 344207

5 years agoRemove corresponding lib32/ files when WITHOUT_OFED=1 is set
avos [Sat, 16 Feb 2019 16:17:46 +0000 (16:17 +0000)]
Remove corresponding lib32/ files when WITHOUT_OFED=1 is set

MFC after: 5 days
MFC with: 344207

5 years agoRefresh OptionalObsoleteFiles.inc for MK_PMC:
avos [Sat, 16 Feb 2019 16:01:23 +0000 (16:01 +0000)]
Refresh OptionalObsoleteFiles.inc for MK_PMC:

- Add missing /usr/sbin/pmc, pmcformat.h, libpmcstat.h and pmc.haswellxeon.3
to the list.
- Correct man page section for pmcstudy.8.
- Include recently added libipt and libopencsd for corresponding TARGET_ARCH

MFC after: 5 days

5 years agowlandebug: disable PIE to fix build failure
emaste [Sat, 16 Feb 2019 12:49:55 +0000 (12:49 +0000)]
wlandebug: disable PIE to fix build failure

libifconfig is built as a static-only PRIVATELIB (and there is no _pie.a
version) so disable PIE in libifconfig's consumer.

Sponsored by: The FreeBSD Foundation

5 years agoAdd more rc.d scripts / empty directors / config files into
avos [Sat, 16 Feb 2019 05:04:01 +0000 (05:04 +0000)]
Add more rc.d scripts / empty directors / config files into
OptionalObsoleteFiles.inc

Note: only files with conditional installation logic were
included from the PR.

PR: 233046
Submitted by: <rozhuk.im@gmail.com>
MFC after: 5 days

5 years agoAllow to remove unused files via 'make delete-old(-libs)' when WITHOUT_OFED
avos [Sat, 16 Feb 2019 04:49:51 +0000 (04:49 +0000)]
Allow to remove unused files via 'make delete-old(-libs)' when WITHOUT_OFED
and / or WITHOUT_OFED_EXTRA src.conf(5) options are set.

MFC after: 5 days

5 years agopowerpc/booke: Fix 32-bit build
jhibbits [Sat, 16 Feb 2019 04:47:33 +0000 (04:47 +0000)]
powerpc/booke: Fix 32-bit build

MFC after: 2 weeks
MFC with: 344202

5 years agopowerpc/booke: depessimize MAS register updates
jhibbits [Sat, 16 Feb 2019 04:38:34 +0000 (04:38 +0000)]
powerpc/booke: depessimize MAS register updates

We only need to isync before we actually use the MAS registers, so before and
after the TLB read/write/sync/search operations.

MFC after: 2 weeks

5 years agopowerpc/booke: Use DMAP where possible for page copy and zeroing
jhibbits [Sat, 16 Feb 2019 04:16:10 +0000 (04:16 +0000)]
powerpc/booke: Use DMAP where possible for page copy and zeroing

This avoids several locks and pmap_kenter()'s, improving performance
marginally.

MFC after: 2 weeks

5 years agoRemove vi(1)-related files via 'make delete-old' when WITHOUT_VI=1 is set.
avos [Sat, 16 Feb 2019 03:49:48 +0000 (03:49 +0000)]
Remove vi(1)-related files via 'make delete-old' when WITHOUT_VI=1 is set.

MFC after: 5 days

5 years agoGC ATA_REQUEST_TIMEOUT option remnants
avos [Sat, 16 Feb 2019 01:48:38 +0000 (01:48 +0000)]
GC ATA_REQUEST_TIMEOUT option remnants

It was removed from code in r249083 and from sys/conf/options in r249213.

PR: 222170
MFC after: 3 days

5 years agoAdd support for a virtual hostname to nfsd
sef [Sat, 16 Feb 2019 00:15:54 +0000 (00:15 +0000)]
Add support for a virtual hostname to nfsd

Specifically, this allows (via "-V vhostname") telling nfsd what principal
to use, instead of the hostname.  This is used at iXsystems for fail-over in
HA systems.

Reviewed by: macklem
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D19191

5 years agoRemove write-only s_flag.
imp [Sat, 16 Feb 2019 00:15:02 +0000 (00:15 +0000)]
Remove write-only s_flag.

5 years agoImaginary cat jumped my keyboard!
glebius [Fri, 15 Feb 2019 23:46:34 +0000 (23:46 +0000)]
Imaginary cat jumped my keyboard!

5 years agoFixup bsd.prog.mk after r344182
cem [Fri, 15 Feb 2019 23:41:54 +0000 (23:41 +0000)]
Fixup bsd.prog.mk after r344182

Reported by: tinderbox
Sponsored by: Dell EMC Isilon

5 years agoFor 32-bit machines rollback the default number of vnode pager pbufs
glebius [Fri, 15 Feb 2019 23:36:22 +0000 (23:36 +0000)]
For 32-bit machines  rollback the default number of vnode pager pbufs
back to the lever before r343030.  For 64-bit machines reduce it slightly,
too.  Together with r343030 I bumped the limit up to the value we use at
Netflix to serve 100 Gbit/s of sendfile traffic, and it probably isn't a
good default.

Provide a loader tunable to change vnode pager pbufs count. Document it.

5 years agoFUSE: Refresh cached file size when it changes (lookup)
cem [Fri, 15 Feb 2019 22:55:13 +0000 (22:55 +0000)]
FUSE: Refresh cached file size when it changes (lookup)

The cached fvdat->filesize is indepedent of the (mostly unused)
cached_attrs, and we failed to update it when a cached (but perhaps
inactive) vnode was found during VOP_LOOKUP to have a different size than
cached.

As noted in the code comment, this can occur in distributed filesystems or
with other kinds of irregular file behavior (anything is possible in FUSE).

We do something similar in fuse_vnop_getattr already.

PR: 230258 (as reported in description; other issues explored in
comments are not all resolved)
Reported by: MooseFS FreeBSD Team <freebsd AT moosefs.com>
Submitted by: Jakub Kruszona-Zawadzki <acid AT moosefs.com> (earlier version)

5 years agoFUSE: The FUSE design expects writethrough caching
cem [Fri, 15 Feb 2019 22:52:49 +0000 (22:52 +0000)]
FUSE: The FUSE design expects writethrough caching

At least prior to 7.23 (which adds FUSE_WRITEBACK_CACHE), the FUSE protocol
specifies only clean data to be cached.

Prior to this change, we implement and default to writeback caching.  This
is ok enough for local only filesystems without hardlinks, but violates the
general design contract with FUSE and breaks distributed filesystems or
concurrent access to hardlinks of the same inode.

In this change, add cache mode as an extension of cache enable/disable.  The
new modes are UC (was: cache disabled), WT (default), and WB (was: cache
enabled).

For now, WT caching is implemented as write-around, which meets the goal of
only caching clean data.  WT can be better than WA for workloads that
frequently read data that was recently written, but WA is trivial to
implement.  Note that this has no effect on O_WRONLY-opened files, which
were already coerced to write-around.

Refs:
  * https://sourceforge.net/p/fuse/mailman/message/8902254/
  * https://github.com/vgough/encfs/issues/315

PR: 230258 (inspired by)

5 years agoFUSE: Only "dirty" cached file size when data is dirty
cem [Fri, 15 Feb 2019 22:51:09 +0000 (22:51 +0000)]
FUSE: Only "dirty" cached file size when data is dirty

Most users of fuse_vnode_setsize() set the cached fvdat->filesize and update
the buf cache bounds as a result of either a read from the underlying FUSE
filesystem, or as part of a write-through type operation (like truncate =>
VOP_SETATTR).  In these cases, do not set the FN_SIZECHANGE flag, which
indicates that an inode's data is dirty (in particular, that the local buf
cache and fvdat->filesize have dirty extended data).

PR: 230258 (related)

5 years agoFUSE: Respect userspace FS "do-not-cache" of path components
cem [Fri, 15 Feb 2019 22:50:31 +0000 (22:50 +0000)]
FUSE: Respect userspace FS "do-not-cache" of path components

The FUSE protocol demands that kernel implementations cache user filesystem
path components (lookup/cnp data) for a maximum period of time in the range
of [0, ULONG_MAX] seconds.  In practice, typical requests are for 0, 1, or
10 seconds; or "a long time" to represent indefinite caching.

Historically, FreeBSD FUSE has ignored this client directive entirely.  This
works fine for local-only filesystems, but causes consistency issues with
multi-writer network filesystems.

For now, respect 0 second cache TTLs and do not cache such metadata.
Non-zero metadata caching TTLs in the range [0.000000001, ULONG_MAX] seconds
are still cached indefinitely, because it is unclear how a userspace
filesystem could do anything sensible with those semantics even if
implemented.

Pass fuse_entry_out to fuse_vnode_get when available and only cache lookup
if the user filesystem did not set a zero second TTL.

PR: 230258 (inspired by; does not fix)

5 years agoFUSE: Respect userspace FS "do-not-cache" of file attributes
cem [Fri, 15 Feb 2019 22:49:15 +0000 (22:49 +0000)]
FUSE: Respect userspace FS "do-not-cache" of file attributes

The FUSE protocol demands that kernel implementations cache user filesystem
file attributes (vattr data) for a maximum period of time in the range of
[0, ULONG_MAX] seconds.  In practice, typical requests are for 0, 1, or 10
seconds; or "a long time" to represent indefinite caching.

Historically, FreeBSD FUSE has ignored this client directive entirely.  This
works fine for local-only filesystems, but causes consistency issues with
multi-writer network filesystems.

For now, respect 0 second cache TTLs and do not cache such metadata.
Non-zero metadata caching TTLs in the range [0.000000001, ULONG_MAX] seconds
are still cached indefinitely, because it is unclear how a userspace
filesystem could do anything sensible with those semantics even if
implemented.

In the future, as an optimization, we should implement notify_inval_entry,
etc, which provide userspace filesystems a way of evicting the kernel cache.

One potentially bogus access to invalid cached attribute data was left in
fuse_io_strategy.  It is restricted behind the undocumented and non-default
"vfs.fuse.fix_broken_io" sysctl or "brokenio" mount option; maybe these are
deadcode and can be eliminated?

Some minor APIs changed to facilitate this:

1. Attribute cache validity is tracked in FUSE inodes ("fuse_vnode_data").

2. cache_attrs() respects the provided TTL and only caches in the FUSE
inode if TTL > 0.  It also grows an "out" argument, which, if non-NULL,
stores the translated fuse_attr (even if not suitable for caching).

3. FUSE VTOVA(vp) returns NULL if the vnode's cache is invalid, to help
avoid programming mistakes.

4. A VOP_LINK check for potential nlink overflow prior to invoking the FUSE
link op was weakened (only performed when we have a valid attr cache).  The
check is racy in a multi-writer network filesystem anyway -- classic TOCTOU.
We have to trust any userspace filesystem that rejects local caching to
account for it correctly.

PR: 230258 (inspired by; does not fix)

5 years agoUse make's :tl instead of checking "no" and "NO"
emaste [Fri, 15 Feb 2019 22:48:50 +0000 (22:48 +0000)]
Use make's :tl instead of checking "no" and "NO"

Suggested by: kevans
Reviewed by: kevans

5 years agoFix Makefile conditional after r344179
emaste [Fri, 15 Feb 2019 22:30:09 +0000 (22:30 +0000)]
Fix Makefile conditional after r344179

5 years agoRegen src.conf.5 after r344179
emaste [Fri, 15 Feb 2019 22:28:34 +0000 (22:28 +0000)]
Regen src.conf.5 after r344179

5 years agoAdd WITH_PIE knob to build Position Independent Executables
emaste [Fri, 15 Feb 2019 22:22:38 +0000 (22:22 +0000)]
Add WITH_PIE knob to build Position Independent Executables

Building binaries as PIE allows the executable itself to be loaded at a
random address when ASLR is enabled (not just its shared libraries).

With this change PIE objects have a .pieo extension and INTERNALLIB
libraries libXXX_pie.a.

MK_PIE is disabled for some kerberos5 tools, Clang, and Subversion, as
they explicitly reference .a libraries in their Makefiles.  These can
be addressed on an individual basis later.  MK_PIE is also disabled for
rtld-elf because it is already position-independent using bespoke
Makefile rules.

Currently only dynamically linked binaries will be built as PIE.

Discussed with: dim
Reviewed by: kib
MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18423

5 years agoiflib: Improve return values of interrupt handlers.
shurd [Fri, 15 Feb 2019 18:51:43 +0000 (18:51 +0000)]
iflib: Improve return values of interrupt handlers.

iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more
correct. This potentially caused issues with shared legacy interrupts.

Driver filters returning FILTER_STRAY are now properly handled.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com>
Reviewed by: marius, gallatin
Obtained from: Haiku (a84bb9, 4947d1)
MFC after: 1 week
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D19201

5 years agostand: dev_net: correct net_open's interpretation of params
kevans [Fri, 15 Feb 2019 18:28:51 +0000 (18:28 +0000)]
stand: dev_net: correct net_open's interpretation of params

net_open previously casted the first vararg to a char * and this was
half-OK: at first, it is passed to netif_open, which would cast it back to
the struct devdesc * that it really is and use it properly. It is then
strdup()d and used as the netdev_name, which is objectively wrong.

Correct it so that the first vararg is properly casted to a struct devdesc *
and the netdev_name gets set properly to make it more clear at a glance that
it's not doing something horribly wrong.

Reported by: mmel
Reviewed by: imp, mmel, tsoome
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19206

5 years agoIn r340044 an attempt to quiet coverity warning cid 1357336
rgrimes [Fri, 15 Feb 2019 16:48:15 +0000 (16:48 +0000)]
In r340044 an attempt to quiet coverity warning cid 1357336
was incorrectly implemented leading to a possible double free.

It is possible for both the conditional free,
and the unconditional free added in r340044 to be done,
fix that by initializing uopt to NULL,
removing the conditional free,
and only using the unconditional free at the end.

Reported by: Patrick Mooney (patrick.mooney@joyent.com)
Reviewed by: jhb (maintainer), Patrick Mooney (joyent/illumos)
Approved by: bde (mentor)
CID: 1357336
MFC after: 3 days
MFC with: 340044
Differential Revision: https://reviews.freebsd.org/D19202

5 years agoIn r340042 an attempt to quiet coverity warning cid 1305412 was overdone.
rgrimes [Fri, 15 Feb 2019 16:20:21 +0000 (16:20 +0000)]
In r340042 an attempt to quiet coverity warning cid 1305412 was overdone.
nopt is the only allocated space,
xopt and cp are aliases into that allocated space.
Remove the 2 unneeded free's

Reported by: Patrick Mooney (@pmooney_pfmooney.com)
Reviewed by: jhb (maintainer), Patrick Mooney (joyent/illumos)
Approved by: bde (mentor)
CID: 1305412
MFC after: 3 days
MFC with: 340042
Differential Revision: https://reviews.freebsd.org/D19200

5 years agoDo not use ntc for obtaining buffer on Rx in the ENA
mw [Fri, 15 Feb 2019 10:40:41 +0000 (10:40 +0000)]
Do not use ntc for obtaining buffer on Rx in the ENA

In out of order mode Rx buffer are accesses by req_id.
Accessing and validating mbuf using ntc is causing false error.

Increase driver revision after latest RX OOO completion fixes.

Submitted by: Rafal Kozik <rk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
MFC after: 1 week

5 years agoFix validation of the Rx OOO completion in the ENA
mw [Fri, 15 Feb 2019 10:34:27 +0000 (10:34 +0000)]
Fix validation of the Rx OOO completion in the ENA

Requested ID should be validated when the packet is received and not
when the driver is repopulating the mbufs.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
MFC after: 1 week

5 years agoFix a byte ordering issue for the advertised receiver window in ACK
tuexen [Fri, 15 Feb 2019 09:45:17 +0000 (09:45 +0000)]
Fix a byte ordering issue for the advertised receiver window in ACK
segments sent in TIMEWAIT state, which I introduced in r336937.

MFC after: 3 days
Sponsored by: Netflix, Inc.

5 years agoFix another issue from r344141, having to do with size of a shift amount.
sef [Fri, 15 Feb 2019 04:15:43 +0000 (04:15 +0000)]
Fix another issue from r344141, having to do with size of a shift amount.
This did not show up in my testing.

Differential Revision: https://reviews.freebsd.org/D18592

5 years agoPasting in a source control line missed the last quote. Fixed.
sef [Fri, 15 Feb 2019 04:01:59 +0000 (04:01 +0000)]
Pasting in a source control line missed the last quote.  Fixed.

5 years agoAdd AES-CCM encryption, and plumb into OCF.
sef [Fri, 15 Feb 2019 03:53:03 +0000 (03:53 +0000)]
Add AES-CCM encryption, and plumb into OCF.

This commit essentially has three parts:

* Add the AES-CCM encryption hooks.  This is in and of itself fairly small,
as there is only a small difference between CCM and the other ICM-based
algorithms.
* Hook the code into the OpenCrypto framework.  This is the bulk of the
changes, as the algorithm type has to be checked for, and the differences
between it and GCM dealt with.
* Update the cryptocheck tool to be aware of it.  This is invaluable for
confirming that the code works.

This is a software-only implementation, meaning that the performance is very
low.

Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D19090

5 years agoAdd CBC-MAC authentication.
sef [Fri, 15 Feb 2019 03:46:39 +0000 (03:46 +0000)]
Add CBC-MAC authentication.

This adds the CBC-MAC code to the kernel, but does not hook it up to
anything (that comes in the next commit).

https://tools.ietf.org/html/rfc3610 describes the algorithm.

Note that this is a software-only implementation, which means it is
fairly slow.

Sponsored by:   iXsystems Inc
Differential Revision:  https://reviews.freebsd.org/D18592

5 years agoFinish the fix for overflow in calcru1().
bde [Thu, 14 Feb 2019 19:07:08 +0000 (19:07 +0000)]
Finish the fix for overflow in calcru1().

The previous fix was unnecessarily very slow up to 105 hours where the
simple formula used previously worked, and unnecessarily slow by a factor
of about 5/3 up to 388 days, and didn't work above 388 days.  388 days is
not a long time, since it is a reasonable uptime, and for processes the
times being calculated are aggregated over all threads, so with N CPUs
running the same thread a runtime of 388 days is reachable after only
388 / N physical days.

The PRs document overflow at 388 days, but don't try to fix it.

Use the simple formula up to 76 hours.  Then use a complicated general
method that reduces to the simple formula up to a bit less than 105
hours, then reduces to the previous method without its extra work up
to almost 388 days, then does more complicated reductions, usually
many bits at a time so that this is not slow.  This works up to half
of maximum representable time (292271 years), with accumulated rounding
errors of at most 32 usec.

amd64 can do all this with no avoidable rounding errors in an inline
asm with 2 instructions, but this is too special to use.  __uint128_t
can do the same with 100's of instructions on 64-bit arches.  Long
doubles with at least 64 bits of precision are the easiest method to
use on i386 userland, but are hard to use in the kernel.

PR: 76972 and duplicates
Reviewed by: kib

5 years agoixl: Fix panic caused by bug exposed by r344062
erj [Thu, 14 Feb 2019 18:02:37 +0000 (18:02 +0000)]
ixl: Fix panic caused by bug exposed by r344062

Don't use a struct if_irq for IFLIB_INTR_IOV type interrupts since that results
in get_core_offset() being called on them, and get_core_offset() doesn't
handle IFLIB_INTR_IOV type interrupts, which results in an assert() being triggered
in iflib_irq_set_affinity().

PR: 235730
Reported by: Jeffrey Pieper <jeffrey.e.pieper@intel.com>
MFC after: 1 day
Sponsored by: Intel Corporation

5 years agoFix small typo.
imp [Thu, 14 Feb 2019 17:04:04 +0000 (17:04 +0000)]
Fix small typo.

Differential Review: https://reviews.freebsd.org/D19193

5 years agoMake anon clustering more compatible.
kib [Thu, 14 Feb 2019 15:45:53 +0000 (15:45 +0000)]
Make anon clustering more compatible.

Make the clustering enabling knob more fine-grained by providing a
setting where the allocation with hint is not clustered. This is aimed
to be somewhat more compatible with e.g. go 1.4 which expects that
hinted mmap without MAP_FIXED does not change the allocation address.

Now the vm.cluster_anon can be set to 1 to only cluster when no hints,
and to 2 to always cluster.  Default value is 1.

Requested by: peter
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D19194

5 years ago[PPC64] Fix mismatch between thread flags and MSR
luporl [Thu, 14 Feb 2019 15:15:32 +0000 (15:15 +0000)]
[PPC64] Fix mismatch between thread flags and MSR

When sigreturn() restored a thread's context, SRR1 was being restored
to its previous value, but pcb_flags was not being touched.

This could cause a mismatch between the thread's MSR and its pcb_flags.
For instance, when the thread used the FPU for the first time inside
the signal handler, sigreturn() would clear SRR1, but not pcb_flags.
Then, the thread would return with the FPU bit cleared in MSR and,
the next time it tried to use the FPU, it would fail on a KASSERT
that checked if the FPU was disabled.

This change clears the FPU bit in both pcb_flags and frame->srr1,
as the code that restores the context expects to use the FPU trap
to re-enable it.

PR: 234539
Reported by: sbruno
Reviewed by: jhibbits, sbruno
Differential Revision: https://reviews.freebsd.org/D19166

5 years agoEnable enabling ASLR on non-x86 architectures.
kib [Thu, 14 Feb 2019 14:44:53 +0000 (14:44 +0000)]
Enable enabling ASLR on non-x86 architectures.

Discussed with: emaste
Sponsored by: The FreeBSD Foundation

5 years agoUnify i386 and amd64 getcontextx.c, and use ifuncs while there.
kib [Thu, 14 Feb 2019 14:02:33 +0000 (14:02 +0000)]
Unify i386 and amd64 getcontextx.c, and use ifuncs while there.

In particular, use ifuncs for __getcontextx_size(), also calculate the
size of the extended save area in resolver.  Same for __fillcontextx2().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agox86 __vdso_gettc(): use machine/cpufunc.h function for CPUID.
kib [Thu, 14 Feb 2019 13:59:00 +0000 (13:59 +0000)]
x86 __vdso_gettc(): use machine/cpufunc.h function for CPUID.

Based on the discussion with: jkim
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoProvide userspace versions of do_cpuid() and cpuid_count() on i386.
kib [Thu, 14 Feb 2019 13:53:11 +0000 (13:53 +0000)]
Provide userspace versions of do_cpuid() and cpuid_count() on i386.

Some older compilers, when generating PIC code, cannot handle inline
asm that clobbers %ebx (because %ebx is used as the GOT offset
register).  Userspace versions avoid clobbering %ebx by saving it to
stack before executing the CPUID instruction.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoAdd UPDATING entry for IEEE80211_AMPDU_AGE and AH_SUPPORT_AR5416 options
avos [Thu, 14 Feb 2019 09:21:19 +0000 (09:21 +0000)]
Add UPDATING entry for IEEE80211_AMPDU_AGE and AH_SUPPORT_AR5416 options
removal

Notified by: ian

5 years agoPull in r353907 from upstream llvm trunk (by Reid Kleckner):
dim [Wed, 13 Feb 2019 20:13:40 +0000 (20:13 +0000)]
Pull in r353907 from upstream llvm trunk (by Reid Kleckner):

  [MC] Make symbol version errors non-fatal

  We stil don't have a source location, which is pretty lame, but at
  least we won't tell the user to file a clang bug report anymore.

  Fixes PR40712

This will make errors for symbols with @@ versions that are not defined
non-fatal.  For example:

  void f(void)
  {
    __asm__(".symver foo,bar@@baz");
  }

will now result in:

  error: versioned symbol bar@@baz must be defined

instead of clang crashing with a diagnostic report.

PR: 234671
Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40712
MFC after: 3 days

5 years agosilence cast-align warnings from clang on powerpc64
luporl [Wed, 13 Feb 2019 18:28:53 +0000 (18:28 +0000)]
silence cast-align warnings from clang on powerpc64

silence the following warning when compiling libthr with clang 8
for powerpc64 architecture:

usr/src/lib/libthr/arch/powerpc/include/pthread_md.h:82:10: error:
cast from 'uint8_t *' (aka 'unsigned char *') to 'struct tcb *'
increases required alignment from 1 to 8 [-Werror,-Wcast-align]
82:  return ((struct tcb *)(_tp - TP_OFFSET));

Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: git_bdragon.rtk0.net, emaste, kib, jhibbits, luporl
Differential Revision: https://reviews.freebsd.org/D18807

5 years agoImplement per-CPU pmap activation tracking for RISC-V.
markj [Wed, 13 Feb 2019 17:50:01 +0000 (17:50 +0000)]
Implement per-CPU pmap activation tracking for RISC-V.

This reduces the overhead of TLB invalidations by ensuring that we
only interrupt CPUs which are using the given pmap.  Tracking is
performed in pmap_activate(), which gets called during context switches:
from cpu_throw(), if a thread is exiting or an AP is starting, or
cpu_switch() for a regular context switch.

For now, pmap_sync_icache() still must interrupt all CPUs.

Reviewed by: kib (earlier version), jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18874

5 years agoImplement pmap_clear_modify() for RISC-V.
markj [Wed, 13 Feb 2019 17:38:47 +0000 (17:38 +0000)]
Implement pmap_clear_modify() for RISC-V.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18875

5 years agoImplement transparent 2MB superpage promotion for RISC-V.
markj [Wed, 13 Feb 2019 17:19:37 +0000 (17:19 +0000)]
Implement transparent 2MB superpage promotion for RISC-V.

This includes support for pmap_enter(..., psind=1) as described in the
commit log message for r321378.

The changes are largely modelled after amd64.  arm64 has more stringent
requirements around superpage creation to avoid the possibility of TLB
conflict aborts, and these requirements do not apply to RISC-V, which
like amd64 permits simultaneous caching of 4KB and 2MB translations for
a given page.  RISC-V's PTE format includes only two software bits, and
as these are already consumed we do not have an analogue for amd64's
PG_PROMOTED.  Instead, pmap_remove_l2() always invalidates the entire
2MB address range.

pmap_ts_referenced() is modified to clear PTE_A, now that we support
both hardware- and software-managed reference and dirty bits.  Also
fix pmap_fault_fixup() so that it does not set PTE_A or PTE_D on kernel
mappings.

Reviewed by: kib (earlier version)
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18863
Differential Revision: https://reviews.freebsd.org/D18864
Differential Revision: https://reviews.freebsd.org/D18865
Differential Revision: https://reviews.freebsd.org/D18866
Differential Revision: https://reviews.freebsd.org/D18867
Differential Revision: https://reviews.freebsd.org/D18868

5 years agoIn r335015 PCB destroing was made deferred using epoch_call().
ae [Wed, 13 Feb 2019 15:46:05 +0000 (15:46 +0000)]
In r335015 PCB destroing was made deferred using epoch_call().

But ipsec_delete_pcbpolicy() uses some VNET-virtualized variables,
and thus it needs VNET context, that is missing during gtaskqueue
executing. Use inp_vnet context to set curvnet in in_pcbfree_deferred().

PR: 235684
MFC after: 1 week

5 years agoThis commit adds the missing release mechanism for the
rrs [Wed, 13 Feb 2019 14:57:59 +0000 (14:57 +0000)]
This commit adds the missing release mechanism for the
ratelimiting code. The two modules (lagg and vlan) did have
allocation routines, and even though they are indirect (and
vector down to the underlying interfaces) they both need to
have a free routine (that also vectors down to the actual interface).

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

5 years agoMFV r344088 (libarchive):
mm [Wed, 13 Feb 2019 07:37:33 +0000 (07:37 +0000)]
MFV r344088 (libarchive):
archive_read_disk_posix.c: initialize delayed_errno

MFC after: 2 weeks

5 years agoNote that readpassphrase() came into FreeBSD's libc at 4.6.
obrien [Wed, 13 Feb 2019 04:52:01 +0000 (04:52 +0000)]
Note that readpassphrase() came into FreeBSD's libc at 4.6.

5 years agolibbe(3): Fix be_destroy behavior w.r.t. deep BE snapshots and -o
kevans [Wed, 13 Feb 2019 04:19:08 +0000 (04:19 +0000)]
libbe(3): Fix be_destroy behavior w.r.t. deep BE snapshots and -o

be_destroy is documented to recursively destroy a boot environment.  In the
case of snapshots, one would take this to mean that these are also
recursively destroyed.  However, this was previously not the case.
be_destroy would descend into the be_destroy callback and attempt to
zfs_iter_children on the top-level snapshot, which is bogus.

Our alternative approach is to take note of the snapshot name and iterate
through all of fs children of the BE to try destruction in the children.

The -o option is also fixed to work properly with deep BEs.  If the BE was
created with `bectl create -e otherDeepBE newDeepBE`, for instance, then a
recursive snapshot of otherDeepBE would have been taken for construction of
newDeepBE but a subsequent destroy with BE_DESTROY_ORIGIN set would only
clean up the snapshot at the root of otherDeepBE: ${BEROOT}/otherDeepBE@...

The most recent iteration instead pretends not to know how these things
work, verifies that the origin is another BE and then passes that back
through be_destroy to DTRT when snapshots and deep BEs may be in play.

MFC after: 1 week

5 years agopowerpc/booke: Use the 'tlbilx' instruction on newer cores
jhibbits [Wed, 13 Feb 2019 03:11:12 +0000 (03:11 +0000)]
powerpc/booke: Use the 'tlbilx' instruction on newer cores

Newer cores have the 'tlbilx' instruction, which doesn't broadcast over
CoreNet.  This is significantly faster than walking the TLB to invalidate
the PID mappings.  tlbilx with the arguments given takes 131 clock cycles to
complete, as opposed to 512 iterations through the loop plus tlbre/tlbwe at
each iteration.

MFC after: 3 weeks

5 years agoFix panic message.
imp [Wed, 13 Feb 2019 00:10:12 +0000 (00:10 +0000)]
Fix panic message.

The panic message lead people to believe some userland CAM request had
caused a problem when in reallity it was for a kernel request (eg the
USER bit was cleared). Reword message. Also, improve a couple of
comments to reflect that the periph shouldn't be completely torn down
before we get here (so the path and sim pointers should be valid, but
aren't and the code is designed to be robust enough in the face of
that to give a specific panic message).

5 years agoWith r344062 in place, hwpmc_mod.c generally needs bus_if.h and
marius [Tue, 12 Feb 2019 23:39:18 +0000 (23:39 +0000)]
With r344062 in place, hwpmc_mod.c generally needs bus_if.h and
device_if.h.

5 years agoFix up concurrent test zpool setup and teardown
ngie [Tue, 12 Feb 2019 23:35:46 +0000 (23:35 +0000)]
Fix up concurrent test zpool setup and teardown

Set up zpools with a more unique name, stash the zpool name away in a file pointed
to by `$ZPOOL_NAME_FILE` (which is relative to a per-testcase generated temporary
directory), then remove the file based on `$ZPOOL_NAME_FILE` in the cleanup
routines.

This is a more concurrency-safe solution and will allow the testcases to be safely
executed in parallel.

Reviewed by: kevans, jtl
Approved by: jtl (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19024

5 years agoAdd rc.resume(8) alias for rc(8) to fix the manpage cross references
ngie [Tue, 12 Feb 2019 23:33:16 +0000 (23:33 +0000)]
Add rc.resume(8) alias for rc(8) to fix the manpage cross references

This issue was noticed when running `make manlint` as part of MFCing r342597 to
^/stable/11:
```
$ make -C share/man/man8 rc.8lint
mandoc -Tascii -Tlint rc.8
mandoc: rc.8:548:6: STYLE: referenced manual not found: Xr rc.resume 8
$
```

This is a followup commit to r339818.

Reviewed by: eugen
Approved by: jtl (mentor)
MFC after: 1 week
MFC to: ^/stable/12
Differential Revision: https://reviews.freebsd.org/D19158

5 years agoMFV r344063:
mm [Tue, 12 Feb 2019 23:24:45 +0000 (23:24 +0000)]
MFV r344063:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

PR: 233006 [3]
Security: CVE-2019-1000019 [1], CVE-2019-1000020 [2]
MFC after: 2 weeks

5 years agoFix the build with ALTQ after r344060.
marius [Tue, 12 Feb 2019 22:33:17 +0000 (22:33 +0000)]
Fix the build with ALTQ after r344060.

5 years agoUpdate vendor/libarchive/dist to git 31c0a517c91f44eeee717a04db8b075cadda83d8
mm [Tue, 12 Feb 2019 22:29:41 +0000 (22:29 +0000)]
Update vendor/libarchive/dist to git 31c0a517c91f44eeee717a04db8b075cadda83d8

Relevant vendor changes:
  PR #1085: Fix a null pointer dereference bug in zip writer
  PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
            decopmpression
  PR #1116: Add support for 64-bit ar format
  PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
  PR #1125: RAR5 reader - fix an invalid read and a memory leak
  PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
            due to ENOENT [3]
  PR #1134: Delete unnecessary null pointer checks before calls of free()
  OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
  OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader

PR: 233006 [3]
Security: CVE-2019-1000019 [1], CVE-2019-1000020 [2]

5 years agoMake taskqgroup_attach{,_cpu}(9) work across architectures
marius [Tue, 12 Feb 2019 21:23:59 +0000 (21:23 +0000)]
Make taskqgroup_attach{,_cpu}(9) work across architectures

So far, intr_{g,s}etaffinity(9) take a single int for identifying
a device interrupt. This approach doesn't work on all architectures
supported, as a single int isn't sufficient to globally specify a
device interrupt. In particular, with multiple interrupt controllers
in one system as found on e. g. arm and arm64 machines, an interrupt
number as returned by rman_get_start(9) may be only unique relative
to the bus and, thus, interrupt controller, a certain device hangs
off from.
In turn, this makes taskqgroup_attach{,_cpu}(9) and - internal to
the gtaskqueue implementation - taskqgroup_attach_deferred{,_cpu}()
not work across architectures. Yet in turn, iflib(4) as gtaskqueue
consumer so far doesn't fit architectures where interrupt numbers
aren't globally unique.
However, at least for intr_setaffinity(..., CPU_WHICH_IRQ, ...) as
employed by the gtaskqueue implementation to bind an interrupt to a
particular CPU, using bus_bind_intr(9) instead is equivalent from
a functional point of view, with bus_bind_intr(9) taking the device
and interrupt resource arguments required for uniquely specifying a
device interrupt.
Thus, change the gtaskqueue implementation to employ bus_bind_intr(9)
instead and intr_{g,s}etaffinity(9) to take the device and interrupt
resource arguments required respectively. This change also moves
struct grouptask from <sys/_task.h> to <sys/gtaskqueue.h> and wraps
struct gtask along with the gtask_fn_t typedef into #ifdef _KERNEL
as userland likes to include <sys/_task.h> or indirectly drags it
in - for better or worse also with _KERNEL defined -, which with
device_t and struct resource dependencies otherwise is no longer
as easily possible now.
The userland inclusion problem probably can be improved a bit by
introducing a _WANT_TASK (as well as a _WANT_MOUNT) akin to the
existing _WANT_PRISON etc., which is orthogonal to this change,
though, and likely needs an exp-run.

While at it:
- Change the gt_cpu member in the grouptask structure to be of type
  int as used elswhere for specifying CPUs (an int16_t may be too
  narrow sooner or later),
- move the gtaskqueue_enqueue_fn typedef from <sys/gtaskqueue.h> to
  the gtaskqueue implementation as it's only used and needed there,
- change the GTASK_INIT macro to use "gtask" rather than "task" as
  argument given that it actually operates on a struct gtask rather
  than a struct task, and
- let subr_gtaskqueue.c consistently use __func__ to print functions
  names.

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

5 years agogarp: Fix vnet related panic for gratuitous arp
kp [Tue, 12 Feb 2019 21:22:57 +0000 (21:22 +0000)]
garp: Fix vnet related panic for gratuitous arp

Gratuitous ARP packets are sent from a timer, which means we don't have a vnet
context set. As a result we panic trying to send the packet.

Set the vnet context based on the interface associated with the interface
address.

To reproduce:
  sysctl net.link.ether.inet.garp_rexmit_count=2
  ifconfig vtnet1 10.0.0.1/24 up

PR: 235699
Reviewed by: vangyzen@
MFC after: 1 week

5 years agoFurther correct and optimize the bus_dma(9) usage of iflib(4):
marius [Tue, 12 Feb 2019 21:08:44 +0000 (21:08 +0000)]
Further correct and optimize the bus_dma(9) usage of iflib(4):
o Correct the obvious bugs in the netmap(4) parts:
  - No longer check for the existence of DMA maps as bus_dma(9)
    is used unconditionally in iflib(4) since r341095.
  - Supply the correct DMA tag and map pairs to bus_dma(9)
    functions (see also the commit message of r343753).
  - In iflib_netmap_timer_adjust(), add synchronization of the
    TX descriptors before calling the ift_txd_credits_update
    method as the latter evaluates the TX descriptors possibly
    updated by the MAC.
  - In _task_fn_tx(), wrap the netmap(4)-specific bits in
    #ifdef DEV_NETMAP just as done in _task_fn_admin() and
    _task_fn_rx() respectively.
o In iflib_fast_intr_rxtx(), synchronize the TX rather than
  the RX descriptors before calling the ift_txd_credits_update
  method (see also above).
o There's no need to synchronize an RX buffer that is going to
  be recycled in iflib_rxd_pkt_get(), yet; it's sufficient to
  do that as late as passing RX buffers to the MAC via the
  ift_rxd_refill method. Hence, combine that synchronization
  with the synchronization of new buffers into a common spot
  in _iflib_fl_refill().
o There's no need to synchronize the RX descriptors of a free
  list in preparation of the MAC updating their statuses with
  every invocation of rxd_frag_to_sd(); it's enough to do this
  once before handing control over to the MAC, i. e. before
  calling ift_rxd_flush method in _iflib_fl_refill(), which
  already performs the necessary synchronization.
o Given that the ift_rxd_available method evaluates the RX
  descriptors which possibly have been altered by the MAC,
  synchronize as appropriate beforehand. Most notably this
  is now done in iflib_rxd_avail(), which in turn means that
  we don't need to issue the same synchronization yet again
  before calling the ift_rxd_pkt_get method in iflib_rxeof().
o In iflib_txd_db_check(), synchronize the TX descriptors
  before handing them over to the MAC for transmission via
  the ift_txd_flush method.
o In iflib_encap(), move the TX buffer synchronization after
  the invocation of the ift_txd_encap() method. If the MAC
  driver fails to encapsulate the packet and we retry with
  a defragmented mbuf chain or finally fail, the cycles for
  TX buffer synchronization have been wasted. Synchronizing
  afterwards matches what non-iflib(4) drivers typically do
  and is sufficient as the MAC will not actually start with
  the transmission before - in this case - the ift_txd_flush
  method is called.
  Moreover, for the latter reason the synchronization of the
  TX descriptors in iflib_encap() can go as it's enough to
  synchronize them before passing control over to the MAC by
  issuing the ift_txd_flush() method (see above).
o In iflib_txq_can_drain(), only synchronize TX descriptors
  if the ift_txd_credits_update method accessing these is
  actually called.

Differential Revision: https://reviews.freebsd.org/D19081

5 years agoPoint people to SMP(4) for CPU<->domain mapping.
phk [Tue, 12 Feb 2019 21:06:07 +0000 (21:06 +0000)]
Point people to SMP(4) for CPU<->domain mapping.

5 years agoRevert r343077 until the license issues surrounding it can be resolved.
imp [Tue, 12 Feb 2019 19:05:09 +0000 (19:05 +0000)]
Revert r343077 until the license issues surrounding it can be resolved.

Approved by: core@

5 years agoPull in r339734 from upstream llvm trunk (by Eli Friedman):
dim [Tue, 12 Feb 2019 18:32:14 +0000 (18:32 +0000)]
Pull in r339734 from upstream llvm trunk (by Eli Friedman):

  [ARM] Make PerformSHLSimplify add nodes to the DAG worklist correctly.

  Intentionally excluding nodes from the DAGCombine worklist is likely
  to lead to weird optimizations and infinite loops, so it's generally
  a bad idea.

  To avoid the infinite loops, fix DAGCombine to use the
  isDesirableToCommuteWithShift target hook before performing the
  transforms in question, and implement the target hook in the ARM
  backend disable the transforms in question.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=38530 . (I don't have a
  reduced testcase for that bug. But we should have sufficient test
  coverage for PerformSHLSimplify given that we're not playing weird
  tricks with the worklist. I can try to bugpoint it if necessary,
  though.)

  Differential Revision: https://reviews.llvm.org/D50667

This should fix a possible hang when compiling sys/dev/nxge/if_nxge.c
(which exists now only in the stable/11 branch) for arm.

5 years agoFix markup - use .Pa for the directory component, not .Fa.
trasz [Tue, 12 Feb 2019 13:01:55 +0000 (13:01 +0000)]
Fix markup - use .Pa for the directory component, not .Fa.

Reported by: 0mp
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years ago[ppc64] prevent infinite loop on icache sync
luporl [Tue, 12 Feb 2019 11:29:03 +0000 (11:29 +0000)]
[ppc64] prevent infinite loop on icache sync

At moea64_sync_icache(), when the 'va' argument has page size
alignment, round_page() will return the same value as 'va'.
This would cause 'len' to be 0 and thus an infinite loop.

With this change, 'lim' will always point to the next page boundary.

This issue occurred especially during debugging sessions, when a breakpoint
was placed on an exact page-aligned offset, for instance.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D19149

5 years agoImprove input validation for raw IPv4 socket using the IP_HDRINCL
tuexen [Tue, 12 Feb 2019 10:17:21 +0000 (10:17 +0000)]
Improve input validation for raw IPv4 socket using the IP_HDRINCL
option.

This issue was found by running syzkaller on OpenBSD.
Greg Steuck made me aware that the problem might also exist on FreeBSD.

Reported by: Greg Steuck
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18834

5 years agoRemove empty files
lwhsu [Tue, 12 Feb 2019 08:16:05 +0000 (08:16 +0000)]
Remove empty files

Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation

5 years agotermcap: Add an entry for kitty
bwidawsk [Tue, 12 Feb 2019 05:15:36 +0000 (05:15 +0000)]
termcap: Add an entry for kitty

The project is here:
https://github.com/kovidgoyal/kitty/

I created a port (which now needs updating):
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233010

If only we could use terminfo :(

MFC after:      5 days
Approved by:    bapt
Differential Revision: https://reviews.freebsd.org/D19060

5 years agoUMA: unsign some variables related to allocation in hash_alloc().
pfg [Tue, 12 Feb 2019 04:33:05 +0000 (04:33 +0000)]
UMA: unsign some variables related to allocation in hash_alloc().

As a followup to r343673, unsign some variables related to allocation
since the hashsize cannot be negative. This gives a bit more space to
handle bigger allocations and avoid some implicit casting.

While here also unsign uh_hashmask, it makes little sense to keep that
signed.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19148

5 years agoBump `__FreeBSD_version__` for r343891
ngie [Tue, 12 Feb 2019 03:32:40 +0000 (03:32 +0000)]
Bump `__FreeBSD_version__` for r343891

This will allow upstream consumers, e.g., capsicum-test and third-party
packages (via ports(7)), to test for a specific `__FreeBSD_version__` and
expect `renameat(2)` to be functional.

PR: 222258
Approved by: emaste (mentor)
Reviewed by: emaste
MFC with: r343891
Differential Revision: https://reviews.freebsd.org/D19154

5 years agoRemove entry for Intenso product.
kevlo [Tue, 12 Feb 2019 02:55:25 +0000 (02:55 +0000)]
Remove entry for Intenso product.

5 years agoRemove duplicate vendor id in r334650. Intenso doesn't have a USB VID.
kevlo [Tue, 12 Feb 2019 02:48:16 +0000 (02:48 +0000)]
Remove duplicate vendor id in r334650.  Intenso doesn't have a USB VID.

5 years agolibbe(3): Belatedly note the BE_DESTROY_ORIGIN option added in r343977
kevans [Tue, 12 Feb 2019 02:16:21 +0000 (02:16 +0000)]
libbe(3): Belatedly note the BE_DESTROY_ORIGIN option added in r343977

X-MFC-With: r343977

5 years agoFix the fix added in r343287 for spurious HFSC bandwidth check errors
pkelsey [Mon, 11 Feb 2019 22:58:43 +0000 (22:58 +0000)]
Fix the fix added in r343287 for spurious HFSC bandwidth check errors

The logic added in r343287 to avoid false-positive
sum-of-child-bandwidth check errors for HFSC queues has a bug in it
that causes the upperlimit service curve of an HFSC queue to be pulled
down to its parent's linkshare service curve if it happens to be above
it.

Upon further inspection/reflection, this generic
sum-of-child-bandwidths check does not need to be fixed for HFSC - it
needs to be skipped.  For HFSC, the equivalent check is to ensure the
sum of child linkshare service curves are at or below the parent's
linkshare service curve, and this check is already being performed by
eval_pfqueue_hfsc().

This commit reverts the affected parts of r343287 and adds new logic
to skip the generic sum-of-child-bandwidths check for HFSC.

MFC after: 1 day
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D19124

5 years agoCID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c
dab [Mon, 11 Feb 2019 22:09:26 +0000 (22:09 +0000)]
CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c

In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that
fall to the bottom of the case set `lp` to `NULL`, so the test for a
non-NULL value of `lp` and call to `free()` if true is dead code as
the test can never be true. Fix by eliminating the whole if
statement. To guard against a possible future change that accidentally
violates this assumption, use a `KASSERT()` to catch if `lp` is
non-NULL.

Reviewed by: cem
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19109

5 years agomdmfs: Fix many bugs in automatic md(4) creation.
brooks [Mon, 11 Feb 2019 21:31:26 +0000 (21:31 +0000)]
mdmfs: Fix many bugs in automatic md(4) creation.

This code allocated a correctly sized buffer, read past the end of the
source buffer, writing off the end of the target buffer, and then writing
a '\0' terminator past the end of the target buffer (in the wrong place).
It then leaked the buffer.

Switch to a statically sized buffer on the stack and update the source
pointer and
length before use so the correct things are copied.

Fix a logic error in the checks that the format of the line is as
expected and move on out of an assert.

Remove an unneeded close(). fclose() closes the descriptor.

Found with: CheriABI
Obtained from: CheriBSD
Reviewed by: kib, jhb, markj
Differential Revision: https://reviews.freebsd.org/D19122

5 years agoEnable PCI BAR reallocation by default.
jhb [Mon, 11 Feb 2019 20:47:09 +0000 (20:47 +0000)]
Enable PCI BAR reallocation by default.

When pci_realloc_bars was first added, the intention was to eventually
enable it by default, but it was left disabled to preserve existing
behavior.  The setting is pretty conservative in that it does not
attempt to allocate resources for BARs that the BIOS/firmware leaves
disabled.  It only attempts to reallocate resources for a BAR that the
firmware programmed during boot but that conflicts with another
resource during the kernel's device scan.

PR 221350 is an example of a machine that this knob fixes.

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

5 years agoAdd explanation of branches to the ports(7) man page.
trasz [Mon, 11 Feb 2019 20:46:32 +0000 (20:46 +0000)]
Add explanation of branches to the ports(7) man page.

Reviewed by: matthew@, freebsd@mhka.no
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19146

5 years agoRemove `set' field from state structure and use set from parent rule.
ae [Mon, 11 Feb 2019 18:10:55 +0000 (18:10 +0000)]
Remove `set' field from state structure and use set from parent rule.

Initially it was introduced because parent rule pointer could be freed,
and rule's information could become inaccessible. In r341471 this was
changed. And now we don't need this information, and also it can become
stale. E.g. rule can be moved from one set to another. This can lead
to parent's set and state's set will not match. In this case it is
possible that static rule will be freed, but dynamic state will not.
This can happen when `ipfw delete set N` command is used to delete
rules, that were moved to another set.
To fix the problem we will use the set number from parent rule.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

5 years agoBump .Dd for today's edit.
cracauer [Mon, 11 Feb 2019 16:31:15 +0000 (16:31 +0000)]
Bump .Dd for today's edit.

Thank you Enji Cooper

5 years agoClarify NFSv4 /etc/exports semantics, with working example.
cracauer [Mon, 11 Feb 2019 15:51:28 +0000 (15:51 +0000)]
Clarify NFSv4 /etc/exports semantics, with working example.
The existing wording has been confusing users for years.

5 years agoFix flags used when compiling kern_kcov.c and subr_coverage.c.
tuexen [Mon, 11 Feb 2019 15:38:05 +0000 (15:38 +0000)]
Fix flags used when compiling kern_kcov.c and subr_coverage.c.

Without this fix, the usage of kernel coverage would lockup the system.
Thanks to Andrew for suggesting the final form of the fix.

PR: 235611
Reviewed by: andrew@, emaste@
Differential Revision: https://reviews.freebsd.org/D19135

5 years agoAdd sensors support for AXP803/AXP813. Sensor values such as
ganbold [Mon, 11 Feb 2019 14:31:19 +0000 (14:31 +0000)]
Add sensors support for AXP803/AXP813. Sensor values such as
battery charging, charge state, voltage, charging current, discharging current,
battery capacity etc. can be obtained via sysctl.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D19145

5 years agoFix off-by-one error in BERI virtio driver
gonzo [Mon, 11 Feb 2019 07:42:32 +0000 (07:42 +0000)]
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

5 years agoPlace pf_altq_get_nth_active() under the ALTQ ifdef
pkelsey [Mon, 11 Feb 2019 05:39:38 +0000 (05:39 +0000)]
Place pf_altq_get_nth_active() under the ALTQ ifdef

MFC after: 1 week

5 years agoReduce the time it takes the kernel to install a new PF config containing a large...
pkelsey [Mon, 11 Feb 2019 05:17:31 +0000 (05:17 +0000)]
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

5 years agobectl(8): commit missing test modifications from r343993
kevans [Mon, 11 Feb 2019 04:00:42 +0000 (04:00 +0000)]
bectl(8): commit missing test modifications from r343993

X-MFC-With: r343993

5 years agobectl(8): Add -o flag to destroy to clean up the origin snapshot of BE
kevans [Mon, 11 Feb 2019 04:00:01 +0000 (04:00 +0000)]
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

5 years agogbde(8) - simplify randomisation with arc4random_buf
cem [Mon, 11 Feb 2019 00:11:02 +0000 (00:11 +0000)]
gbde(8) - simplify randomisation with arc4random_buf

Submitted by: David CARLIER <devnexen AT gmail.com>
Differential Revision: https://reviews.freebsd.org/D18678

5 years agonet80211(4): hide casts for 'i_seq' field offset calculation inside
avos [Sun, 10 Feb 2019 23:58:56 +0000 (23:58 +0000)]
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

5 years agolibnv: fix memory leaks
oshogbo [Sun, 10 Feb 2019 23:30:54 +0000 (23:30 +0000)]
libnv: fix memory leaks

Free the data array for NV_TYPE_DESCRIPTOR_ARRAY case.

MFC after: 2 weeks

5 years agolibnv: fix memory leaks
oshogbo [Sun, 10 Feb 2019 23:28:55 +0000 (23:28 +0000)]
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 <rmind@netbsd.org>
Reported by: clang/gcc ASAN
MFC after: 2 weeks