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

5 years agoMFC r343340:
avos [Mon, 28 Jan 2019 01:12:20 +0000 (01:12 +0000)]
MFC r343340:
net80211: fix channel list construction for non-auto operating mode.

Change the way how channel list mode <-> desired mode match is done:
- Match channel list mode for next non-auto desired modes:
 * 11b: 11g, 11ng;
 * 11a: 11na
- Add pre-defined channels only when one of the next conditions met:
 * the desired channel mode is 'auto' or
 * the desired channel and selected channel list modes are exactly
the same or
 * the previous rule (11g / 11n promotion) applies.

Before r275875 construction work properly for all except
11ng / 11na modes - these were broken at all
(i.e., the scan list was empty); after r275875 all checks were removed,
so scan table was populated by all device-compatible channels
(desired mode was ignored).

For example, if I will set 'ifconfig wlan0 mode 11ng' for RTL8821AU:
- pre-r275875: nothing, scan will not work;
- after r275875: both 11ng and 11na bands were scanned; also, since 11b
channel list was used, 14th channel was scanned too.
- after this change: only 11ng - 1-13 channels - are used for scanning.

Note: since 11-stable does not have VHT mode definitions
they were removed from this merge.

5 years agoMFC r343235:
avos [Mon, 28 Jan 2019 00:58:01 +0000 (00:58 +0000)]
MFC r343235:
iwn(4): drop return code from iwn_*attach functions (they cannot fail)

While here, add missing trace 'end' marker in iwn5000_attach().

5 years agoMFC r343341:
avos [Mon, 28 Jan 2019 00:51:26 +0000 (00:51 +0000)]
MFC r343341:
ifconfig: drop unused macros from ifieee80211.c

5 years agoMFC: r342634 (partial)
marius [Sun, 27 Jan 2019 19:04:28 +0000 (19:04 +0000)]
MFC: r342634 (partial)

o Don't allocate resources for SDMA in sdhci(4) if the controller or the
  front-end doesn't support SDMA or the latter implements a platform-
  specific transfer method instead. While at it, factor out allocation
  and freeing of SDMA resources to sdhci_dma_{alloc,free}() in order to
  keep the code more readable when adding support for ADMA variants.

o Base the size of the SDMA bounce buffer on MAXPHYS up to the maximum
  of 512 KiB instead of using a fixed 4-KiB-buffer. With the default
  MAXPHYS of 128 KiB and depending on the controller and medium, this
  reduces the number of SDHCI interrupts by a factor of ~16 to ~32 on
  sequential reads while an increase of throughput of up to ~84 % was
  seen.

  Front-ends for broken controllers that only support an SDMA buffer
  boundary of a specific size may set SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY
  and supply a size via struct sdhci_slot. According to Linux, only -
  unsupported in stable/11 anyway - Qualcomm MSM-type SDHCI controllers
  are affected by this, though.

  Requested by: Shreyank Amartya (unconditional bump to 512 KiB)

o Introduce a SDHCI_DEPEND macro for specifying the dependency of the
  front-end modules on the sdhci(4) one and bump the module version
  of sdhci(4) to 2 via an also newly introduced SDHCI_VERSION in order
  to ensure that all components are in sync WRT struct sdhci_slot.

o In sdhci(4):
  - Make pointers const were applicable, and
  - replace a few device_printf(9) calls with slot_printf() for
    consistency.

5 years agoMFC: r333745, r333764, r337533, r339375, r341041
marius [Sun, 27 Jan 2019 14:36:52 +0000 (14:36 +0000)]
MFC: r333745, r333764, r337533, r339375, r341041

- ck: add support for executing callbacks outside of main poll loop
  Pull in change from upstream deca119d14bfffd440770eb67cbdbeaf7b57eb7b
- Import CK as of commit deca119d14bfffd440770eb67cbdbeaf7b57eb7b.
  This is mostly a noop, for mergeinfo purpose, because the relevant changes
  were committed directly.
- Import CK as of commit 08813496570879fbcc2adcdd9ddc0a054361bfde, mostly
  to avoid using lwsync on ppc32.
- Import CK as of commit 5221ae2f3722a78c7fc41e47069ad94983d3bccb.
  This fixes two problems, one where epoch calls could occur before all
  the readers had exited the epoch section, and one where the epoch calls
  could be unnecessarily delayed.
- Import CK as of 21d3e319407d19dece16ee317c757ffc54a452bc, which makes its
  sparcv9 atomics compatible with the FreeBSD kernel by using instructions
  which access the appropriate address space.

5 years agoMFC r306323:
avos [Sun, 27 Jan 2019 14:27:53 +0000 (14:27 +0000)]
MFC r306323:
[ath_hal] Add FCC6_FCCA regulatory domain (0x0014).

PR: 194336
Requested by: Chris Hutchinson <portmaster@bsdforge.com>

5 years agoMFC: r342964
nyan [Sun, 27 Jan 2019 13:58:06 +0000 (13:58 +0000)]
MFC: r342964

  Sync with OpenBSD.

  bc.y: Rev 1.50
  - write parse errors to stderr, prompted by Martijn Dekker
  - we're only interactive if stdout en stderr are a tty as well as stdin

PR: 234430
Obtained from: OpenBSD

5 years agoMFC r343213:
avos [Sun, 27 Jan 2019 13:03:48 +0000 (13:03 +0000)]
MFC r343213:
net80211: resolve ioctl <-> detach race for ieee80211com structure

Since r287197 ieee80211com is a part of drivers softc; as a result,
after detach all pointers to it (iv_ic, ni_ic) are invalid. Most
possible users (tasks, interrupt handlers) are blocked / removed
when device is stopped; however, ioctl handlers were not tracked
and may crash if ieee80211com structure is accessed.

