]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r343484:
Konstantin Belousov [Sun, 3 Feb 2019 00:39:35 +0000 (00:39 +0000)]
MFC r343484:
Remove now redundand ifunc relocation code which should have been
removed as part of r341441.

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

Document the instance context pointer.

5 years agoMFC r341472:
Andrey V. Elsukov [Sat, 2 Feb 2019 17:42:17 +0000 (17:42 +0000)]
MFC r341472:
  Add ability to request listing and deleting only for dynamic states.

  This can be useful, when net.inet.ip.fw.dyn_keep_states is enabled, but
  after rules reloading some state must be deleted. Added new flag '-D'
  for such purpose.

  Retire '-e' flag, since there can not be expired states in the meaning
  that this flag historically had.

  Also add "verbose" mode for listing of dynamic states, it can be enabled
  with '-v' flag and adds additional information to states list. This can
  be useful for debugging.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

5 years agoMFC r341471:
Andrey V. Elsukov [Sat, 2 Feb 2019 17:40:43 +0000 (17:40 +0000)]
MFC r341471:
  Reimplement how net.inet.ip.fw.dyn_keep_states works.

  Turning on of this feature allows to keep dynamic states when parent
  rule is deleted. But it worked only when the default rule is
  "allow from any to any".

  Now when rule with dynamic opcode is going to be deleted, and
  net.inet.ip.fw.dyn_keep_states is enabled, existing states will reference
  named objects corresponding to this rule, and also reference the rule.
  And when ipfw_dyn_lookup_state() will find state for deleted parent rule,
  it will return the pointer to the deleted rule, that is still valid.
  This implementation doesn't support O_LIMIT_PARENT rules.

  The refcnt field was added to struct ip_fw to keep reference, also
  next pointer added to be able iterate rules and not damage the content
  when deleted rules are chained.

  Named objects are referenced only when states are going to be deleted to
  be able reuse kidx of named objects when new parent rules will be
  installed.

  ipfw_dyn_get_count() function was modified and now it also looks into
  dynamic states and constructs maps of existing named objects. This is
  needed to correctly export orphaned states into userland.

  ipfw_free_rule() was changed to be global, since now dynamic state can
  free rule, when it is expired and references counters becomes 1.

  External actions subsystem also modified, since external actions can be
  deregisterd and instances can be destroyed. In these cases deleted rules,
  that are referenced by orphaned states, must be modified to prevent access
  to freed memory. ipfw_dyn_reset_eaction(), ipfw_reset_eaction_instance()
  functions added for these purposes.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D17532

