]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r343980:
avos [Sat, 16 Feb 2019 01:05:22 +0000 (01:05 +0000)]
MFC r343980:
ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter

5 years agoMFC r343112: jail(8): stop crashing with SIGSEGV inside run_command()
eugen [Sat, 16 Feb 2019 00:40:03 +0000 (00:40 +0000)]
MFC r343112: jail(8): stop crashing with SIGSEGV inside run_command()
function while processing not entirely correct jail.conf(5) file
having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
so extrap variable stays NULL.

Reported by:    marck

5 years agoMFC r343909:
avos [Sat, 16 Feb 2019 00:37:08 +0000 (00:37 +0000)]
MFC r343909:
newkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
when output file cannot be opened

PR: 201732
Reported by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r343163:
wulf [Fri, 15 Feb 2019 20:46:03 +0000 (20:46 +0000)]
MFC r343163:

psm(4): detect Lenovo top-button clickpads

libinput has special handling for Lenovo ThinkPad *40 series, where it
treats clicks on the top button area as if they came from the TrackPoint:
https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html

Detect these devices and set the corresponding evdev property.

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D18676

5 years agoMFC r343859:
kib [Fri, 15 Feb 2019 11:36:16 +0000 (11:36 +0000)]
MFC r343859:
Add comment noting that the strange spelling of GenuineIntel is for reason.

5 years agoMFC r343899:
kib [Fri, 15 Feb 2019 11:28:32 +0000 (11:28 +0000)]
MFC r343899:
In null_vptocnp(), cache vp->v_mount and use it for null_nodeget() call.

PR: 235549

5 years agoMFC r343897, r343898:
kib [Fri, 15 Feb 2019 11:27:21 +0000 (11:27 +0000)]
MFC r343897, r343898:
Some style for nullfs_mount().
Before using VTONULL(), check that the covered vnode belongs to nullfs.

5 years agoMFC r343905:
hselasky [Fri, 15 Feb 2019 09:21:16 +0000 (09:21 +0000)]
MFC r343905:
Improve Bluetooth device discovery support for Android and Microsoft devices.

Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
project at github.com.

PR: 210089
Sponsored by: Mellanox Technologies

5 years agoMFC r343480,343482: Silence Clang Scan warning about unsafe use of strcpy.
se [Thu, 14 Feb 2019 15:42:29 +0000 (15:42 +0000)]
MFC r343480,343482: Silence Clang Scan warning about unsafe use of strcpy.

Replace strcpy() by memcpy to the previously allocated range of known size.

5 years agoMFC r343479: Fix potential buffer overflow and undefined behavior.
se [Thu, 14 Feb 2019 15:41:05 +0000 (15:41 +0000)]
MFC r343479: 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.

5 years agoMFC r343408: Silence Clang Scan warnings regarding unsafe use of strcp().
se [Thu, 14 Feb 2019 15:39:17 +0000 (15:39 +0000)]
MFC r343408: Silence Clang Scan warnings regarding unsafe use of strcp().

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

A bogus assignment to a variable (whose previous value may be required in
a later block) has also been removed.

5 years agoMFC r343339: Silence Clang Scan warning about use of unitialized variable.
se [Thu, 14 Feb 2019 15:33:04 +0000 (15:33 +0000)]
MFC r343339: Silence Clang Scan warning about use of unitialized variable.

The logic is changed to depend on actual "beep" parameters instead of on a
flag that may be set for invalid parameters.

An embedded literal escape character has been replaced by "\e", since it
could confuse terminals when displaying the affected line.

5 years agoMFC r343868:
avos [Thu, 14 Feb 2019 09:50:59 +0000 (09:50 +0000)]
MFC r343868:
Add ypldap(8)-related files and /var/yp directory to the
OptionalObsoleteFiles.inc.

5 years agoMFC r343591:
cy [Thu, 14 Feb 2019 00:52:03 +0000 (00:52 +0000)]
MFC r343591:

Do not obtain an already held read lock. This causes a witness panic when
ipfs is invoked. This is the second of two panics resolving PR 235110.

PR: 235110
Reported by: David.Boyd49@twc.com

5 years agoMFC: r343372
marius [Wed, 13 Feb 2019 16:02:55 +0000 (16:02 +0000)]
MFC: r343372

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>
Differential Revision: https://reviews.freebsd.org/D18817

