]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agorc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used
avos [Sun, 27 Jan 2019 15:55:31 +0000 (15:55 +0000)]
rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used

They will stop it automatically ('Interface wlan0 is down,
dhclient exiting'); use /etc/rc.d/dhclient stop command only when
none of them is used.

MFC after: 5 days

5 years agoProperly define and declare phynode_topo_lock,
mmel [Sun, 27 Jan 2019 15:50:36 +0000 (15:50 +0000)]
Properly define and declare phynode_topo_lock,
it should be single global variable.

X-MFC with: r340845
Noticed by: phynode_topo_lock

5 years agodevd.conf(5): simplify regex
avos [Sun, 27 Jan 2019 15:29:58 +0000 (15:29 +0000)]
devd.conf(5): simplify regex

Submitted by: Helge Oldach <freebsd@oldach.net>
MFC after: 5 days

5 years agopcf(4): fix parentheses in if condition
avos [Sun, 27 Jan 2019 15:19:28 +0000 (15:19 +0000)]
pcf(4): fix parentheses in if condition

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

5 years agowlan.4: improve wording
avos [Sun, 27 Jan 2019 15:10:20 +0000 (15:10 +0000)]
wlan.4: improve wording

PR: 218075
Submitted by: Aaron Taylor <halfnote1004@gmail.com>
MFC after: 5 days

5 years agoFix a typo.
cy [Sun, 27 Jan 2019 02:31:42 +0000 (02:31 +0000)]
Fix a typo.

MFC after: 3 days

5 years agoBump SPECNAMELEN to MAXNAMLEN.
kib [Sun, 27 Jan 2019 00:46:06 +0000 (00:46 +0000)]
Bump SPECNAMELEN to MAXNAMLEN.

This includes the bump for cdevsw d_version.  Otherwise, the impact on
the ABI (not KBI) is surprisingly low.  The most important affected
interface is devname(3) and ttyname(3) which already correctly handle
long names (and ttyname(3) should not be affected at all).

Still, due to the d_version bump, I argue that the change is not MFC-able.

Requested by: mmacy
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18932

5 years agoRemove now redundand ifunc relocation code which should have been
kib [Sun, 27 Jan 2019 00:37:52 +0000 (00:37 +0000)]
Remove now redundand ifunc relocation code which should have been
removed as part of r341441.

This call to reloc_non_plt() may crash if ifunc resolvers use the
needed libraries symbols since the pass over the needed libs
relocation is not yet done.  The change in r341441 ensures the right
relocation order otherwise.

Submitted by: theraven
MFC after: 1 week
Discussed in: https://reviews.freebsd.org/D17529

5 years agoUpdate tunefs and newfs error messages for the -L (volume label) option
mckusick [Sat, 26 Jan 2019 22:27:12 +0000 (22:27 +0000)]
Update tunefs and newfs error messages for the -L (volume label) option
to note that underscores are valid.

PR:           235182
Reported by:  Rodney W. Grimes (rgrimes@)
Sponsored by: Netflix

5 years agoSlightly improve previous commit that silenced a Clang Scan warning.
se [Sat, 26 Jan 2019 22:24:15 +0000 (22:24 +0000)]
Slightly improve previous commit that silenced a Clang Scan warning.

The strdup() call does not take advantage of the known length of the
source string. Replace by malloc() and memcpy() utilizimng the pre-
calculated string length.

Submitted by: cperciva
Reported by: rgrimes
MFC after: 2 weeks

5 years ago- In _iflib_fl_refill(), don't mark an RX buffer as available in the
marius [Sat, 26 Jan 2019 21:35:51 +0000 (21:35 +0000)]
- In _iflib_fl_refill(), don't mark an RX buffer as available in the
  corresponding bitmap before adding an mbuf has actually succeeded.
  Previously, m_gethdr(M_NOWAIT, ...) failing caused a "hole" in the
  RX ring but not in its bitmap. One implication of such a hole was
  that in a subsequent call to _iflib_fl_refill() with the RX buffer
  accounting still indicating another reclaimable buffer, bit_ffc(3)
  nevertheless returned -1 in frag_idx which in turn caused havoc
  when used as an index. Thus, additionally assert that frag_idx is
  0 or greater.
  Another possible consequence of a hole in the RX ring was a NULL-
  dereference when trying to use the unallocated mbuf, for example
  in iflib_rxd_pkt_get().

  While at it, make the variable declarations in _iflib_fl_refill()
  conform to style(9) and remove redundant checks already performed
  by bit_ffc{,_at}(3).

- In iflib_queues_alloc(), don't pass redundant M_ZERO to bit_alloc(3).

Reported and tested by: pho

5 years agoSilence Clang Scan warning about potentially unsafe use of strcpy.
se [Sat, 26 Jan 2019 21:30:26 +0000 (21:30 +0000)]
Silence Clang Scan warning about potentially unsafe use of strcpy.

While this is a false positive, the use of strdup() simplifies the code.

MFC after: 2 weeks

5 years agoFix potential buffer overflow and undefined behavior.
se [Sat, 26 Jan 2019 20:43:28 +0000 (20:43 +0000)]
Fix potential buffer overflow and undefined behavior.

The buffer allocated in read_chat() could be 1 element too short, if the
chatstr parameter passed in is 1 or 3 charachters long (e.g. "a" or "a b").
The allocation of the pointer array does not account for the terminating
NULL pointer in that case.

Overlapping source and destination strings are undefined in strcpy().
Instead of moving a string to the left by one character just increment the
char pointer before it is assigned to the results array.

MFC after: 2 weeks

5 years agoCatch up with some years of driver development.
netchild [Sat, 26 Jan 2019 18:23:19 +0000 (18:23 +0000)]
Catch up with some years of driver development.
Most impressive in terms of doxygen stuff are the isci and
ocs_fc drivers.

5 years agoFix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065.
bz [Sat, 26 Jan 2019 17:52:12 +0000 (17:52 +0000)]
Fix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065.

 * There's no reason to have a while() loop here, because:
    - if msleep returns 0, that means we were woken up by the interrupt handler,
      and we are going to exit immediately as sc_fw_chunk_done will now be 1
      (there is nothing else that sleeps on sc_fw.)
    - if msleep doesn't return 0 (i.e. it returned ETIMEDOUT) then we will
      exit immediately because of the if-test.
   So, just use a single msleep() and then check sc_fw_chunk_done as before.
 * The comment said we were sleeping for 5 seconds, but the msleep was only
   for 1. Before r314065, this was 1 second and so was the comment,
   and in that commit the comment was changed and the function call wasn't.

Possibly fixes failures to initialize uCode on certain devices.

Submitted by: Augustin Cavalier (waddlesplash gmail.com)
Obtained from: Haiku 132990ecdcb072f2ce597b5d497ff3e5b1f09c20
MFC after: 10 days

5 years agoObsoleteFiles.inc: remove adv(4) / adw(4) man pages after r339567
avos [Sat, 26 Jan 2019 17:27:12 +0000 (17:27 +0000)]
ObsoleteFiles.inc: remove adv(4) / adw(4) man pages after r339567

5 years agogeom_uzip(4): set 'gp != NULL' assertion on top of the function
avos [Sat, 26 Jan 2019 17:17:25 +0000 (17:17 +0000)]
geom_uzip(4): set 'gp != NULL' assertion on top of the function

There was yet another access to this variable in g_trace() few
lines upper.

PR: 203499
Reported by: cem
MFC after: 5 days
MFC with: 343473

5 years agoRemove 2GHz channel list copies from wireless drivers.
avos [Sat, 26 Jan 2019 17:00:55 +0000 (17:00 +0000)]
Remove 2GHz channel list copies from wireless drivers.

Wrap ieee80211_add_channel_list_2ghz into another function
which supplies default (1-14) channel list to it and drop
its copies from drivers.

Checked with RTL8188EE, country US / JP / KR / UA.

MFC after: 2 weeks

5 years agogeom_uzip(4): move NULL pointer KASSERT check before it is dereferenced
avos [Sat, 26 Jan 2019 14:54:06 +0000 (14:54 +0000)]
geom_uzip(4): move NULL pointer KASSERT check before it is dereferenced

PR: 203499
Submitted by: <chadf@triularity.org>
MFC after: 5 days

5 years agootus(4): fix a typo in man page (802.11 -> 802.11n)
avos [Sat, 26 Jan 2019 14:14:25 +0000 (14:14 +0000)]
otus(4): fix a typo in man page (802.11 -> 802.11n)

MFC after: 3 days

5 years agolibcasper: do not run registered exit functions
oshogbo [Sat, 26 Jan 2019 14:10:49 +0000 (14:10 +0000)]
libcasper: do not run registered exit functions

Casper library should not use exit(3) function because before setting it up
applications may register it. Casper doesn't depend on any registered exit
function, so it safe to change this.

Reported by: jceel
MFC after: 2 weeks

5 years agozfs: allow to change cache flush sysctl
oshogbo [Sat, 26 Jan 2019 13:53:00 +0000 (13:53 +0000)]
zfs: allow to change cache flush sysctl

There is no reason for this variable to be tunable.
This variable is used as a barrier in few places.

Discussed with: pjd
MFC after: 2 weeks
Sponsored by: Fudo Security

5 years agoExpand DDB's set of printable soft dependency data structures. The
mckusick [Sat, 26 Jan 2019 05:35:24 +0000 (05:35 +0000)]
Expand DDB's set of printable soft dependency data structures. The
set of known soft dependency data structures now includes: sd_worklist,
sd_inodedep, sd_allocdirect, sd_allocindir, and sd_mkdir. DDB can
also print lists of sd_allinodedeps, sd_mkdir_list, and sd_workhead.
The sd_workhead script is useful for listing all the dependencies
associated with a buffer, e.g. bp->b_dep.

Prefix the soft dependency show names with sd_ so that they sort
together when listed by DDB's "show help" and to distinguish them
from other data structures printable by DDB.

Sponsored by: Netflix

5 years agoFix reporting errors with `gai_strerror(..)`
ngie [Sat, 26 Jan 2019 03:43:12 +0000 (03:43 +0000)]
Fix reporting errors with `gai_strerror(..)`

The return value (`err`) should be checked; not the `errno` value.

PR: 235200
Approved by: emaste (mentor)
Reviewed by: asomers, lwhsu
MFC after: 28 days
MFC with: r343362, r343365, r343367-r343368
Differential Revision: https://reviews.freebsd.org/D18969

5 years agoext2fs: Add some extra consistency checks for the superblock.
pfg [Fri, 25 Jan 2019 22:22:29 +0000 (22:22 +0000)]
ext2fs: Add some extra consistency checks for the superblock.

Maliciously formed, or badly corrupted, filesystems can cause kernel
panics.  In general, such acts of foot-shooting can only be accomplished
by root, but in a world with VM images that is  moving towards automated
mounts it is important to have some form of prevention.

Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert
of Fraunhofer FKIE.
Incidentaly this should also fix a memory corruption issue reported by
Dr Silvio Cesare of InfoSect.

Huge thanks to all reseachers for making us aware of the issue.

admbug: 872, 891
Reviewed by: fsu
Obtained from: NetBSD (with minor changes)
MFC after: 3 days

5 years agoFix format/arg mismatch
gonzo [Fri, 25 Jan 2019 21:38:28 +0000 (21:38 +0000)]
Fix format/arg mismatch

USe correct format for int arguments

PR: 229549
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years agoAdd printing of b_ioflags to DDB `show buffer' command.
mckusick [Fri, 25 Jan 2019 21:24:09 +0000 (21:24 +0000)]
Add printing of b_ioflags to DDB `show buffer' command.

Sponsored by: Netflix

5 years agoFix a few more places to handle ofld tx queues for RATELIMIT.
jhb [Fri, 25 Jan 2019 20:54:18 +0000 (20:54 +0000)]
Fix a few more places to handle ofld tx queues for RATELIMIT.

- Drain offload transmit queues when RATELIMIT is enabled but
  TCP_OFFLOAD is not.
- Expose the per-VI nofldtxq and first_ofld_txq sysctls when
  RATELIMIT is enabled but TCP_OFFLOAD is not.
- Clear offload transmit queue stats as part of a 'cxgbetool clearstats'
  request when RATELIMIT is enabled but TCP_OFFLOAD is not.

Reviewed by: np
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D18966

5 years agoFix 32-bit buildworld broken by r343438.
cy [Fri, 25 Jan 2019 20:53:29 +0000 (20:53 +0000)]
Fix 32-bit buildworld broken by r343438.

5 years agoAdd new USB quirk.
hselasky [Fri, 25 Jan 2019 20:20:27 +0000 (20:20 +0000)]
Add new USB quirk.

PR: 235202
Differential Revision: https://reviews.freebsd.org/D18917
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years ago[mips] Fix error condition check that always evaluates to false
gonzo [Fri, 25 Jan 2019 20:14:28 +0000 (20:14 +0000)]
[mips] Fix error condition check that always evaluates to false

Use proper logical operand when checking the value of srcid

PR: 200988
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years agoAdd full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI.
hselasky [Fri, 25 Jan 2019 20:13:28 +0000 (20:13 +0000)]
Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years ago[mips] Unbreak kernel build for CI20
gonzo [Fri, 25 Jan 2019 20:10:57 +0000 (20:10 +0000)]
[mips] Unbreak kernel build for CI20

- Include header required for boot_parse_XXX functions
- Use boot_parse_args when parsing argc/argv style arguments
- Remove unused function

5 years agoAllow tunefs to include '_' as a legal character in label names
mckusick [Fri, 25 Jan 2019 20:07:18 +0000 (20:07 +0000)]
Allow tunefs to include '_' as a legal character in label names
to make it consistent with newfs. Document the legality of '_'
in label names in both tunefs(8) and newfs(8).

PR:           235182
Submitted by: darius@dons.net.au
Reviewed by:  Conrad Meyer
MFC after:    3 days
Sponsored by: Netflix

5 years ago[mips] Fix counter mask in jz4780 timer driver
gonzo [Fri, 25 Jan 2019 20:02:55 +0000 (20:02 +0000)]
[mips] Fix counter mask in jz4780 timer driver

Fix dublicate value in what is apparent copypaste mistake. The last value
in mask is supposed to be for counter 7, not counter 3.

PR: 229790
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years ago[mips] remove check that is always false (unsinged < 0)
gonzo [Fri, 25 Jan 2019 19:58:56 +0000 (19:58 +0000)]
[mips] remove check that is always false (unsinged < 0)

cpuid and local cpu variable are unsigned so checking if value is less than zero
always yields false.

PR: 211088
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years agoDocument that `sendfile` will return an invalid value for `sbytes` if provided an...
ngie [Fri, 25 Jan 2019 19:56:02 +0000 (19:56 +0000)]
Document that `sendfile` will return an invalid value for `sbytes` if provided an invalid address

This is meant to clarify the fact that the system call will not fail
with -1/EFAULT, as one might expect, when reading the sendfile(2)
manpage today.

While here, pet the mandoc linter, when dealing with the section that
describes valid values for `flags`.

PR: 232210
MFC after: 2 weeks
Approved by: emaste (mentor)
Reviewed by: glebius, 0mp
Differential Revision: https://reviews.freebsd.org/D18949

5 years ago[mips] remove dublicate values in enable mask in nlm_usb_intr_en
gonzo [Fri, 25 Jan 2019 19:36:20 +0000 (19:36 +0000)]
[mips] remove dublicate values in enable mask in nlm_usb_intr_en

PR: 230572
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years agoTemporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}
lwhsu [Fri, 25 Jan 2019 18:48:20 +0000 (18:48 +0000)]
Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction}
expected failure after clang700-import merge

