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

5 years agoMFC r343005: Handle SIGIO for listening sockets
Jason A. Harmening [Mon, 21 Jan 2019 08:24:49 +0000 (08:24 +0000)]
MFC r343005: Handle SIGIO for listening sockets

r319722 separated struct socket and parts of the socket I/O path into
listening-socket-specific and dataflow-socket-specific pieces.  Listening
socket connection notifications are now handled by solisten_wakeup() instead
of sowakeup(), but solisten_wakeup() does not currently post SIGIO to the
owning process.

PR: 234258

5 years agoMFC r343017:
Konstantin Belousov [Mon, 21 Jan 2019 07:44:46 +0000 (07:44 +0000)]
MFC r343017:
Handle overflow in calculating max kmem size.

5 years agoMFC r342845,342846: Port NetBSD improvements:
Xin LI [Mon, 21 Jan 2019 06:14:26 +0000 (06:14 +0000)]
MFC r342845,342846: Port NetBSD improvements:

 - Add -l support for xz files
 - Add lzip support to gzip based on the example lzip decoder.

Obtained from: NetBSD
Relnotes: yes

5 years agoProperly commit the revert of r343205.
Mark Johnston [Mon, 21 Jan 2019 04:10:45 +0000 (04:10 +0000)]
Properly commit the revert of r343205.

MFCing the head revert isn't the same as reverting the MFC.

This is a direct commit to stable/12.

5 years agoMFC r343245:
Mark Johnston [Mon, 21 Jan 2019 03:48:30 +0000 (03:48 +0000)]
MFC r343245:
Revert r343117.

5 years agoMFC r342757: getopt_long(3): fix case of malformed long opt
Kyle Evans [Mon, 21 Jan 2019 02:59:37 +0000 (02:59 +0000)]
MFC r342757: getopt_long(3): fix case of malformed long opt

When presented with an arg string like '-l-', getopt_long will successfully
parse out the 'l' short option, then proceed to match '--' against the first
longopts entry as it later does a strncmp with len=0. This latter bit is
arguably another bug in itself, but presumably not a practical issue as all
callers of parse_long_options are already doing the right thing (except this
one pointed out).

An opt string like '-l-' should be considered malformed and throw a bad
argument rather than behaving as if '--' were passed. It cannot possibly do
what the invoker expects, and it's probably the result of a typo (ls -l- a)
rather than any intent.

5 years agoMFC r342903, r342911: libbe(3)/bectl(8) refactor and fix mount for deep BEs
Kyle Evans [Mon, 21 Jan 2019 02:57:57 +0000 (02:57 +0000)]
MFC r342903, r342911: libbe(3)/bectl(8) refactor and fix mount for deep BEs

r342903: libbe(3): move altroot augmentation bits around a little bit

We could perhaps have a method that does this given a dataset, but it's yet
clear that we'll always want to bypass the altroot when we grab the
mountpoint. For now, we'll refactor things a bit so we grab the altroot
length when libbe is initialized and have a common method that does the
necessary augmentation (replace with / if it's the root, return a pointer to
later in the string if not).

This will be used in some upcoming work to make be_mount work properly for
deep BEs.

r342911: libbe(3): Change be_mount to mount/unmount child datasets

This set of changes is geared towards making bectl respect deep boot
environments when they exist and are mounted. The deep BE composition
functionality (`bectl add`) remains disabled for the time being. This set of
changes has no effect for the average user. but allows deep BE users to
upgrade properly with their current setup.

libbe(3): Open the target boot environment and get a zfs handle, then pass
that with the target mountpoint to be_mount_iter; If the BE_MNT_DEEP flag is
set call zfs_iter_filesystems and mount the child datasets.

Similar logic is employed when unmounting the datasets, save for children
are unmounted first.

bectl(8): Change bectl_cmd_jail to pass the BE_MNT_DEEP flag when
calling be_mount as well as call be_unmount when cleaning up after the
jail has exited instead of umount(2) directly.

PR: 234795

5 years agoMFC r343092:
Andriy Voskoboinyk [Mon, 21 Jan 2019 01:03:03 +0000 (01:03 +0000)]
MFC r343092:
rtwn(4): clear 'basic' rate bit before calculating RTS/CTS rate.

Rate tables have this bit set to indicate minimal set of basic rates;
however, it overlappes with MCS bit, so rate2ridx() will treat them as
an 11n rate.

Due to the current rates setup the issue can be reproduced only
in 5GHz band with 11n / protection enabled.