5 years agoMFC: r343203
marius [Wed, 13 Feb 2019 14:28:02 +0000 (14:28 +0000)]
MFC: r343203

ixgbe: this statement may fall through warnings with gcc

The recent gcc versions (7 and 8 at least) can check for switch case
statements for fall through (implicit-fallthrough). When fall through
is intentional, the default method for warning suppression is to place
comment /* FALLTHROUGH */ exactly before next case statement.

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

5 years agoMFC: r333879, r342749
marius [Wed, 13 Feb 2019 14:25:05 +0000 (14:25 +0000)]
MFC: r333879, r342749

- Even though 64-bit atomics are supported on i386 there are panics
  indicating that the code does not work correctly there. Switch
  to mutex based variant (and fix that while we're here).
  Reported by: pho, kib

- mp_ring: avoid items offset difference between iflib and mp_ring
  on architectures without 64-bit atomics
  Reported by: Augustin Cavalier <waddlesplash@gmail.com>

5 years agoMFC r343871:
avos [Wed, 13 Feb 2019 09:28:48 +0000 (09:28 +0000)]
MFC r343871:
recoverdisk(1): fclose() file supplied via '-r readlist' parameter when
it's no longer needed

PR: 204952
Reported by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r343586: Remove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.
mav [Wed, 13 Feb 2019 00:39:28 +0000 (00:39 +0000)]
MFC r343586: Remove BIO_ORDERED flag from BIO_FLUSH sent by ZFS.

In all cases where ZFS sends BIO_FLUSH, it first waits for all related
writes to complete, so its BIO_FLUSH does not care about strict ordering.
Removal of one makes life much easier at least for NVMe driver, which
hardware has no concept of request ordering, relying completely on software.

5 years agoMFC r343582,r343588:Relax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.
mav [Wed, 13 Feb 2019 00:38:28 +0000 (00:38 +0000)]
MFC r343582,r343588:Relax BIO_FLUSH ordering in da(4), respecting BIO_ORDERED.

r212160 tightened this from always using MSG_SIMPLE_Q_TAG to always
MSG_ORDERED_Q_TAG.  Since it also marked all BIO_FLUSH requests with
BIO_ORDERED, this commit changes nothing immediately, but it returns
BIO_FLUSH callers ability to actually specify ordering they really
need, alike to other request types.

5 years agoMFC r343585: Only sort requests of types that have concept of offset.
mav [Wed, 13 Feb 2019 00:35:09 +0000 (00:35 +0000)]
MFC r343585: Only sort requests of types that have concept of offset.

Other types, such as BIO_FLUSH or BIO_ZONE, or especially new/unknown ones,
may imply some degree of ordering even if strict ordering is not requested
explicitly.

5 years agoMFC r342598:
ngie [Tue, 12 Feb 2019 23:37:20 +0000 (23:37 +0000)]
MFC r342598:

Remove legacy rc.d infrastructure references from rc(8)

Legacy rc.d scripts (.sh extension) have not been supported since
r193118. Remove the outdated references to the legacy format, as they
are no longer valid.

PR: 193936
Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D19157

5 years agoMFC r342946: Remove accessing remote node and domain objects
ram [Tue, 12 Feb 2019 17:05:59 +0000 (17:05 +0000)]
MFC r342946: Remove accessing remote node and domain objects
while processing cam actions.
  Issue:
    ocs_fc(4) driver panics. It's induced by setting the port_state
  sysctl to offline, then online, then offline, then online, and so
  forth and so on in rapid succession.

  Reason:
    While we set the port_state to online fc discovery will start and OS
  is enumerating the target discs by calling ocs_action(),  then set the
  port state to "offline" which deletes domain/sport/nodes.

    In ocs_action()->XPT_GET_TRAN_SETTINGS we are accessing the remote
  node which can be invalid to get the wwpn, wwnn and port.

  Fix:
    Removed accessing of remote node and domain in some ocs_action() cases.
    Populated the required values from ocs_fcport.
    This removes the dependency of node and domain structures while
  processing XPT_PATH_INQ and XPT_GET_TRAN_SETTINGS.
     We will invalidate the target entries after the device lost
  timeout(30 seconds).

Approved by:ken,mav

5 years agoFix PAE modules build on i386.
kib [Tue, 12 Feb 2019 16:56:10 +0000 (16:56 +0000)]
Fix PAE modules build on i386.

Reimplement PAE version of pte_load() by copying/pasting the
atomic_load_acq_64_i586() into it definition. pmap_kextract() is defined
as inline and uses pte_load() in its body, so the pte_load() should be
available when pmap.h is included. On stable/11, the atomic inlines are
not exposed to modules.

This is a direct commit to stable/11.

Reported by: dim
Sponsored by: The FreeBSD Foundation

5 years agoMFC 343548:
marck [Tue, 12 Feb 2019 14:03:39 +0000 (14:03 +0000)]
MFC 343548:

  Allow dashes as a valid character in UFS labels.

5 years agoMFC r343772, r343867
vmaffione [Tue, 12 Feb 2019 09:26:05 +0000 (09:26 +0000)]
MFC r343772, r343867

netmap: refactor logging macros and pipes

Changelist:
    - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr
      and nm_prlim, to avoid possible naming conflicts.
    - Add netmap_krings_mode_commit() helper function and use that
      to reduce code duplication.
    - Refactor pipes control code to export some functions that
      can be reused by the veth driver (on Linux) and epair(4).
    - Add check to reject API requests with version less than 11.
    - Small code refactoring for the null adapter.

5 years agoMFC r343870:
avos [Tue, 12 Feb 2019 07:03:37 +0000 (07:03 +0000)]
MFC r343870:
ipcs(1): drop obsolete error checking

This code is unreachable since r77551.

PR: 201728

5 years agoMFC r342904:
ngie [Tue, 12 Feb 2019 03:13:10 +0000 (03:13 +0000)]
MFC r342904:

route(8): clarify -prefixlen description

Try to reword -prefixlen section to more clearly and accurately describe how
the -prefixlen modifier works.

While here, fix a word that igor considered a typo: aggregatable addresses is a
valid technical term per RFC-2374, however, it was superseded by the term
"aggregator" in RFC-3587.

Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D19156

5 years agoMFC r339343,r343444:
ngie [Tue, 12 Feb 2019 02:57:34 +0000 (02:57 +0000)]
MFC r339343,r343444:

r339343 (by allanjude):

Document that sendfile(2) can return ENOTCAPABLE

PR: 232207

r343444:

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
Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D19150

5 years agoMFC r343562, r343563: Reimplement BIO_ORDERED handling in nvd(4).
mav [Tue, 12 Feb 2019 00:53:43 +0000 (00:53 +0000)]
MFC r343562, r343563: Reimplement BIO_ORDERED handling in nvd(4).

This fixes BIO_ORDERED semantics while also improving performance by:
 - sleeping also before BIO_ORDERED bio, as defined, not only after;
 - not queueing BIO_ORDERED bio to taskqueue if no other bios running;
 - waking up sleeping taskqueue explicitly rather then rely on polling.

On Samsung SSD 970 PRO this shows sync write latency, measured with
`diskinfo -wS`, reduction from ~2ms to ~1.1ms by not sleeping without
reason till next HZ tick.

On the same device ZFS pool with 8 ZVOLs synchronously writing 4KB blocks
shows ~950 IOPS instead of ~750 IOPS before.  I suspect ZFS does not need
BIO_ORDERED on BIO_FLUSH at all, but that will be next question.

5 years agoMFC r343520:
kp [Mon, 11 Feb 2019 19:08:03 +0000 (19:08 +0000)]
MFC r343520:

pfctl: Point users to net.pf.request_maxcount if large requests are rejected

The kernel will reject very large tables to avoid resource exhaustion
attacks. Some users run into this limit with legitimate table
configurations.

The error message in this case was not very clear:

  pf.conf:1: cannot define table nets: Invalid argument
  pfctl: Syntax error in config file: pf rules not loaded

If a table definition fails we now check the request_maxcount sysctl,
and if we've tried to create more than that point the user at
net.pf.request_maxcount:

  pf.conf:1: cannot define table nets: too many elements.
  Consider increasing net.pf.request_maxcount.
  pfctl: Syntax error in config file: pf rules not loaded

PR: 235076

5 years agoMFC r343921:
bcr [Mon, 11 Feb 2019 17:48:52 +0000 (17:48 +0000)]
MFC r343921:

Add an example to pw.8 about how to add an existing user to a group.

Instead of using pw to modify group membership, users often edit
/etc/group by hand, which is discouraged.  Provide an example of
adding a user to the wheel group, which is a common use case.
I'm using a different user here as in the previous example as that
deleted the user (although the examples don't necessarily have to
be followed in order).

Reviewed by: rgrimes,0mp
Approved by:    0mp
Differential Revision: https://reviews.freebsd.org/D19123

5 years agoMFC r336446: Implemented Device Lost Timer,
ram [Mon, 11 Feb 2019 16:28:04 +0000 (16:28 +0000)]
MFC r336446: Implemented Device Lost Timer,
which is used to give target device the time to recover before marking dead.

Issue: IO fails immediately after doing port-toggle.
Fix: Added LDT(Device Lost Timer)- we wait a specific period of time prior to telling the OS about lost device.

Approved by: ken, mav
Differential Revision: D16196

5 years agoMFC r343727: Use switch instead of chained if/else to improve readability.
mav [Mon, 11 Feb 2019 14:50:12 +0000 (14:50 +0000)]
MFC r343727: Use switch instead of chained if/else to improve readability.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Sponsored by: iXsystems, Inc.

5 years agoMFC r343728: Check element type before setting LEDs.
mav [Mon, 11 Feb 2019 14:49:10 +0000 (14:49 +0000)]
MFC r343728: Check element type before setting LEDs.

With r319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature
sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array
device slot elements.  Other type elements will be skipped, but it would be
simple to add additional cases for controlling the ident LEDs of other
element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using
unnamed numeric constants, leverage existing code abstractions.

Submitted by:   Ryan Moeller <ryan@freqlabs.com>
Sponsored by:   iXsystems, Inc.

5 years agoMFC r343745, r343752: Add missed tunables/sysctls for some new vdev variables.
mav [Mon, 11 Feb 2019 14:47:26 +0000 (14:47 +0000)]
MFC r343745, r343752: Add missed tunables/sysctls for some new vdev variables.

While there, make few existing sysctls writeable, since there is no reason
not to.

5 years agoMFC r343815:
avos [Mon, 11 Feb 2019 00:31:58 +0000 (00:31 +0000)]
MFC r343815:
iwn(4): plug initialization path vs interrupt handler races

There are few places in interrupt handler where the driver
lock is dropped; ensure that device is still running before
processing remaining ring entries.

PR: 192641

5 years agoMFC r342910:
pfg [Sun, 10 Feb 2019 23:47:37 +0000 (23:47 +0000)]
MFC r342910:
grep(1) outputs NOT-matched lines with multi-byte characters

PR: 113343

5 years agoMFC r343470:
oshogbo [Sun, 10 Feb 2019 22:32:09 +0000 (22:32 +0000)]
MFC r343470:
  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 agoMFC r343474:
avos [Sun, 10 Feb 2019 21:00:02 +0000 (21:00 +0000)]
MFC r343474:
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.

5 years agoMFC r343698, r343700:
avos [Sun, 10 Feb 2019 20:42:06 +0000 (20:42 +0000)]
MFC r343698, r343700:
ifconfig(8): display management / multicast wlan(4) rates properly

For 11n / 11ac we are still using non-11n rates for management and
multicast traffic by default; check 'MCS rate' bit to determine how
to print them correctly.

PR: 161035

5 years agoMFC r343837:
avos [Sun, 10 Feb 2019 20:25:45 +0000 (20:25 +0000)]
MFC r343837:
net80211(4): validate supplied roam:rate values from ifconfig(8)

5 years agoMFC r343724:
kib [Sun, 10 Feb 2019 05:42:01 +0000 (05:42 +0000)]
MFC r343724:
Do not call PHOLD() while owning the allproc_lock sx.

5 years agoMFC r342592:
dim [Sat, 9 Feb 2019 12:01:10 +0000 (12:01 +0000)]
MFC r342592:

Pull in r342397 from upstream llvm trunk (by Amara Emerson):

  Revert "Revert r342183 "[DAGCombine] Fix crash when store merging
  created an extract_subvector with invalid index.""

  Fixed the assertion failure.

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

This fixes 'Assertion failed: ((VT.getVectorNumElements() +
N2C->getZExtValue() <= N1.getValueType().getVectorNumElements()) &&
"Extract subvector overflow!"), function getNode' when building the
multimedia/aom port (with AVX2 enabled).

