]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

6 years agoAdd "usbconfig dump_all_desc", a subcommand to dump all device and config
trasz [Tue, 13 Mar 2018 19:49:06 +0000 (19:49 +0000)]
Add "usbconfig dump_all_desc", a subcommand to dump all device and config
descriptors.

Reviewed by: hselasky@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoAdd a "jail" keyword to list the name of a jail rather than its ID.
jhb [Tue, 13 Mar 2018 18:30:26 +0000 (18:30 +0000)]
Add a "jail" keyword to list the name of a jail rather than its ID.

Inspired by: mwlucas
Reviewed by: jamie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14683

6 years agoRevert the chunk from r330410 in vm_page_reclaim_run().
kib [Tue, 13 Mar 2018 18:27:23 +0000 (18:27 +0000)]
Revert the chunk from r330410 in vm_page_reclaim_run().

There, the pages freed might be managed but the page's lock is not
owned.  For KPI correctness, the page lock is requried around the call
to vm_page_free_prep(), which is asserted.  Reclaim loop already did
the work which could be done by vm_page_free_prep(), so the lock is
not needed and the only consequence of not owning it is the assert
trigger.

Instead of adding the locking to satisfy the assert, revert to the
code that calls vm_page_free_phys() directly.

Reported by: pho
Discussed with: jeff
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoRestore missing temporary variable, deleted by accident in r330845. This
nwhitehorn [Tue, 13 Mar 2018 18:24:21 +0000 (18:24 +0000)]
Restore missing temporary variable, deleted by accident in r330845. This
unbreaks the ppc32 AIM build.

Reported by: jhibbits

6 years agoEFIRT: SetVirtualAddressMap with 1:1 mapping after exiting boot services
kevans [Tue, 13 Mar 2018 17:10:52 +0000 (17:10 +0000)]
EFIRT: SetVirtualAddressMap with 1:1 mapping after exiting boot services

This fixes a problem encountered on the Lenovo Thinkpad X220/Yoga 11e where
runtime services would try to inexplicably jump to other parts of memory
where it shouldn't be when attempting to enumerate EFI vars, causing a
panic.

The virtual mapping is enabled by default and can be disabled by setting
efi_disable_vmap in loader.conf(5).

Reviewed by: kib (earlier version)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14677

6 years agoUse C99 boolean type for translate_osrel
emaste [Tue, 13 Mar 2018 16:40:29 +0000 (16:40 +0000)]
Use C99 boolean type for translate_osrel

Migrate to modern types before creating MD Linuxolator bits for new
architectures.

Reviewed by: cem
Sponsored by: Turing Robotic Industries Inc.
Differential Revision: https://reviews.freebsd.org/D14676

6 years agoPrefer uintXX_t to u_intXX_t
imp [Tue, 13 Mar 2018 16:33:00 +0000 (16:33 +0000)]
Prefer uintXX_t to u_intXX_t

A foolish consistency is the hobgoblin of little minds, adored by
little statesmen and philosophers and divines. With consistency a
great soul has simply nothing to do. -- Ralph Waldo Emerson

6 years agoAdd some argument checks to be more user-friendly.
mav [Tue, 13 Mar 2018 15:29:13 +0000 (15:29 +0000)]
Add some argument checks to be more user-friendly.

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

6 years agoExecute PowerPC64/AIM kernel from direct map region when possible.
nwhitehorn [Tue, 13 Mar 2018 15:03:58 +0000 (15:03 +0000)]
Execute PowerPC64/AIM kernel from direct map region when possible.

When the kernel can be in real mode in early boot, we can execute from
high addresses aliased to the kernel's physical memory. If that high
address has the first two bits set to 1 (0xc...), those addresses will
automatically become part of the direct map. This reduces page table
pressure from the kernel and it sets up the kernel to be used with
radix translation, for which it has to be up here.

This is accomplished by exploiting the fact that all PowerPC kernels are
built as position-independent executables and relocate themselves
on start. Before this patch, the kernel runs at 1:1 VA:PA, but that
VA/PA is random and set by the bootloader. Very early, it processes
its ELF relocations to operate wherever it happens to find itself.
This patch uses that mechanism to re-enter and re-relocate the kernel
a second time witha new base address set up in the early parts of
powerpc_init().

Reviewed by: jhibbits
Differential Revision: D14647

6 years agoCorrect minor typo in comment, efi_dmcap -> efi_tmcap
kevans [Tue, 13 Mar 2018 15:02:46 +0000 (15:02 +0000)]
Correct minor typo in comment, efi_dmcap -> efi_tmcap

6 years agoefirtc: Pass a dummy tmcap pointer to efi_get_time_locked
kevans [Tue, 13 Mar 2018 15:01:23 +0000 (15:01 +0000)]
efirtc: Pass a dummy tmcap pointer to efi_get_time_locked