5 years agoMFC r343130
Kristof Provost [Mon, 21 Jan 2019 00:32:04 +0000 (00:32 +0000)]
MFC r343130

pf: fix pfsync breaking carp

Fix missing initialisation of sc_flags into a valid sync state on clone which
breaks carp in pfsync.

This regression was introduce by r342051.

PR: 235005
Submitted by: smh@FreeBSD.org
Pointy hat to: kp

5 years agoMFC r342990
Kristof Provost [Sun, 20 Jan 2019 22:03:43 +0000 (22:03 +0000)]
MFC r342990

pf tests: Test PR 229241

pfctl has an issue with 'set skip on <group>', which causes inconsistent
behaviour: the set skip directive works initially, but does not take
effect when the same rules are re-applied.

PR: 229241

5 years agoMFC r342989
Kristof Provost [Sun, 20 Jan 2019 22:01:39 +0000 (22:01 +0000)]
MFC r342989

pfctl: Fix 'set skip' handling for groups

When we skip on a group the kernel will automatically skip on the member
interfaces. We still need to update our own cache though, or we risk
overruling the kernel afterwards.

This manifested as 'set skip' working initially, then not working when
the rules were reloaded.

PR: 229241

5 years agoMFC r342991:
Andriy Voskoboinyk [Sun, 20 Jan 2019 14:33:29 +0000 (14:33 +0000)]
MFC r342991:
net80211: provide rate validation for injected frames.

There may be various side effects (device timeout, firmware and / or
kernel panic) when an invalid (or inapplicable - e.g., an MCS rate
for 11g-only device) is set; check rates before sending the frame to
the driver.

5 years agoMFC r343108:
Konstantin Belousov [Sun, 20 Jan 2019 12:14:33 +0000 (12:14 +0000)]
MFC r343108:
Trim whitespace at EoL, use tabs instead of spaces for indent.

PR: 235004

5 years agoMFC r342671:
Justin Hibbits [Sun, 20 Jan 2019 03:58:21 +0000 (03:58 +0000)]
MFC r342671:

rtld-elf: Fix powerpc64 TLS handling, matching powerpc's fix

We need to subtract the TLS_TCB_SIZE to get to the real data pointer, since
r13 points to the end of the TCB structure.  Prior to this, devel/protobuf-c
port broke with recent update to devel/protobuf, which exposed this issue.

Submitted by: andreast
Reported by: Piotr Kubaj

5 years agoMFC r341387:
Justin Hibbits [Sun, 20 Jan 2019 03:53:42 +0000 (03:53 +0000)]
MFC r341387:

Fix PowerPC64 ELFv1-specific problem in __elf_phdr_match_addr() leading to crash
in threaded programs that unload libraries.

Summary:
The GNOME update to 3.28 exposed a bug in __elf_phdr_match_addr(), which leads
to a crash when building devel/libsoup on powerpc64.

Due to __elf_phdr_match_addr() limiting its search to PF_X sections, on the
PPC64 ELFv1 ABI, it was never matching function pointers properly.

This meant that libthr was never cleaning up its atfork list in
__pthread_cxa_finalize(), so if a library with an atfork handler was unloaded,
libthr would crash on the next fork.

Normally, the null pointer check it does before calling the handler would avoid
this crash, but, due to PPC64 ELFv1 using function descriptors instead of raw
function pointers, a null check against the pointer itself is insufficient, as
the pointer itself was not null, it was just pointing at a function descriptor
that had been zeroed. (Which is an ABI violation.)

Calling a zeroed function descriptor on PPC64 ELFv1 causes a jump to address 0
with a zeroed r2 and r11.

5 years agoMFC r342988:
Justin Hibbits [Sun, 20 Jan 2019 03:30:04 +0000 (03:30 +0000)]
MFC r342988:

powerpcspe: Correct SPE high-component loading

Don't clobber the low part of the register restoring the high component of.
This could lead to very bad behavior if it's an ABI-affected register.

While here, also mark the asm volatile in the SPE high save case, to match
the load case.

5 years agoMFC r343117:
Mark Johnston [Sun, 20 Jan 2019 00:58:54 +0000 (00:58 +0000)]
MFC r343117:
Fix handling of rights on stdio streams.

PR: 234885

5 years agoMFC r343088:
Andriy Voskoboinyk [Sat, 19 Jan 2019 15:07:25 +0000 (15:07 +0000)]
MFC r343088:
rtwn_usb(4): add new USB id for RTL8821AU