Reported by: jbeich
PR: 234480

5 years agoMFC r343673: Fix integer math overflow in UMA hash_alloc().
mav [Sat, 9 Feb 2019 02:10:03 +0000 (02:10 +0000)]
MFC r343673: Fix integer math overflow in UMA hash_alloc().

512GB of ZFS ABD ARC means abd_chunk zone of 128M 4KB items.  To manage
them UMA tries to allocate 2GB hash table, which size does not fit into
the int variable, causing later allocation failure, which makes ARC shrink
back below the 512GB, not letting it to use more RAM.  With this change I
easily reached >700GB ARC size on 768GB RAM machine.

Sponsored by: iXsystems, Inc.

5 years agoMFC r343604:
avos [Fri, 8 Feb 2019 14:27:25 +0000 (14:27 +0000)]
MFC r343604:
bwn(4): reuse ieee80211_tx_complete function

5 years agoMFC r343603:
avos [Fri, 8 Feb 2019 13:57:28 +0000 (13:57 +0000)]
MFC r343603:
ipw(4): reuse ieee80211_tx_complete function

This should partially fix 'netstat -b -I wlan0' output

5 years agoMFC r343572:
hselasky [Fri, 8 Feb 2019 10:27:02 +0000 (10:27 +0000)]
MFC r343572:
Add support for Audio Sink and Audio Source profiles to sdpd(8).