PR: 234040
Reviewed by: ngie, markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18938

5 years agoComment out the default sh(1) aliases for root, introduced in r343416.
trasz [Fri, 25 Jan 2019 17:09:26 +0000 (17:09 +0000)]
Comment out the default sh(1) aliases for root, introduced in r343416.
The rest of this stuff is still to be discussed, but I think at this
point we have the agreement that the aliases should go.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDon't include two header files when not needed.
tuexen [Fri, 25 Jan 2019 17:08:28 +0000 (17:08 +0000)]
Don't include two header files when not needed.

This allows the part of the rewrite of TCP reassembly in this
files to be MFCed to stable/11 with manual change.

MFC after: 3 days
Sponsored by: Netflix, Inc.

5 years agoUse ACPI TPM2 table to probe tpmtis and tpmcrb device.
takawata [Fri, 25 Jan 2019 16:16:10 +0000 (16:16 +0000)]
Use ACPI TPM2 table to probe tpmtis and tpmcrb device.

Differential Revision: https://reviews.freebsd.org/D18937

5 years agoFix an iflib driver unload panic introduced in r343085
gallatin [Fri, 25 Jan 2019 15:02:18 +0000 (15:02 +0000)]
Fix an iflib driver unload panic introduced in r343085

The new loop to sync and unload descriptors was indexed
by "i", rather than "j".   The panic was caused by "i"
being advanced rather than "j", and eventually becoming
out of bounds.

