]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r334363: elfdump: chase ABI tag note name change from r232832
emaste [Tue, 19 Jun 2018 17:11:53 +0000 (17:11 +0000)]
MFC r334363: elfdump: chase ABI tag note name change from r232832

r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag.
Follow suit in elfdump.

Elfdump's note parsing is very basic and should be significantly
reworked, but for now just restore the broken functionality.

PR: 228290
Submitted by: martin at lispworks.com

5 years agoMFC r334993:
hselasky [Tue, 19 Jun 2018 11:06:36 +0000 (11:06 +0000)]
MFC r334993:
Implement the ip_eth_mc_map() function in the LinuxKPI.

Sponsored by: Mellanox Technologies

5 years agoMFC r333895, r334022
cy [Mon, 18 Jun 2018 19:35:17 +0000 (19:35 +0000)]
MFC r333895, r334022

r333895:
Drop obsolete Buenos Aires Convention.

Prompted by: Recent discussion

r334022:
Drop obsolete Buenos Aires Convention.

5 years agoMFC r335034:
dim [Sun, 17 Jun 2018 17:38:24 +0000 (17:38 +0000)]
MFC r335034:

Fix build of liquidio with base gcc on i386

Some casts from pointers to uint64_t and back in lio_main.c cause base
gcc on i386 to warn "cast from pointer to integer of different size",
and vice versa.  Add additional casts to uintptr_t to suppress these.

Reviewed by: sbruno
Differential Revision: https://reviews.freebsd.org/D15754

5 years agoMFC r334947:
dim [Sun, 17 Jun 2018 17:35:30 +0000 (17:35 +0000)]
MFC r334947:

Disable building aesni with base gcc

Because base gcc does not support the required intrinsics, do not
attempt to compile the aesni module with it.

Noticed by: Dan Allen <danallen46@gmail.com>

5 years agoMFC r334945:
dim [Sun, 17 Jun 2018 17:32:32 +0000 (17:32 +0000)]
MFC r334945:

Fix build of ocs_fs with base gcc on i386

Add a few intermediate casts to uintptr_t to suppress "cast to pointer
from integer of different size" warnings from gcc.  Also remove a few
incorrect casts.

Reviewed by: ram
Differential Revision: https://reviews.freebsd.org/D15747

5 years agoMFC r334948:
dim [Sun, 17 Jun 2018 17:28:27 +0000 (17:28 +0000)]
MFC r334948:

Fix build of bxe with base gcc on i386

Casting from rman_res_t to a pointer results in "cast to pointer from
integer of different size" warnings with base gcc on i386, so print
these without casting.  The kva field of struct bxe_bar is of type
vm_offset_t, which can be 32 or 64 bit, so cast it to uintmax_t before
printing.

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

5 years agoMFC r334946:
dim [Sun, 17 Jun 2018 17:24:57 +0000 (17:24 +0000)]
MFC r334946:

Fix build of i915kms with base gcc

Base gcc fails to compile sys/dev/drm2/i915/intel_display.c for i386,
with the following -Werror warnings:

cc1: warnings being treated as errors
/usr/src/sys/dev/drm2/i915/intel_display.c:8884: warning:
initialization from incompatible pointer type

This is due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36432, which
incorrectly interprets the [] as a flexible array member.

Because base gcc does not have a -W flag to suppress this particular
warning, it requires a rather ugly cast.  To not influence any other
compiler, put it in a #if/#endif block.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D15744

6 years agoMFC r334876:
kp [Sat, 16 Jun 2018 09:32:05 +0000 (09:32 +0000)]
MFC r334876:

pf: Fix deadlock with route-to

If a locally generated packet is routed (with route-to/reply-to/dup-to) out of
a different interface it's passed through the firewall again. This meant we
lost the inp pointer and if we required the pointer (e.g. for user ID matching)
we'd deadlock trying to acquire an inp lock we've already got.

Pass the inp pointer along with pf_route()/pf_route6().

PR: 228782

6 years agoMFC r325560:
bdrewery [Fri, 15 Jun 2018 15:10:21 +0000 (15:10 +0000)]
MFC r325560:

  META_MODE: Bmake 20171028 in r325340 simplifies the meta filename.

6 years agoMFC r334791,r334811:
bdrewery [Fri, 15 Jun 2018 15:05:00 +0000 (15:05 +0000)]
MFC r334791,r334811:

  r334791:
    Stop using head(1) which is not available in installworld.
  r334811:
    Use simpler sed invocation.

6 years agoMFC r330702:
bdrewery [Fri, 15 Jun 2018 15:01:59 +0000 (15:01 +0000)]
MFC r330702:

  LIB32: Avoid linking in unneeded (and invalid lib32) libz for libmagic build
  tool.

6 years agoMFC r334506:
markj [Fri, 15 Jun 2018 08:59:24 +0000 (08:59 +0000)]
MFC r334506:
Avoid completing I/O when dumping core after a panic.

6 years agoMFC r335089:
kib [Thu, 14 Jun 2018 18:50:49 +0000 (18:50 +0000)]
MFC r335089:
Enable eager FPU context switch on i386.
CVE: CVE-2018-3665

MFC r335131
Remove printf() in #NM handler.

MFC r335132:
Reorganize code flow in fpudna()/npxdna().

Early MFC approved by: re (gjb)

6 years agoMFC r325794, r325838 (by imp):
mav [Thu, 14 Jun 2018 18:18:55 +0000 (18:18 +0000)]
MFC r325794, r325838 (by imp):
Provide link speed data in XPT_GET_TRAN_SETTINGS. Provide full version
information for that and XPT_PATH_INQ. Provide macros to encode/decode
major/minor versions.  Read the link speed and lane count to compute
the base_transfer_speed for XPT_PATH_INQ.