This allows user-space programs like virtual_oss(8) to act
as a Bluetooth speaker device.

Sponsored by: Mellanox Technologies

5 years agoMFC r343683:
avos [Fri, 8 Feb 2019 04:48:12 +0000 (04:48 +0000)]
MFC r343683:
Do not acquire IEEE80211_LOCK twice in cac_timeout(); reuse
locked function instead.

It is externally visible since r257065.

5 years agoMFC r343808:
kib [Fri, 8 Feb 2019 03:29:17 +0000 (03:29 +0000)]
MFC r343808:
Remove pointless initial value for i386 vm.pmap.pat_works sysctl definition.

5 years agoMFC r337272:
bdrewery [Thu, 7 Feb 2019 23:55:11 +0000 (23:55 +0000)]
MFC r337272:

  Fix some filemon path logging issues.

5 years agoMFC r343633:
bdrewery [Thu, 7 Feb 2019 21:22:01 +0000 (21:22 +0000)]
MFC r343633:

  Shar files may be seen as binary by grep.

5 years agoMFC r343689
vmaffione [Thu, 7 Feb 2019 10:44:53 +0000 (10:44 +0000)]
MFC r343689

netmap: upgrade sync-kloop support

Add SYNC_KLOOP_MODE option, and add support for direct mode, where application
executes the TXSYNC and RXSYNC in the context of the ioeventfd wake up callback.

