]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoPrefix UFS symbols with UFS_ to reduce namespace pollution
emaste [Sat, 17 Mar 2018 01:48:27 +0000 (01:48 +0000)]
Prefix UFS symbols with UFS_ to reduce namespace pollution

Followup to r313780.  Also prefix ext2's and nandfs's versions with
EXT2_ and NANDFS_.

Reported by: kib
Reviewed by: kib, mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9623

6 years agoANSIfy sys/x86
emaste [Sat, 17 Mar 2018 01:40:09 +0000 (01:40 +0000)]
ANSIfy sys/x86

6 years agoelftoolchain nm(1): Initialize allocated memory before use
cem [Fri, 16 Mar 2018 22:25:33 +0000 (22:25 +0000)]
elftoolchain nm(1): Initialize allocated memory before use

In out of memory scenarios (where one of these allocations failed but
other(s) did not), nm(1) could reference the uninitialized value of these
allocations (undefined behavior).

Always initialize any successful allocations as the most expedient
resolution of the issue.  However, I would encourage upstream elftoolchain
contributors to clean up the error path to just abort immediately, rather
than proceeding sloppily when one allocation fails.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoAdd _IOC_NEWLEN() and _IOC_NEWTYPE() macros.
brooks [Fri, 16 Mar 2018 22:23:04 +0000 (22:23 +0000)]
Add _IOC_NEWLEN() and _IOC_NEWTYPE() macros.

These macros take an existing ioctl(2) command and replace the length
with the specified length or length of the specified type respectively.
These can be used to define commands for 32-bit compatibility with fewer
opportunities for cut-and-paste errors then a whole new definition.

Reviewed by: cem, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14706

6 years agolibdtrace: Fix another uninitialized dtt_flags UB
cem [Fri, 16 Mar 2018 21:10:36 +0000 (21:10 +0000)]
libdtrace: Fix another uninitialized dtt_flags UB

Like r331073, eliminate a UB by fully initializing the struct with a designated
initializer.  Note that the similar src_dtt is not fully used, so a similar
treatment was not absolutely required.  I chose to leave it alone.  It
wouldn't hurt to do the same thing, though.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoAdd myself to committers-ports.dot
dteske [Fri, 16 Mar 2018 21:03:54 +0000 (21:03 +0000)]
Add myself to committers-ports.dot

Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D14688

6 years agotelnetd(8): Fix dereference of uninitialized value 'IF'
cem [Fri, 16 Mar 2018 20:59:56 +0000 (20:59 +0000)]
telnetd(8): Fix dereference of uninitialized value 'IF'

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agolibdtrace: Eliminate a minor UB by fully initializing parameter struct
cem [Fri, 16 Mar 2018 20:43:40 +0000 (20:43 +0000)]
libdtrace: Eliminate a minor UB by fully initializing parameter struct

The dtt_flags value is dereferenced by dt_type_pointer() and must be
initialized first.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agorandom(4): Poll for signals during large reads
cem [Fri, 16 Mar 2018 18:50:26 +0000 (18:50 +0000)]
random(4): Poll for signals during large reads

Occasionally poll for signals during large reads of the /dev/u?random
devices.  This allows cancellation via SIGINT of accidental invocations of
very large reads.  (A 2GB /dev/random read, which takes about 10 seconds on
my 2017 AMD Zen processor, can be aborted.)

I believe this behavior was intended since 2014 (r273997), just not fully
implemented.

This is motivated by a potential getrandom(2) interface that may not
explicitly forbid extremely large reads on 64-bit platforms -- even larger
than the 2GB limit imposed on devfs I/O by default.  Such reads, if they are
to be allowed, should be cancellable by the user or administrator.

Reviewed by: delphij
Approved by: secteam (delphij)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14684

6 years agoMake not getting BootOrder a warning, not a fatal error when printing.
imp [Fri, 16 Mar 2018 18:16:31 +0000 (18:16 +0000)]
Make not getting BootOrder a warning, not a fatal error when printing.

Sponsored by: Netflix

6 years agoUse EFI RTC capabilities info when registering, add bootverbose diagnostics.
ian [Fri, 16 Mar 2018 18:16:27 +0000 (18:16 +0000)]
Use EFI RTC capabilities info when registering, add bootverbose diagnostics.

Make some small improvements to the efirtc driver by obtaining the clock
capabilities (resolution and whether the sub-second counters are reset) and
using the info when registering the clock. When the hardware zeroes out the
subsecond info on clock-set, schedule clock updates to happen just before
top-of-second, so that the RTC time is closely in-sync with kernel time.

Also, in the identify() routine, always add the driver if EFI runtime
services are available, then decide in probe() whether to attach the driver
or not. If not attaching and bootverbose is on, say why. All of this is
basically to avoid "silent failure" -- if someone thinks there should be an
efi rtc and it's not attaching, at least they can set bootverbose and maybe
get a clue from the output.

Differential Revision: https://reviews.freebsd.org/D14565 (timed out)

6 years agoOnly print boot order / boot current if we can get the variables from
imp [Fri, 16 Mar 2018 18:12:50 +0000 (18:12 +0000)]
Only print boot order / boot current if we can get the variables from
the loader. Some UEFI implementations don't return all of them.

Sponsored by: Netflix

6 years agoPull in r321999 from upstream clang trunk (by Ivan A. Kosarev):
dim [Fri, 16 Mar 2018 18:04:13 +0000 (18:04 +0000)]
Pull in r321999 from upstream clang trunk (by Ivan A. Kosarev):

  [CodeGen] Fix TBAA info for accesses to members of base classes

  Resolves:
  Bug 35724 - regression (r315984): fatal error: error in backend:
  Broken function found (Did not see access type in access path!)
  https://bugs.llvm.org/show_bug.cgi?id=35724

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