6 years agoMFC r333180: Fix LOR between controller and queue locks.
mav [Thu, 14 Jun 2018 17:09:33 +0000 (17:09 +0000)]
MFC r333180: Fix LOR between controller and queue locks.

Admin pass-through requests took controller lock before the queue lock,
but in case of request submission to a failed controller controller lock
was taken after the queue lock.  Fix that by reducing the lock scopes and
switching to mtx_pool locks to track pass-through request completion.

6 years agoMFC r333130: Improve nvme(4) attach/detach sequences.
mav [Thu, 14 Jun 2018 17:06:19 +0000 (17:06 +0000)]
MFC r333130: Improve nvme(4) attach/detach sequences.

This change allows clean device detach on attach failures and driver unload,
while previous code tried to talk to already shut down controller, or even
accessed resources failed to allocate.

6 years agoMFC r333127: Fix use-after-free in nvme_qpair_destroy().
mav [Thu, 14 Jun 2018 17:02:58 +0000 (17:02 +0000)]
MFC r333127: Fix use-after-free in nvme_qpair_destroy().

dma_tag_payload should not be destroyed before payload_dma_map, and seems
it should be used there instead of dma_tag to match creation.

6 years agoMFC r332897 (by imp), r333123:
mav [Thu, 14 Jun 2018 16:58:03 +0000 (16:58 +0000)]
MFC r332897 (by imp), r333123:
Migrate to make_dev_s interface to populate /dev/nvmeX entries

6 years agoMFC r331046 (by imp): Try polling the qpairs on timeout.
mav [Thu, 14 Jun 2018 16:51:39 +0000 (16:51 +0000)]
MFC r331046 (by imp): 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.

6 years agoMFC r330954, r330955 (by imp):
mav [Thu, 14 Jun 2018 16:19:05 +0000 (16:19 +0000)]
MFC r330954, r330955 (by imp):
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.

6 years agoMFC r330953 (by imp): Don't make the namespace devices eternal.
mav [Thu, 14 Jun 2018 15:02:27 +0000 (15:02 +0000)]
MFC r330953 (by imp): 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.

6 years agoMFC r328089 (by imp):
mav [Thu, 14 Jun 2018 14:58:51 +0000 (14:58 +0000)]
MFC r328089 (by imp):
Move setting of CAM_SIM_QUEUED to before we actually submit it to the
hardware. Setting it after is racy, and we can lose the race on a
heavily loaded system.

6 years agoMFC r313954 (by imp): Remove obsolete comment after prior rev.
mav [Thu, 14 Jun 2018 14:50:30 +0000 (14:50 +0000)]
MFC r313954 (by imp): Remove obsolete comment after prior rev.

6 years agoMFC r311351 (by rpokala):
mav [Thu, 14 Jun 2018 14:46:20 +0000 (14:46 +0000)]
MFC r311351 (by rpokala):
In the same vein as r311350, fix whitespace in handling of XPT_PATH_INQ in
several more drivers.

6 years agoMFC r311350 (by rpokala):
mav [Thu, 14 Jun 2018 14:45:08 +0000 (14:45 +0000)]
MFC r311350 (by rpokala):
Fix whitespace in handling of XPT_PATH_INQ in adw(4).

Came across this while doing some other minor CAM cleanup. Whitespace-only
change, so not bothering w/ a review.

6 years agoMFC r335072:
kib [Wed, 13 Jun 2018 21:10:33 +0000 (21:10 +0000)]
MFC r335072:
Enable eager FPU context switch by default on amd64.

Security: CVE-2018-3665

6 years agoMFC r334886:
dim [Wed, 13 Jun 2018 20:35:56 +0000 (20:35 +0000)]
MFC r334886:

Add missed libc++ entries to (Optional)ObsoleteFiles.inc

Some of these were removed during the libc++ 5.0.0 import, others were
added in the libc++ 6.0.0 import.

6 years agoFix build of si with base gcc on i386
dim [Wed, 13 Jun 2018 20:33:52 +0000 (20:33 +0000)]
Fix build of si with base gcc on i386

Casting from rman_res_t to a pointer results in "cast to pointer from
integer of different size" warnings with base gcc on i386, so use
intermediate casts to uintptr_t to suppress these.

Direct commit to stable/11, since si(4) has been removed from head.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D15752

6 years agoMFC r309925, r309931, r309933, r310035, r310278, r310310, r310311,
ed [Wed, 13 Jun 2018 13:41:23 +0000 (13:41 +0000)]
MFC r309925, r309931, r309933, r310035, r310278, r310310, r310311,
    r310323, r310349, r310350, r310351, r310352, r310383, r310384,
    r310385, r310386, r310393, r310453, r310456, r310494, r310504,
    r310528, r310890, r310893, r310974, r311918, r312921, r313357,
    r314563, r314585, r314642, r315322, r315618, r315620, r315622,
    r315643, r316951, r316973, r326338, r326339, r326573, r331270,
    r332099, r332110, r332111, r332118, r332165, r332510 and r332511.

This commit brings syslogd(8) in sync with the copy in HEAD. The key
improvement of this change is that it adds support for RFC 5424 log
ingestion and exposition (enabled by passing in -O rfc5424). This allows
for saner logging in environments with multiple time zones.

The list of changes to merge back were obtained by running:

    svn mergeinfo --show-revs eligible \
        ^/head/usr.sbin/syslogd ^/stable/11/usr.sbin/syslogd

Of the commits listed, r314436, r325188 and r326025 were excluded, as
they affect a significant number of unrelated files (SPDX and 4-clause
license renumbering). Due to the large number of directly committed
changes on this branch, I had no choice but to perform the merge as
follows:

    svn merge --accept=theirs-full -c <list of revisions> ^/head .