5 years agoMFC r343748:
dim [Thu, 7 Feb 2019 06:55:26 +0000 (06:55 +0000)]
MFC r343748:

Use NLDT to get number of LDTs on i386

Compiling a GENERIC kernel for i386 with clang 8.0 results in the
following warning:

/usr/src/sys/i386/i386/sys_machdep.c:542:40: error: 'sizeof ((ldt))' will return the size of the pointer, not the array itself [-Werror,-Wsizeof-pointer-div]
        nldt = pldt != NULL ? pldt->ldt_len : nitems(ldt);
                                              ^~~~~~~~~~~
/usr/src/sys/sys/param.h:299:32: note: expanded from macro 'nitems'
#define nitems(x)       (sizeof((x)) / sizeof((x)[0]))
                         ~~~~~~~~~~~ ^

Indeed, 'ldt' is declared as 'union descriptor *', so nitems() is not
the right way to determine the number of LDTs.  Instead, the NLDT define
from sys/x86/include/segments.h should be used.

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

5 years agoMFC r343757:
kib [Thu, 7 Feb 2019 01:55:11 +0000 (01:55 +0000)]
MFC r343757:
Update CPUID bits definitions and CPU identification based on changes
in SDM rev. 069.

5 years agoMFC r343549
vmaffione [Wed, 6 Feb 2019 10:00:40 +0000 (10:00 +0000)]
MFC r343549

