]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r350248:
Michael Tuexen [Sat, 7 Sep 2019 11:22:24 +0000 (11:22 +0000)]
MFC r350248:

Fix a LOR in SCTP which was found by running syzkaller.

Submitted by: rrs@
Reported by: markj@

4 years agoMFC r350216:
Michael Tuexen [Sat, 7 Sep 2019 11:19:55 +0000 (11:19 +0000)]
MFC r350216:

Wakeup the application when doing PD-API for unordered DATA chunks.
Work done with rrs@.

4 years agoMFC 350028:
Michael Tuexen [Sat, 7 Sep 2019 10:57:47 +0000 (10:57 +0000)]
MFC 350028:

dd support for ICMPv6 messages indicating a parameter problem related
to an unrecognized next header.

4 years agoMFC 350027:
Michael Tuexen [Sat, 7 Sep 2019 10:56:38 +0000 (10:56 +0000)]
MFC 350027:

Let packet_op() explicitly return the type and code instead of doing
this implicitly by encoding it in a number space.

No functional change intended.

This is done as a preparation to add support for ICMPv6 mesages
indicating a parameter problem related to the next header.

4 years agoMFC r350026:
Michael Tuexen [Sat, 7 Sep 2019 10:55:12 +0000 (10:55 +0000)]
MFC r350026:

Whitespace change. No functional change.

4 years agoMFC r349999:
Michael Tuexen [Sat, 7 Sep 2019 10:53:29 +0000 (10:53 +0000)]
MFC r349999:

Add support for MSG_EOR and MSG_EOF in sendmsg() for SCTP.

This is an FreeBSD extension, not covered by Posix.

This issue was found by running syzkaller.

4 years agoMFC r349998:
Michael Tuexen [Sat, 7 Sep 2019 10:51:33 +0000 (10:51 +0000)]
MFC r349998:

Fix socket state handling when freeing an SCTP endpoint.

This issue was found by runing syzkaller.

4 years agoMFC r349989:
Michael Tuexen [Sat, 7 Sep 2019 10:49:37 +0000 (10:49 +0000)]
MFC r349989:

Improve the input validation for l_linger.
When using the SOL_SOCKET level socket option SO_LINGER, the structure
struct linger is used as the option value. The component l_linger is of
type int, but internally copied to the field so_linger of the structure
struct socket. The type of so_linger is short, but it is assumed to be
non-negative and the value is used to compute ticks to be stored in a
variable of type int.

Therefore, perform input validation on l_linger similar to the one
performed by NetBSD and OpenBSD.

Thanks to syzkaller for making me aware of this issue.

Thanks to markj@ for pointing out that a similar check should be added
to so_linger_set().

Reviewed by: markj@
Differential Revision: https://reviews.freebsd.org/D20948

4 years agoMFC r349986:
Michael Tuexen [Sat, 7 Sep 2019 10:47:43 +0000 (10:47 +0000)]
MFC r349986:

When calling sctp_initialize_auth_params(), the inp must have at
least a read lock. To avoid more complex locking dances, just
call it in sctp_aloc_assoc() when the write lock is still held.

4 years agoMFC r349968:
Michael Tuexen [Sat, 7 Sep 2019 10:45:44 +0000 (10:45 +0000)]
MFC r349968:

r348494 fixes a race in udp_output(). The same race exists in
udp_output6(), therefore apply a similar patch to IPv6.

Reviewed by: bz@, markj@
Differential Revision: https://reviews.freebsd.org/D20936

4 years agoMFC r349228:
Michael Tuexen [Sat, 7 Sep 2019 10:39:49 +0000 (10:39 +0000)]
MFC r349228:

The variable names in the description of the port number usage is
inconsistent. This patch fixes that and improves the precision of
the description.
Thanks to Tom Marcoen for reporting the issue and providing an
initial patch, on which this change is based.

PR: 237723
Reviewed by: bcr@
Differential Revision: https://reviews.freebsd.org/D20708

4 years agoMFC r351379 r351385 r351592:
Mike Karels [Fri, 6 Sep 2019 21:53:04 +0000 (21:53 +0000)]
MFC r351379 r351385 r351592:

Change w(1) to compute FROM (host) field size dynamically

It's nice to be able to display a full IPv6 host address if
needed, but it's also nice to display more than 3 characters of a command
line. Compute the needed size for the FROM column in an earlier pass,
and determine the maximum, then print what fits for the command.

Fix address annotation in xml output from w

The libxo xml feature of adding an annotation with the "original"
address from the utmpx file if it is different than the final "from"
field was broken by r351379. This was pointed out by the gcc error
that save_p might be used uninitialized. Save the original address
as needed in each entry, don't just use the last one from the previous
loop.

Reviewed by:    marcel@
Differential Revision:  https://reviews.freebsd.org/D21211
Differential Revision:  https://reviews.freebsd.org/D21390

4 years agoMFC r350858-r350859, r350987, r351170
Alan Somers [Fri, 6 Sep 2019 20:16:08 +0000 (20:16 +0000)]
MFC r350858-r350859, r350987, r351170

r350858:
ping6: Add missing static keyword for a global variable