This fixes "Did not see access type in access path" fatal errors when
building the devel/gdb port (version 8.1).

Reported by: jbeich
PR: 226658
MFC after: 3 months
X-MFC-With: r327952

6 years agoPull in r327638 from upstream llvm trunk (by Matthew Simpson):
dim [Fri, 16 Mar 2018 17:50:44 +0000 (17:50 +0000)]
Pull in r327638 from upstream llvm trunk (by Matthew Simpson):

  [ConstantFolding, InstSimplify] Handle more vector GEPs

  This patch addresses some additional cases where the compiler crashes
  upon encountering vector GEPs. This should fix PR36116.

  Differential Revision: https://reviews.llvm.org/D44219
  Reference: https://bugs.llvm.org/show_bug.cgi?id=36116

This fixes an assertion when building the emulators/snes9x port.

Reported by: jbeich
PR: 225471
MFC after: 3 months
X-MFC-With: r327952

6 years agoExtend SSID maximum string length to 32 chars to support longer SSID
krion [Fri, 16 Mar 2018 16:56:56 +0000 (16:56 +0000)]
Extend SSID maximum string length to 32 chars to support longer SSID
names.

Approved by: adrian
Differential Revision: https://reviews.freebsd.org/D14710

6 years agoAdd the header file needed for the recently-added call to pagedaemon_wakeup().
ian [Fri, 16 Mar 2018 16:06:25 +0000 (16:06 +0000)]
Add the header file needed for the recently-added call to pagedaemon_wakeup().

6 years agoSet the inp_vflag consistently for accepted TCP/IPv6 connections when
tuexen [Fri, 16 Mar 2018 15:26:07 +0000 (15:26 +0000)]
Set the inp_vflag consistently for accepted TCP/IPv6 connections when
net.inet6.ip6.v6only=0.

Without this patch, the inp_vflag would have INP_IPV4 and the
INP_IPV6 flags for accepted TCP/IPv6 connections if the sysctl
variable net.inet6.ip6.v6only is 0. This resulted in netstat
to report the source and destination addresses as IPv4 addresses,
even they are IPv6 addresses.

PR: 226421
Reviewed by: bz, hiren, kib
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D13514

6 years agoChase r331057 in libsysdecode erno table
emaste [Fri, 16 Mar 2018 15:15:25 +0000 (15:15 +0000)]
Chase r331057 in libsysdecode erno table

6 years agolinux_errno.c: add newer errno values
emaste [Fri, 16 Mar 2018 14:51:47 +0000 (14:51 +0000)]
linux_errno.c: add newer errno values

Also introduce a static assert to ensure the list is kept up to date.

Sponsored by: Turing Robotic Industries Inc.

6 years agoShare a single bsd-linux errno table across MD consumers
emaste [Fri, 16 Mar 2018 14:46:38 +0000 (14:46 +0000)]
Share a single bsd-linux errno table across MD consumers

Three copies of the linuxulator linux_sysvec.c contained identical
BSD to Linux errno translation tables, and future work to support other
architectures will also use the same table.  Move the table to a common
file to be used by all.  Make it 'const int' to place it in .rodata.

(Some existing Linux architectures use MD errno values, but x86 and Arm
share the generic set.)

This change should introduce no functional change; a followup will add
missing errno values.

MFC after: 3 weeks
Sponsored by: Turing Robotic Industries Inc.
Differential Revision: https://reviews.freebsd.org/D14665

6 years agoMove assym.s to DPSRC in sgx module
emaste [Fri, 16 Mar 2018 13:33:42 +0000 (13:33 +0000)]
Move assym.s to DPSRC in sgx module

assym.s is only to be included by other .s files, and should not
actually be assembled by itself.

6 years agoANSIfy i386/vm86.c
emaste [Fri, 16 Mar 2018 12:12:41 +0000 (12:12 +0000)]
ANSIfy i386/vm86.c

6 years agoGarbage collect unused chacha20 code
cem [Fri, 16 Mar 2018 07:11:53 +0000 (07:11 +0000)]
Garbage collect unused chacha20 code

Two copies of chacha20 were imported into the tree on Apr 15 2017 (r316982)
and Apr 16 2017 (r317015).  Only the latter is actually used by anything, so
just go ahead and garbage collect the unused version while it's still only
in CURRENT.

I'm not making any judgement on which implementation is better.  If I pulled
the wrong one, feel free to swap the existing implementation out and replace
it with the other code (conforming to the API that actually gets used in
randomdev, of course).  We only need one generic implementation.

Sponsored by: Dell EMC Isilon

6 years agoFix GCC build: Remove redundant pagedaemon_wakeup declaration
cem [Fri, 16 Mar 2018 07:05:09 +0000 (07:05 +0000)]
Fix GCC build: Remove redundant pagedaemon_wakeup declaration

Introduced in r331018.

Reported by: kevans
Sponsored by: Dell EMC Isilon

6 years agoTry polling the qpairs on timeout.
imp [Fri, 16 Mar 2018 05:23:48 +0000 (05:23 +0000)]
Try polling the qpairs on timeout.

On some systems, we're getting timeouts when we use multiple queues on
drives that work perfectly well on other systems. On a hunch, Jim
Harris suggested I poll the completion queue when we get a timeout.
This patch polls the completion queue if no fatal status was
indicated. If it had pending I/O, we complete that request and
return. Otherwise, if aborts are enabled and no fatal status, we abort
the command and return. Otherwise we reset the card.

This may clear up the problem, or we may see it result in lots of
timeouts and a performance problem. Either way, we'll know the next
step. We may also need to pay attention to the fatal status bit
of the controller.

PR: 211713
Suggested by: Jim Harris
Sponsored by: Netflix