netmap: add notifications on kloop stop

On sync-kloop stop, send a wake-up signal to the kloop, so that
waiting for the timeout is not needed.
Also, improve logging in netmap_freebsd.c.

5 years agoMFC r343346
vmaffione [Wed, 6 Feb 2019 09:49:42 +0000 (09:49 +0000)]
MFC r343346

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().
    - 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()

5 years agoMFC r343344
vmaffione [Wed, 6 Feb 2019 09:38:44 +0000 (09:38 +0000)]
MFC r343344

netmap: fix knote() argument to match the mutex state

The nm_os_selwakeup function needs to call knote() to wake up kqueue(9)
users. However, this function can be called from different code paths,
with different lock requirements.
This patch fixes the knote() call argument to match the relavant lock state.
Also, comments have been updated to reflect current code.

PR:     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219846
Reported by:    Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D18876

5 years agoMFC r343682:
avos [Wed, 6 Feb 2019 02:35:56 +0000 (02:35 +0000)]
MFC r343682:
sys/dev/wtap: Check return value from malloc(..., M_NOWAIT) and
drop unneeded cast.

5 years agoMFC r343681:
avos [Wed, 6 Feb 2019 02:18:11 +0000 (02:18 +0000)]
MFC r343681:
run(4): fix allocated memory type for ieee80211_node(4)

PR: 177366

5 years agoMFC r343574:
avos [Wed, 6 Feb 2019 02:06:00 +0000 (02:06 +0000)]
MFC r343574:
Fix compilation with 'option NDISAPI + device ndis' and
without 'device pccard' in the kernel config file.

PR: 171532
Reported by: Robert Bonomi <bonomi@host128.r-bonomi.com>

5 years agoMFC r343697:
avos [Wed, 6 Feb 2019 01:53:01 +0000 (01:53 +0000)]
MFC r343697:
net80211(4): fix rate check when 'roaming' ifconfig(8) option is set to 'auto'

Do not try to clear 'basic rate' bit from roamRate; it cannot be here and,
actually, this operation clears 'MCS rate' bit instead, breaking comparison
for 11n / 11ac modes.

5 years agoMFC r343684:
avos [Wed, 6 Feb 2019 01:47:22 +0000 (01:47 +0000)]
MFC r343684:
Drop unused M_80211_COM malloc(9) type.

It is not used since r287197.

5 years agoMFC r343542:
avos [Wed, 6 Feb 2019 01:42:26 +0000 (01:42 +0000)]
MFC r343542:
upgt(4): unbreak build with UPGT_DEBUG

5 years agoDocument SA-19:01 and SA-19:02.
gjb [Tue, 5 Feb 2019 22:08:49 +0000 (22:08 +0000)]
Document SA-19:01 and SA-19:02.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r343784:
markj [Tue, 5 Feb 2019 17:57:30 +0000 (17:57 +0000)]
MFC r343784:
Avoid leaking fp references when truncating SCM_RIGHTS control messages.

Approved by: so
Security: CVE-2019-5596

5 years agoMFC r343780:
kib [Tue, 5 Feb 2019 17:54:02 +0000 (17:54 +0000)]
MFC r343780:
amd64: clear callee-preserved registers on syscall exit.

Approved by: so
Security: CVE-2019-5595

5 years agonetmap: small cleanup on em, lem, igb, ixgbe
vmaffione [Tue, 5 Feb 2019 10:33:22 +0000 (10:33 +0000)]
netmap: small cleanup on em, lem, igb, ixgbe

Replace D, ND and RD macros with the corresponding nm_pr* ones.

5 years agoMFC r343541:
avos [Tue, 5 Feb 2019 03:01:10 +0000 (03:01 +0000)]
MFC r343541:
Drop some unneeded includes from wireless USB drivers.

5 years agoMFC r342815:
cy [Tue, 5 Feb 2019 02:33:57 +0000 (02:33 +0000)]
MFC r342815:

Remove ipsd (IP Scan Detetor). It is unused and to my knowledge has
never been used on any platform that ipfilter has been on. However
it looks like it could be a useful utility, therefore there are plans
to make it a port one day. It lacks a man page as well.