Reviewed by: kib
MFC after: 3 days
Sponsored by: Netflix

5 years agoclang: default to DWARF 4 as of FreeBSD 13
emaste [Fri, 25 Jan 2019 14:46:13 +0000 (14:46 +0000)]
clang: default to DWARF 4 as of FreeBSD 13

FreeBSD previously defaulted to DWARF 2 because several tools (gdb,
ctfconvert, etc.) did not support later versions.  These have either
been fixed or are deprecated.

Note that gdb 6 still exists but has been moved out of $PATH into
/usr/libexec and is intended only for use by crashinfo(8).  The kernel
build sets the DWARF version explicitly via -gdwarf2, so this should
have no effect there.

PR: 234887 [exp-run]
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17930

5 years agoFix a bug in the restart window computation of TCP New Reno
tuexen [Fri, 25 Jan 2019 13:57:09 +0000 (13:57 +0000)]
Fix a bug in the restart window computation of TCP New Reno

When implementing support for IW10, an update in the computation
of the restart window used after an idle phase was missed. To
minimize code duplication, implement the logic in tcp_compute_initwnd()
and call it. This fixes a bug in NewReno, which was not aware of
IW10.

Submitted by: Richard Scheffenegger
Reviewed by: tuexen@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18940

5 years agoGarbage collect AH_SUPPORT_AR5416 config option.
avos [Fri, 25 Jan 2019 13:48:40 +0000 (13:48 +0000)]
Garbage collect AH_SUPPORT_AR5416 config option.