6 years agoAdd required interface header.
ian [Fri, 16 Mar 2018 02:46:08 +0000 (02:46 +0000)]
Add required interface header.

Reported by: andreast@

6 years agortwn(4): de-hardcode ('h/w rate index' - 'corresponding MCS index') constant
avos [Fri, 16 Mar 2018 01:03:10 +0000 (01:03 +0000)]
rtwn(4): de-hardcode ('h/w rate index' - 'corresponding MCS index') constant

6 years agourtw(4), zyd(4): reduce code verbosity.
avos [Fri, 16 Mar 2018 00:38:10 +0000 (00:38 +0000)]
urtw(4), zyd(4): reduce code verbosity.

No functional change intended.

6 years agourtw(4): provide names for some commonly used rate indices + drop
avos [Fri, 16 Mar 2018 00:09:16 +0000 (00:09 +0000)]
urtw(4): provide names for some commonly used rate indices + drop
now-unused urtw_rate2rtl()

6 years agoCorrect comment for IFM_IEEE80211_VHT media variant.
avos [Thu, 15 Mar 2018 23:32:29 +0000 (23:32 +0000)]
Correct comment for IFM_IEEE80211_VHT media variant.

6 years agoAdd a request structure and make the implementation use it.
brooks [Thu, 15 Mar 2018 21:42:49 +0000 (21:42 +0000)]
Add a request structure and make the implementation use it.

This allows compatibility translation to take place on the stack
(md_ioctl is too big) and is more suitable as a public interface within
the kernel than the kern_ioctl interface.

Except for the initialization of the md_req from the md_ioctl
(including detection of kernel md_file pointers) and the updating
of the md_ioctl prior to return, this is a mechanical replacment
of md_ioctl and mdio with md_req and mdr.

Reviewed by: markj, cem, kib (assorted versions)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14704

6 years agoFinish removal of dataacq.h (r330716) and pcaudioio.h (r330766).
brooks [Thu, 15 Mar 2018 21:31:19 +0000 (21:31 +0000)]
Finish removal of dataacq.h (r330716) and pcaudioio.h (r330766).

6 years agoEliminate pageout wakeup races. Take another step towards lockless
jeff [Thu, 15 Mar 2018 19:23:07 +0000 (19:23 +0000)]
Eliminate pageout wakeup races.  Take another step towards lockless
vmd_free_count manipulation.  Reduce the scope of the free lock by
using a pageout lock to synchronize sleep and wakeup.  Only trigger
the pageout daemon on transitions between states.  Drive all wakeup
operations directly as side-effects from freeing memory rather than
requiring an additional function call.

Reviewed by: markj, kib
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14612

6 years agoAdd a space between a section number and a following comma.
markj [Thu, 15 Mar 2018 19:03:54 +0000 (19:03 +0000)]
Add a space between a section number and a following comma.

Fix some nits from igor while here.

MFC after: 3 days

6 years agoModify rc.d/fsck to handle new status from fsck/fsck_ffs
dab [Thu, 15 Mar 2018 18:29:56 +0000 (18:29 +0000)]
Modify rc.d/fsck to handle new status from fsck/fsck_ffs

r328013 introduced a new error code from fsck_ffs that indicates that
it could not completely fix the file system; this happens when it
prints the message PLEASE RERUN FSCK. However, this status can happen
when fsck is run in "preen" mode and the rc.d/fsck script does not
handle that error code. Modify rc.d/fsck so that if "fsck -p"
("preen") returns the new status code (16) it will run "fsck -y", as
it currently does for a status code of 8 (the "standard error exit").

Reported by: markj
Reviewed by: mckusick, markj, ian, rgrimes
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14679

6 years agoMove implementation of ioctls into kern_*() functions.
brooks [Thu, 15 Mar 2018 18:12:55 +0000 (18:12 +0000)]
Move implementation of ioctls into kern_*() functions.

Move locks from outside ioctl to the individual implementations.

This is the first step of changing the implementations to act on a
kernel-internal request struct rather than on struct md_ioctl and to
removing the use of kern_ioctl in mountroot.

Reviewed by: cem, kib, markj (prior version)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14700

6 years agoFix iSCSI target crash on session reinstation.
trasz [Thu, 15 Mar 2018 17:36:13 +0000 (17:36 +0000)]
Fix iSCSI target crash on session reinstation.

The crash scenario goes like this: there's a thread waiting on "reinstate";
because it doesn't update the timeout counter it gets terminated by the
callout; at this point the maintenance thread starts the termination routine.
The first thread finishes waiting, proceeds to icl_conn_handoff(), and drops
the refcount, which allows the maintenance thread to free its resources.  At
this point another thread receives a PDU.  Boom.

PR: 222898, 219866
Reported by: Eugene M. Zheganin <emz at norma.perm.ru>
Tested by: Eugene M. Zheganin <emz at norma.perm.ru>
Reviewed by: mav@ (earlier version)
MFC after: 2 weeks
Sponsored by: playkey.net

6 years agoRestore the behavior of returning the total number of units by
brooks [Thu, 15 Mar 2018 16:37:43 +0000 (16:37 +0000)]
Restore the behavior of returning the total number of units by
unconditionally incrementing i in the loop;

Reported by: cem
MFC with: r330880
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14685

6 years agoaesni(4): Stylistic/comment enhancements
cem [Thu, 15 Mar 2018 16:17:02 +0000 (16:17 +0000)]
aesni(4): Stylistic/comment enhancements

Improve clarity of a comment and style(9) some areas.

No functional change.

Reported by: markj (on review of a mostly-copied driver)
Sponsored by: Dell EMC Isilon