5 years agoMFC: 332990,337892,343546
bapt [Mon, 4 Feb 2019 08:37:16 +0000 (08:37 +0000)]
MFC: 332990,337892,343546

Update pci_vendors to 2019.01.29

5 years agoMFC r343576:
avos [Mon, 4 Feb 2019 03:44:07 +0000 (03:44 +0000)]
MFC r343576:
ndiscvt(8): abort if no IDs were found during conversion.

PR: 69268
Submitted by: <darius@dons.net.au>

5 years agoMFC r343607:
kib [Sun, 3 Feb 2019 00:45:52 +0000 (00:45 +0000)]
MFC r343607:
Reserve a bit in the FreeBSD feature control note for marking the
image as not compatible with ASLR.

5 years agoMFC r343484:
kib [Sun, 3 Feb 2019 00:44:26 +0000 (00:44 +0000)]
MFC r343484:
Remove now redundand ifunc relocation code which should have been
removed as part of r341441.

5 years agoMFC r343600:
cy [Sun, 3 Feb 2019 00:36:12 +0000 (00:36 +0000)]
MFC r343600:

Document the instance context pointer.

5 years agoMFC r343502:
avos [Sat, 2 Feb 2019 16:57:49 +0000 (16:57 +0000)]
MFC r343502:
Remove RADIUS-related files when WITHOUT_RADIUS_SUPPORT=true is set
in src.conf(5)

PR: 234041

5 years agoMFC r343499:
avos [Sat, 2 Feb 2019 04:21:00 +0000 (04:21 +0000)]
MFC r343499:
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.

5 years agoMFC r343552
vmaffione [Fri, 1 Feb 2019 12:24:56 +0000 (12:24 +0000)]
MFC r343552

vtnet: fix typo in vtnet_free_taskqueues

Because of a typo, the code was mistakenly resetting the
vtnrx_vq pointer rather than vtntx_tq.

Reviewed by:    bryanv
Differential Revision:  https://reviews.freebsd.org/D19015

5 years agoMFC r343453:
hselasky [Fri, 1 Feb 2019 10:09:13 +0000 (10:09 +0000)]
MFC r343453:
Add new USB quirk.

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

5 years agoMFC r343451:
hselasky [Fri, 1 Feb 2019 10:06:49 +0000 (10:06 +0000)]
MFC r343451:
Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI.

Sponsored by: Mellanox Technologies

5 years agoMFC r343418:
kp [Fri, 1 Feb 2019 10:04:54 +0000 (10:04 +0000)]
MFC r343418:

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

5 years agoMFC r343496:
avos [Fri, 1 Feb 2019 03:26:10 +0000 (03:26 +0000)]
MFC r343496:
pcf(4): fix parentheses in if condition

PR: 210709
Submitted by: David Binderman <dcb314@hotmail.com>

5 years agoMFC r343497:
avos [Fri, 1 Feb 2019 03:02:52 +0000 (03:02 +0000)]
MFC r343497:
Unbreak devd.conf(5) regex after r343249

PR: 235239
Submitted by: Helge Oldach <freebsd@oldach.net>

5 years agoMFC r343495:
avos [Fri, 1 Feb 2019 02:43:13 +0000 (02:43 +0000)]
MFC r343495:
wlan.4: improve wording

PR: 218075
Submitted by: Aaron Taylor <halfnote1004@gmail.com>

5 years agoMFC r342928:
sef [Thu, 31 Jan 2019 22:08:02 +0000 (22:08 +0000)]
MFC r342928:
   Change ZFS quotas to return EINVAL when not present (matches man page).

Approved by: mav
Reviewed by: markj
PR: 234413
Sponsored by: iXsystems Inc
Reported by: Emrion <kmachine@free.fr>

5 years agoMFC r343473:
avos [Thu, 31 Jan 2019 11:36:28 +0000 (11:36 +0000)]
MFC r343473:
geom_uzip(4): move NULL pointer KASSERT check before it is dereferenced

PR: 203499
Submitted by: <chadf@triularity.org>

MFC r343475:
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

5 years agoMFC r340242:
brooks [Wed, 30 Jan 2019 23:38:42 +0000 (23:38 +0000)]
MFC r340242:

Add a top-level make target to rebuild all sysent files.