It does nothing since r318857.

5 years agopf: Fix use-after-free of counters
kp [Fri, 25 Jan 2019 01:06:06 +0000 (01:06 +0000)]
pf: Fix use-after-free of counters

When cleaning up a vnet we free the counters in V_pf_default_rule and
V_pf_status from shutdown_pf(), but we can still use them later, for example
through pf_purge_expired_src_nodes().

Free them as the very last operation, as they rely on nothing else themselves.

PR: 235097
MFC after: 1 week

5 years agonet80211: reuse TICKS_2_MSEC / MSEC_2_TICKS macros from sys/time.h
avos [Fri, 25 Jan 2019 01:05:18 +0000 (01:05 +0000)]
net80211: reuse TICKS_2_MSEC / MSEC_2_TICKS macros from sys/time.h

Replace in-place implementation with system-wide one; since it
guarantees non-zero result drop all less-than-one checks from
drivers and net80211.

MFC after: 2 weeks

5 years agoInstall .shrc for root, and set PS1 for the toor account.
trasz [Thu, 24 Jan 2019 23:34:51 +0000 (23:34 +0000)]
Install .shrc for root, and set PS1 for the toor account.

Reviewed by: jilles
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18872

5 years agonetmap: fix crash with monitors and VALE ports
vmaffione [Thu, 24 Jan 2019 22:09:26 +0000 (22:09 +0000)]
netmap: fix crash with monitors and VALE ports

Crash report described here:
    https://github.com/luigirizzo/netmap/issues/583
Fixed by providing dummy sync callback in case it is missing.

5 years agoFix a typo/wordsmith a description modified in r343407
ngie [Thu, 24 Jan 2019 20:35:58 +0000 (20:35 +0000)]
Fix a typo/wordsmith a description modified in r343407

r343407 accidentally introduced a typo (folling -> following). While
reading the change out loud, I realized that the original sentence was
wordy. almost sounding like a run-on sentence.

Improve the flow by splitting up the two thoughts into two distinct sentence
fragments.

PR: 194547, 208497
Reviewed by: emaste
Approved by: emaste (mentor)
MFC after: 1 month
MFC with: r343407
Differential Revision: https://reviews.freebsd.org/D18947

5 years agofreebsd-update: Clarify unsupported upgrade message
emaste [Thu, 24 Jan 2019 18:51:15 +0000 (18:51 +0000)]
freebsd-update: Clarify unsupported upgrade message

PR: 204115
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18916

5 years agofreebsd-update: fix style from r343271 change
emaste [Thu, 24 Jan 2019 18:48:15 +0000 (18:48 +0000)]
freebsd-update: fix style from r343271 change

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
MFC with: r343271
Sponsored by: The FreeBSD Foundation

5 years agofreebsd-update: Stop installing empty component sets
emaste [Thu, 24 Jan 2019 18:41:00 +0000 (18:41 +0000)]
freebsd-update: Stop installing empty component sets

Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: rgrimes
Reviewed by: delphij
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18927

5 years agoSilence Clang Scan warnings regarding the use of strcp().
se [Thu, 24 Jan 2019 18:39:45 +0000 (18:39 +0000)]
Silence Clang Scan warnings regarding the use of strcp().

While these warnings are false positives, the use of strdup() instead of
malloc() and strcpy() simplifies and clarifies the code.

While checking the remaining uses of strcpy and strcat I noticed an
assignment of a strlen() to a variable "s", whose value needs to be
preserved for use in later output routines (where it is used to allocate
a buffer). I do not think that the value of "s" will come out lower than
its correct value and thus there is no risk of a buffer overflow, in the
general case, but a specially crafter argument might lead to an overflow.

The bogus assignment to "s" is removed since this value was only used a
single time in the following malloc() call, which has been removed.

MFC after: 2 weeks

5 years agofreebsd-update: open $PAGER only if necessary
emaste [Thu, 24 Jan 2019 18:26:30 +0000 (18:26 +0000)]
freebsd-update: open $PAGER only if necessary

PR: 194547, 208497
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

5 years agoAdd ZFS usage tips to freebsd-tips.
bcr [Thu, 24 Jan 2019 18:13:23 +0000 (18:13 +0000)]
Add ZFS usage tips to freebsd-tips.

Add a bunch of examples on how to use ZFS features like:
- listing available space,
- setting and displaying a userquota,
- displaying pool I/O statistics and pool history,
- displaying the compression ratio for a dataset,
- various list options (sorting, removing headers),
- performing a dry-run of a snapshot delete,
- removing a range of snapshots,
- setting a custom property,
- preventing removal of a snapshot with ZFS holds,
- permission sets for zfs send/receive.

Additionally, clarify the existing examples a bit when
it comes to displaying space by mentioning UFS explicitly.
Other examples include displaying I/O in top(1), querying
sysctl(8) for active CPUs and available RAM. Mention systat(1)
and its options, too.
While here, reformat the example to upload a dmesg(8) a bit
to wrap properly.

Thanks to Allan Jude for his help with some of the ZFS examples.

Reviewed by: dru,allanjude
Approved by: allanjude (earlier version)
MFC after: 3 days
Relnotes: yes (ZFS examples in freebsd-tips)
Differential Revision: https://reviews.freebsd.org/D18541

5 years agoGet the arithmetic right...
tuexen [Thu, 24 Jan 2019 16:47:18 +0000 (16:47 +0000)]
Get the arithmetic right...

