]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMake uboot_devdesc properly alias disk_devdesc, so that parsing the u-boot
ian [Mon, 18 Feb 2019 04:44:52 +0000 (04:44 +0000)]
Make uboot_devdesc properly alias disk_devdesc, so that parsing the u-boot
loaderdev variable works correctly.

The uboot_devdesc struct is variously cast back and forth between
uboot_devdesc and disk_devdesc as pointers are handed off through various
opaque interfaces.  uboot_devdesc attempted to mimic the layout of
disk_devdesc by having a devdesc struct, followed by a union of some
device-specific stuff that included a struct that contains the same fields
as a disk_devdesc.  However, one of those fields inside the struct is 64-bit
which causes the entire union to be 64-bit aligned -- 32 bits of padding
is added between the struct devdesc and the union, so the whole mess ends
up NOT properly mimicking a disk_devdesc after all.  (In disk_devdesc there
is also 32 bits of padding, but it shows up immediately before the d_offset
field, rather than before the whole collection of d_* fields.)

This fixes the problem by using an anonymous union to overlay the devdesc
field uboot network devices need with the disk_devdesc that uboot storage
devices need.  This is a different solution than the one contributed with
the PR (so if anything goes wrong, the blame goes to me), but 95% of the
credit for this fix goes to Pawel Worach and Manuel Stuhn who analyzed the
problem and proposed a fix.

PR: 233097

5 years agokdump: expand comment on reasons for CAPFAIL_LOOKUP
emaste [Mon, 18 Feb 2019 03:49:16 +0000 (03:49 +0000)]
kdump: expand comment on reasons for CAPFAIL_LOOKUP

Comment for CAPFAIL_LOOKUP refered only to paths containing ".." but
it is returned for other restricted VFS lookup cases, such as absolute
paths or openat(AT_FDCWD, ...).

5 years agosnmp_hostres(3): fix a typo in sanity checks in handle_chunk()
avos [Mon, 18 Feb 2019 03:23:10 +0000 (03:23 +0000)]
snmp_hostres(3): fix a typo in sanity checks in handle_chunk()

PR: 204253
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 5 days

5 years agoFix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c
avos [Mon, 18 Feb 2019 03:15:25 +0000 (03:15 +0000)]
Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c

Re-apply r343909 to this file to get the issue fixed.

PR: 204956
Reported by: David Binderman <dcb314@hotmail.com>
MFC after: 5 days

5 years agolualoader: only clear the screen before first password prompt
kevans [Mon, 18 Feb 2019 02:59:47 +0000 (02:59 +0000)]
lualoader: only clear the screen before first password prompt

This was previously an unconditional screen clear, regardless of whether or
not we would be prompting for any passwords. This is pointless, given that
the screen clear is only there to put our screen into a consistent state
before we draw the prompts and do cursor manipulation.

This is also the only screen clear besides that to draw the menu.  One can
now see early pre-loader and loader output with the menu disabled, which may
be useful for diagnostics.

Reported by: ian
MFC after: 3 days

5 years agopowerpc/boot: Move ubldr to /boot/uboot, and make this a separate filesystem
jhibbits [Mon, 18 Feb 2019 01:57:47 +0000 (01:57 +0000)]
powerpc/boot: Move ubldr to /boot/uboot, and make this a separate filesystem

Summary:
Now that mpc85xx can boot via ubldr, move ubldr to a separate
filesystem, mounted on /boot/uboot, so that a fresh install can boot correctly.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D18709

5 years agoGarbage collection no-longer-used constant.
ian [Sun, 17 Feb 2019 23:48:51 +0000 (23:48 +0000)]
Garbage collection no-longer-used constant.

5 years agoMake lsdev -v output line up in neat columns by using a fixed width for
ian [Sun, 17 Feb 2019 23:46:11 +0000 (23:46 +0000)]
Make lsdev -v output line up in neat columns by using a fixed width for
the size field and a tab between the partition type and the size.

Changes this

  disk devices:
        disk0 (MMC)
        disk0s1: DOS/Windows            49MB
        disk0s2: FreeBSD                14GB
        disk0s2a: FreeBSD UFS         14GB
        disk0s2b: Unknown             2048KB
        disk0s2d: FreeBSD UFS         2040KB

to this

  disk devices:
        disk0 (MMC)
        disk0s1: DOS/Windows      49MB
        disk0s2: FreeBSD          14GB
        disk0s2a: FreeBSD UFS     14GB
        disk0s2b: Unknown       2048KB
        disk0s2d: FreeBSD UFS   2040KB