This would, however, cause some unrelated changes, such as undoing the
r333356 (MFC of r332877) and still adding the SPDX tag to syslogd.c.
These have been reverted manually.

Requested by: Dave Cottlehuber
Thanks to: dim@ for sharing his insight on hackers@

6 years agoMFC r334726:
kp [Wed, 13 Jun 2018 13:15:04 +0000 (13:15 +0000)]
MFC r334726:

pf: Return non-zero from 'status' if pf is not enabled

In the pf rc.d script the output of `/etc/rc.d/pf status` or `/etc/rc.d/pf
onestatus` always provided an exit status of zero. This made it fiddly to
programmatically determine if pf was running or not.

Return a non-zero status if the pf module is not loaded, extend pfctl to have
an option to return an error status if pf is not enabled.

PR: 228632
Submitted by: James Park-Watt <jimmypw AT gmail.com>

6 years agoMFC r334875:
ae [Wed, 13 Jun 2018 07:17:10 +0000 (07:17 +0000)]
MFC r334875:
  Explicitly change the link state when we assingn an address.

  Since we are setting IFF_UP flag on SIOCSIFADDR, it is possible, that
  after this link state information still not initialized properly.
  This leads to problems with routing, since now interface has
  IFCAP_LINKSTATE capability and a route is considered as working only
  when interface's link state is in LINK_STATE_UP (see RT_LINK_IS_UP()
  macro).

6 years agoMFC r334707:
ae [Wed, 13 Jun 2018 07:16:01 +0000 (07:16 +0000)]
MFC r334707:
  Use m_copyback() function to write delayed checksum when it isn't located
  in the first mbuf of the chain.

6 years agoMFC r334324:
ae [Wed, 13 Jun 2018 07:14:34 +0000 (07:14 +0000)]
MFC r334324:
  Remove empty encap_init() function.

6 years agoMFC r333374:
gjb [Mon, 11 Jun 2018 17:22:27 +0000 (17:22 +0000)]
MFC r333374:
 Use vYYYYMMDD in the timestamp suffix for Google Compute Engine
 snapshot images for consistency with other OSes.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r334505:
markj [Mon, 11 Jun 2018 15:44:53 +0000 (15:44 +0000)]
MFC r334505:
Don't export _end on arm64 and riscv.

6 years agoMFC r334504:
markj [Mon, 11 Jun 2018 15:44:02 +0000 (15:44 +0000)]
MFC r334504:
Remove an inaccuracy from mincore.2.

6 years agoMFC r334101:
markj [Mon, 11 Jun 2018 15:43:28 +0000 (15:43 +0000)]
MFC r334101:
Add GET_STACK_USAGE() for arm64.

6 years agoMFC r334656, r334665, r334695
ian [Sun, 10 Jun 2018 22:26:15 +0000 (22:26 +0000)]
MFC r334656, r334665, r334695

r334656:
Add vsnprintf() to libsa.  Alpha-sort the printf prototypes in stand.h.

r334665:
Make the v*printf() functions in libsa return int instead of void.
This makes them compatible with the C standard signatures, avoiding
spurious mismatch errors in the places where the oddball requirements
of standalone code end up putting two declarations of the same function
in play.

r334695:
Remove comments and assertions that are no longer valid after r330809.

r330809 replaced duplication of devdesc struct fields with an embedded copy
of the devdesc struct, to avoid fragility.  That means all the scattered
comments indicating that structs must match are no longer valid.  Likewise
asserts that attempted to mitigate some of the old fragility.

Reviewed by: imp@

6 years agoIssue:
ram [Sat, 9 Jun 2018 04:05:18 +0000 (04:05 +0000)]
Issue:
     Utility hangs when  OCS_IOCTL_CMD_MGMT_GET_ALL called in parallel on port 0 and port 1.

  Fix: Using static structure for results is corrupting the second ioctl request. Removed static for results structure.

Approved by: ken

6 years agoMFC r334091:
eadler [Sat, 9 Jun 2018 03:01:38 +0000 (03:01 +0000)]
MFC r334091:

md5: perform compare case-insenstive

md5 generates a md5 hash lowercase, but it might be provided in
uppercase. Allow this.

PR:           205598
Reported by:  ohauer
MFC After:    2 weeks

6 years agoMFC r333403:
ae [Fri, 8 Jun 2018 10:09:30 +0000 (10:09 +0000)]
MFC r333403:
  Bring in some last changes in NAT64 implementation:

  o Modify ipfw(8) to be able set any prefix6 not just Well-Known,
    and also show configured prefix6;
  o relocate some definitions and macros into proper place;
  o convert nat64_debug and nat64_allow_private variables to be
    VNET-compatible;
  o add struct nat64_config that keeps generic configuration needed
    to NAT64 code;
  o add nat64_check_prefix6() function to check validness of specified
    by user IPv6 prefix according to RFC6052;
  o use nat64_check_private_ip4() and nat64_embed_ip4() functions
    instead of nat64_get_ip4() and nat64_set_ip4() macros. This allows
    to use any configured IPv6 prefixes that are allowed by RFC6052;
  o introduce NAT64_WKPFX flag, that is set when IPv6 prefix is
    Well-Known IPv6 prefix. It is used to reduce overhead to check this;
  o modify nat64lsn_cfg and nat64stl_cfg structures to use nat64_config
    structure. And respectivelly modify the rest of code;
  o remove now unused ro argument from nat64_output() function;
  o remove __FreeBSD_version ifdef, NAT64 was not merged to older versions;
  o add commented -DIPFIREWALL_NAT64_DIRECT_OUTPUT flag to module's Makefile
    as example.

MFC r333406:
  Update NAT64 documentation, now we support any IPv6 prefixes.