Since ieee80211com pointer access from ieee80211vap structure is not
protected by lock (constant after interface creation) and used in
many other places just use reference counting for ioctl handlers;
on detach set 'detached' flag and wait until reference counter goes to 0.

For KBI stability the last element of iv_spare[] array was reused.

5 years agoMFC r343249:
avos [Sat, 26 Jan 2019 13:36:06 +0000 (13:36 +0000)]
MFC r343249:
Fix duplicate wpa_supplicant(8) / hostapd(8) startup with devd(8)

Do not invoke 'wlan_up' function from devd(8) on interface
creation event (an example to create such event:
'ifconfig wlan0 create wlandev rtwn0');
they're typically produced during 'service netif (re)start'
and result in duplicate interface initialization.

From the user side if WPA option is used, this result in messages like:
- /etc/rc.d/wpa_supplicant: WARNING: failed to start wpa_supplicant
or
- wpa_supplicant already running?  (pid=xxxx).
(for HOSTAP interfaces this race may result in startup failure).

As a side effect, wpa_supplicant(8) / hostapd(8) will not be
invoked when new wlan(4) interface is created manually and
corresponding configuration for it is present in rc.conf(5).

This change does not affect device attach / removal events.

5 years agoMFC r343244:
avos [Sat, 26 Jan 2019 13:02:59 +0000 (13:02 +0000)]
MFC r343244:
devd.conf(5): add otus(4) into wifi-driver-regex

5 years agoMFC r343190:
avos [Sat, 26 Jan 2019 12:35:06 +0000 (12:35 +0000)]
MFC r343190:
net80211: drop m_pullup call from ieee80211_crypto_decap.

For most wireless drivers Rx mbuf is allocated as one
contiguous chunk; only few are using chains for allocations -
but even then at least MCLBYTES (minus Rx descriptor size) is
available in the first mbuf.

In addition to the above, m_pullup was never called here - otherwise,
reallocation will break post-crypto_decap logic (ieee80211_decap,
ieee80211_deliver_data...), so just remove it; length check is left
in case if some truncated frame appears here.

PR: 234241

5 years agoMFC r343105: libedit: Avoid out of bounds read in 'bind' command
jilles [Fri, 25 Jan 2019 22:52:49 +0000 (22:52 +0000)]
MFC r343105: libedit: Avoid out of bounds read in 'bind' command

This is CVS revision 1.31 from NetBSD lib/libedit/chartype.c:
Make sure that argv is NULL terminated since functions like tty_stty rely
on it to be so (Gerry Swinslow)

This broke when the wide-character support was enabled in libedit. The
conversion from multibyte to wide-character did not supply the apparently
expected terminating NULL in the new argv array.

PR: 233343

5 years agoMFC r342557, r342559: Reimplement nvd(4) detach handling.
mav [Fri, 25 Jan 2019 20:00:59 +0000 (20:00 +0000)]
MFC r342557, r342559: Reimplement nvd(4) detach handling.

Previous code typically crashed in case of NVMe device unplug or even clean
detach while some I/Os are still in flight.  To fix this the new code calls
disk_gone() and waits for confirmation of all references gone before calling
disk_destroy(), freeing other resources and allowing controller detach.

While there, fix disk lists locking and reimplement unit numbers assignment.

5 years agoMFC r343089:
tuexen [Fri, 25 Jan 2019 15:48:00 +0000 (15:48 +0000)]
MFC r343089:

Limit the user-controllable amount of memory the kernel allocates
via IPPROTO_SCTP level socket options.

This issue was found by running syzkaller.

5 years agoMFC r342857:
tuexen [Fri, 25 Jan 2019 15:40:51 +0000 (15:40 +0000)]
MFC r342857:

Avoid overfow in vtruncbuf()

Using daddr_t instead of int avoids trunclbn to become negative when it
shouldn't.
This isssue was found by running syzkaller.

Reviewed by: mckusick, kib, markj
Differential Revision: https://reviews.freebsd.org/D18763

5 years agoMFC r338138:
tuexen [Fri, 25 Jan 2019 15:25:53 +0000 (15:25 +0000)]
MFC r338138:

Enabling the IPPROTO_IPV6 level socket option IPV6_USE_MIN_MTU on a TCP
socket resulted in sending fragmented IPV6 packets.

This is fixes by reducing the MSS to the appropriate value. In addtion,
if the socket option is set before the handshake happens, announce this
MSS to the peer. This is not stricly required, but done since TCP
is conservative.

PR: 173444
Reviewed by: bz@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16796

5 years agoMFC r338137:
tuexen [Fri, 25 Jan 2019 15:21:42 +0000 (15:21 +0000)]
MFC r338137:

Fix the inheritance of IPv6 level socket options on TCP sockets.

This was broken for IPv6 listening socket, which are not IPV6_ONLY,
and the accepted TCP connection was using IPv4.

Reviewed by: bz@, rrs@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D16792

5 years agoMFC r343082:
kib [Fri, 25 Jan 2019 11:46:07 +0000 (11:46 +0000)]
MFC r343082:
Implement shmat(2) flag SHM_REMAP.

5 years agoMFC r328433:
kib [Fri, 25 Jan 2019 11:26:05 +0000 (11:26 +0000)]
MFC r328433:
EMFILE errno documented.

5 years agoMFC r343302:
kib [Fri, 25 Jan 2019 11:01:11 +0000 (11:01 +0000)]
MFC r343302:
Remove unused *_sysinit_flags() declarations.

5 years agoMFC r343259:
gjb [Thu, 24 Jan 2019 17:55:33 +0000 (17:55 +0000)]
MFC r343259:
 Correct a typo: was -> way.

Sponsored by: The FreeBSD Foundation