MFC after: 3 days
Sponsored by: Netflix, Inc.

5 years agoKill a trailing whitespace character...
tuexen [Thu, 24 Jan 2019 16:43:13 +0000 (16:43 +0000)]
Kill a trailing whitespace character...

MFC after: 3 days
Sponsored by: Netflix, Inc.

5 years agoUpdate a comment to reflect the current reality.
tuexen [Thu, 24 Jan 2019 16:40:14 +0000 (16:40 +0000)]
Update a comment to reflect the current reality.

SYN-cache entries live for abaut 12 seconds, not 45, when default
setting are used.

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

5 years agoMake sh(1) support \u in PS1. This removes one fork/exec on interactive
trasz [Thu, 24 Jan 2019 11:59:46 +0000 (11:59 +0000)]
Make sh(1) support \u in PS1.  This removes one fork/exec on interactive
shell startup.

Reviewed by: 0mp (man page), jilles
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18790

5 years agoFix refcounting leaks in IPv6 MLD code leading to loss of IPv6
hselasky [Thu, 24 Jan 2019 08:34:13 +0000 (08:34 +0000)]
Fix refcounting leaks in IPv6 MLD code leading to loss of IPv6
connectivity.

Looking at past changes in this area like r337866, some refcounting
bugs have been introduced, one by one. For example like calling
in6m_disconnect() and in6m_rele_locked() in mld_v1_process_group_timer()
where previously no disconnect nor refcount decrement was done.
Calling in6m_disconnect() when it shouldn't causes IPv6 solitation to no
longer work, because all the multicast addresses receiving the solitation
messages are now deleted from the network interface.

This patch reverts some recent changes while improving the MLD
refcounting and concurrency model after the MLD code was converted
to using EPOCH(9).

List changes:
- All CK_STAILQ_FOREACH() macros are now properly enclosed into
  EPOCH(9) sections. This simplifies assertion of locking inside
  in6m_ifmultiaddr_get_inm().
- Corrected bad use of in6m_disconnect() leading to loss of IPv6
  connectivity for MLD v1.
- Factored out checks for valid inm structure into
  in6m_ifmultiaddr_get_inm().

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoWhen detaching a network interface drain the workqueue freeing the inm's
hselasky [Thu, 24 Jan 2019 08:25:02 +0000 (08:25 +0000)]
When detaching a network interface drain the workqueue freeing the inm's
because the destructor will access the if_ioctl() callback in the ifnet
pointer which is about to be freed. This prevents use-after-free.

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoAdd debugging sysctl to disable incoming MLD v2 messages similar to the
hselasky [Thu, 24 Jan 2019 08:18:02 +0000 (08:18 +0000)]
Add debugging sysctl to disable incoming MLD v2 messages similar to the
existing sysctl for MLD v1 messages.

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix duplicate acquiring of refcount when joining IPv6 multicast groups.
hselasky [Thu, 24 Jan 2019 08:15:41 +0000 (08:15 +0000)]
Fix duplicate acquiring of refcount when joining IPv6 multicast groups.
This was observed by starting and stopping rpcbind(8) multiple times.

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix prompt for MFSROOT in tinybsd
gonzo [Thu, 24 Jan 2019 06:34:29 +0000 (06:34 +0000)]
Fix prompt for MFSROOT in tinybsd

tinybsd offers two choices when prompting user for MFSROOT: 'YES'
and 'NO'. Script logic only handles 'yes'. Change offered values
to lower case.

PR: 131059
Submitted by: Brock Williams <brock@cotcomsol.com>
MFC after: 1 week

5 years agoiwm - Remove unused TX_CMD_NEXT_FRAME_*
kevans [Thu, 24 Jan 2019 03:50:27 +0000 (03:50 +0000)]
iwm - Remove unused TX_CMD_NEXT_FRAME_*

Taken-From: Linux git b1e06c65fb69c5e3fddcd91987561e225eaa9bfa

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (b0c6116f364a121ab6b9d634ca1997d4167fa747)

5 years agoiwm - Remove unused REPLY_MAX
kevans [Thu, 24 Jan 2019 03:50:03 +0000 (03:50 +0000)]
iwm - Remove unused REPLY_MAX

Taken-From: Linux git e4eb275ac5cfe71686612d929a9829345b2a4ada

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (92a727c99d6ec5abf14bb6853e95e3a187a0cd4e)

5 years agoiwm - Update alive response handling, add v4 and remove old versions.
kevans [Thu, 24 Jan 2019 03:49:35 +0000 (03:49 +0000)]
iwm - Update alive response handling, add v4 and remove old versions.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (3820e2bf3331ced3541d1811a38c5a5136dfab93)

5 years agoiwm - Fix race during detach, where a callout is left after driver is gone.
kevans [Thu, 24 Jan 2019 03:49:11 +0000 (03:49 +0000)]
iwm - Fix race during detach, where a callout is left after driver is gone.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (ba3b4ff9a1fc04a349df05d6d3449f4d9b15c4be)

5 years agoif_iwm - Stop iwm_watchdog callout when idle.
kevans [Thu, 24 Jan 2019 03:48:50 +0000 (03:48 +0000)]
if_iwm - Stop iwm_watchdog callout when idle.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (6a8683b0e9d734f23bd9647e117da198c2b9a74e)

5 years agoiwm - Always clear watchdog timer, when bringing down firmware state.
kevans [Thu, 24 Jan 2019 03:48:27 +0000 (03:48 +0000)]
iwm - Always clear watchdog timer, when bringing down firmware state.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (8abdc2b36a45c4e9c95fc8263ca532ea26633dcb)

5 years agoiwm - Clear Time Event active state, when receiving End Notification.
kevans [Thu, 24 Jan 2019 03:47:47 +0000 (03:47 +0000)]
iwm - Clear Time Event active state, when receiving End Notification.

* This hopefully avoids some firmware panics, I was occasionally seeing,
when iwm disconnects upon losing signal to an access point at some point.