6 years agoMFC r333400:
ae [Fri, 8 Jun 2018 09:52:49 +0000 (09:52 +0000)]
MFC r333400:
  Add IFCAP_LINKSTATE support to if_loop(4).

6 years agoMFC r334725:
tuexen [Thu, 7 Jun 2018 17:43:31 +0000 (17:43 +0000)]
MFC r334725:

Improve compliance with RFC 4895 and RFC 6458.

Silently dicard SCTP chunks which have been requested to be
authenticated but are received unauthenticated no matter if support
for SCTP authentication has been negotiated. This improves compliance
with RFC 4895.

When the application uses the SCTP_AUTH_CHUNK socket option to
request a chunk to be received in an authenticated way, enable
the SCTP authentication extension for the end-point. This improves
compliance with RFC 6458.

Discussed with: Peter Lei
Approved by: re (gjb, early MFC)

6 years agoMFC: r334443 (by cem@)
marius [Thu, 7 Jun 2018 15:03:47 +0000 (15:03 +0000)]
MFC: r334443 (by cem@)

dhclient(8): allow to supersede interface-mtu option

In some cases broken DHCP servers might send invalid MTU value, so allow to
use 'supersede' in dhclient.conf to override this. When superseded value is
0, MTU value is not updated at all.

PR: 206721
Submitted by: novel@
Reported by: <jimp AT pfsense.org>
Relnotes: yes (potentially surprising behavior change w/ broken dhcpd mtu)
Differential Revision: https://reviews.freebsd.org/D15484

6 years agoMFC r334594: dwatch(1): Update manual to reference actual release
dteske [Thu, 7 Jun 2018 13:06:56 +0000 (13:06 +0000)]
MFC r334594: dwatch(1): Update manual to reference actual release

Sponsored by: Smule, Inc.

6 years agoMFC r334445:
dim [Thu, 7 Jun 2018 09:03:42 +0000 (09:03 +0000)]
MFC r334445:

Resolve conflicts between macros in fenv.h and ieeefp.h

This is a follow-up to r321483, which disabled -Wmacro-redefined for
some lib/msun tests.

If an application included both fenv.h and ieeefp.h, several macros such
as __fldcw(), __fldenv() were defined in both headers, with slightly
different arguments, leading to conflicts.

Fix this by putting all the common macros in the machine-specific
versions of ieeefp.h.  Where needed, update the arguments in places
where the macros are invoked.

This also slightly reduces the differences between the amd64 and i386
versions of ieeefp.h.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D15633

6 years agoMFC r334429:
hselasky [Thu, 7 Jun 2018 07:49:18 +0000 (07:49 +0000)]
MFC r334429:
Implement support for the PCI_BUS_NUM() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334428:
hselasky [Thu, 7 Jun 2018 07:48:26 +0000 (07:48 +0000)]
MFC r334428:
Implement support for the kvmalloc_array() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334427:
hselasky [Thu, 7 Jun 2018 07:47:32 +0000 (07:47 +0000)]
MFC r334427:
Correct macroname in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334426:
hselasky [Thu, 7 Jun 2018 07:46:39 +0000 (07:46 +0000)]
MFC r334426:
Define __initconst in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334425:
hselasky [Thu, 7 Jun 2018 07:45:49 +0000 (07:45 +0000)]
MFC r334425:
Implement bitmap_complement() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334423:
hselasky [Thu, 7 Jun 2018 07:44:54 +0000 (07:44 +0000)]
MFC r334423:
Implement idr_is_empty() in the LinuxKPI and make idr_remove() API compatible
with upstream Linux by returning the pointer to the removed element.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334422:
hselasky [Thu, 7 Jun 2018 07:43:58 +0000 (07:43 +0000)]
MFC r334422:
Correct argument for evdev_push_rel().

This is a regression issue after r319162.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334320 and r334328:
hselasky [Thu, 7 Jun 2018 07:42:48 +0000 (07:42 +0000)]
MFC r334320 and r334328:

Implement atomic_add_64() and atomic_subtract_64() for the i386 target.

While at it add missing _acq_ and _rel_ variants for 64-bit atomic
operations under i386.

Reviewed by: kib @
Sponsored by: Mellanox Technologies

6 years agoMFC r334283:
hselasky [Thu, 7 Jun 2018 07:38:37 +0000 (07:38 +0000)]
MFC r334283:
The schedule_timeout_killable() function should listen for signals
in the LinuxKPI.

Found by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334281:
hselasky [Thu, 7 Jun 2018 07:37:38 +0000 (07:37 +0000)]
MFC r334281:
Implement wait_event_killable() in the LinuxKPI.

Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334280:
hselasky [Thu, 7 Jun 2018 07:36:44 +0000 (07:36 +0000)]
MFC r334280:
Allow TASK_PARKED bit being set when going to sleep in the LinuxKPI.

Found by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMFC r334158:
hselasky [Thu, 7 Jun 2018 07:32:51 +0000 (07:32 +0000)]
MFC r334158:
Add function to wait for USB ethernet attach to complete.

Sponsored by: Mellanox Technologies

6 years agoMFC r333311:
pfg [Wed, 6 Jun 2018 22:29:21 +0000 (22:29 +0000)]
MFC r333311:
msdosfs: use vfs_timestamp() to generate timestamps instead of getnanotime().

Most filesystems, with the notable exceptions of msdosfs and autofs use
only vfs_timestamp() to read the current time. This has the benefit of
configurable granularity (using the vfs.timestamp_precision sysctl).

For convenience, use it on msdosfs too.

Submitted by: Damjan Jovanovic

6 years agoMFC: r333580
rmacklem [Wed, 6 Jun 2018 22:02:20 +0000 (22:02 +0000)]
MFC: r333580
Fix a slow leak of session structures in the NFSv4.1 server.