5 years agoMFC r343502:
Andriy Voskoboinyk [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 r343518:
Andriy Voskoboinyk [Sat, 2 Feb 2019 04:27:47 +0000 (04:27 +0000)]
MFC r343518:
rtwn_usb(4): add new USB id.

Submitted and tested by: <yklaxds@gmail.com>
Github issue: https://github.com/s3erios/rtwn/issues/4

5 years agoMFC r343499:
Andriy Voskoboinyk [Sat, 2 Feb 2019 04:19:35 +0000 (04:19 +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 r343353:
Mark Johnston [Fri, 1 Feb 2019 18:19:33 +0000 (18:19 +0000)]
MFC r343353:
Correct uma_prealloc()'s use of domainset iterators after r339925.

5 years agoMFC r343552
Vincenzo Maffione [Fri, 1 Feb 2019 12:22:48 +0000 (12:22 +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:
Hans Petter Selasky [Fri, 1 Feb 2019 10:08:34 +0000 (10:08 +0000)]
MFC r343453:
Add new USB quirk.

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

5 years agoMFC r343451:
Hans Petter Selasky [Fri, 1 Feb 2019 10:05:50 +0000 (10:05 +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:
Kristof Provost [Fri, 1 Feb 2019 10:04:53 +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 agoBuild fix for missing NET_EPOCH_XXX() dependencies after r343650.
Hans Petter Selasky [Fri, 1 Feb 2019 09:18:44 +0000 (09:18 +0000)]
Build fix for missing NET_EPOCH_XXX() dependencies after r343650.
This patch is to be reverted when the relevant changes are MFC'ed.
This is a direct commit.

Sponsored by: Mellanox Technologies

5 years agoMFC r343395:
Hans Petter Selasky [Fri, 1 Feb 2019 09:08:19 +0000 (09:08 +0000)]
MFC r343395:
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
Sponsored by: Mellanox Technologies

5 years agoMFC r343394:
Hans Petter Selasky [Fri, 1 Feb 2019 09:07:27 +0000 (09:07 +0000)]
MFC r343394:
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
Sponsored by: Mellanox Technologies

5 years agoMFC r343393:
Hans Petter Selasky [Fri, 1 Feb 2019 09:06:40 +0000 (09:06 +0000)]
MFC r343393:
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
Sponsored by: Mellanox Technologies

5 years agoMFC r343392:
Hans Petter Selasky [Fri, 1 Feb 2019 09:05:41 +0000 (09:05 +0000)]
MFC r343392:
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
Sponsored by: Mellanox Technologies

5 years agoMFC r343225:
Toomas Soome [Fri, 1 Feb 2019 06:19:12 +0000 (06:19 +0000)]
MFC r343225:
Unbreak mip64 build after r328437

Add exit and getchar functions to beri/boot2 code. They are required by
panic_action functin introduced in r328437

5 years agoMFC r343496:
Andriy Voskoboinyk [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:
Andriy Voskoboinyk [Fri, 1 Feb 2019 03:01:19 +0000 (03:01 +0000)]
MFC r343497:
Unbreak devd.conf(5) regex after r343249

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

5 years agoMFC r343495:
Andriy Voskoboinyk [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 r343147:
Konstantin Belousov [Fri, 1 Feb 2019 00:37:55 +0000 (00:37 +0000)]
MFC r343147:
i386/PAE busdma: allow more bounce pages.

5 years agoMFC r343146:
Konstantin Belousov [Fri, 1 Feb 2019 00:36:14 +0000 (00:36 +0000)]
MFC r343146:
x86 busdma: fix mis-use of bus_addr_t where vm_paddr_t is assumed.

5 years agoMFC r342928:
Sean Eric Fagan [Thu, 31 Jan 2019 22:06:46 +0000 (22:06 +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 r343124:
Toomas Soome [Thu, 31 Jan 2019 17:06:59 +0000 (17:06 +0000)]
MFC r343124:

libsa: add asprintf()

asprintf() is a nice tool for string processing.

5 years agoMFC r343123:
Toomas Soome [Thu, 31 Jan 2019 16:43:35 +0000 (16:43 +0000)]
MFC r343123:
loader should ignore active multi_vdev_crash_dump feature on zpool

Since the loader zfs reader does not need to read the dump zvol, we can
just enable the feature.

illumos issue #9051 https://www.illumos.org/issues/9051

5 years agoMFC r343473:
Andriy Voskoboinyk [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 r343077:
Marcelo Araujo [Thu, 31 Jan 2019 07:08:37 +0000 (07:08 +0000)]
MFC r343077:

Fix broken uart on Win2016 guest.

Obtained from: Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4)

5 years agoRegen after r343596: enable ppoll in capability mode.
Brooks Davis [Wed, 30 Jan 2019 23:48:10 +0000 (23:48 +0000)]
Regen after r343596: enable ppoll in capability mode.

PR: 232495

5 years agoMFC r340129, r340195, r340198
Brooks Davis [Wed, 30 Jan 2019 23:47:21 +0000 (23:47 +0000)]
MFC r340129, r340195, r340198

r340129:
capsicum: allow ppoll(2) in capability mode

We already allow to use poll(2). There is no reason to disallow
ppoll(2).

PR: 232495
Submitted by: Stefan Grundmann <sg2342@googlemail.com>
Reviewed by: cem, oshogbo

r340195:
capsicum: Add ppoll and freebsd32_ppoll to compat32.

PR: 232495
Pointed out by: brooks

r340198:
Remove ppoll. freebsd32 doesn't define a ppoll syscall.

Reported by: jhb

5 years agoMFC r340242:
Brooks Davis [Wed, 30 Jan 2019 23:36:02 +0000 (23:36 +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: r343481
Marius Strobl [Wed, 30 Jan 2019 11:56:10 +0000 (11:56 +0000)]
MFC: r343481

- 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().
  This bug was introduced with r341095, MFCed to stable/12 in r343304.

  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 agoMFC r343486:
Cy Schubert [Wed, 30 Jan 2019 02:39:08 +0000 (02:39 +0000)]
MFC r343486:

Fix a typo.

5 years agoMFC r343366:
Brooks Davis [Tue, 29 Jan 2019 18:08:46 +0000 (18:08 +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 r343305:
Brooks Davis [Tue, 29 Jan 2019 18:06:35 +0000 (18:06 +0000)]
MFC r343305:

Rework CASE_IOC_IFGROUPREQ() to require a case before the macro.

This is more compatible with formatting tools and looks more normal.

Reported by: jhb (on a different review)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18442

5 years agoMFC r343297:
Kristof Provost [Tue, 29 Jan 2019 17:52:42 +0000 (17:52 +0000)]
MFC r343297:

pf tests: Check size validation in DIOCGETSRCNODES

Ensure that invalid sizes for DIOCGETSRCNODES do not cause panics.

5 years agoMFC r343295:
Kristof Provost [Tue, 29 Jan 2019 17:49:38 +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.
Xin LI [Tue, 29 Jan 2019 07:47:57 +0000 (07:47 +0000)]
MFC r343038: Use TD_IS_IDLETHREAD instead of unrolled version.

5 years agoMFC r343472:
Andriy Voskoboinyk [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
Kirk McKusick [Mon, 28 Jan 2019 21:46:05 +0000 (21:46 +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 r343247:
Mark Johnston [Mon, 28 Jan 2019 16:18:17 +0000 (16:18 +0000)]
MFC r343247:
Fix cmp(1) tests for "special" mode.

5 years agoMFC r343274, r343275:
Mark Johnston [Mon, 28 Jan 2019 16:14:53 +0000 (16:14 +0000)]
MFC r343274, r343275:
Optimize RISC-V copyin(9)/copyout(9) routines.

5 years agoMFC r343430
Andrew Gallatin [Mon, 28 Jan 2019 14:34:59 +0000 (14:34 +0000)]
MFC r343430

  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
Sponsored by: Netflix

5 years agoMFC r342170: add support for marking interrupt handlers as suspended
Andriy Gapon [Mon, 28 Jan 2019 09:45:28 +0000 (09:45 +0000)]
MFC r342170: add support for marking interrupt handlers as suspended

The goal of this change is to fix a problem with PCI shared interrupts
during suspend and resume.

5 years agoMFC r343413
Vincenzo Maffione [Mon, 28 Jan 2019 09:18:28 +0000 (09:18 +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 r342379, r342383:
Pedro F. Giffuni [Mon, 28 Jan 2019 02:26:05 +0000 (02:26 +0000)]
MFC r342379, r342383:
gai_strerror() - Update string error messages according to RFC 3493.

Error messages in gai_strerror(3) vary largely among OSs.

For new software we largely replaced the obsoleted EAI_NONAME and
with EAI_NODATA but we never updated the corresponding message to better
match the intended use. We also have references to ai_flags and ai_family
which are not very descriptive for non-developer end users.

Bring new error messages based on informational RFC 3493, which has
obsoleted RFC 2553, and make them consistent among the header and
manpage.

5 years agoMFC r343238:
Andriy Voskoboinyk [Mon, 28 Jan 2019 01:47:16 +0000 (01:47 +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.
- Reuse IEEE80211_IS_DATA() macro.

5 years agoMFC r343459:
Pedro F. Giffuni [Mon, 28 Jan 2019 01:36:55 +0000 (01:36 +0000)]
MFC r343459:
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)

5 years agoMFC r343234:
Andriy Voskoboinyk [Mon, 28 Jan 2019 01:28:17 +0000 (01:28 +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:
Andriy Voskoboinyk [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:
Andriy Voskoboinyk [Mon, 28 Jan 2019 01:09:23 +0000 (01:09 +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, 11acg;
 * 11a: 11na, 11ac
- 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 / 11ac promotion) applies.

Before r275875 construction work properly for all except
11ng / 11na / 11acg / 11ac 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.

5 years agoMFC r343235:
Andriy Voskoboinyk [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:
Andriy Voskoboinyk [Mon, 28 Jan 2019 00:51:26 +0000 (00:51 +0000)]
MFC r343341:
ifconfig: drop unused macros from ifieee80211.c

5 years agoMFC: r342634
Marius Strobl [Sun, 27 Jan 2019 19:04:02 +0000 (19:04 +0000)]
MFC: r342634

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
  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,
  - replace a few device_printf(9) calls with slot_printf() for
    consistency, and
  - sync some local functions with their prototypes WRT static.

5 years agoMFC: r342965
Yoshihiro Takahashi [Sun, 27 Jan 2019 14:03:38 +0000 (14:03 +0000)]
MFC: r342965

  Fix indentation in ruptime command output for hosts in the "down" state.

PR: 234239

5 years agoMFC: r342964
Yoshihiro Takahashi [Sun, 27 Jan 2019 13:56:44 +0000 (13:56 +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:
Andriy Voskoboinyk [Sun, 27 Jan 2019 12:39:35 +0000 (12:39 +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 agoAdd ZFS usage tips to freebsd-tips.
Benedict Reuschling [Sun, 27 Jan 2019 11:52:16 +0000 (11:52 +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)
Relnotes: yes (ZFS examples in freebsd-tips)
Differential Revision: https://reviews.freebsd.org/D18541

5 years agoMFC r343249:
Andriy Voskoboinyk [Sat, 26 Jan 2019 13:17:19 +0000 (13:17 +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:
Andriy Voskoboinyk [Sat, 26 Jan 2019 12:55:45 +0000 (12:55 +0000)]
MFC r343244:
devd.conf(5): add otus(4) into wifi-driver-regex

5 years agoMFC r343190:
Andriy Voskoboinyk [Sat, 26 Jan 2019 12:28:47 +0000 (12:28 +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 r343363, r343364:
Mark Johnston [Fri, 25 Jan 2019 20:24:53 +0000 (20:24 +0000)]
MFC r343363, r343364:
Fix an LLE lookup race.

PR: 234296

5 years agoMFC r342557, r342559: Reimplement nvd(4) detach handling.
Alexander Motin [Fri, 25 Jan 2019 19:56:06 +0000 (19:56 +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 r343047:
Stephen Hurd [Fri, 25 Jan 2019 18:30:12 +0000 (18:30 +0000)]
MFC r343047:

Fix window update issue when scaling disabled

When the TCP window scale option is not used, and the window
opens up enough in one soreceive, a window update will not be sent.

For example, if recwin == 65535, so->so_rcv.sb_hiwat >= 262144, and
so->so_rcv.sb_hiwat <= 524272, the window update will never be sent.
This is because recwin and adv are clamped to TCP_MAXWIN << tp->rcv_scale,
and so will never be >= so->so_rcv.sb_hiwat / 4
or <= so->so_rcv.sb_hiwat / 8.

This patch ensures a window update is sent if the window opens by
TCP_MAXWIN << tp->rcv_scale, which should only happen when the window
size goes from zero to the max expressible.

This issue looks like it was introduced in r306769 when recwin was clamped
to TCP_MAXWIN << tp->rcv_scale.

Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D18821

5 years agoMFC r343089:
Michael Tuexen [Fri, 25 Jan 2019 15:46:30 +0000 (15:46 +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 r342879:
Michael Tuexen [Fri, 25 Jan 2019 15:44:53 +0000 (15:44 +0000)]
MFC r342879:

Fix getsockopt() for IP_OPTIONS/IP_RETOPTS.

r336616 copies inp->inp_options using the m_dup() function.
However, this function expects an mbuf packet header at the beginning,
which is not true in this case.
Therefore, use m_copym() instead of m_dup().

This issue was found by syzkaller.

Reviewed by: mmacy@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D18753

5 years agoMFC r342857:
Michael Tuexen [Fri, 25 Jan 2019 15:39:33 +0000 (15:39 +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 r343145:
Konstantin Belousov [Fri, 25 Jan 2019 11:14:20 +0000 (11:14 +0000)]
MFC r343145:
MI VM: Make it possible to set size of superpage at boot instead of compile
time.

5 years agoMFC r343144:
Konstantin Belousov [Fri, 25 Jan 2019 11:12:22 +0000 (11:12 +0000)]
MFC r343144:
nvdimm: initialize SPA uuids statically.

5 years agoMFC r343143:
Konstantin Belousov [Fri, 25 Jan 2019 11:11:28 +0000 (11:11 +0000)]
MFC r343143:
nvdimm: add a driver for the NVDIMM root device

5 years agoMFC r339461:
Konstantin Belousov [Fri, 25 Jan 2019 11:05:32 +0000 (11:05 +0000)]
MFC r339461:
nvdimm(4): Fix GCC 6.4.0 build

5 years agoMFC r343302:
Konstantin Belousov [Fri, 25 Jan 2019 10:58:34 +0000 (10:58 +0000)]
MFC r343302:
Remove unused *_sysinit_flags() declarations.

5 years agoMFC r343105: libedit: Avoid out of bounds read in 'bind' command
Jilles Tjoelker [Thu, 24 Jan 2019 22:34:30 +0000 (22:34 +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 r339960 (cem): freebsd-update: add a progress report
Ed Maste [Thu, 24 Jan 2019 22:25:52 +0000 (22:25 +0000)]
MFC r339960 (cem): freebsd-update: add a progress report

for the "fetching files..."

After patching step is done.

PR: 232857
Submitted by: mat

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

Sponsored by: The FreeBSD Foundation

5 years agoMFC r342603:
Navdeep Parhar [Thu, 24 Jan 2019 17:31:03 +0000 (17:31 +0000)]
MFC r342603:
cxgbe(4): Attach to two T540 variants.

Sponsored by: Chelsio Communications

5 years agoMFC r343074: Suppress excessive error prints in ENA TX hotpath
Marcin Wojtas [Thu, 24 Jan 2019 09:38:18 +0000 (09:38 +0000)]
MFC r343074: Suppress excessive error prints in ENA TX hotpath

Sponsored by: Amazon, Inc.

5 years agoMFC r343348:
Mark Johnston [Thu, 24 Jan 2019 01:03:12 +0000 (01:03 +0000)]
MFC r343348:
ocs_fc: Ensure that we zero-initialize memory before copying it out.

admbugs: 765

5 years agoMFC r343087:
Konstantin Belousov [Wed, 23 Jan 2019 20:47:31 +0000 (20:47 +0000)]
MFC r343087:
Style(9) fixes for x86/busdma_bounce.c.

5 years agoMFC r343086:
Konstantin Belousov [Wed, 23 Jan 2019 20:44:51 +0000 (20:44 +0000)]
MFC r343086:
Remove unused prototype.

5 years agoMFC r343085:
Konstantin Belousov [Wed, 23 Jan 2019 20:43:42 +0000 (20:43 +0000)]
MFC r343085:
Improve iflib busdma(9) KPI use.

5 years agoMFC r343082:
Konstantin Belousov [Wed, 23 Jan 2019 20:34:22 +0000 (20:34 +0000)]
MFC r343082:
Implement shmat(2) flag SHM_REMAP.

5 years agoMFC r343081:
Konstantin Belousov [Wed, 23 Jan 2019 20:31:24 +0000 (20:31 +0000)]
MFC r343081:
Trim spaces at the end of lines.

5 years agoMFC r343286:
Mark Johnston [Wed, 23 Jan 2019 17:40:12 +0000 (17:40 +0000)]
MFC r343286:
nfs: Zero the buffers exported by NFSSVC_DUMPCLIENTS and DUMPLOCKS.

admbugs: 765

5 years agoMFC r343265:
Mark Johnston [Wed, 23 Jan 2019 17:36:58 +0000 (17:36 +0000)]
MFC r343265:
hwpmc: Plug memory disclosures from PMC_OP_{GETPMCINFO,GETCPUINFO}.

admbugs: 765

5 years agoMFC linuxulator stack memory disclosure fixes
Ed Maste [Wed, 23 Jan 2019 14:19:40 +0000 (14:19 +0000)]
MFC linuxulator stack memory disclosure fixes

r343260 linuxulator: fix stack memory disclosure in linux_ioctl_v4l
r343261 linuxulator: fix stack memory disclosure in linux_ioctl_termio
r343262 linuxulator: fix stack memory disclosure in linux_sigaltstack
r343263 linuxulator: fix stack memory disclosure in linux_sigaltstack

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Security: Kernel stack memory disclosure
Sponsored by: The FreeBSD Foundation

5 years agoMFC r343103:
Cy Schubert [Wed, 23 Jan 2019 02:43:49 +0000 (02:43 +0000)]
MFC r343103:

Remove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
no longer needed.

5 years agoMFC r343073:
Cy Schubert [Wed, 23 Jan 2019 02:40:29 +0000 (02:40 +0000)]
MFC r343073:

Remove an IRIX-only source file.

5 years agoMFC r342558: Switch from mutexes to atomics in GEOM_DEV I/O path.
Alexander Motin [Wed, 23 Jan 2019 01:23:19 +0000 (01:23 +0000)]
MFC r342558: Switch from mutexes to atomics in GEOM_DEV I/O path.

Mutexes in I/O path there were used twice per I/O to atomically access
several variables to close and/or destroy the device on last request
completion.  I found the way to fit all required info into one integer,
suitable for atomic operations.  It opened race window on device close,
but addition of timeout to the msleep() there should cover it.

Profiling shows removal of significant spinning time on those mutexes
and IOPS increase from ~600K to >800K to NVMe on 72-core systems.

5 years agoMFC r342546: Add descriptions to NVMe interrupts.
Alexander Motin [Wed, 23 Jan 2019 01:16:19 +0000 (01:16 +0000)]
MFC r342546: Add descriptions to NVMe interrupts.

5 years agoIncrease MTX_POOL_SLEEP_SIZE from 128 to 1024.
Alexander Motin [Wed, 23 Jan 2019 00:56:53 +0000 (00:56 +0000)]
Increase MTX_POOL_SLEEP_SIZE from 128 to 1024.

This value remained unchanged for 15 years, and now this bump reduces
lock spinning in GEOM and BIO layers while doing ~1.6M IOPS to 4 NVMe
on 72-core system from ~25% to ~5% by the cost of additional 28KB RAM.

While there, align struct mtx_pool fields to cache lines.

5 years agoMFC r342399: Remove CAM SIM lock from NVMe SIM.
Alexander Motin [Wed, 23 Jan 2019 00:54:08 +0000 (00:54 +0000)]
MFC r342399: Remove CAM SIM lock from NVMe SIM.

CAM does not require SIM lock since FreeBSD 10.4, and NVMe code never
required it at all, using per-queue locks instead.  This formally allows
parallel request submission in CAM mode as much as single per-device and
per-queue locks of CAM allow.

5 years agoMFC r342977 (by cem): amdtemp(4): Add support for Family 15h, Model >=60h
Alexander Motin [Tue, 22 Jan 2019 21:04:03 +0000 (21:04 +0000)]
MFC r342977 (by cem): amdtemp(4): Add support for Family 15h, Model >=60h

Family 15h is a bit of an oddball.  Early models used the same temperature
register and spec (mostly[1]) as earlier CPU families.

Model 60h-6Fh and 70-7Fh use something more like Family 17h's Service
Management Network, communicating with it in a similar fashion.  To support
them, add support for their version of SMU indirection to amdsmn(4) and use
it in amdtemp(4) on these models.

While here, clarify some of the deviceid macros in amdtemp(4) that were
added with arbitrary, incorrect family numbers, and remove ones that were
not used.  Additionally, clarify intent and condition of heterogenous
multi-socket system detection.

[1]: 15h adds the "adjust range by -49°C if a certain condition is met,"
which previous families did not have.

Reported by:    D. C. <tjoard AT gmail.com>
PR:             234657
Tested by:      D. C. <tjoard AT gmail.com>

5 years agoMFC r341095:
Andrew Gallatin [Tue, 22 Jan 2019 17:34:53 +0000 (17:34 +0000)]
MFC r341095:

  Use busdma unconditionally in iflib

  - Remove the complex mechanism to choose between using busdma
  and raw pmap_kextract at runtime.   The reduced complexity makes
  the code easier to read and maintain.

  - Fix a bug in the small packet receive path where clusters were
  repeatedly mapped but never unmapped. We now store the cluster's
  bus address and avoid re-mapping the cluster each time a small
  packet is received.

  This patch fixes bugs I've seen where ixl(4) will not even
  respond to ping without seeing DMAR faults.

  I see a small improvement (14%) on packet forwarding tests using
  a Haswell based Xeon E5-2697 v3.  Olivier sees a small
  regression (-3% to -6%) with lower end hardware.

Reviewed by: mmacy
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D17901

5 years agoMFC r342856: Added support for the SIOCGI2C ioctl.
Xin LI [Tue, 22 Jan 2019 04:20:00 +0000 (04:20 +0000)]
MFC r342856: Added support for the SIOCGI2C ioctl.

Submitted by: Ram Kishore Vegesna <ram.vegesna@broadcom.com>
Obtained from: Broadcom

5 years agoMFC r342864:
Mark Johnston [Tue, 22 Jan 2019 02:02:12 +0000 (02:02 +0000)]
MFC r342864:
Specify the correct option level when emulating SO_PEERCRED.

PR: 234722

5 years agoMFC r343041
Kristof Provost [Tue, 22 Jan 2019 01:07:18 +0000 (01:07 +0000)]
MFC r343041

pf: silence a runtime warning

Sometimes, for negated tables, pf can log 'pfr_update_stats: assertion failed'.
This warning does not clarify anything for users, so silence it, just as
OpenBSD has.

PR: 234874

5 years agoMFC r343162:
Brooks Davis [Mon, 21 Jan 2019 19:22:02 +0000 (19:22 +0000)]
MFC r343162:

Make SIFTR work again after r342125 (D18443).

Correct a logic error.

Only disable when already enabled or enable when disabled.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Obtained from: Cheng Cui
Differential Revision: https://reviews.freebsd.org/D18885

5 years agoMFC r343153: freebsd-update.8: mandoc -Tlint fixes
Ed Maste [Mon, 21 Jan 2019 18:34:33 +0000 (18:34 +0000)]
MFC r343153: freebsd-update.8: mandoc -Tlint fixes

PR: 185389

5 years agoMFC r343023:
Pedro F. Giffuni [Mon, 21 Jan 2019 14:52:48 +0000 (14:52 +0000)]
MFC r343023:
msun: reduce diff between src/e_j0.c and src/e_j0f.c

PR: 229501