5 years agoUse a couple local variables to avoid repetitive long expressions that
ian [Sun, 17 Feb 2019 23:38:17 +0000 (23:38 +0000)]
Use a couple local variables to avoid repetitive long expressions that
cause line-wrapping.

5 years agoRestore loader(8)'s ability for lsdev to show partitions within a bsd slice.
ian [Sun, 17 Feb 2019 23:32:09 +0000 (23:32 +0000)]
Restore loader(8)'s ability for lsdev to show partitions within a bsd slice.

I'm pretty sure this used to work at one time, perhaps long ago.  It has
been failing recently because if you call disk_open() with dev->d_partition
set to -1 when d_slice refers to a bsd slice, it assumes you want it to
open the first partition within that slice.  When you then pass that open
dev instance to ptable_open(), it tries to read the start of the 'a'
partition and decides there is no recognizable partition type there.

This restores the old functionality by resetting d_offset to the start
of the raw slice after disk_open() returns.  For good measure, d_partition
is also set back to -1, although that doesn't currently affect anything.

I would have preferred to make disk_open() avoid such rude assumptions and
if you ask for partition -1 you get the raw slice.  But the commit history
shows that someone already did that once (r239058), and had to revert it
(r239232), so I didn't even try to go down that road.

5 years agolibnv: fix revert
oshogbo [Sun, 17 Feb 2019 18:32:19 +0000 (18:32 +0000)]
libnv: fix revert

Reported by: jenkins

5 years agolibnv: fix double free
oshogbo [Sun, 17 Feb 2019 18:26:27 +0000 (18:26 +0000)]
libnv: fix double free

In r343986 we introduced a double free. The structure was already
freed fixed in the r302966. This problem was introduced
because the GitHub version was out of sync with the FreeBSD one.

Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org>
MFC with: r343986

5 years agoIt turns out r344226 narrowed the overrun bug but did not eliminate it entirely
pkelsey [Sun, 17 Feb 2019 17:47:08 +0000 (17:47 +0000)]
It turns out r344226 narrowed the overrun bug but did not eliminate it entirely

This commit fixes a remaining output buffer overrun in the
single-sector case when there is a non-zero tail.

Reviewed by: allanjude, tsoome
MFC after: 3 months
MFC with: r344226
Differential Revision: https://reviews.freebsd.org/D19220

5 years agoRemove a write-only variable orphaned by r340677.
markj [Sun, 17 Feb 2019 16:56:41 +0000 (16:56 +0000)]
Remove a write-only variable orphaned by r340677.

5 years agoFix refcount leaks in the SGX Linux compat ioctl handler.
markj [Sun, 17 Feb 2019 16:43:44 +0000 (16:43 +0000)]
Fix refcount leaks in the SGX Linux compat ioctl handler.

Some argument validation error paths would return without releasing the
file reference obtained at the beginning of the function.

While here, fix some style bugs and remove trivial debug prints.

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

5 years agoRemove a redundant flag variable.
markj [Sun, 17 Feb 2019 16:35:19 +0000 (16:35 +0000)]
Remove a redundant flag variable.

Use the object pointer itself to determine whether the object is locked.
No functional change intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19215

5 years agoRemove whole-disk vdev support from zfsboot
pkelsey [Sun, 17 Feb 2019 03:52:44 +0000 (03:52 +0000)]
Remove whole-disk vdev support from zfsboot

This is consistent with the removal of whole-disk vdev support from
libsa/zfs/zfs.c in r342151, and is part way to having the LBAs read
during probe be fully constrained by partition tables when present.

Reviewed by: tsoome
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D19142

5 years agoFix memory corruption bug introduced in r325310
pkelsey [Sun, 17 Feb 2019 03:35:15 +0000 (03:35 +0000)]
Fix memory corruption bug introduced in r325310

The bug occurred when a bounce buffer was used and the requested read
size was greater than the size of the bounce buffer.  This commit also
rewrites the read logic so that it is easier to systematically verify
all alignment and size cases.

Reviewed by: allanjude, tsoome
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D19140

5 years agoAdd sysctl for setting battery charging current.
ganbold [Sun, 17 Feb 2019 01:16:27 +0000 (01:16 +0000)]
Add sysctl for setting battery charging current.
The charging current can be set using steps
from 0: 200mA to 13: 2800mA (200mA/step).
While there, fix battery charging current related
sensor descriptions.

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

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