This fixes -Wmissing-variable-declarations error when compiled with
WARNS=6.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21214

r350859:
ping6: Remove unnecessary level of indirection from dnsdecode() parameter

The `sp' pointer doesn't need to be modified in the caller of
dnsdecode().

This fixes -Wcast-qual error (`must have all intermediate pointers
const qualified to be safe') when compiled with WARNS=6.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21215

r350987:
ping6: Fix data type of a variable for a packet sequence number

Submitted by:   Ján Sučan <sucanjan@gmail.com>
Sponsored by:   Google, inc. (Google Summer of Code 2019)
Differential Revision:  https://reviews.freebsd.org/D21218

r351170:
ping6: Fix dnsdecode() bug introduced by r350859

Revision 350859 removed level of indirection that was needed for setting the
caller's `cp' pointer. dnsdecode() uses return value to indicate error or
success. It returns pointer to a buffer holding a decompressed DNS name or
NULL. The caller uses that value only to find out the result, not for accessing
the buffer.

We use the return value to propagate the new value of `cp' pointer to
the caller instead of using an output argument.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC-With: 350859
Sponsored by: Google, Inc (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21266

4 years agoMFC r350556:
Alan Somers [Fri, 6 Sep 2019 19:46:27 +0000 (19:46 +0000)]
MFC r350556:

Capsicumize ping6

Add capsicum support to ping6, mostly copying the strategy used for ping.

Submitted by: Ján Sučan <jansucan@gmail.com>
Reviewed by: markj
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21050

4 years agoMFC r350453:
Alan Somers [Fri, 6 Sep 2019 19:36:41 +0000 (19:36 +0000)]
MFC r350453:

Add a CXXWARNFLAGS variable

Some warning flags are valid for C++ but not C. GCC 8 complains if you pass
such flags when building a C file. Using a separate variable for these
flags allows building both C and C++ files in the same directory (such as
the fusefs tests) under GCC.

Reviewed by: cem, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21116

4 years agoMFC r350426:
Alan Somers [Fri, 6 Sep 2019 19:29:02 +0000 (19:29 +0000)]
MFC r350426:

sendfile: don't panic when VOP_GETPAGES_ASYNC returns an error

This is a partial merge of 350144 from projects/fuse2

PR: 236466
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21095

4 years agoMFC r350386, r350390
Alan Somers [Fri, 6 Sep 2019 19:22:33 +0000 (19:22 +0000)]
MFC r350386, r350390

r350386:
Add v_inval_buf_range, like vtruncbuf but for a range of a file

v_inval_buf_range invalidates all buffers within a certain LBA range of a
file. It will be used by fusefs(5). This commit is a partial merge of
r346162, r346606, and r346756 from projects/fuse2.

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

r350390:
Better comments for vlrureclaim

Sponsored by: The FreeBSD Foundation

4 years agoMFC r350314:
Alan Somers [Fri, 6 Sep 2019 19:07:34 +0000 (19:07 +0000)]
MFC r350314:

special-case getvfsbyname(3) for fusefs(5)

fusefs file systems may have a fsname subtype (set by mount_fusefs's "-o
subtype" option) that gets appended to the fsname as returned by statfs(2).
The subtype is set on a per-mount basis so it isn't part of the struct
vfsconf. Special-case getvfsbyname to match either the full "fusefs.foobar"
or short "fusefs" fsname.

This is a merge of r348007, r348054, and r350093 from projects/fuse2

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

4 years agoMFC r350291:
Alan Somers [Fri, 6 Sep 2019 18:23:00 +0000 (18:23 +0000)]
MFC r350291:

Add c++14 and c++17 to COMPILER_FEATURES

This will be used to gate the fusefs tests. It's a partial merge of r348281
from projects/fuse2.

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

4 years agoMFC r350268:
Alan Somers [Fri, 6 Sep 2019 18:14:14 +0000 (18:14 +0000)]
MFC r350268:

VOP_FSYNC.9: update copyright after r345677

MFC-With: r345677
Sponsored by: The FreeBSD Foundation

4 years agoMFC r350227:
Alan Somers [Fri, 6 Sep 2019 18:11:39 +0000 (18:11 +0000)]
MFC r350227:

[skip ci] Fix the comment for cache_purge(9)

This is a merge of r348738 from projects/fuse2

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

4 years agoMFC r346186:
Alan Somers [Fri, 6 Sep 2019 18:10:03 +0000 (18:10 +0000)]
MFC r346186:

fusefs: add a fusefs(5) man page

PR: 233393
Reported by: tech-lists@zyxst.net
Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19651

4 years agoMFC r345986:
Alan Somers [Fri, 6 Sep 2019 18:08:13 +0000 (18:08 +0000)]
MFC r345986:

fusefs: fix a panic on mount

Don't page fault if the file descriptor provided with "-o fd" is invalid.
This is a merge of r345419 from the projects/fuse2 branch.

Reviewed by: ngie
Tested by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19836

4 years agoMFC r345675, r345689
Alan Somers [Fri, 6 Sep 2019 18:02:58 +0000 (18:02 +0000)]
MFC r345675, r345689

r345675:
fusefs: convert debug printfs into dtrace probes

fuse(4) was heavily instrumented with debug printf statements that could
only be enabled with compile-time flags. They fell into three basic groups:

1. Totally redundant with dtrace FBT probes. These I deleted.
2. Print textual information, usually error messages. These I converted to
   SDT probes of the form fuse:fuse:FILE:trace. They work just like the old
   printf statements except they can be enabled at runtime with dtrace. They
   can be filtered by FILE and/or by priority.
3. More complicated probes that print detailed information. These I
   converted into ad-hoc SDT probes.

Also, de-inline fuse_internal_cache_attrs.  It's big enough to be a regular
function, and this way it gets a dtrace FBT probe.

This commit is a merge of r345304, r344914, r344703, and r344664 from
projects/fuse2.

Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19667

r345689:
fix the GENERIC-NODEBUG build after r345675

Submitted by: cy
Reported by: cy, Michael Butler <imb@protected-networks.net>
X-MFC-With: 345675

4 years agoMFC r344183-r344187, r344333-r344334, r344407, r344857, r344865 (by cem)
Alan Somers [Fri, 6 Sep 2019 17:56:24 +0000 (17:56 +0000)]
MFC r344183-r344187, r344333-r344334, r344407, r344857, r344865 (by cem)

r344183:
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)

r344184:
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)

r344185:
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)

r344186:
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)

r344187:
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)

r344333:
fuse: add descriptions for remaining sysctls

(Except reclaim revoked; I don't know what that goal of that one is.)

r344334:
Fuse: whitespace and style(9) cleanup

Take a pass through fixing some of the most egregious whitespace issues in
fs/fuse.  Also fix some style(9) warts while here.  Not 100% cleaned up, but
somewhat less painful to look at and edit.

No functional change.

r344407:
fuse: Fix a regression introduced in r337165

On systems with non-default DFLTPHYS and/or MAXBSIZE, FUSE would attempt to
use a buf cache block size in excess of permitted size.  This did not affect
most configurations, since DFLTPHYS and MAXBSIZE both default to 64kB.
The issue was discovered and reported using a custom kernel with a DFLTPHYS
of 512kB.

PR: 230260 (comment #9)
Reported by: ken@

r344857:
FUSE: Prevent trivial panic

When open(2) was invoked against a FUSE filesystem with an unexpected flags
value (no O_RDONLY / O_RDWR / O_WRONLY), an assertion fired, causing panic.

For now, prevent the panic by rejecting such VOP_OPENs with EINVAL.

This is not considered the correct long term fix, but does prevent an
unprivileged denial-of-service.

PR: 236329
Reported by: asomers
Reviewed by: asomers
Sponsored by: Dell EMC Isilon

r344865:
fuse: switch from DFLTPHYS/MAXBSIZE to maxcachebuf

On GENERIC kernels with empty loader.conf, there is no functional change.
DFLTPHYS and MAXBSIZE are both 64kB at the moment.  This change allows
larger bufcache block sizes to be used when either MAXBSIZE (custom kernel)
or the loader.conf tunable vfs.maxbcachebuf (GENERIC) is adjusted higher
than the default.

Suggested by: ken@

4 years agoMFC r350685:
Edward Tomasz Napierala [Fri, 6 Sep 2019 17:54:51 +0000 (17:54 +0000)]
MFC r350685:

Add cdceem(4) driver, for virtual ethernet devices compliant
with Communication Device Class Ethernet Emulation Model (CDC EEM).
The driver supports both the device, and host side operation; there
is a new USB template (#11) for the former.

This enables communication with virtual USB NIC provided by iLO 5,
as found in new HPE Proliant servers.

Reviewed by: hselasky
Relnotes: yes
Sponsored by: Hewlett Packard Enterprise

4 years agoMFC r350225:
Alan Somers [Fri, 6 Sep 2019 17:43:00 +0000 (17:43 +0000)]
MFC r350225:

Remove the USE_RFC2292BIS option and reap dead code

This option was imported as part of the KAME project in r62627 (in 2000).
It was turned on unconditionally in r121472 (in 2003) and has been on ever
since. The old alternative code has bitrotted. Reap the dead code.

Reported by: Ján Sučan <jansucan@gmail.com>
Differential Revision: https://reviews.freebsd.org/D20938

4 years agoMFC r345350, r346441, r346765
Alan Somers [Fri, 6 Sep 2019 17:21:21 +0000 (17:21 +0000)]
MFC r345350, r346441, r346765

r345350:
Rename fuse(4) to fusefs(4)

This makes it more consistent with other filesystems, which all end in "fs",
and more consistent with its mount helper, which is already named
"mount_fusefs".

Reviewed by: cem, rgrimes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19649

r346441:
Use symlinks for kernel modules rather than hardlinks

When aliasing a kernel module to a different name (ie if_igb for if_em),
it's better to use symlinks than hard links. kldxref will omit entries for
the links, ensuring that the loaded module has the correct name.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19979

r346765:
Don't symlink fusefs.ko to fuse.ko on PPC

Some PPC systems (PowerNV) use msdosfs for /boot, which can't handle either
symlinks or hardlinks. So on PPC, copy the module instead. This change fixes
installkernel on such systems after r345350.

Reported by: Brandon Bergren <git_bdragon.rtk0.net>
Reviewed by: jhibbits, rgrimes
MFC-With: 345350, 346441
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19993

4 years agoMFC r351593: zfs_ioc_snapshot: check user-prop permissions on snapshotted datasets
Andriy Gapon [Fri, 6 Sep 2019 12:27:47 +0000 (12:27 +0000)]
MFC r351593: zfs_ioc_snapshot: check user-prop permissions on snapshotted datasets

4 years agoMFC r351413,351459,351467: unbreak last(1) for 8-bit locales
Eugene Grosbein [Fri, 6 Sep 2019 05:30:06 +0000 (05:30 +0000)]
MFC r351413,351459,351467: unbreak last(1) for 8-bit locales

Ouput format of last's broken for non UTF-8 locales
since it got libxo(3) support. It uses strftime(3) that produces
non UTF-8 strings passed to xo_emit(3) with wrong %s format -
it should be %hs in this case, so xo_emit(3) produces empty output.

This change is basically no-op when locale is of UTF-8 type,
f.e. en_GB.UTF-8 or ru_RU.UTF-8 or sr_RS.UTF-8@latin.
Also it is no-op for C/POSIX locale that's a subset of UTF-8.

It fixes output for other locales.

4 years agoRename stable/12 to 12.1-PRERELEASE, marking the start of the
Glen Barber [Fri, 6 Sep 2019 00:00:13 +0000 (00:00 +0000)]
Rename stable/12 to 12.1-PRERELEASE, marking the start of the
12.1 release cycle.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoMFC r349845:
Warner Losh [Thu, 5 Sep 2019 23:54:44 +0000 (23:54 +0000)]
MFC r349845:

  Work around devices which return all zeros for reads of existing MSI-X table
  VCTRL registers.

Note: This is confirmed to fix the nvme lost interrupt issues, seen on both
virtual and real cards.
PR: 211713

4 years agoMFC r351747:
Warner Losh [Thu, 5 Sep 2019 23:40:38 +0000 (23:40 +0000)]
MFC r351747:

  Implement nvme suspend / resume for pci attachment

Note: this is merged ~9 hours early due to a desire to have it in before feature
freeze in 20 minutes. Several reports of it working in current (and one that it
worked in -stable after copying all of -current's nvme driver) gives me
confidence that bending the rules a little here is the right trade-off.

PR: 240340
Relnotes: Yes

4 years agoMFC r343755:
Warner Losh [Thu, 5 Sep 2019 23:27:59 +0000 (23:27 +0000)]
MFC r343755:

  Regularize the Netflix copyright

4 years agoRevert r351902 ... it didn't properly exclude rack.c changes
Warner Losh [Thu, 5 Sep 2019 23:24:43 +0000 (23:24 +0000)]
Revert r351902 ... it didn't properly exclude rack.c changes

4 years agoMFC r351706:
Warner Losh [Thu, 5 Sep 2019 23:13:44 +0000 (23:13 +0000)]
MFC r351706:

  In nvme_completion_poll, add a sanity check to make sure that we complete the
  polling within a second. Panic if we don't. All the commands that use this
  interface should typically complete within a few tens to hundreds of
  microseconds. Panic rather than return ETIMEDOUT because if the command
  somehow does later complete, it will randomly corrupt memory. Also, it helps
  to get a traceback from where the unexpected failure happens, rather than an
  infinite loop.

4 years agoMFC r351705:
Warner Losh [Thu, 5 Sep 2019 23:12:56 +0000 (23:12 +0000)]
MFC r351705:

  In all the places that we use the polled for completion interface, except
  crash dump support code, move the while loop into an inline function. These
  aren't done in the fast path, so if the compiler choses to not inline, any
  performance hit is tiny.

4 years agoMFC r351704:
Warner Losh [Thu, 5 Sep 2019 23:12:06 +0000 (23:12 +0000)]
MFC r351704:

  Add a brief comment explaining why we can return ETIMEDOUT from the call to
  the polled interface. Normally this would have the potential to corrupt stack
  memory because the completion routines would run after we return. In this
  case, however, we're doing a dump so it's safe for reasons explained in the
  comment.

4 years agoMFC r351406,r351447:
Warner Losh [Thu, 5 Sep 2019 23:09:50 +0000 (23:09 +0000)]
MFC r351406,r351447:

  r351406:
    We need to define version 1 of nvme, not nvme_foo. Otherwise nvd won't load
    and people who pull in nvme/nvd from modules can't load nvd.ko since it
    depends on nvme, not nvme_foo. The duplicate doesn't matter since kldxref
    properly handles that case.
  r351447:
    It turns out the duplication is only mostly harmless.

4 years agoMFC r351411:
Warner Losh [Thu, 5 Sep 2019 23:07:57 +0000 (23:07 +0000)]
MFC r351411:

  When we have errors resetting the device before we allocate the queues, don't
  try to tear them down in the ctrlr_destroy path. Otherwise, we dereference
  queue structures that are NULL and we trap.

4 years agoMFC r351403:
Warner Losh [Thu, 5 Sep 2019 23:04:37 +0000 (23:04 +0000)]
MFC r351403:

  Move releasing of resources to later

4 years agoMFC r351376:
Warner Losh [Thu, 5 Sep 2019 23:03:37 +0000 (23:03 +0000)]
MFC r351376:

  Remove stray line that was duplicated.

4 years agoMFC r351356:
Warner Losh [Thu, 5 Sep 2019 23:02:08 +0000 (23:02 +0000)]
MFC r351356:

  Create a AHCI attachment for nvme.

4 years agoMFC r351355:
Warner Losh [Thu, 5 Sep 2019 23:01:12 +0000 (23:01 +0000)]
MFC r351355:

  Separate the pci attachment from the rest of nvme

4 years agoMFC r343755:
Warner Losh [Thu, 5 Sep 2019 22:38:53 +0000 (22:38 +0000)]
MFC r343755:

  Regularize the Netflix copyright

4 years agoMFC r349005:
Bryan Drewery [Thu, 5 Sep 2019 20:39:05 +0000 (20:39 +0000)]
MFC r349005:

  Don't delete .depend files outside of cleandepend.

4 years agoMFC r347458,r348975,r348976:
Bryan Drewery [Thu, 5 Sep 2019 20:31:25 +0000 (20:31 +0000)]
MFC r347458,r348975,r348976:

  r347458:
    Fix build race with machine links and genoffset.o.
  r348975:
    Restore genassym.o to CLEANFILES.
  r348976:
    Add missing DPSRCS entry for assym.inc.

4 years agoMFC r339635,r350301,r350327,r351151:
Bryan Drewery [Thu, 5 Sep 2019 20:26:20 +0000 (20:26 +0000)]
MFC r339635,r350301,r350327,r351151:

  r339635:
    Fix regex for extracting SHM_* values for libsysdecode
  r350301:
    libsysdecode: add explicit dependencies on recently changed headers
  r350327:
    libsysdecode: use the proper include directory
  r351151:
    Rework r339635 to fix .depend.tables.h handling.

4 years agoMFC r350848:
Ian Lepore [Thu, 5 Sep 2019 19:25:44 +0000 (19:25 +0000)]
MFC r350848:

The am335x_ehrpwm driver now requires the pwmbus_if interface, add it.

4 years agoFix LINT kernel builds on powerpc64 and sparc64. This is a direct commit
Ian Lepore [Thu, 5 Sep 2019 17:20:48 +0000 (17:20 +0000)]
Fix LINT kernel builds on powerpc64 and sparc64.  This is a direct commit
to 12-stable because the nandfs code no longer exists in 13-current.

The build was failing with

 nandfs_dat.c:301:
  warning: comparison is always false due to limited range of data type

I tried to fix it with an inline (size_t) cast of nargv->nv_nmembs in the
if() expression, but that didn't help (which seems a bit buggy), but using
an intermediate variable fixed it.  Elegance doesn't matter as much as
suppressing the warning; this code is long-dead even on this branch.

4 years agoMFC r348979:
Bryan Drewery [Thu, 5 Sep 2019 17:20:20 +0000 (17:20 +0000)]
MFC r348979:

  Stop using .OODATE for extracting firmware.

4 years agoMFC r350847:
Ian Lepore [Thu, 5 Sep 2019 16:53:55 +0000 (16:53 +0000)]
MFC r350847:

Allow the sdhci timeout sysctl var to be set as a tunable.  Also, add a
missing newline in a warning printf.

4 years agoMFC r346255:
Bryan Drewery [Thu, 5 Sep 2019 16:52:55 +0000 (16:52 +0000)]
MFC r346255:

  Fix 'jot -r 0 start end' to work.

Relnotes: yes

4 years agoMFC r350988:
Ian Lepore [Thu, 5 Sep 2019 16:48:43 +0000 (16:48 +0000)]
MFC r350988:

Add PNP_INFO to the gpiopps driver.

4 years agoMFC r350838, r350840-r350841, r350849, r350879
Ian Lepore [Thu, 5 Sep 2019 16:46:16 +0000 (16:46 +0000)]
MFC r350838, r350840-r350841, r350849, r350879

r350838:
Switch the am335x_pmic driver to using iicdev_readfrom/writeto.

PR: 239697
Submitted by: Chuhong Yuan

r350840:
Garbage collect the no-longer-necessary MAX_IIC_DATA_SIZE (there is not a
buffer allocated at that fixed size anymore).

r350841:
When responding to an interrupt in the am335x_pmic driver, use a taskqueue
thread to do the work that involves i2c IO, which sleeps while the IO is
in progress.

r350849:
Remove use of intr_config_hook from the am335x_pmic and tda19988 drivers.
Long ago this was needed, but now low-level i2c controller drivers cleverly
defer attachment of the bus until interrupts are enabled (if they require
interrupts to function), so that every i2c slave device doesn't have to.

r350879:
Revert r350841.  I didn't realize that on this chip, reading the interrupt
status register clears pending interrupts.  By moving that code out of the
interrupt handler into a taskqueue task, I effectively created an interrupt
storm by returning from the handler with the interrupt source still active.

We'll have to find a different solution for this driver's need to sleep
in an ithread context.

4 years agoMFC r350591, r350971, r351724
Ian Lepore [Thu, 5 Sep 2019 16:37:10 +0000 (16:37 +0000)]
MFC r350591, r350971, r351724

r350591:
Add a driver for Texas Instruments ADS101x/ADS111x i2c ADC chips.

Instances of the device can be configured using hints or FDT data.

Interfaces to reconfigure the chip and extract voltage measurements from
it are available via sysctl(8).

r350971:
Fix the driver name in ads111x.4, and hook the manpage up to the build.

The driver was originally written with the name ads1115, but at the last
minute it got renamed to ads111x to reflect its support for many related
chips, but I forgot to update the manpage to match the renaming before
committing it all.

r351724:
Fix the name of the devicetree bindings document file cited in the manpage.

4 years agoMFC r349957:
Tijl Coosemans [Thu, 5 Sep 2019 09:57:20 +0000 (09:57 +0000)]
MFC r349957:

Fix layout.  -C needs to be styled as a flag here, not as a new list item.

4 years agoMFC r351167:
Hans Petter Selasky [Thu, 5 Sep 2019 09:35:06 +0000 (09:35 +0000)]
MFC r351167:
Include item position in report descriptor dump in usbhidctl(1).

Submitted by: Kevin Zheng <kevinz5000@gmail.com>
PR: 239918

4 years agoMFC r351146:
Hans Petter Selasky [Thu, 5 Sep 2019 09:32:00 +0000 (09:32 +0000)]
MFC r351146:
Implement detach_kernel_driver command in usbconfig(8).

Submitted by: Kevin Zheng <kevinz5000@gmail.com>
PR: 239916

4 years agoMFC r351009:
Hans Petter Selasky [Thu, 5 Sep 2019 09:28:58 +0000 (09:28 +0000)]
MFC r351009:
Implement pci_enable_msi() and pci_disable_msi() in the LinuxKPI.
This patch makes the DRM graphics driver in ports usable on aarch64.

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D21008
Sponsored by: Mellanox Technologies

4 years agoMFC r347387:
Hans Petter Selasky [Thu, 5 Sep 2019 09:20:15 +0000 (09:20 +0000)]
MFC r347387:
Fix memory leak of PCI BUS structure in the LinuxKPI.

Sponsored by: Mellanox Technologies

4 years agoMFC: r350395
Rick Macklem [Wed, 4 Sep 2019 20:14:21 +0000 (20:14 +0000)]
MFC: r350395
Fix printing of Server Re-Failed and Server Faults.

nfsstat -s prints bogus large numbers for the Server Re-Failed and Server
Faults fields. This was introduced by r328588.
Although I know nothing about libxo, these lines aren't titles and this
patch seems to fix the problem, so I am committing it for rea@ who emailed
it to me.
It also deleted the trailing ':' from the title lines, since those were not
in the pre-r328588 output.

If there is a more correct fix, someone conversant with libxo will need
to do so.

4 years agoMFC r351213: assert that td_lk_slocks is not leaked upon return from kernel
Aleksandr Rybalko [Wed, 4 Sep 2019 19:32:50 +0000 (19:32 +0000)]
MFC r351213: assert that td_lk_slocks is not leaked upon return from kernel

4 years agoMFC: r351231, r351233
Jung-uk Kim [Wed, 4 Sep 2019 14:05:04 +0000 (14:05 +0000)]
MFC: r351231, r351233

Fix sound on headset jack for Lenovo Thinkpad X1 Carbon Gen 6 (model 20KH).

4 years agoMFC r351213: assert that td_lk_slocks is not leaked upon return from kernel
Andriy Gapon [Wed, 4 Sep 2019 09:54:05 +0000 (09:54 +0000)]
MFC r351213: assert that td_lk_slocks is not leaked upon return from kernel

4 years agoMFC r351168: zfs_vget: fix vnode reference count leak in error path
Andriy Gapon [Wed, 4 Sep 2019 08:47:29 +0000 (08:47 +0000)]
MFC r351168: zfs_vget: fix vnode reference count leak in error path

4 years agoMFC r350897: MFV r350896: 6585 sha512, skein, and edonr have an
Andriy Gapon [Wed, 4 Sep 2019 08:41:55 +0000 (08:41 +0000)]
MFC r350897: MFV r350896: 6585 sha512, skein, and edonr have an
unenforced dependency on extensible dataset

4 years agostable/ branches: commit missing part of patch
Kyle Evans [Tue, 3 Sep 2019 21:11:04 +0000 (21:11 +0000)]
stable/ branches: commit missing part of patch

truss prior to r350069 also attempted to use mips regnum bits -- let it
happen.

4 years agotests: shm_open(2): Verify FD_CLOEXEC
Kyle Evans [Tue, 3 Sep 2019 20:26:08 +0000 (20:26 +0000)]
tests: shm_open(2): Verify FD_CLOEXEC

Motivated by the fact that I'm messing around near the implementation and
wanting to ensure this doesn't get messed up in the process.

4 years agoMFC r351227: mips: avoid empty mdproc struct
Kyle Evans [Tue, 3 Sep 2019 20:23:58 +0000 (20:23 +0000)]
MFC r351227: mips: avoid empty mdproc struct

Compiling with a more modern toolchain than GCC 4.2 in base warns about the
empty struct. Take a hint and comment from r350902+r350953 by luporl@.

4 years agoMFC r351408-r351410: reduce pollution from mips machine/regnum.h
Kyle Evans [Tue, 3 Sep 2019 20:19:43 +0000 (20:19 +0000)]
MFC r351408-r351410: reduce pollution from mips machine/regnum.h

r351408:
libsa: mips: use _JB_* from machine/asm.h, remove regnum dep

This brings the libsa/mips _setjmp implementation closer to parity with the
libc version.

r351409:
mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM

machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via
machine/reg.h. Many of the regnum definitions are too short and too generic
to be exposing to any userland application including one of these two
headers. Moreover, these actively cause build failures in googletest
(template <typename T1 ...> expanding to template <typename 9 ...>).

Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of
the userland consumers to define as needed.

r351410:
libsa: mips: fix typo that had slipped into the diff on local machine

4 years agoMFC r351407: libc: mips: remove unused longjmp.c
Kyle Evans [Tue, 3 Sep 2019 20:15:06 +0000 (20:15 +0000)]
MFC r351407: libc: mips: remove unused longjmp.c

4 years agoMFC r350502:
Konstantin Belousov [Tue, 3 Sep 2019 20:06:36 +0000 (20:06 +0000)]
MFC r350502:
Make umtxq_check_susp() to correctly handle thread exit requests.

4 years agoMFC r349951, r349994, r349995, r350005, r350023 (by jhibbits), r350478:
Konstantin Belousov [Tue, 3 Sep 2019 20:04:44 +0000 (20:04 +0000)]
MFC r349951, r349994, r349995, r350005, r350023 (by jhibbits), r350478:
Provide protection against starvation of the ll/sc loops when accessing
userpace.

4 years agoMFC r350863:
Konstantin Belousov [Tue, 3 Sep 2019 19:56:52 +0000 (19:56 +0000)]
MFC r350863:
compat/linux: Remove obsoleted and somewhat confusing comments related to COMPAT_43.

4 years agoMFC r350862:
Konstantin Belousov [Tue, 3 Sep 2019 19:55:44 +0000 (19:55 +0000)]
MFC r350862:
Only enable COMPAT_43 changes for syscalls ABI for a.out processes.

4 years agoMFC r350204:
Konstantin Belousov [Tue, 3 Sep 2019 19:52:28 +0000 (19:52 +0000)]
MFC r350204:
Switch the rest of the refcount(9) functions to bool return type.

4 years agoMFC r350200:
Konstantin Belousov [Tue, 3 Sep 2019 19:50:38 +0000 (19:50 +0000)]
MFC r350200:
Fix userspace build after r350199.

4 years agoMFC r350199:
Konstantin Belousov [Tue, 3 Sep 2019 19:49:40 +0000 (19:49 +0000)]
MFC r350199:
Check and avoid overflow when incrementing fp->f_count in
fget_unlocked() and fhold().

4 years agoMFC r351458:
Konstantin Belousov [Tue, 3 Sep 2019 19:39:06 +0000 (19:39 +0000)]
MFC r351458:
Add nvdimm(4) man page.

4 years agoMFC r350575:
Konstantin Belousov [Tue, 3 Sep 2019 19:36:46 +0000 (19:36 +0000)]
MFC r350575:
rtld-elf: Remove x86 elf_rtld.x linker scripts.

4 years agoMFC r350504:
Konstantin Belousov [Tue, 3 Sep 2019 19:34:32 +0000 (19:34 +0000)]
MFC r350504:
Try to decrease the number of bugs in unionfs after the VV_TEXT flag removal.

4 years agoMFC r351435:
Konstantin Belousov [Tue, 3 Sep 2019 19:30:02 +0000 (19:30 +0000)]
MFC r351435:
De-commision the MNTK_NOINSMNTQ kernel mount flag.

4 years agoMFC r351114:
Konstantin Belousov [Tue, 3 Sep 2019 19:27:59 +0000 (19:27 +0000)]
MFC r351114:
Fix OOM handling of some corner cases.

4 years agoMFC r350882:
Cy Schubert [Tue, 3 Sep 2019 19:14:00 +0000 (19:14 +0000)]
MFC r350882:

Initialize the frentry (the control block that defines a rule) checksum
to zero. Matching checksums save time and effort by mitigating the need
for full rule compare.

4 years agoMFC r351488
Vincenzo Maffione [Tue, 3 Sep 2019 18:04:45 +0000 (18:04 +0000)]
MFC r351488

netmap: remove obsolete file

The netmap_pt.c module has become obsolete after
the refactoring that added netmap_kloop.c.
Remove it and unlink it from the build system.

4 years agoMFC r351253:
Dimitry Andric [Tue, 3 Sep 2019 17:31:12 +0000 (17:31 +0000)]
MFC r351253:

Pull in r368867 from upstream libc++ trunk (by Marshall Clow):

  Rework recursive_timed_mutex so that it uses __thread_id instead of
  using the lower-level __libcpp_thread_id. This is prep for fixing
  PR42918. Reviewed as https://reviews.llvm.org/D65895

Pull in r368916 from upstream libc++ trunk (by Marshall Clow):

  Fix thread comparison by making sure we never pass our special 'not a
  thread' value to the underlying implementation. Fixes PR#42918.

This should fix std::thread::id::operator==() attempting to call
pthread_equal(3) with zero values.

Reported by: andrew@tao11.riddles.org.uk
PR: 239038, 239550

4 years agoMFC r348628: elf_common: add GNU note types and NT_GNU_PROPERTY_TYPE_0 bits
Ed Maste [Tue, 3 Sep 2019 17:29:01 +0000 (17:29 +0000)]
MFC r348628: elf_common: add GNU note types and NT_GNU_PROPERTY_TYPE_0 bits

To support Intel CET IBT/Shadow Stack.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r350989: Remove some more leftover rlogin man page xrefs
Ed Maste [Tue, 3 Sep 2019 16:57:32 +0000 (16:57 +0000)]
MFC r350989: Remove some more leftover rlogin man page xrefs

rcmds were removed in r32435 and these three man pages can trivially
drop the references.

There's still a reference in pts.4 because it describes a mode
(TIOCPKT_NOSTOP), and only lists rlogin/rlogind as examples of programs
that use that mode.  To update later.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r350983: crunch: remove rsh and rlogin from example config file
Ed Maste [Tue, 3 Sep 2019 16:55:28 +0000 (16:55 +0000)]
MFC r350983: crunch: remove rsh and rlogin from example config file

rcmds removed in r324351.

Historical references in the README are maintained.  There's a paragraph
describing a "980K crunched 'fixit'" that references rsh and rlogin.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r350979: Remove rsh/rlogin references from security man page
Ed Maste [Tue, 3 Sep 2019 16:54:27 +0000 (16:54 +0000)]
MFC r350979: Remove rsh/rlogin references from security man page

More extensive changes to this page are certainly needed, but at least
remove references to binaries that no longer exist.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r350980: Remove rlogin/rsh references from src.conf(5) WITHOUT_BLACKLIST_SUPPORT
Ed Maste [Tue, 3 Sep 2019 16:52:44 +0000 (16:52 +0000)]
MFC r350980: Remove rlogin/rsh references from src.conf(5) WITHOUT_BLACKLIST_SUPPORT

rcmds were removed in r324351

Sponsored by: The FreeBSD Foundation

4 years agoMFC r351134: Add support for 'j', 't' and 'z' flags to kernel sscanf().
Alexander Motin [Tue, 3 Sep 2019 16:38:25 +0000 (16:38 +0000)]
MFC r351134: Add support for 'j', 't' and 'z' flags to kernel sscanf().

4 years agoMFC r351000: sys/{x86,amd64}: remove one of doubled ;s
Ed Maste [Tue, 3 Sep 2019 16:26:35 +0000 (16:26 +0000)]
MFC r351000: sys/{x86,amd64}: remove one of doubled ;s

4 years agoMFC r351395: msdosfs_fat: reduce diffs with NetBSD and makefs
Ed Maste [Tue, 3 Sep 2019 16:25:27 +0000 (16:25 +0000)]
MFC r351395: msdosfs_fat: reduce diffs with NetBSD and makefs

Use pointer arithmetic (as now done in makefs, and in NetBSD) instead of
taking the address of array element.  No functional change, but this
makes it easier to compare different versions of this file.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r351606: Take proper lock in ses_setphyspath_callback().
Alexander Motin [Tue, 3 Sep 2019 16:20:04 +0000 (16:20 +0000)]
MFC r351606: Take proper lock in ses_setphyspath_callback().

XPT_DEV_ADVINFO call should be protected by the lock of the specific
device it is addressed to, not the lock of SES device.  In some weird
case, probably with hardware violating standards, it sometimes caused
NULL dereference due to race.

To protect from it further, add lock assertion to *_dev_advinfo().

4 years agoMFC r350492: vmx: use C99 bool, not boolean_t
Ed Maste [Tue, 3 Sep 2019 16:18:07 +0000 (16:18 +0000)]
MFC r350492: vmx: use C99 bool, not boolean_t

Bhyve's vmm is a self-contained modern component and thus a good
candidate for use of C99 types.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r351425: vtfontcvt: simplify rshift_row
Ed Maste [Tue, 3 Sep 2019 16:15:57 +0000 (16:15 +0000)]
MFC r351425: vtfontcvt: simplify rshift_row

We don't need to specify the buffer size in both bytes and bits.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r351550: Always check cam_periph_error() status for ERESTART.
Alexander Motin [Tue, 3 Sep 2019 14:52:39 +0000 (14:52 +0000)]
MFC r351550: Always check cam_periph_error() status for ERESTART.

Even if we do not expect retries, we better be sure, since otherwise it
may result in use after free kernel panic.  I've noticed that it retries
SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY.

4 years agoMFC r351205: Use calloc().
Xin LI [Tue, 3 Sep 2019 07:02:18 +0000 (07:02 +0000)]
MFC r351205: Use calloc().