For a fairly rare case of a client doing an ExchangeID after a hard reboot,
the old confirmed clientid still exists, but some clients use a new
co_verifier. For this case, the server was not freeing up the sessions on
the old confirmed clientid.
This patch fixes this case. It also adds two LIST_INIT() macros, which are
actually no-ops, since the structure is malloc()d with M_ZERO so the pointer
is already set to NULL.
It should have minimal impact, since the only way I could exercise this
code path was by doing a hard power cycle (pulling the plus) on a machine
running Linux with a NFSv4.1 mount on the server.
Originally spotted during testing of the ESXi 6.5 client.

PR: 228497

6 years agoMFC r334532:
tuexen [Wed, 6 Jun 2018 20:03:35 +0000 (20:03 +0000)]
MFC r334532:

Don't overflow a buffer if we receive an INIT or INIT-ACK chunk
without a RANDOM parameter but with a CHUNKS or HMAC-ALGO parameter.
Please note that sending this combination violates the specification.

Thanks to Ronald E. Crane for reporting the issue for the userland
stack.

6 years agoMFC r334497:
tuexen [Wed, 6 Jun 2018 20:02:05 +0000 (20:02 +0000)]
MFC r334497:

Limit the retransmission timer for SYN-ACKs by TCPTV_REXMTMAX.

Use the same logic to handle the SYN-ACK retransmission when sent from
the syn cache code as when sent from the main code.

Sponsored by: Netflix, Inc.

6 years agoMFC r334494:
tuexen [Wed, 6 Jun 2018 20:00:21 +0000 (20:00 +0000)]
MFC r334494:

Ensure net.inet.tcp.syncache.rexmtlimit is limited by TCP_MAXRXTSHIFT.

If the sysctl variable is set to a value larger than TCP_MAXRXTSHIFT+1,
the array tcp_syn_backoff[] is accessed out of bounds.

Discussed with: jtl@
Sponsored by: Netflix, Inc.

6 years agoMFC r333603:
tuexen [Wed, 6 Jun 2018 19:56:19 +0000 (19:56 +0000)]
MFC r333603:

Ensure that the MTU's used are multiple of 4.

The length of SCTP packets is always a multiple of 4. Therefore,
ensure that the MTUs used are also a multiple of 4.

Thanks to Irene Ruengeler for providing an earlier version of this
patch.

MFC r334286:

Use correct mask.
Introduced in https://svnweb.freebsd.org/changeset/base/333603.
Thanks to Irene Ruengler for testing and reporting the issue.

6 years agoMFC r333304:
tuexen [Wed, 6 Jun 2018 19:51:55 +0000 (19:51 +0000)]
MFC r333304:

Ensure we are not dereferencing a NULL pointer.

CID: 1385266

6 years agoMFC r333178:
tuexen [Wed, 6 Jun 2018 19:48:39 +0000 (19:48 +0000)]
MFC r333178:

Simplify the call to tcp_drop(), since the handling of soft error
is also done in tcp_drop(). No functional change.

Sponsored by: Netflix, Inc.

6 years agoMFC: r334396
rmacklem [Wed, 6 Jun 2018 01:21:33 +0000 (01:21 +0000)]
MFC: r334396
Strengthen locking for the NFSv4.1 server DestroySession operation.

If a client did a DestroySession on a session while it was still in use,
the server might try to use the session structure after it is free'd.
I think the client has violated RFC5661 if it does this, but this patch
makes DestroySession block all other nfsd threads so no thread could
be using the session when it is free'd. After the DestroySession, nfsd
threads will not be able to find the session. The patch also adds a check
for nd_sessionid being set, although if that was not the case it would have
been all 0s and unlikely to have a false match.
This might fix the crashes described in PR#228497 for the FreeNAS server.

PR: 228497

6 years agoMFC r334389:
markj [Wed, 6 Jun 2018 00:59:43 +0000 (00:59 +0000)]
MFC r334389:
Typo.

PR: 228533

6 years agoMFC r334031:
kib [Tue, 5 Jun 2018 13:53:37 +0000 (13:53 +0000)]
MFC r334031:
Implement printf(3) family %m format string extension.

6 years agoMFC r333577:
kib [Tue, 5 Jun 2018 13:46:18 +0000 (13:46 +0000)]
MFC r333577:
Add implementations for clog(3), clogf(3), and clogl(3).

PR: 216863

6 years agoMFC: r334252
rmacklem [Mon, 4 Jun 2018 20:47:37 +0000 (20:47 +0000)]
MFC: r334252
Fix the sleep event for layout recall.

The sleep for I/O completion during an NFSv4.1 pNFS layout recall used
the wrong event value and could result in the "[nfscl]" thread hung
for the mount.
This patch fixes the event to be the correct.
This bug will only affect NFSv4.1 pnfs mounts and only when the server
does a layout recall callback, so it won't affect many. Without the patch,
a mount without the "pnfs" option will avoid the problem.
Found during testing of the pNFS server.

6 years agoMFC: r333592
rmacklem [Mon, 4 Jun 2018 20:21:51 +0000 (20:21 +0000)]
MFC: r333592
Fix the eir_server_scope reply argument for NFSv4.1 ExchangeID.

In the reply to an ExchangeID operation, the NFSv4.1 server returns a
"scope" value (eir_server_scope). If this value is the same, it indicates
that two servers share state, which is never the case for FreeBSD servers.
As such, the value needs to be unique and it was without this patch.
However, I just found out that it is not supposed to change when the
server reboots and without this patch, it did change.
This patch fixes eir_server_scope so that it does not change when the
server is rebooted.
The only affect not having this patch has is that Linux clients don't
reclaim opens and locks after a server reboot, which meant they lost
any byte range locks held before the server rebooted.
It only affects NFSv4.1 mounts and the FreeBSD NFSv4.1 client was not
affected by this bug.