* This is synchronizing the if_iwm_time_event.c file a bit more from the
corresponding Linux iwlwifi/mvm/time-event.c.

Taken-From:     Linux iwlwifi

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (e8cb71584a6a72232c13151d60e57f7f229220eb)

5 years agoiwm - Improve firmware Time Event handling.
kevans [Thu, 24 Jan 2019 03:47:04 +0000 (03:47 +0000)]
iwm - Improve firmware Time Event handling.

* This is a mix of the OpenBSD Git 7fd9664469d1b717a307eebd74aeececbd3c41cc
change, and syncing with the Linux iwlwifi code.

Taken-From: Linux iwlwifi, and OpenBSD

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (706a3044afd27c3fecfdf57bec1695310e53e228)

5 years agoiwm - Avoid Tx watchdog timeout, when dropping a connection.
kevans [Thu, 24 Jan 2019 03:46:35 +0000 (03:46 +0000)]
iwm - Avoid Tx watchdog timeout, when dropping a connection.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (3e12596fb5c55351517cdd741d72979388a8c75c)

5 years agoiwm - Track firmware state better, and improve handling in iwm_newstate().
kevans [Thu, 24 Jan 2019 03:45:55 +0000 (03:45 +0000)]
iwm - Track firmware state better, and improve handling in iwm_newstate().

* This avoids firmware resets in all the cases in iwm_newstate(). Instead
iwm_bring_down_firmware() is called, which tears down all the STA
connection state, according to the sc->sc_firmware_state value.

* Improve the behaviour of the LED blinking a bit, so it only blinks when
there really is a wireless scan going on.

* Print the newstate arg in debug output of iwm_newstate(), to help in
debugging.

This is inspired by the firmware state maintaining change in OpenBSD's iwm,
by stsp@openbsd.org (OpenBSD Git 0ddb056fb7370664b1d4b84392697cb17d1a414a).

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (8a41b10ac639d0609878696808387a6799d39b57)

5 years agoif_iwm - Add firmware API definitions for TX power commands.
kevans [Thu, 24 Jan 2019 03:45:24 +0000 (03:45 +0000)]
if_iwm - Add firmware API definitions for TX power commands.

* While there remove unused IWM_UCODE_TLV_CAPA_LMAC_UPLOAD definition,
which isn't defined in iwlwifi.

Taken-From: Linux iwlwifi

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (fd4f9de8bc72ea961e50829b45b59d0549040b7d)

5 years agoif_iwm - Configure the PCIe LTR, fix PCI express capability accesses.
kevans [Thu, 24 Jan 2019 03:44:48 +0000 (03:44 +0000)]
if_iwm - Configure the PCIe LTR, fix PCI express capability accesses.

Taken-From: Linux iwlwifi

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (08a7ad5a5ff65aaaf2df6a609be7a4e1df43efc3)

5 years agoif_iwm - Update struct iwm_scan_results_notif. Remove old/unused definitions
kevans [Thu, 24 Jan 2019 03:44:20 +0000 (03:44 +0000)]
if_iwm - Update struct iwm_scan_results_notif. Remove old/unused definitions

* Remove outdated notifications IWM_SCAN_ABORT_CMD,
IWM_SCAN_START_NOTIFICATION and IWM_SCAN_RESULTS_NOTIFICATION.

* Remove unused enum iwm_scan_complete_status.

* Use the updated FW Api version 3 of struct iwm_scan_results_notif.

* No functional change, since struct iwm_scan_results_notif is never
accessed in iwm at the moment.

Taken-From: Linux iwlwifi commits 1083fd7391e989be52022f0f338e9dadc048b063
and 75118fdb63496e4611ab50380499ddd62b9de69f.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (c947b0b8dc96dabefd63f7b70d53695e36c7b64f)

5 years agoiwm - Reduce gratuitous differences with Linux iwlwifi in struct naming.
kevans [Thu, 24 Jan 2019 03:43:45 +0000 (03:43 +0000)]
iwm - Reduce gratuitous differences with Linux iwlwifi in struct naming.

* Rename some structs and struct members for firmware handling.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (4b1006a6e4d0f61d48c67b46e1f791e30837db67)

5 years agoif_iwm - Check sc->sc_attached flag in suspend/resume callbacks.
kevans [Thu, 24 Jan 2019 03:42:59 +0000 (03:42 +0000)]
if_iwm - Check sc->sc_attached flag in suspend/resume callbacks.

* There is (almost) nothing to do in suspend/resume if if_iwm has failed
during initialization (e.g. because of firmware load failure) and was
already uninitialized by iwm_detach_local().

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (67b5e090efb225654815fed91020db6cfc16bb19)

5 years agoif_iwm - Move iwm_read_firmware() call into iwm_attach().
kevans [Thu, 24 Jan 2019 03:42:23 +0000 (03:42 +0000)]
if_iwm - Move iwm_read_firmware() call into iwm_attach().

* We should load the firmware exactly once before the driver really
initializes the hardware the first time, and unload it at detach time.
There is no need to retrieve the firmware during execution of
iwm_mvm_load_ucode_wait_alive(), we should make sure we already have the
firmware data at hand before that.

* The existing sc_preinit_hook code fails to deal with the case where
if_iwm is loaded by the loader (or is statically linked) and the
firmware needs to be loaded from disk. So we can just call
iwm_read_firmware() from iwm_attach() directly.

* A separate solution will have to be added to properly defer the firmware
loading during bootup, until the necessary filesystem is mounted.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (0104ee1f4cb6a2313c00c2526c6ae98d42e5041d)

5 years agoif_iwm - The iwm_prepare_card_hw() in iwm_attach() is only needed on 8K hw.
kevans [Thu, 24 Jan 2019 03:41:44 +0000 (03:41 +0000)]
if_iwm - The iwm_prepare_card_hw() in iwm_attach() is only needed on 8K hw.

* Doing the iwm_prepare_card_hw() call in iwm_attach() only on Family 8000
hardware matches the code in Linux iwlwifi.