As noted in the comment, UEFI spec claims the capabilities pointer is
optional, but some implementations will choke and attempt to dereference it
without checking. This specific problem was found on a Lenovo Thinkpad X220
that would panic in efirtc_identify.

6 years agoUse C99 designated initializers for struct execsw
emaste [Tue, 13 Mar 2018 13:09:10 +0000 (13:09 +0000)]
Use C99 designated initializers for struct execsw

It it makes use slightly more clear and facilitates grepping.

6 years agobiosdisk.c should not set d_opendata.
tsoome [Tue, 13 Mar 2018 09:58:29 +0000 (09:58 +0000)]
biosdisk.c should not set d_opendata.

Same as 330807, d_opendata is owned by open_disk and we should not
set it.

M    stand/i386/libi386/biosdisk.c

6 years agoat_rtc: check in ACPI FADT boot flags if the RTC is present
royger [Tue, 13 Mar 2018 09:42:33 +0000 (09:42 +0000)]
at_rtc: check in ACPI FADT boot flags if the RTC is present

Or else disable the device. Note that the detection can be bypassed by
setting the hw.atrtc.enable option in the loader configuration file.
More information can be found on atrtc(4).

Sponsored by: Citrix Systems R&D
Reviewed by: ian
Differential revision: https://reviews.freebsd.org/D14399

6 years agovt_vga: check if VGA is available from ACPI FADT table
royger [Tue, 13 Mar 2018 09:38:53 +0000 (09:38 +0000)]
vt_vga: check if VGA is available from ACPI FADT table

On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
available or not.

Sponsored by: Citrix systems R&D
Reviewed by: marcel
Differential revision: https://reviews.freebsd.org/D14397

6 years agoAdd `nvmecontrol format` subcommand.
mav [Tue, 13 Mar 2018 03:02:09 +0000 (03:02 +0000)]
Add `nvmecontrol format` subcommand.

It allows to change namespace parameters, such as block size, metadata,
protection information, etc. and/or erase the data.

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

6 years agolualoader: Sprinkle some verbose_loading salt
kevans [Tue, 13 Mar 2018 02:59:13 +0000 (02:59 +0000)]
lualoader: Sprinkle some verbose_loading salt

Our module loading messages should be hidden without verbose_loading -- go
ahead and do that as a first step.

6 years agoApply some style(9) to Linuxulator linux_sysvec.c comments
emaste [Tue, 13 Mar 2018 00:40:05 +0000 (00:40 +0000)]
Apply some style(9) to Linuxulator linux_sysvec.c comments

6 years agoimgact_linux.c: use standard indentation
emaste [Mon, 12 Mar 2018 23:28:25 +0000 (23:28 +0000)]
imgact_linux.c: use standard indentation

Sponsored by: Turing Robotic Industries Inc.

6 years agoUse the stack for temporary storage in OTIOCCONS.
brooks [Mon, 12 Mar 2018 23:04:42 +0000 (23:04 +0000)]
Use the stack for temporary storage in OTIOCCONS.

The old code used the thread's pcb via the uap->data pointer.

Reviewed by: ed
Approved by: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14674

6 years agoReject ioctls to SCSI enclosures from 32-bit compat processes.
brooks [Mon, 12 Mar 2018 23:02:01 +0000 (23:02 +0000)]
Reject ioctls to SCSI enclosures from 32-bit compat processes.

The ioctl objects contain pointers and require translation and some
refactoring of the infrastructure to work. For now prevent opertion
on garbage values. This is very slightly overbroad in that ENCIOC_INIT
is safe.

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

6 years agoReject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.
brooks [Mon, 12 Mar 2018 22:58:07 +0000 (22:58 +0000)]
Reject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.

These take a union ccb argument which is full of kernel pointers.
Substantial translation efforts would be required to make this work.
By rejecting the request we avoid processing or returning entierly
wrong data.

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

6 years agoMIPS: Implement fue*word* and casueword* in assembly.
brooks [Mon, 12 Mar 2018 22:10:06 +0000 (22:10 +0000)]
MIPS: Implement fue*word* and casueword* in assembly.

Remove NO_FUEWORD so the 'e' variants are wrapped by the non-'e'
variants.  This is more correct and leaves sparc64 as the outlier.

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

6 years agoPrint the load and device path as well as BootCurrent and BootOrder
imp [Mon, 12 Mar 2018 21:40:24 +0000 (21:40 +0000)]
Print the load and device path as well as BootCurrent and BootOrder

Sponsored by: Netflix

6 years agoStar BootCurrent entry when booting.
imp [Mon, 12 Mar 2018 21:40:19 +0000 (21:40 +0000)]
Star BootCurrent entry when booting.

Sponsored by: Netflix

6 years agoMove the env convenience routines out of boot1.c.
imp [Mon, 12 Mar 2018 21:40:14 +0000 (21:40 +0000)]
Move the env convenience routines out of boot1.c.