6 years agoMFC r319792:
markj [Mon, 4 Jun 2018 14:23:04 +0000 (14:23 +0000)]
MFC r319792:
Override the locale so that file lists get a consistent sort order.

6 years agoMFC r333570:
markj [Mon, 4 Jun 2018 14:16:01 +0000 (14:16 +0000)]
MFC r333570:
DTrace aarch64: Avoid calling unwind_frame() in the probe context.

6 years agoMFC r334100:
markj [Mon, 4 Jun 2018 14:15:03 +0000 (14:15 +0000)]
MFC r334100:
Document the return value of sbuf_bcat(9).

6 years agoMFC r333278, r333279:
markj [Mon, 4 Jun 2018 14:13:04 +0000 (14:13 +0000)]
MFC r333278, r333279:
Avoid dropping the topology lock in gmirror's dumpconf implementation.

6 years agoMFC r333783: MFV r333779: xz 5.2.4.
delphij [Mon, 4 Jun 2018 05:53:32 +0000 (05:53 +0000)]
MFC r333783: MFV r333779: xz 5.2.4.

6 years agoMFC r333098:
delphij [Mon, 4 Jun 2018 05:38:22 +0000 (05:38 +0000)]
MFC r333098:

Don't bail out from the check if readboot() returns !FSFATAL.

This can happen when the fsinfo signature is invalid, and the
user have choose to fix it, in which case the code would return
FSBOOTMOD (not FSOK but not FSFATAL either).

All other (fatal) cases would return FSFATAL.

Obtained from: Android Open Source Project
Obtained from: https://android.googlesource.com/platform/external/fsck_msdos/+/d8775a29ea7eac2e5f1504dd21da3725b93b3036

6 years agoMFC r332905:
delphij [Mon, 4 Jun 2018 05:23:06 +0000 (05:23 +0000)]
MFC r332905:

Use calloc() instead of malloc+bzero.

Reviewed by: ken, emaste

6 years agoMFC r334432:
dim [Sun, 3 Jun 2018 17:17:45 +0000 (17:17 +0000)]
MFC r334432:

Fix build of stand with base gcc

* Make autoboot() a static function in stand/common/boot.c, so it does
  not shadow local variables in gptboot.c and zfsboot.c.
* Remove -Winline from the Makefiles for gptboot, gptzfsboot and
  zfsboot, as gcc will always fail to inline some functions, and there
  is nothing we can do about it.
* For gcc <= 4.2.1, silence -Wuninitialized for isoboot, as it produces
  a false positive warning.
* Remove deprecated and unnecessary -mcpu=i386 flag from stand/defs.mk,
  as there is already a -march=i386 flag further in the file.

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

6 years agoMFC r333650, r333652, r333682, r334406, r334409-r334410, and r334489.
np [Sun, 3 Jun 2018 15:12:40 +0000 (15:12 +0000)]
MFC r333650, r333652, r333682, r334406, r334409-r334410, and r334489.

r333650:
cxgbe(4): Claim some more T5 and T6 boards.

r333652:
cxgbe(4): Add support for two more flash parts.

r333682:
cxgbe(4): Fall back to a failsafe configuration built into the firmware
if an error is reported while pre-processing the configuration file that
the driver attempted to use.

Also, allow the user to explicitly use the built-in configuration with
hw.cxgbe.config_file="built-in"

r334406:
cxgbe(4): Consider all supported speeds when building the ifmedia list
for a port.  Fix other related issues while here:
- Require port lock for access to link_config.
- Allow 100Mbps operation by tracking the speed in Mbps.  Yes, really.
- New port flag to indicate that the media list is immutable.  It will
  be used in future refinements.

This also fixes a bug where the driver reports incorrect media with
recent firmwares.

r334409:
cxgbe(4): Implement ifm_change callback.

r334410:
cxgbe(4): Use ifm for ifmedia just like the rest of the kernel.

No functional change.

r334489:
cxgbe(4): Include full duplex mediaopt in media that can be reported as
active.  Always report full duplex in active media.

Sponsored by: Chelsio Communications

6 years agoindent(1) in stable/11 is known to be incomplete or incorrect in some
eadler [Sat, 2 Jun 2018 21:50:00 +0000 (21:50 +0000)]
indent(1) in stable/11 is known to be incomplete or incorrect in some
ways.  Since the code is not planned for MFC, just remove the failing
tests.

This is a direct commit to stable/11 as the issue does not affect
-current.

Discussed with; pstef
PR: 228491

6 years agoMFC r332399:
eadler [Sat, 2 Jun 2018 21:46:48 +0000 (21:46 +0000)]
MFC r332399:

[tests] change tests/sys/acl/run to run on perl 5.26

Previously unescaped regex just resulted in a warning. Now it results in
a failed test.

Approved by: re (marius)
PR: 228491

6 years agoRevert r333474 in stable/11, which switches the default pkg repository
gjb [Sat, 2 Jun 2018 02:06:48 +0000 (02:06 +0000)]
Revert r333474 in stable/11, which switches the default pkg repository
from latest to quarterly, now that releng/11.2 had branched.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoFix __FreeBSD_version on stable/11, following r334460.
gjb [Fri, 1 Jun 2018 00:30:55 +0000 (00:30 +0000)]
Fix __FreeBSD_version on stable/11, following r334460.

Pointyhat: gjb (myself)
Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoRename stable/11 back to -PRERELEASE for the duration of the
gjb [Fri, 1 Jun 2018 00:28:29 +0000 (00:28 +0000)]
Rename stable/11 back to -PRERELEASE for the duration of the
11.2-RELEASE cycle, now that releng/11.2 had branched.