Reported by: Mike Tancsa <mike@sentex.net>
Tested by: Mike Tancsa <mike@sentex.net>

5 years agoMFC r340926:
Vladimir Kondratyev [Fri, 18 Jan 2019 21:25:10 +0000 (21:25 +0000)]
MFC r340926:

evdev: Fix pause key release event in AT keyboard set 1 to evdev xlat-or.

5 years agoMFC r340912,r340913:
Vladimir Kondratyev [Fri, 18 Jan 2019 21:11:02 +0000 (21:11 +0000)]
MFC r340912,r340913:

psm(4): Revert r328640 and add minimal support for active AUX port
        multiplexers

Active PS/2 multiplexing is a method for attaching up to four PS/2
pointing devices to a computer. Enabling of multiplexed mode allows
commands to be directed to individual devices using routing prefixes.
Multiplexed mode reports input with each byte tagged to identify
its source. This method differs from one currently supported by psm(4)
where so called guest device (trackpoint) is attached to special
interface located on the host device (touchpad) and latter performs
guest protocol conversion to special encapsulation packet format.

At present time active PS/2 multiplexing is used in some models of
HP laptops e.g. EliteBook 8560w, 9470m. Enabling of absolute operation
mode on such touchpads is connected with following problems:
1. Touchpad's port priority is lower than trackpoint's. That blocks
   information queries thus prevents touchpad detection and configuration.
2. Touchpad and trackpoint have different protocol packet sizes and
   sync bytes.

As PS/2 usage is on decline only minimal possible set of changes to
support Synaptics touchpad and generic mouses is implemented.
Active multiplexing mode is enabled only at probe stage to scan through
attached PS/2 devices to query and configure Synaptics touchpad.
After touchpad has been configured, mux is switched back to legacy
(hidden multiplexing) mode to perform normal interrupt-driven input
data processing. Overflow bit values rather than tags are used to
separate packets produced by different devices. Switching back to
legacy mode allows to avoid psm(4) and atkbd(4) rework to support
4 instances of mouse driver.

Note: While in hidden multiplexing mode KBC does some editing of the
packet stream. It remembers the button bits from the last packet
received from each device, and replaces the button bits of every
packet with the logical OR of all devices’ most recent button bits.
This sort of button crosstalk results in spurious button events
which are inhibitted with various tricks. E.g. trackpoint middle
button events are suppressed while trackpad surface is touched and
touchpad left and right button events are suppressed if corresponding
trackpoint buttons are pressed.

PR: 231058
Reported by: Michael Figiel <mifigiel at gmail.com>
Tested by: Michael Figiel <mifigiel at gmail.com>

5 years agoMFC r340338:
Vladimir Kondratyev [Fri, 18 Jan 2019 20:59:06 +0000 (20:59 +0000)]
MFC r340338:
wmt(4): Add PNP record so it could be picked by devd/devmatch.
Fix uhid(4) conflict with blacklisting of multitouch HID-usages
in uhid(4) probe handler.

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

5 years agoMFC r342822:
David Bright [Fri, 18 Jan 2019 16:03:59 +0000 (16:03 +0000)]
MFC r342822:

asmc: Add support for Mac mini 4,1 (Mid-2010)

5 years agoMFC r342770:
David Bright [Fri, 18 Jan 2019 15:58:32 +0000 (15:58 +0000)]
MFC r342770:

asmc: Patch to add MacBook Pro 9,2 support

PR: 211513
Submitted by: William Theesfeld Jr <wtheesfeld@mailbox.org>
Reported by: William Theesfeld Jr <wtheesfeld@mailbox.org>

5 years agoMFC r342925:
Andrey V. Elsukov [Fri, 18 Jan 2019 09:54:28 +0000 (09:54 +0000)]
MFC r342925:
  Relax requirement to packet size of CARP protocol and remove version check.

  CARP shares protocol number 112 with VRRP (RFC 5798). And the size of
  VRRP packet may be smaller than CARP. ipfw_chk() does m_pullup() to at
  least sizeof(struct carp_header) and can fail when packet is VRRP. This
  leads to packet drop and message about failed pullup attempt.
  Also, RFC 5798 defines version 3 of VRRP protocol, this version number
  also unsupported by CARP and such check leads to packet drop.

  carp_input() does its own checks for protocol version and packet size,
  so we can remove these checks to be able pass VRRP packets.

  PR: 234207