* While there remove DEFAULT_MAX_TX_POWER definition which is unused, and
has a value different from IWL_DEFAULT_MAX_TX_POWER in iwlwifi.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (e8560f8dc58df12a7c79a6bb4e6ccb156e001085)

5 years agoif_iwm - Update firmware rs table, instead of indexing the table in tx cmds.
kevans [Thu, 24 Jan 2019 03:41:09 +0000 (03:41 +0000)]
if_iwm - Update firmware rs table, instead of indexing the table in tx cmds.

* Rather than providing a non-zero index into the firmware RS table,
we should always use index 0 and update the firmware RS table whenever
our chosen tx rate for data-frames changes.

* Send IWM_LQ_CMD updates when the tx rate gets updated by the net80211
rate control (which is after we tell the tx status to the net80211
rate-control in iwm_mvm_rx_tx_cmd_single()).

* Disregard frames transferred with a different tx rate than the currently
selected rate for the rate-control calculations. This way we avoid
counting management frames (which are sent at a slow, and fixed rate),
as well as frames we added to the tx queue just before a new IWM_LQ_CMD
update took effect.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from: DragonFlyBSD (5d6b465e288ac5b52d7115688d4e6516acbbea1c)

5 years agoixl(4): Fix handling data passed with ioctl from NVM update tool
erj [Thu, 24 Jan 2019 01:08:37 +0000 (01:08 +0000)]
ixl(4): Fix handling data passed with ioctl from NVM update tool

From Krzysztof:

Ensure that the entire data buffer passed from the NVM update tool is copied in
to kernel space and copied back out to user space using copyin() and copyout().

PR: 234104
Submitted by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reported by: Finn <ixbug@riseup.net>
MFC after: 5 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18817

5 years agointel iflib drivers: correct initialization of tx_cidx_processed
erj [Thu, 24 Jan 2019 01:03:00 +0000 (01:03 +0000)]
intel iflib drivers: correct initialization of tx_cidx_processed

From Jake:

In r341156 ("Fix first-packet completion", 2018-11-28) a hack to work
around a delta calculation determining how many descriptors were used
was added to ixl_isc_tx_credits_update_dwb.

The same fix was also applied to the em and igb drivers in r340310, and
to ix in r341156.

The hack checked the case where prev and cur were equal, and then added
one. This works, because by the time we do the delta check, we already
know there is at least one packet available, so the delta should be at
least one.

However, it's not a complete fix, and as indicated by the comment is
really a hack to work around the real bug.

The real problem is that the first time that we transmit a packet,
tx_cidx_processed will be set to point to the start of the ring.
Ultimately, the credits_update function expects it to point to the
*last* descriptor that was processed. Since we haven't yet processed any
descriptors, pointing it to 0 results in this incorrect calculation.

Fix the initialization code to have it point to the end of the ring
instead. One way to think about this, is that we are setting the value
to be one prior to the first available descriptor.

Doing so, corrects the delta calculation in all cases. The original fix
only works if the first packet has exactly one descriptor. Otherwise, we
will report 1 less than the correct value.

As part of this fix, also update the MPASS assertions to match the real
expectations. First, ensure that prev is not equal to cur, since this
should never happen. Second, remove the assertion about prev==0 || delta
!= 0. It looks like that originated from when the em driver was
converted to iflib. It seems like it was supposed to ensure that delta
was non-zero. However, because we originally returned 0 delta for the
first calculation, the "prev == 0" was tacked on.

Instead, replace this with a check that delta is greater than zero,
after the correction necessary when the ring pointers wrap around.

This new solution should fix the same bug as r341156 did, but in a more
robust way.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: shurd@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D18545

5 years agoFix up r343367
ngie [Wed, 23 Jan 2019 23:48:57 +0000 (23:48 +0000)]
Fix up r343367

I should have only changed the format qualifier with the `size_t` value,
`length`, not the other [`off_t`] value, `dest_file_size`.

MFC after: 1 month
MFC with: r343362, r343365, r343367
Approved by: emaste (mentor; implicit)
Reported by: gcc 8.x

5 years agoUnbreak the build on architectures where size_t isn't synonymous with uintmax_t
ngie [Wed, 23 Jan 2019 23:30:55 +0000 (23:30 +0000)]
Unbreak the build on architectures where size_t isn't synonymous with uintmax_t

I should have used `%zu` instead of `%ju` with `size_t` types.

MFC after: 1 month
MFC with: r343362, r343365
Approved by: emaste (mentor; implicit)
Reviewed by: asomers
Pointyhat to: ngie
Submitted by: asomers
Differential Revision: https://reviews.freebsd.org/D18935

5 years agoRemove documentation for the nonexistant cred_update_thread(9).
brooks [Wed, 23 Jan 2019 23:25:42 +0000 (23:25 +0000)]
Remove documentation for the nonexistant cred_update_thread(9).

This was a tangential change submitted as part of D18930.

Submitted by: jack@gandi.net

5 years agoUnbreak the gcc build with sendfile_test after r343362
ngie [Wed, 23 Jan 2019 23:06:39 +0000 (23:06 +0000)]
Unbreak the gcc build with sendfile_test after r343362

gcc 8.x is more pedantic than clang 7.x with format strings and the tests
passed `void*` variables while supplying `%s` (which is technically
incorrect).

Make the affected `void*` variables use `char*` storage instead to address
this issue, as the compiler will upcast the values to `char*`.

MFC after: 1 month
MFC with: r343362
Approved by: emaste (mentor; implicit)
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D18934

5 years agoStyle.
markj [Wed, 23 Jan 2019 22:19:49 +0000 (22:19 +0000)]
Style.

Reviewed by: bz
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoFix an LLE lookup race.
markj [Wed, 23 Jan 2019 22:18:23 +0000 (22:18 +0000)]
Fix an LLE lookup race.

After the afdata read lock was converted to epoch(9), readers could
observe a linked LLE and block on the LLE while a thread was
unlinking the LLE.  The writer would then release the lock and schedule
the LLE for deferred free, allowing readers to continue and potentially
schedule the LLE timer.  By the point the timer fires, the structure is
freed, typically resulting in a crash in the callout subsystem.