Bump __FreeBSD_version.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r334068 (phil):
gjb [Thu, 31 May 2018 23:55:59 +0000 (23:55 +0000)]
MFC r334068 (phil):
 Import libxo-0.9.0:
  - Add xo_format_is_numeric() with improved logic to decide if format
    strings are numeric, so json output quotes them
  - Convert docs to sphinx/rst
  - update tests

PR: 221676
Approved by: re (marius)
Sponsored by: The FreeBSD Foundation

6 years agoAkin r302691 in head, synchronize the build stripping for the disc1
marius [Thu, 31 May 2018 23:48:27 +0000 (23:48 +0000)]
Akin r302691 in head, synchronize the build stripping for the disc1
image with that of the bootonly image (but similarly modulo games
and groff(1)) as the amd64 disc1 image is overflowing. This also
removes the redundant MK_LLDB.

This is a direct commit to stable/11 rather than a MFC of r302691 as
the the disc1 image stripping previously has been directly modified
in stable/11 by r303027.

Approved by: re (gjb)

6 years agoMFC: r327364, r334293
marius [Thu, 31 May 2018 22:20:31 +0000 (22:20 +0000)]
MFC: r327364, r334293

- Add AHCI/XHCI device IDs found on AMD 1950X+X399 system
- Describe Fresco Logic FL1100 USB 3.0 controllers.

Approved by: re (gjb)

6 years agoMFC r334310, r334337:
gjb [Thu, 31 May 2018 20:01:58 +0000 (20:01 +0000)]
MFC r334310, r334337:

 r334310 (imp):
  Teach ufs_module.c about bsd labels and probe 'a' partition.

  If the check for a UFS partition at offset 0 on the disk fails, check
  to see if there's a BSD disklabel at block 1 (standard) or at offset
  512 (install images assume 512 sector size). If found, probe for UFS
  on the 'a' partition.

  This fixes UEFI booting images from a BSD labeled MBR slice when the
  'a' partiton isn't at offset 0. This is a stop-gap fix since we plan
  on removing boot1.efi in FreeBSD 12. We can't easily do that for 11.2,
  however, hence the short MFC window.

 r334337 (emaste):
  switch amd64 memstick installer images to MBR

  A good number of BIOSes have trouble booting from GPT in non-UEFI
  mode.

  With this change amd64 memsticks remain dual-mode (booting from either
  UEFI or CSM); the partitioning type is just switched from GPT to MBR.

PR: 227954

Note, there are two changes specific to stable/11 where there is code
that had diverged from head and never merged back.  The two changes are
an include in stand/efi/boot1/ufs_module.c, replacing sys/disk/bsd.h
with sys/disklabel.h and replacing BSD_MAGIC with DISKMAGIC in the
same file.  The latter two are direct commits to stable/11 in order to
avoid unexpected regressions at this point of the 11.2 cycle.  Thank
you to imp@ for pointing out what changes needed to be made.

Approved by: re (marius)

Sponsored by: The FreeBSD Foundation

6 years agoMFC r333176:
tuexen [Thu, 31 May 2018 16:48:08 +0000 (16:48 +0000)]
MFC r333176:

Fix in the documentation that the default hop limit is not 30, but
the value of the sysctl variable net.inet6.ip6.hlim.
This is true since
https://svnweb.freebsd.org/base?view=revision&revision=122574

The default of 30 (which was correct up to r122574) was incorrectly
documented in
https://svnweb.freebsd.org/base?view=revision&revision=130268

Thanks to Timo Voelker for makeing me aware of the inconsistency
between to code and the documentation.

Approved by: re@ (marius)

6 years agoMFC r333382:
tuexen [Thu, 31 May 2018 16:14:45 +0000 (16:14 +0000)]
MFC r333382:

When reporting ERROR or ABORT chunks, don't use more data
that is guaranteed to be contigous.
Thanks to Felix Weinrank for finding and reporting this bug
by fuzzing the usrsctp stack.

MFC r333386:

Fix two typos reported by N. J. Mann, which were introduced in
https://svnweb.freebsd.org/changeset/base/333382 by me.

Approved by: re@ (marius)

6 years agoMFC r334176:
brooks [Thu, 31 May 2018 16:01:10 +0000 (16:01 +0000)]
MFC r334176:

Indicate the brk/sbrk are deprecated and not portable.

More firmly suggest mmap(2) instead.

Include the history of arm64 and riscv shipping without brk/sbrk.

Mention that sbrk(0) produces unreliable results.

Approved by: re (kib)
Reviewed by: emaste, Marcin Cieślak
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15535

6 years agoMFC r333186:
tuexen [Thu, 31 May 2018 16:00:03 +0000 (16:00 +0000)]
MFC r333186:

Send an ICMPv6 PacketTooBig message in case of forwading a packet which
is too big for the outgoing interface and no firewall is involed.
This problem was introduced in
https://svnweb.freebsd.org/changeset/base/324996
Thanks to Irene Ruengeler for finding the bug and testing the fix.

Approved by: re

6 years agoMFC r329276,r329451,r330294,r330414,r330415,r330418,r331109,r332394,r332398,
mjg [Thu, 31 May 2018 15:58:28 +0000 (15:58 +0000)]
MFC r329276,r329451,r330294,r330414,r330415,r330418,r331109,r332394,r332398,
    r333831:

    rwlock: diff-reduction of runlock compared to sx sunlock

==

    Undo LOCK_PROFILING pessimisation after r313454 and r313455

    With the option used to compile the kernel both sx and rw shared ops would
    always go to the slow path which added avoidable overhead even when the
    facility is disabled.

    Furthermore the increased time spent doing uncontested shared lock acquire
    would be bogusly added to total wait time, somewhat skewing the results.

    Restore old behaviour of going there only when profiling is enabled.

    This change is a no-op for kernels without LOCK_PROFILING (which is the
    default).