These routines are more generally useful. Even though boot1 is on its
way out, it's better to make these common during the transition than
copy them.

6 years agoUse the one-line-per-file pattern here, and sort the file names.
imp [Mon, 12 Mar 2018 21:40:09 +0000 (21:40 +0000)]
Use the one-line-per-file pattern here, and sort the file names.

Sponsored by: Netflix

6 years agoGC unused routines.
imp [Mon, 12 Mar 2018 21:40:05 +0000 (21:40 +0000)]
GC unused routines.

Sponsored by: Netflix

6 years agoRemove d_type from devdesc. It's not needed as we can fetch it from
imp [Mon, 12 Mar 2018 21:39:59 +0000 (21:39 +0000)]
Remove d_type from devdesc. It's not needed as we can fetch it from
d_dev->dv_type when we need it.

6 years agoUse the actual struct devdesc at the start of all *_devdesc structs
imp [Mon, 12 Mar 2018 21:39:49 +0000 (21:39 +0000)]
Use the actual struct devdesc at the start of all *_devdesc structs

The current system is fragile and requires very careful layout of all
*_devdesc structures. It also makes it hard to change the base
devdesc. Take a page from CAM and put the 'header' in all the derived
classes and adjust the code to match.

For OFW, move the iHandle h_handle out of a slot conflicting with
d_opendata. Due to quirks in the alignment rules, this worked.
However changing the code to use d_opendata storage now that it's a
pointer is hard, so just have a separate field for it.

All other cleanups were to make the *_devdesc structures match where
they'd taken some liberties that were none-the-less compatible enough
to work.

6 years agoMake struct libi386_devdesc match the struct devdesc better
imp [Mon, 12 Mar 2018 21:39:42 +0000 (21:39 +0000)]
Make struct libi386_devdesc match the struct devdesc better

Move data to top and call it d_opendata.

6 years agoWe can't use d_opendata for blkio storage.
imp [Mon, 12 Mar 2018 21:39:38 +0000 (21:39 +0000)]
We can't use d_opendata for blkio storage.

open_disk uses d_opendata for it's own purpse. We can't store blkio
there. Fortunately, blkio is stored elsewhere and we never actually
retrieve blkio from d_opendata. Eliminate it as a source of confusion.
Eliminate all stores of d_opendata in efi since this layer doesn't own
that field.

6 years agoMinor cosmetic changes.
imp [Mon, 12 Mar 2018 21:39:27 +0000 (21:39 +0000)]
Minor cosmetic changes.

Make sure { on the same line as struct for all struct *devdesc.  Move
some type definitions to next to the dv_type define, since that's what
sets the d_type.

6 years agoe1000g: this statement may fall through
tsoome [Mon, 12 Mar 2018 17:05:53 +0000 (17:05 +0000)]
e1000g: this statement may fall through

The gcc 7 does check for switch statement fall through cases, and if legit,
such complaint can besilenced by /* FALLTHROUGH */ comment. Unfortunately
such comment is quite limited, but will still notify the reader.

This patch is backport from illumos, see
https://www.illumos.org/rb/r/941/

Reviewed by: eadler
Differential Revision: https://reviews.freebsd.org/D14663

6 years agoPrint fuses and fna fields in identify data.
mav [Mon, 12 Mar 2018 16:31:25 +0000 (16:31 +0000)]
Print fuses and fna fields in identify data.

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

6 years agoANSIfy sys/kern/imgact_*
emaste [Mon, 12 Mar 2018 15:45:50 +0000 (15:45 +0000)]
ANSIfy sys/kern/imgact_*

6 years agoLinuxulator: apply style(9) to return
emaste [Mon, 12 Mar 2018 15:35:24 +0000 (15:35 +0000)]
Linuxulator: apply style(9) to return

Sponsored by: Turing Robotic Industries Inc.

6 years agoGive the atrtc_time_lock a unique name.
ian [Mon, 12 Mar 2018 15:26:11 +0000 (15:26 +0000)]
Give the atrtc_time_lock a unique name.

Reported by: hps@

6 years agoTighten up periph lock to avoid some races
imp [Mon, 12 Mar 2018 15:17:16 +0000 (15:17 +0000)]
Tighten up periph lock to avoid some races

Make sure the periph lock is held around rmw access to softc data,
espeically flags, including work flags in iosched.
Add asserts for the periph lock where it should be held.

PR: 226510
Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D14456

6 years agoThe vmresult table was missing most of the values apart from two due to
bz [Mon, 12 Mar 2018 13:32:51 +0000 (13:32 +0000)]
The vmresult table was missing most of the values apart from two due to
extra "_" in the names we grep for. Add the "_" to the pattern.

Reviewed by: jhb
MFC after: 3 days
Sponsored by: iXsystems, Inc.