Fix the problem by modifying the lookup path to check for the LLE_LINKED
flag upon acquiring the LLE lock.  If it's not set, the lookup fails.

PR: 234296
Reviewed by: bz
Tested by: sbruno, Victor <chernov_victor@list.ru>,
Mike Andrews <mandrews@bit0.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18906

5 years agoAdd [initial] functional tests for sendfile(2) as lib/libc/sys/sendfile
ngie [Wed, 23 Jan 2019 22:00:17 +0000 (22:00 +0000)]
Add [initial] functional tests for sendfile(2) as lib/libc/sys/sendfile

These testcases exercise a number of functional requirements for sendfile(2).

The testcases use IPv4 and IPv6 domain sockets with TCP, and were confirmed
functional on UFS and ZFS. UDP address family sockets cannot be used per the
sendfile(2) contract, thus using UDP sockets is outside the scope of
testing the syscall in positive cases. As seen in
`:s_negative_udp_socket_test`, UDP is used to test the sendfile(2) contract
to ensure that EINVAL is returned by sendfile(2).

The testcases added explicitly avoid testing out `SF_SYNC` due to the
complexity of verifying that support. However, this is a good next logical
item to verify.

The `hdtr_positive*` testcases work to a certain degree (the header
testcases pass), but the trailer testcases do not work (it is an expected
failure). In particular, the value received by the mock server doesn't match
the expected value, and instead looks something like the following (using
python array notation):

`trailer[:]message[1:]`

instead of:

`message[:]trailer[:]`

This makes me think there's a buffer overrun issue or problem with the
offset somewhere in the sendfile(2) system call, but I need to do some
other testing first to verify that the code is indeed sane, and my
assumptions/code isn't buggy.

The `sbytes_negative` testcases that check `sbytes` being set to an
invalid value resulting in `EFAULT` fails today as the other change
(which checks `copyout(9)`) has not been committed [1]. Thus, it
should remain an expected failure (see bug 232210 for more details
on this item).

Next steps for testing sendfile(2):
1. Fix the header/trailer testcases so that they pass.
2. Setup if_tap interface and test with it, instead of using "localhost", per
   @asomers's suggestion.
3. Handle short recv(2)'s in `server_cat(..)`.
4. Add `SF_SYNC` support.
5. Add some more negative tests outside the scope of the functional contract.

MFC after: 1 month
Reviewed by: asomers
Approved by: emaste (mentor)
PR:  232210
Sponsored by:   Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D18625

5 years agoRemove extraneous setutxent() calls in write(1).
markj [Wed, 23 Jan 2019 20:02:17 +0000 (20:02 +0000)]
Remove extraneous setutxent() calls in write(1).

We already call setutxent() once during initialization.  Furthermore,
the subsequent calls occur after the process has entered capability
mode, so they fail, and attempts to fetch database entries fail as
a result.

PR: 235096
Submitted by: fullermd@over-yonder.net
MFC after: 3 days

5 years agoCorrect uma_prealloc()'s use of domainset iterators after r339925.
markj [Wed, 23 Jan 2019 18:58:15 +0000 (18:58 +0000)]
Correct uma_prealloc()'s use of domainset iterators after r339925.

The iterator should be reinitialized after every successful slab
allocation.  A request to advance the iterator is interpreted as
an allocation failure, so a sufficiently large preallocation would
cause the iterator to believe that all domains were exhausted,
resulting in a sleep with the keg lock held. [1]

Also, keg_alloc_slab() should pass the unmodified wait flag to the
item initialization routine, which may use it to perform allocations
from other zones.

Reported and tested by: slavah
Diagnosed by: kib [1]
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoAdd USB quirk.
hselasky [Wed, 23 Jan 2019 18:53:13 +0000 (18:53 +0000)]
Add USB quirk.

Submitted by: Gary Jennejohn <gljennjohn@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFixed issues reported by coverity scan.
ram [Wed, 23 Jan 2019 17:34:01 +0000 (17:34 +0000)]
Fixed issues reported by coverity scan.

Approved by: mav
MFC after: 3 weeks

5 years agoocs_fc: Ensure that we zero-initialize memory before copying it out.
markj [Wed, 23 Jan 2019 17:28:39 +0000 (17:28 +0000)]
ocs_fc: Ensure that we zero-initialize memory before copying it out.

Note that the affected interface is available only to root.

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Reviewed by: emaste, ram
MFC after: 1 day
Security: Kernel memory disclosure
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18914

5 years agogmirror: Relocate DEVICE_FLAGS to adjacent lines
cem [Wed, 23 Jan 2019 16:44:21 +0000 (16:44 +0000)]
gmirror: Relocate DEVICE_FLAGS to adjacent lines

gmirror's sc_flags is shared between some on-disk state and some runtime
only state.  There's no real reason for that and they could probably be
split up.  Until they are, locate all of the flags for the same field
nearby each other in the source, for clarity.

No functional change.

Sponsored by: Dell EMC Isilon

5 years agonetmap: improvements to the netmap kloop (CSB mode)
vmaffione [Wed, 23 Jan 2019 14:51:36 +0000 (14:51 +0000)]
netmap: improvements to the netmap kloop (CSB mode)

Changelist:
    - Add the proper memory barriers in the kloop ring processing
      functions.
    - Fix memory barriers usage in the user helpers (nm_sync_kloop_appl_write,
      nm_sync_kloop_appl_read).
    - Fix nm_kr_txempty() helper to look at rhead rather than rcur. This
      is important since the kloop can read a value of rcur which is ahead
      of the value of rhead (see explanation in nm_sync_kloop_appl_write)
    - Remove obsolete ptnetmap_guest_write_kring_csb() and
      ptnet_guest_read_kring_csb(), and update if_ptnet(4) to use those.
    - Prepare in advance the arguments for netmap_sync_kloop_[tr]x_ring(),
      to make the kloop faster.
    - Provide kernel and user implementation for nm_ldld_barrier() and
      nm_ldst_barrier()

MFC after: 2 weeks