==

    sx: fix adaptive spinning broken in r327397

    The condition was flipped.

    In particular heavy multithreaded kernel builds on zfs started suffering
    due to nested sx locks.

    For instance make -s -j 128 buildkernel:

    before: 3326.67s user 1269.62s system 6981% cpu 1:05.84 total
    after: 3365.55s user 911.27s system 6871% cpu 1:02.24 total

==

    locks: fix a corner case in r327399

    If there were exactly rowner_retries/asx_retries (by default: 10) transitions
    between read and write state and the waiters still did not get the lock, the
    next owner -> reader transition would result in the code correctly falling
    back to turnstile/sleepq where it would incorrectly think it was waiting
    for a writer and decide to leave turnstile/sleepq to loop back. From this
    point it would take ts/sq trips until the lock gets released.

    The bug sometimes manifested itself in stalls during -j 128 package builds.

    Refactor the code to fix the bug, while here remove some of the gratituous
    differences between rw and sx locks.

==

    sx: don't do an atomic op in upgrade if it cananot succeed

    The code already pays the cost of reading the lock to obtain the waiters
    flag. Checking whether there is more than one reader is not a problem and
    avoids dirtying the line.

    This also fixes a small corner case: if waiters were to show up between
    reading the flag and upgrading the lock, the operation would fail even
    though it should not. No correctness change here though.

==

    mtx: tidy up recursion handling in thread lock

    Normally after grabbing the lock it has to be verified we got the right one
    to begin with. However, if we are recursing, it must not change thus the
    check can be avoided. In particular this avoids a lock read for non-recursing
    case which found out the lock was changed.

    While here avoid an irq trip of this happens.

==

    locks: slightly depessimize lockstat

    The slow path is always taken when lockstat is enabled. This induces
    rdtsc (or other) calls to get the cycle count even when there was no
    contention.

    Still go to the slow path to not mess with the fast path, but avoid
    the heavy lifting unless necessary.

    This reduces sys and real time during -j 80 buildkernel:
    before: 3651.84s user 1105.59s system 5394% cpu 1:28.18 total
    after: 3685.99s user 975.74s system 5450% cpu 1:25.53 total
    disabled: 3697.96s user 411.13s system 5261% cpu 1:18.10 total

    So note this is still a significant hit.

    LOCK_PROFILING results are not affected.

==

    rw: whack avoidable re-reads in try_upgrade

==

    locks: extend speculative spin waiting for readers to drain

    Now that 10 years have passed since the original limit of 10000 was
    committed, bump it a little bit.

    Spinning waiting for writers is semi-informed in the sense that we always
    know if the owner is running and base the decision to spin on that.
    However, no such information is provided for read-locking. In particular
    this means that it is possible for a write-spinner to completely waste cpu
    time waiting for the lock to be released, while the reader holding it was
    preempted and is now waiting for the spinner to go off cpu.

    Nonetheless, in majority of cases it is an improvement to spin instead of
    instantly giving up and going to sleep.

    The current approach is pretty simple: snatch the number of current readers
    and performs that many pauses before checking again. The total number of
    pauses to execute is limited to 10k. If the lock is still not free by
    that time, go to sleep.

    Given the previously noted problem of not knowing whether spinning makes
    any sense to begin with the new limit has to remain rather conservative.
    But at the very least it should also be related to the machine. Waiting
    for writers uses parameters selected based on the number of activated
    hardware threads. The upper limit of pause instructions to be executed
    in-between re-reads of the lock is typically 16384 or 32678. It was
    selected as the limit of total spins. The lower bound is set to
    already present 10000 as to not change it for smaller machines.

    Bumping the limit reduces system time by few % during benchmarks like
    buildworld, buildkernel and others. Tested on 2 and 4 socket machines
    (Broadwell, Skylake).

    Figuring out how to make a more informed decision while not pessimizing
    the fast path is left as an exercise for the reader.

==

    fix uninitialized variable warning in reader locks

Approved by: re (marius)

6 years agoMFC SVN r334261-334262,334359: dwatch(1) touch-ups
dteske [Wed, 30 May 2018 18:27:48 +0000 (18:27 +0000)]
MFC SVN r334261-334262,334359: dwatch(1) touch-ups

r334261: Guard against error when given -t "*..."
r334262: Eliminate ANSI dimming in developer mode
r334359: Fix "-t test" for post-processing profiles

Bump FreeBSD_version directly in stable/11 for ports IGNORE (as in r334290)

Reviewed by: gjb
Approved by: re (gjb)
Sponsored by: Smule, Inc.

6 years agoMFC 333606: Make the common interrupt entry point labels local labels.
jhb [Tue, 29 May 2018 13:54:34 +0000 (13:54 +0000)]
MFC 333606: Make the common interrupt entry point labels local labels.

Kernel debuggers depend on symbol names to find stack frames with a
trapframe rather than a normal stack frame.  The labels used for the
shared interrupt entry point for the PTI and non-PTI cases did not
match the existing patterns confusing debuggers.  Add the '.L' prefix
to mark these symbols as local so they are not visible in the symbol
table.

Approved by: re (kib)

6 years agoMFC r334038:
kib [Tue, 29 May 2018 13:24:42 +0000 (13:24 +0000)]
MFC r334038:
Enable IBRS when entering an interrupt handler from usermode.

Approved by: re (marius)

6 years agoMFC r334027: xen-blkback: do not use state 3
royger [Tue, 29 May 2018 07:51:24 +0000 (07:51 +0000)]
MFC r334027: xen-blkback: do not use state 3

Linux will not connect to a backend that's in state 3
(XenbusStateInitialised), it needs to be in state 2
(XenbusStateInitWait) for Linux to attempt to connect to the
backend.

Approved by: re (kib)