6 years agoAdd termcap entries for the st terminal (https://st.sucksless.org)
bapt [Thu, 15 Mar 2018 15:13:17 +0000 (15:13 +0000)]
Add termcap entries for the st terminal (https://st.sucksless.org)

MFC after: 3 days

6 years agoFix tab vs space indentation
bapt [Thu, 15 Mar 2018 15:05:26 +0000 (15:05 +0000)]
Fix tab vs space indentation

MFC after: 3 days

6 years agozfs test suite: move definition of DISK to the cfg file in zpool_get
avg [Thu, 15 Mar 2018 14:47:53 +0000 (14:47 +0000)]
zfs test suite: move definition of DISK to the cfg file in zpool_get

The variable is used not only by the setup script but also by the
atf test bodies.

Another one that should have been in r331001.

6 years agozfs test suite: add new pool properties / features to the zpool_get list
avg [Thu, 15 Mar 2018 14:41:09 +0000 (14:41 +0000)]
zfs test suite: add new pool properties / features to the zpool_get list

6 years agozfs test suite: move definition of DISK to the cfg file in zpool_get
avg [Thu, 15 Mar 2018 14:35:46 +0000 (14:35 +0000)]
zfs test suite: move definition of DISK to the cfg file in zpool_get

The variable is used not only by the setup script but also by the
atf test bodies.

This should have been in r331001.

6 years agozfs test suite: move definition of DISK to the cfg file in zpool_export
avg [Thu, 15 Mar 2018 14:23:31 +0000 (14:23 +0000)]
zfs test suite: move definition of DISK to the cfg file in zpool_export

The variable is used not only by the setup script but also by the
atf test bodies.

6 years agoMake getnameinfo(3) salen requirement less strict and
hrs [Thu, 15 Mar 2018 13:46:28 +0000 (13:46 +0000)]
Make getnameinfo(3) salen requirement less strict and
document details of salen in getnameinfo(3) manual page.

getnameinfo(3) returned EAI_FAIL when salen was not equal to
the length corresponding to the value specified by sa->sa_family.
However, POSIX or RFC 3493 does not require it and RFC 4038
Sec.6.2.3 shows an example passing sizeof(struct sockaddr_storage)
to salen.

This change makes the requirement less strict by accepting
salen up to sizeof(struct sockaddr_storage).  It also includes
two more changes: one is to fix return values because both SUSv4
and RFC 3493 require EAI_FAMILY when the address length is invalid,
another is to fix sa_len dependency in PF_LOCAL.

Pointed out by: Christophe Beauval
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D14585

6 years agozfs test suite: support device paths with intermediate directories
avg [Thu, 15 Mar 2018 12:47:34 +0000 (12:47 +0000)]
zfs test suite: support device paths with intermediate directories

The code assumed that disks (devices) used for testing are always named
like /dev/foo, but there is no reason for that restriction and we can
easily support paths like /dev/stripe/bar.

6 years agozfs test suite: fix a typo, TESTPOOL vs TESTPOOL2
avg [Thu, 15 Mar 2018 12:44:13 +0000 (12:44 +0000)]
zfs test suite: fix a typo, TESTPOOL vs TESTPOOL2

6 years agozfs test suite: destroy old gnops before creating new ones
avg [Thu, 15 Mar 2018 12:42:19 +0000 (12:42 +0000)]
zfs test suite: destroy old gnops before creating new ones

6 years agozfs test suite: align zfs_destroy_005_neg: with upstream
avg [Thu, 15 Mar 2018 12:40:43 +0000 (12:40 +0000)]
zfs test suite: align zfs_destroy_005_neg: with upstream

The change is to account for a different order in which the recursive
destroy may be attempted.  If we first try a dataset that can be destroyed
then it will be destroyed, but if we first try a dataset that cannot be
destroyed then we will not attempt to destroy the other dataset.

6 years agozfs test suite: fix a typo, da0 vs $disk
avg [Thu, 15 Mar 2018 12:35:22 +0000 (12:35 +0000)]
zfs test suite: fix a typo, da0 vs $disk

6 years agore-enable zfs_copies_006_pos test after a fix in r330977
avg [Thu, 15 Mar 2018 09:28:10 +0000 (09:28 +0000)]
re-enable zfs_copies_006_pos test after a fix in r330977

The test was disabled in r329408.

PR: 225960

6 years agog_access: deal with races created by geoms that drop the topology lock
avg [Thu, 15 Mar 2018 09:16:10 +0000 (09:16 +0000)]
g_access: deal with races created by geoms that drop the topology lock

The problem is that g_access() must be called with the GEOM topology
lock held.  And that gives a false impression that the lock is indeed
held across the call.  But this isn't always true because many classes,
ZVOL being one of the many, need to drop the lock.  It's either to
perform an I/O on the first open or to acquire a different lock (like in
g_mirror_access).

That, of course, can break many assumptions.  For example,
g_slice_access() adds an extra exclusive count on the first open. As
described above, an underlying geom may drop the topology lock and that
would open a race with another thread that would also request another
extra exclusive count.  In general, two consumers may be granted
incompatible accesses.

To avoid this problem the code is changed to mark a geom with special
flag before calling its access method and clear the flag afterwards.  If
another thread sees that flag, then it means that the topology lock has
been dropped (either by the geom in question or downstream from it), so
it is not safe to make another access call.  So, the second thread would
use g_topology_sleep() to wait until the flag is cleared and only then
would it proceed with the access.

Also see http://docs.freebsd.org/cgi/mid.cgi?809d9254-ee56-59d8-69a4-08838e985cea

PR: 225960
Reported by: asomers
Reviewed by: markj, mav
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14533

6 years agore-enable zpool_upgrade_007_pos test after the fix in r330974
avg [Thu, 15 Mar 2018 08:52:49 +0000 (08:52 +0000)]
re-enable zpool_upgrade_007_pos test after the fix in r330974

The test was disabled in r329248.

PR: 225877

6 years agoMFV r330973: 9164 assert: newds == os->os_dsl_dataset
avg [Thu, 15 Mar 2018 08:49:21 +0000 (08:49 +0000)]
MFV r330973: 9164 assert: newds == os->os_dsl_dataset

illumos/illumos-gate@5f5913bb83405db87f982abee80162a479d363af
https://github.com/illumos/illumos-gate/commit/5f5913bb83405db87f982abee80162a479d363af

https://www.illumos.org/issues/9164
  This issue has been reported by Alan Somers as
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225877

  dmu_objset_refresh_ownership() first disowns a dataset (and releases
  it) and then owns it again. There is an assert that the new dataset
  object is the same as the old dataset object.  When running ZFS Test
  Suite on FreeBSD we see this panic from zpool_upgrade_007_pos test:

  panic: solaris assert: newds == os->os_dsl_dataset (0xfffff80045f4c000
  == 0xfffff80021ab4800)

  I see that the old dataset has dsl_dataset_evict_async() pending in
  ds_dbu.dbu_tqent and its ds_dbuf is NULL.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Don Brady <don.brady@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <avg@FreeBSD.org>

PR: 225877
Reported by: asomers
MFC after: 1 week

6 years agoReverting r330925 for now
wma [Thu, 15 Mar 2018 06:19:45 +0000 (06:19 +0000)]
Reverting r330925 for now

6 years agolibefi: UEFI_BOOT_VAR_GUID duplicates EFI_GLOBAL_VARIABLE
tsoome [Thu, 15 Mar 2018 05:58:35 +0000 (05:58 +0000)]
libefi: UEFI_BOOT_VAR_GUID duplicates EFI_GLOBAL_VARIABLE

Drop UEFI_BOOT_VAR_GUID and use EFI_GLOBAL_VARIABLE.

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

6 years agoIncrease ABOUT FIRMWARE command timeout to 5s.
mav [Thu, 15 Mar 2018 01:07:21 +0000 (01:07 +0000)]
Increase ABOUT FIRMWARE command timeout to 5s.

It seems default timeout of 100ms is not enough for my 2694L card,
while it was perfectly fine for others, even for full-height 2694.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

6 years agoRemove KERNEL_RETPOLINE from BROKEN_OPTIONS on i386
emaste [Thu, 15 Mar 2018 00:57:57 +0000 (00:57 +0000)]
Remove KERNEL_RETPOLINE from BROKEN_OPTIONS on i386

Clang will compile both amd64 and i386 with retpoline.

Sponsored by: The FreeBSD Foundation

6 years agoMerge ACPICA 20180313.
jkim [Wed, 14 Mar 2018 23:45:48 +0000 (23:45 +0000)]
Merge ACPICA 20180313.

6 years agoRemove local definitions for _STA method in favor of ACPICA.
jkim [Wed, 14 Mar 2018 23:42:28 +0000 (23:42 +0000)]
Remove local definitions for _STA method in favor of ACPICA.

These macros were added in ACPICA 20051216, more than a decade ago.

6 years agoFix error messages in cut and pasted code.
imp [Wed, 14 Mar 2018 23:28:28 +0000 (23:28 +0000)]
Fix error messages in cut and pasted code.

Also, fix an unnecessary deref to get ctrlr.

Noticed by: rpokala@
Sponsored by: Netflix

6 years agoWhen tearing down a queue pair, also delete the queue entries.
imp [Wed, 14 Mar 2018 23:01:18 +0000 (23:01 +0000)]
When tearing down a queue pair, also delete the queue entries.

The NVME standard has required in section 7.2.6, since at least 1.1,
that a clean shutdown is signalled by deleting the subission and the
completion queues before setting the shutdown bit in CC. The 1.0
standard, apparently, did not and many of the early Intel cards didn't
care. Some newer cards care, at least one whose beta firmware can
scramble the card on an unclean shutdown. Linux has done this for some
time. To make it possible to move forward with an evaluation of this
pre-release card with wonky firmware, delete the queues on the card
when we delete the qpair structures.

Sponsored by: Netflix

6 years agoDon't make the namespace devices eternal.
imp [Wed, 14 Mar 2018 23:01:04 +0000 (23:01 +0000)]
Don't make the namespace devices eternal.

We'll need to delete namespaces soon, so go ahead and stop making
these devices eternal. It doesn't help much, and will be getting in
the way soon.

Sponsored by: Netflix

6 years agovfs_bio.c: Apply cleanups motivated by Coverity analysis
cem [Wed, 14 Mar 2018 22:11:45 +0000 (22:11 +0000)]
vfs_bio.c: Apply cleanups motivated by Coverity analysis

It is believed that the conditions Coverity indicated were actually
impossible to hit.  So this patch just adds a cleanup to only compute
v_mount once in brelse(), and in vfs_bio_getpages() always initializes error
to zero to appease the static analyzer.

No functional change intended.

Submitted by: Darrick Lew <darrick.freebsd AT gmail.com>
Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14613

6 years agoFix mps deadlock when handling panic
smh [Wed, 14 Mar 2018 21:32:23 +0000 (21:32 +0000)]
Fix mps deadlock when handling panic

During shutdown mps waits for its SSU requests to complete however when
performing a reboot after handling a panic the scheduler is stopped so
getmicrotime which is used can be non-functional.

Switch to using the same method as shutdown_panic to ensure we actually
complete.

In addition reduce the timeout when RB_NOSYNC is set in howto as we expect
this to fail.

Reviewed by: slm
MFC after: 1 week
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D12776

6 years agoPrevent ZFS TRIM breaking VTOC8 partitions
smh [Wed, 14 Mar 2018 21:21:03 +0000 (21:21 +0000)]
Prevent ZFS TRIM breaking VTOC8 partitions

Update the ZFS TRIM code to ensure it respects VTOC8 partition headers as
documented by the ZFS On-Disk Specification section 1.3

Before this a zpool create on a VTOC8 partitioned device would overwrite the
partition metadata.

Reported by: marius
Reviewed by: marius agv
MFC after: 1 week
Sponsored by: Multiplay

6 years agoFix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.
brooks [Wed, 14 Mar 2018 21:11:41 +0000 (21:11 +0000)]
Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.

This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB.

Reviewed by: cem
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14672

6 years agoBump copyright following recent changes
dteske [Wed, 14 Mar 2018 20:55:28 +0000 (20:55 +0000)]
Bump copyright following recent changes

6 years agoFix the check for an empty send socket buffer on a TOE TLS socket.
jhb [Wed, 14 Mar 2018 20:49:51 +0000 (20:49 +0000)]
Fix the check for an empty send socket buffer on a TOE TLS socket.

Compare sbavail() with the cached sb_off of already-sent data instead of
always comparing with zero.  This will correctly close the connection and
send the FIN if the socket buffer contains some previously-sent data but
no unsent data.

Reported by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoRemove TLS-related inlines from t4_tom.h to fix iw_cxgbe(4) build.
jhb [Wed, 14 Mar 2018 20:46:25 +0000 (20:46 +0000)]
Remove TLS-related inlines from t4_tom.h to fix iw_cxgbe(4) build.

- Remove the one use of is_tls_offload() and the function.  AIO special
  handling only needs to be disabled when a TOE socket is actively doing
  TLS offload on transmit.  The TOE socket's mode (which affects receive
  operation) doesn't matter, so remove the check for the socket's mode and
  only check if a TOE socket has TLS transmit keys configured to determine
  if an AIO write request should fall back to the normal socket handling
  instead of the TOE fast path.
- Move can_tls_offload() into t4_tls.c.  It is not used in critical paths,
  so inlining isn't that important.  Change return type to bool while here.

Sponsored by: Chelsio Communications

6 years agoAdd opt_compat.h to isp(4) as required by r330876.
brooks [Wed, 14 Mar 2018 20:07:52 +0000 (20:07 +0000)]
Add opt_compat.h to isp(4) as required by r330876.

MFC with: r330876

6 years agoFix compliancy of the kstrtoXXX() functions in the LinuxKPI, by skipping
hselasky [Wed, 14 Mar 2018 19:51:28 +0000 (19:51 +0000)]
Fix compliancy of the kstrtoXXX() functions in the LinuxKPI, by skipping
one newline character at the end, if any.

Found by: greg@unrelenting.technology
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix bad error messages from dpv(3)
dteske [Wed, 14 Mar 2018 19:23:17 +0000 (19:23 +0000)]
Fix bad error messages from dpv(3)

Before = dpv: <__func__>: posix_spawnp(3): No such file or directory
 After = dpv: <path/cmd>: No such file or directory

Most notably, show the 2nd argument being passed to posix_spawnp(3)
so we know what path/cmd failed.

Also, we don't need to have "posix_spawnp(3)" in the error message
nor the function because that can [a] change and [b] traversed using
a debugger if necessary.

6 years agoUpdate to 2018-03-06
bapt [Wed, 14 Mar 2018 19:09:58 +0000 (19:09 +0000)]
Update to 2018-03-06

MFC after: 3 days

6 years agoUse full month in dpv(3), figpar(3), and bsdconfig(8) manuals
dteske [Wed, 14 Mar 2018 19:09:06 +0000 (19:09 +0000)]
Use full month in dpv(3), figpar(3), and bsdconfig(8) manuals

Reported by: maxim

6 years agoFix typo in a warning message.
trasz [Wed, 14 Mar 2018 18:27:06 +0000 (18:27 +0000)]
Fix typo in a warning message.

MFC after: 2 weeks

6 years agoFix fat-fingering ("optional standard") and move all the OF code to
nwhitehorn [Wed, 14 Mar 2018 18:07:40 +0000 (18:07 +0000)]
Fix fat-fingering ("optional standard") and move all the OF code to
being marked "standard", which is less confusing than having it conditional
on AIM CPUs here, and then picked up through options FDT from conf/files
on Book-E.

Request by: jhibbits

6 years agoCreate a sysctl kern.cam.{,a,n}da.X.invalidate
imp [Wed, 14 Mar 2018 17:53:37 +0000 (17:53 +0000)]
Create a sysctl kern.cam.{,a,n}da.X.invalidate

kern.cam.{,a,n}da.X.invalidate=1 forces *daX to detach by calling
cam_periph_invalidate on the underlying periph. This is for testing
purposes only. Include only with options CAM_TEST_FAILURE and rename
the former [AN]DA_TEST_FAILURE, and fix nda to compile with it set.
We're using it at work to harden geom and the buffer cache to be
resilient in the face of drive failure. Today, it far too often
results in a panic. While much work was done on SIM initiated removal
for the USB thumnb drive removal work, little has been done for periph
initiated removal. This simulates what *daerror() does for some errors
nicely: we get the same panics with it that we do with failing drives.

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

6 years agoThis should have been += so clean builds work.
imp [Wed, 14 Mar 2018 16:45:04 +0000 (16:45 +0000)]
This should have been += so clean builds work.

Noticed by: hps@

6 years agoFix inverted logic that counted all completions as errors, except when
imp [Wed, 14 Mar 2018 16:44:57 +0000 (16:44 +0000)]
Fix inverted logic that counted all completions as errors, except when
they were actual errors.

Sponsored by: Netflix

6 years agoImplement trim collapsing in nda
imp [Wed, 14 Mar 2018 16:44:50 +0000 (16:44 +0000)]
Implement trim collapsing in nda

When multiple trims are in the queue, collapse them as much as
possible. At present, this usually results in only a few trims being
collapsed together, but more work on that will make it possible to do
hundreds (up to some configurable max).

Sponsored by: Netflix

6 years agoAllow NULL ccb to cam_iosched_bio_complete
imp [Wed, 14 Mar 2018 16:44:16 +0000 (16:44 +0000)]
Allow NULL ccb to cam_iosched_bio_complete

When the ccb is NULL to cam_iosched_bio_complete, just update the
other statistics, but not the time. If many operations are collapsed
together, this is needed to keep stats properly for the grouped bp.
This should fix trim accounting.

Sponsored by: Netflix

6 years agoThe expression (aim | fdt) is always true on PowerPC. The last PowerPC
nwhitehorn [Wed, 14 Mar 2018 16:16:25 +0000 (16:16 +0000)]
The expression (aim | fdt) is always true on PowerPC. The last PowerPC
platform that can run without a device tree (PS3) still uses the OF_*()
functions to check if one exists and OF_* is used unconditionally in
core parts of the system like powerpc/machdep.c. Reflect this reality
in files.powerpc, for example by changing occurrences of aim | fdt to
standard.

6 years agopkgbase: Fix post-install script for kernel packages
kevans [Wed, 14 Mar 2018 14:45:57 +0000 (14:45 +0000)]
pkgbase: Fix post-install script for kernel packages

kernel.ucl uses a hardcoded boot/kernel for kldxref, which is the incorrect
directory when we're installing extra kernels that aren't the "default"
kernel (placed at boot/kernel).

Fix this by instead using a new %KERNELDIR% that we now replace in
Makefile.inc1 with "kernel" for the default kernel and "kernel.${_kernel}"
for these extra kernels so that, e.g. /boot/kernel.SHIVA, will get properly
kldxref'd upon update and avoid outdated linker.hints.

Reviewed by: gjb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14689

6 years agoRemove stray ; at end of linux_vdso_deinstall()
emaste [Wed, 14 Mar 2018 13:20:36 +0000 (13:20 +0000)]
Remove stray ; at end of linux_vdso_deinstall()

6 years agoPowerNV: Fix I2C to compile if FDT is disabled
wma [Wed, 14 Mar 2018 09:20:03 +0000 (09:20 +0000)]
PowerNV: Fix I2C to compile if FDT is disabled

Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies

6 years agoUpdate to Zstandard 1.3.3
cem [Wed, 14 Mar 2018 03:00:17 +0000 (03:00 +0000)]
Update to Zstandard 1.3.3

Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin().
The issue is tracked upstream at https://github.com/facebook/zstd/pull/884 .
Otherwise, these are vanilla Zstandard 1.3.3 files.

Note that the 1.3.4 release should be due out soon.

Sponsored by: Dell EMC Isilon

6 years agoubldr: Bump heap size from 512K to 1M
kevans [Wed, 14 Mar 2018 02:35:49 +0000 (02:35 +0000)]
ubldr: Bump heap size from 512K to 1M

lualoader in itself only uses another ~200K, but there seems to be no reason
not to bump it a little higher to give us some more wiggle room.

With this, I can boot using a menu-enabled lualoader, no problem and
reasonably fast. Some heap usage datapoints from the review:

forthloader, no menus, kernel loaded:
heap base at 0x1203d5b0, top at 0x1208e000, used 330320

lualoader, no menus, kernel loaded:
heap base at 0x42050028, top at 0x420ab000, used 372696

lualoader, menus, kernel loaded:
heap base at 0x42050028, top at 0x420d5000, used 544728

Since then, the no menu case for lualoader should have decreased slightly as
I've made some changes to make sure that it no longer loads any of th emenu
bits with beastie disabled.

While here, split heap size out into a HEAP_SIZE macro.

Reviewed by: ian, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14471

6 years agocxgbetool(8): Add the ability to decode hardware TCBs.
np [Wed, 14 Mar 2018 00:04:58 +0000 (00:04 +0000)]
cxgbetool(8): Add the ability to decode hardware TCBs.

Obtained from: Chelsio Communications
MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoInstall files added in SVN's r295373, r295457, r295542
dteske [Tue, 13 Mar 2018 23:37:33 +0000 (23:37 +0000)]
Install files added in SVN's r295373, r295457, r295542

Reported by: woodsb02
MFC after: 3 days
X-MFC to: stable/11

6 years agoWe need opt_compat.h after r330819 and 330820.
imp [Tue, 13 Mar 2018 23:36:15 +0000 (23:36 +0000)]
We need opt_compat.h after r330819 and 330820.

Add opt_compat.h to fix the stand-alone build case.

Sponsored by: Netflix.

6 years agoSupport for TLS offload of TOE connections on T6 adapters.
jhb [Tue, 13 Mar 2018 23:05:51 +0000 (23:05 +0000)]
Support for TLS offload of TOE connections on T6 adapters.

The TOE engine in Chelsio T6 adapters supports offloading of TLS
encryption and TCP segmentation for offloaded connections.  Sockets
using TLS are required to use a set of custom socket options to upload
RX and TX keys to the NIC and to enable RX processing.  Currently
these socket options are implemented as TCP options in the vendor
specific range.  A patched OpenSSL library will be made available in a
port / package for use with the TLS TOE support.

TOE sockets can either offload both transmit and reception of TLS
records or just transmit.  TLS offload (both RX and TX) is enabled by
setting the dev.t6nex.<x>.tls sysctl to 1 and requires TOE to be
enabled on the relevant interface.  Transmit offload can be used on
any "normal" or TLS TOE socket by using the custom socket option to
program a transmit key.  This permits most TOE sockets to
transparently offload TLS when applications use a patched SSL library
(e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
library).  Receive offload can only be used with TOE sockets using the
TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
list of TCP port numbers.  Any connection with either a local or
remote port number in that list will be created as a TLS socket rather
than a plain TOE socket.  Note that although this sysctl accepts an
arbitrary list of port numbers, the sysctl(8) tool is only able to set
sysctl nodes to a single value.  A TLS socket will hang without
receiving data if used by an application that is not using a patched
SSL library.  Thus, the tls_rx_ports node should be used with care.
For a server mostly concerned with offloading TLS transmit, this node
is not needed as plain TOE sockets will fall back to software crypto
when using an unpatched SSL library.

New per-interface statistics nodes are added giving counts of TLS
packets and payload bytes (payload bytes do not include TLS headers or
authentication tags/MACs) offloaded via the TOE engine, e.g.:

dev.cc.0.stats.rx_tls_octets: 149
dev.cc.0.stats.rx_tls_records: 13
dev.cc.0.stats.tx_tls_octets: 26501823
dev.cc.0.stats.tx_tls_records: 1620

TLS transmit work requests are constructed by a new variant of
t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.

TLS transmit work requests require a buffer containing IVs.  If the
IVs are too large to fit into the work request, a separate buffer is
allocated when constructing a work request.  This buffer is associated
with the transmit descriptor and freed when the descriptor is ACKed by
the adapter.

Received TLS frames use two new CPL messages.  The first message is a
CPL_TLS_DATA containing the decryped payload of a single TLS record.
The handler places the mbuf containing the received payload on an
mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
which includes a copy of the TLS header and indicates if there were
any errors.  The handler for this message places the TLS header into
the socket buffer followed by the saved mbuf with the payload data.
Both of these handlers are contained in tom/t4_tls.c.

A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
including send_rx_credits(), a new send_rx_modulate(), and
t4_close_conn().

TLS keys for both transmit and receive are stored in onboard memory
in the NIC in the "TLS keys" memory region.

In some cases a TLS socket can hang with pending data available in the
NIC that is not delivered to the host.  As a workaround, TLS sockets
are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
any data is read from a TLS socket.  In addition, a fallback timer will
periodically send CPL_RX_DATA_ACK messages to the NIC for connections
that are still in the handshake phase.  Once the connection has
finished the handshake and programmed RX keys via the socket option,
the timer is stopped.

A new function select_ulp_mode() is used to determine what sub-mode a
given TOE socket should use (plain TOE, DDP, or TLS).  The existing
set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
handles initialization of TLS-specific state when necessary in
addition to DDP-specific state.

Since TLS sockets do not receive individual TCP segments but always
receive full TLS records, they can receive more data than is available
in the current window (e.g. if a 16k TLS record is received but the
socket buffer is itself 16k).  To cope with this, just drop the window
to 0 when this happens, but track the overage and "eat" the overage as
it is read from the socket buffer not opening the window (or adding
rx_credits) for the overage bytes.

Reviewed by: np (earlier version)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D14529

6 years agoFix typo that misteriously passes compilation.
glebius [Tue, 13 Mar 2018 22:54:29 +0000 (22:54 +0000)]
Fix typo that misteriously passes compilation.

6 years agoSimplify error handling in t4_tom.ko module loading.
jhb [Tue, 13 Mar 2018 21:42:38 +0000 (21:42 +0000)]
Simplify error handling in t4_tom.ko module loading.

- Change t4_ddp_mod_load() to return void instead of always returning
  success.  This avoids having to pretend to have proper support for
  unloading when only part of t4_tom_mod_load() has run.
- If t4_register_uld() fails, don't invoke t4_tom_mod_unload() directly.
  The module handling code in the kernel invokes MOD_UNLOAD on a module
  whose MOD_LOAD fails with an error already.

Reviewed by: np (part of a larger patch)
MFC after: 1 month
Sponsored by: Chelsio Communications

6 years agomd_pad is used by MDIOCLIST and not available for future use.
brooks [Tue, 13 Mar 2018 20:54:18 +0000 (20:54 +0000)]
md_pad is used by MDIOCLIST and not available for future use.

MFC after: 1 week

6 years agoDon't overflow the kernel struct mdio in the MDIOCLIST ioctl.
brooks [Tue, 13 Mar 2018 20:39:06 +0000 (20:39 +0000)]
Don't overflow the kernel struct mdio in the MDIOCLIST ioctl.

Always terminate the list with -1 and document the ioctl behavior.
This preserves existing behavior as seen from userspace with the
addition of the unconditional termination which will not be seen by
working consumers of MDIOCLIST.

Because this ioctl can only be performed by root (in default
configurations) and is not used in the base system this bug is not
deemed to warrant either a security advisory or an eratta notice.

Reviewed by: kib
Obtained from: CheriBSD
Discussed with: security-officer (gordon)
MFC after: 3 days
Security: kernel heap buffer overflow
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14685

6 years agoFix lint/igor warnings
dteske [Tue, 13 Mar 2018 20:35:32 +0000 (20:35 +0000)]
Fix lint/igor warnings

6 years agoFix typo and lint/igor warnings
dteske [Tue, 13 Mar 2018 20:31:07 +0000 (20:31 +0000)]
Fix typo and lint/igor warnings

6 years agoFix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.
brooks [Tue, 13 Mar 2018 19:56:10 +0000 (19:56 +0000)]
Fix ISP_FC_LIP and ISP_RESCAN on big-endian 64-bit systems.

For _IO() ioctls, addr is a pointer to uap->data which is a caddr_t.
When the caddr_t stores an int, dereferencing addr as an (int *) results
in truncation on little-endian 64-bit systems and corruption (owing to
extracting top bits) on big-endian 64-bit systems. In practice the
value of chan was probably always zero on systems of the latter type as
all such FreeBSD platforms use a register-based calling convention.

Reviewed by: mav
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14673