The sysent target is useful when changing makesyscalls.sh, when
making paired changes to syscalls.master files, or in a future where
freebsd32 sysent entries are built from the default syscalls.master.

Reviewed by: bdrewery
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17899

5 years agoMFC r343486:
cy [Wed, 30 Jan 2019 02:39:08 +0000 (02:39 +0000)]
MFC r343486:

Fix a typo.

5 years agoixl: remove unnecessary limitations related to netmap
vmaffione [Tue, 29 Jan 2019 18:18:55 +0000 (18:18 +0000)]
ixl: remove unnecessary limitations related to netmap

Netmap supports the case where TX rings and RX rings have different size.
Remove unnecessary limitations related to netmap support, making the code
simpler.
Also, check that the value of the hw head index written back from the NIC
is valid.

Reviewed by: erj
Differential Revision: https://reviews.freebsd.org/D18984

5 years agoMFC r343366:
brooks [Tue, 29 Jan 2019 18:13:46 +0000 (18:13 +0000)]
MFC r343366:

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 agoMFC r343295:
kp [Tue, 29 Jan 2019 17:49:39 +0000 (17:49 +0000)]
MFC r343295:

pf: Validate psn_len in DIOCGETSRCNODES

psn_len is controlled by user space, but we allocated memory based on it.
Check how much memory we might need at most (i.e. how many source nodes we
have) and limit the allocation to that.

Reported by: markj

5 years agoMFC r343038: Use TD_IS_IDLETHREAD instead of unrolled version.
delphij [Tue, 29 Jan 2019 07:48:49 +0000 (07:48 +0000)]
MFC r343038: Use TD_IS_IDLETHREAD instead of unrolled version.

5 years agoMFC r343472:
avos [Tue, 29 Jan 2019 03:06:25 +0000 (03:06 +0000)]
MFC r343472:
otus(4): fix a typo in man page (802.11 -> 802.11n)

5 years agoMFC of 343449 and 343483
mckusick [Mon, 28 Jan 2019 21:48:04 +0000 (21:48 +0000)]
MFC of 343449 and 343483

Update tunefs to allow '_' in label names.

Update tunefs and newfs error messages to note that '_' is allowed
in label names.

Sponsored by: Netflix

5 years agoMFC r339523:
gonzo [Mon, 28 Jan 2019 18:55:29 +0000 (18:55 +0000)]
MFC r339523:

Add amdgpio, driver for GPIO controller on AMD-based x86_64 platforms

Submitted by: Rajesh Kumar <rajbsd@gmail.com>
Differential Revision: https://reviews.freebsd.org/D16865

5 years agoMFC r343413
vmaffione [Mon, 28 Jan 2019 09:27:28 +0000 (09:27 +0000)]
MFC r343413

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 agoMFC r343459: (parcial)
pfg [Mon, 28 Jan 2019 02:12:48 +0000 (02:12 +0000)]
MFC r343459: (parcial)
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.

Note: for the MFC to stable/11 several changes had to made.

admbug: 872, 891
Reviewed by: fsu
Obtained from: NetBSD (with changes)

5 years agoMFC r343238:
avos [Mon, 28 Jan 2019 01:50:47 +0000 (01:50 +0000)]
MFC r343238:
urtw(4): add length checks in Rx path.

- Check if buffer can contain Rx descriptor before accessing it.
- Verify upper / lower bounds for frame length.
- Do not pass too short frames into ieee80211_find_rxnode().

While here:
- Move cleanup to the function end.

5 years agoMFC r343234:
avos [Mon, 28 Jan 2019 01:37:36 +0000 (01:37 +0000)]
MFC r343234:
run(4): add more length checks in Rx path.

- Discard frames that are bigger than MCLBYTES (to prevent buffer overrun).
- Check buffer length before accessing its contents.
- Fix len <-> dmalen check - the last includes Rx Wireless information
structure size.
- Fix out-of-bounds read during Rx node search for ACK / CTS frames
(monitor mode only).

While here:
- Mark few suspicious places with comments.
- Move common cleanup to the function end.

5 years agoMFC r343342:
avos [Mon, 28 Jan 2019 01:19:43 +0000 (01:19 +0000)]
MFC r343342:
net80211: turn channel mode check into assertion.

There is may be only 11b channel (since chanflags[] table
maps MODE_AUTO to the corresponding 11b channel flags).