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

5 years agoMFC r342603:
np [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: r336114:
mw [Thu, 24 Jan 2019 14:33:15 +0000 (14:33 +0000)]
MFC: r336114:

Remove stray space from PNP string.

Sponsored by: Amazon, Inc.

5 years agoMFC: Second part of Amazon ENA driver fixes and improvements
mw [Thu, 24 Jan 2019 11:31:57 +0000 (11:31 +0000)]
MFC: Second part of Amazon ENA driver fixes and improvements

Now, the driver functionality is aligned with the latest version in HEAD.

r343074 Suppress excessive error prints in ENA TX hotpath
r336099 Add PNP info to PCI attachment of ena driver
r333456 Do not pass header length to the ENA controller
r333453 Apply fixes in ena-com
r333450 Upgrade ENA version to v0.8.1
r325593 Fix setting AENQ group in ENA driver
r325592 Allow usage of more RX descriptors than 1 in ENA driver
r325591 Read max MTU from the ENA device
r325590 Fix calculating io queues number in ENA driver
r325589 Rework printouts and logging level in ENA driver
r325587 Fix comparing L3 type with L4 enum on RX hash in ENA driver
r325586 Fix compilation warnings when building ENA driver with gcc compiler
r325585 Fix checking if the DF flag was set in ENA driver
r325584 Cleanup of the ENA driver header file
r325583 Allow partial MSI-x allocation in ENA driver
r325582 Remove deprecated and unused counters in ENA driver
r325581 Cover ENA driver code with branch predictioning statements

Sponsored by: Amazon, Inc.

5 years agoMFC: First part of Amazon ENA driver fixes and improvements
mw [Thu, 24 Jan 2019 09:53:41 +0000 (09:53 +0000)]
MFC: First part of Amazon ENA driver fixes and improvements

r325580 Refactor style of the ENA driver
r325579 Fix error handling in the ENA driver and lock drbr_free() call
r325578 Destroy admin queue after freeing interrupts in ENA driver
r325577 Split function checking for missing TX completion in ENA driver
r325576 Check for Rx ring state to prevent from stall in the ENA driver
r325574 Add RX OOO completion feature
r325512 Change function validate_tx_req_id() to inline in ENA driver
r325511 Fix ENA driver error handling in attach and basic style fixes
r325239 Rework counting of hardware statistics in ENA driver
r325236 Update ena-com HAL to v1.1.4.3 and update driver accordingly

Sponsored by: Amazon, Inc.

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

admbugs: 765

5 years agoMFC r343086:
kib [Wed, 23 Jan 2019 20:49:14 +0000 (20:49 +0000)]
MFC r343086:
Remove unused prototype.

5 years agoMFC r343081:
kib [Wed, 23 Jan 2019 20:38:01 +0000 (20:38 +0000)]
MFC r343081:
Trim spaces at the end of lines.

5 years agoMFC r343286:
markj [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:
markj [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
emaste [Wed, 23 Jan 2019 14:22:21 +0000 (14:22 +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 [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 [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.
mav [Wed, 23 Jan 2019 01:23:45 +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.
mav [Wed, 23 Jan 2019 01:16:59 +0000 (01:16 +0000)]
MFC r342546: Add descriptions to NVMe interrupts.

5 years agoMFC r342400: Increase MTX_POOL_SLEEP_SIZE from 128 to 1024.
mav [Wed, 23 Jan 2019 00:55:57 +0000 (00:55 +0000)]
MFC r342400: 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: 325765 (imp) Add notes about overlapping copies.
rgrimes [Tue, 22 Jan 2019 21:52:07 +0000 (21:52 +0000)]
MFC: 325765 (imp) Add notes about overlapping copies.

Add notes to each of these that specifically state that results are
undefined if the strings overlap. In the case of memcpy, we document
the overlapping behavior on FreeBSD (pre-existing). For str*, it is
left unspecified, however, since the default (and x86) implementations
do not handle overlapping strings properly.

PR: 223653
Approved by: phk (mentor)

5 years agoMFC r342977 (by cem): amdtemp(4): Add support for Family 15h, Model >=60h
mav [Tue, 22 Jan 2019 21:35:25 +0000 (21:35 +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 r340426 (by cem): amdtemp(4): Fix temperature reporting on AMD 2990WX
mav [Tue, 22 Jan 2019 21:34:25 +0000 (21:34 +0000)]
MFC r340426 (by cem): amdtemp(4): Fix temperature reporting on AMD 2990WX

Update the AMD family 17h temperature reporting based on AMD Tech Doc 56255
OSRR, section 4.2.1.

For CPUS w/CUR_TEMP_RANGE_SEL set, scale the reported temperature into the
range -49..206; i.e., subtract 49°C.

Submitted by:   gallatin@
Reported by:    bcran@

5 years agoMFC r340425 (by cem): amdsmn(4)/amdtemp(4): Attach to Ryzen 2 hostbridges
mav [Tue, 22 Jan 2019 21:33:14 +0000 (21:33 +0000)]
MFC r340425 (by cem): amdsmn(4)/amdtemp(4): Attach to Ryzen 2 hostbridges

As reported, tested, and patch supplied by Johannes.

There may be future work to do to support multiple sensors, but for now, any
sensor at all is a strict improvement for Ryzen 2 systems.

PR:             228480
Submitted by:   Johannes Lundberg <johalun0 AT gmail.com> (earlier version)
Reported by:    deischen@, Johannes, and numerous others

5 years agoMFC r342856: Added support for the SIOCGI2C ioctl.
delphij [Tue, 22 Jan 2019 04:20:52 +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:
markj [Tue, 22 Jan 2019 02:04:37 +0000 (02:04 +0000)]
MFC r342864:
Specify the correct option level when emulating SO_PEERCRED.

PR: 234722

5 years agoMFC r343041
kp [Tue, 22 Jan 2019 01:07:20 +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 [Mon, 21 Jan 2019 19:33:05 +0000 (19:33 +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
emaste [Mon, 21 Jan 2019 18:35:39 +0000 (18:35 +0000)]
MFC r343153:     freebsd-update.8: mandoc -Tlint fixes

PR: 185389

5 years agoMFC r343023:
pfg [Mon, 21 Jan 2019 14:54:01 +0000 (14:54 +0000)]
MFC r343023:
msun: reduce diff between src/e_j0.c and src/e_j0f.c

PR: 229501

5 years agoMFC r342845,342846: Port NetBSD improvements:
delphij [Mon, 21 Jan 2019 06:52:35 +0000 (06:52 +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 agoMFC r343130
kp [Mon, 21 Jan 2019 00:32:03 +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 r342989
kp [Sun, 20 Jan 2019 22:01:41 +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 r342791: fix a typo in chio(4) (which propagates into chio(1))
joerg [Sun, 20 Jan 2019 21:38:24 +0000 (21:38 +0000)]
MFC r342791: fix a typo in chio(4) (which propagates into chio(1))

5 years agoMFC r343108:
kib [Sun, 20 Jan 2019 13:16:36 +0000 (13:16 +0000)]
MFC r343108:
Trim whitespace at EoL, use tabs instead of spaces for indent.

PR: 235004

5 years agoMFC r340926:
wulf [Fri, 18 Jan 2019 21:25:46 +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:
wulf [Fri, 18 Jan 2019 21:12:00 +0000 (21:12 +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 r342822:
dab [Fri, 18 Jan 2019 16:04:36 +0000 (16:04 +0000)]
MFC r342822:

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

5 years agoMFC r342770:
dab [Fri, 18 Jan 2019 15:59:49 +0000 (15:59 +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 342925:
ae [Fri, 18 Jan 2019 09:57:03 +0000 (09:57 +0000)]
MFC 342925:
  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

5 years agoMFC r342884:
hselasky [Fri, 18 Jan 2019 08:57:23 +0000 (08:57 +0000)]
MFC r342884:
Fix loopback traffic when using non-lo0 link local IPv6 addresses.

The loopback interface can only receive packets with a single scope ID,
namely the scope ID of the loopback interface itself. To mitigate this
packets which use the scope ID are appearing as received by the real
network interface, see "origifp" in the patch. The current code would
drop packets which are designated for loopback which use a link-local
scope ID in the destination address or source address, because they
won't match the lo0's scope ID. To fix this restore the network
interface pointer from the scope ID in the destination address for
the problematic cases. See comments added in patch for a more detailed
description.

This issue was introduced with route caching by karels@ .

Reviewed by: bz (network)
Differential Revision: https://reviews.freebsd.org/D18769
Sponsored by: Mellanox Technologies

5 years agoMFC r342778:
hselasky [Fri, 18 Jan 2019 08:48:30 +0000 (08:48 +0000)]
MFC r342778:
Reduce timeout for reading the USB HUB port status to 1000ms and try to filter
out dead USB HUB devices by implementing an error counter, so that the USB
enumeration thread does not spend all its time reading from non-responding
devices, blocking user-space access in the end.

Tested by: Matthias Apitz <guru@unixarea.de>
Sponsored by: Mellanox Technologies

5 years agoMFC r342730:
hselasky [Fri, 18 Jan 2019 08:44:50 +0000 (08:44 +0000)]
MFC r342730:
Improve USB generic debug messages. Print process ID and name when opening
and closing usb/ugenX.Y character device nodes.

Sponsored by: Mellanox Technologies

5 years agoPull in r337861 from upstream llvm trunk (by Hideki Saito):
dim [Wed, 16 Jan 2019 20:38:17 +0000 (20:38 +0000)]
Pull in r337861 from upstream llvm trunk (by Hideki Saito):

  [LV] Fix for PR38110, LV encountered llvm_unreachable()

  Summary: truncateToMinimalBitWidths() doesn't handle all Instructions
  and the worst case is compiler crash via llvm_unreachable(). Fix is
  to add a case to handle PHINode and changed the worst case to NO-OP
  (from compiler crash).

  Reviewers: sbaranga, mssimpso, hsaito

  Reviewed By: hsaito

  Subscribers: llvm-commits

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

This should fix "Unhandled instruction type!" (if assertions are
enabled) or segmentation faults (if assertions are disabled) when
compiling certain versions of the net-p2p/gtk-gnutella port.

Direct commit to stable/11 and stable/12, since head already has this
fix.

Reported by: Jamie Landeg-Jones <jamie@catflap.org>
PR: 234987

5 years agoMFC r342855:
shurd [Wed, 16 Jan 2019 19:20:14 +0000 (19:20 +0000)]
MFC r342855:

Use iflib_if_init_locked() during resume instead of iflib_init_locked().

iflib_init_locked() assumes that iflib_stop() has been called, however,
it is not called for suspend.  iflib_if_init_locked() calls stop then init,
so fixes the problem.

This was causing errors after a resume from suspend.

PR: 224059
Reported by: zeising
Sponsored by: Limelight Networks

5 years agoMFC r343043: scp: disallow empty or current directory
emaste [Wed, 16 Jan 2019 15:15:04 +0000 (15:15 +0000)]
MFC r343043: scp: disallow empty or current directory

Obtained from: OpenBSD scp.c 1.198
Security: CVE-2018-20685
Sponsored by: The FreeBSD Foundation

5 years agoMFC r340933:
bapt [Wed, 16 Jan 2019 12:04:29 +0000 (12:04 +0000)]
MFC r340933:

libedit: improve multibyte support

Until this commit libedit only supported UTF-8 for multibyte charset
Improve it to support other multibyte charsets

Tested with eucJP and SJIS charsets.
Note that this change as been review and committed in upstream libedit
as well via christos@NetBSD

Submitted by: naito.yuichiro _at_ gmail.com
Reviewed by: bapt, pfg, yuripv, 0mp
Differential Revision: https://reviews.freebsd.org/D17903

5 years agoMFC r342591,342599:
kp [Wed, 16 Jan 2019 05:17:27 +0000 (05:17 +0000)]
MFC r342591,342599:

Make kernel print jail ID when logging a process exit

Kernel now includes jail ID when logging a process exit. jid is 0 for unjailed
processes.

Submitted by: Marie Helene Kvello-Aune <freebsd@mhka.no>
Relnotes: yes
Sponsored by: Modirum MDPay

5 years agoMFC r335675:
gonzo [Wed, 16 Jan 2019 04:01:30 +0000 (04:01 +0000)]
MFC r335675:

Fix file(1) dumpdate reporting for dump(8) files

Magic file for dump(8) had this dump and previous dump dates reversed.
Fix order for all three flavours of the dump(8) format.
This fix was committed to upstream repo as magic/Magdir/dump,v 1.17
and will be merged during next vendor import.

PR: 223155

5 years agoMFC r342887:
markj [Wed, 16 Jan 2019 03:07:32 +0000 (03:07 +0000)]
MFC r342887:
Stop setting if_linkmib in vlan(4) ifnets.

PR: 219472

5 years agoMFC 340206: Treat the memory lengths for CHELSIO_T4_GET_MEM as unsigned.
jhb [Tue, 15 Jan 2019 21:07:40 +0000 (21:07 +0000)]
MFC 340206: Treat the memory lengths for CHELSIO_T4_GET_MEM as unsigned.

Previously attempts to read the MC region were failing since the
length was greater than 2^31.

5 years agoMFC r342792, r342805: Provide rc_service variable for rc service scripts
kevans [Tue, 15 Jan 2019 16:12:47 +0000 (16:12 +0000)]
MFC r342792, r342805: Provide rc_service variable for rc service scripts

r342792: rc.subr: Provide rc_service variable for service scripts

Some rc scripts in ports (e.g. uwsgi, apache, openvpn) allow for
'application profiles' that usually require the rc script to be invoked
again for each active profile. Because there's no consistent way to
determine the path because it differs between manual/service(8) invocations
and /etc/rc invocations, this leads to patterns like these:

- www/uwsgi hardcodes the script path
- security/openvpn guesses either $_file or $0 based on $0 = /etc/rc

Instead of forcing rc scripts to guess, provide an rc_service variable to
the scripts that gets set appropriately both for direct execution or when a
script is being executed via run_rc_script (e.g. /etc/rc).

This is our analog of an OpenRC variable with the same name, different case
(RC_SERVICE).

r342805: rc.subr: Fix typo

Originally intended as 'in case in needs to be re-invoked', but it was later
decided (by myself) that 're-invoke itself' makes it more clear that the
script is expected to use this in a way.

PR: 234614

5 years agoMFC r305074-r305075, r327275, r327570: newfs_msdos updates
kevans [Tue, 15 Jan 2019 15:47:01 +0000 (15:47 +0000)]
MFC r305074-r305075, r327275, r327570: newfs_msdos updates

r305074:
Remove CHS alignment. It's not needed and causes problems for the BBB
boot partition. NetBSD removed it in 1.10 in their repo some time ago.

r305075:
The code only converts from bpbHugeSectors to bpbSectors if the sum of
the hidden and huge sectors is less than or equal MAXU16. When
formatting in Windows bpbSectors is still used for 63488 sectors and
2048 hidden (sum > MAXU16). The hidden sectors count is the number of
sectors before the FAT16 Boot Record so it shouldn't affect the sector
count. Attached patch (huge_sec_conversion.patch) to only check for
bpb.bpbHugeSectors <= MAXU16 when converting to bpbSectors.

r327275:
Close fd and fd1 before returning now that we're done with them.

r327570:
Only call close if fd and fd1 are not -1.

PR: 183234

5 years agoMFC r342640: Ensure buffer is nul-terminated.
delphij [Tue, 15 Jan 2019 06:52:34 +0000 (06:52 +0000)]
MFC r342640: Ensure buffer is nul-terminated.

5 years agoMFC r342966:
avos [Tue, 15 Jan 2019 02:16:23 +0000 (02:16 +0000)]
MFC r342966:
net80211: fix possible panic for some drivers after r342464

Check if rate control structures were allocated before trying to
access them in various places; this was possible before on
allocation failure (unlikely), but was revealed after r342211
where allocation was deferred.

In case if driver uses wlan_amrr(4) and it is loaded it
is possible to reproduce the panic via

sysctl net.wlan.<number>.rate_stats

(for wlan0 the number will be 0).

The patch was adjusted a bit since file contents are different enough
since r306591.

5 years agoMFC r340617,341006: unbreak ng_source(4) for 64-bit platforms
eugen [Mon, 14 Jan 2019 09:57:36 +0000 (09:57 +0000)]
MFC r340617,341006: unbreak ng_source(4) for 64-bit platforms

5 years agoMFC r342883:
avos [Mon, 14 Jan 2019 07:54:11 +0000 (07:54 +0000)]
MFC r342883:
net80211: fix panic when device is removed during initialization

if_dead() is called during device detach - check if interface is
still exists before trying to refresh vap MAC address
(IF_LLADDR will trigger page fault otherwise).

5 years agoMFC r342853:
kib [Mon, 14 Jan 2019 07:25:44 +0000 (07:25 +0000)]
MFC r342853:
Add a tunable which changes mincore(2) algorithm to only report data
from the local mapping.

5 years agoMFC r342826:
kib [Mon, 14 Jan 2019 07:22:58 +0000 (07:22 +0000)]
MFC r342826:
Fix use of busdma(9) KPI in ahci(4).

5 years agoMFC r342817: getconf(1): Minor mdoc fix
jilles [Sun, 13 Jan 2019 18:48:13 +0000 (18:48 +0000)]
MFC r342817: getconf(1): Minor mdoc fix

5 years agoMFC r342816: thr_wake(2): Minor mdoc fixes
jilles [Sun, 13 Jan 2019 18:47:37 +0000 (18:47 +0000)]
MFC r342816: thr_wake(2): Minor mdoc fixes

5 years agoMFC r342933:
fsu [Sun, 13 Jan 2019 12:13:08 +0000 (12:13 +0000)]
MFC r342933:
Fix errno values returned from DUMMY_XATTR linuxulator calls

Reported by: weiss@uni-mainz.de
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D18812

5 years agoMFC r342614, r342633
delphij [Sun, 13 Jan 2019 08:49:55 +0000 (08:49 +0000)]
MFC r342614, r342633

r342614:
Properly set svn:mimetype for zh_CN.UTF-8.src.

r342633:
Fix various issues with Chinese locales:

 - Change short weekday names to use only one Chinese character.
   (note: this is a somewhat misunfortunate compromise due to the fact
   that some applications are using short buffer for weekday names,
   and in ~1905 when 星期 system was created to replace the traditional
   七曜 system, which can use 日月火水木金土 to represent Sunday through
   Saturday with just one character without any confusion).
 - for zh_CN locales: use Arabic numerals for month names, matching the
   practice of all other CJK locales
 - Regenerate zh_CN.{GB2312,GBK} locales from zh_CN.UTF-8.

Reported by: ygy
Reviewed by: kevlo
Differential Revision: https://reviews.freebsd.org/D18689

5 years agoMFC r342823:
kib [Sun, 13 Jan 2019 02:38:14 +0000 (02:38 +0000)]
MFC r342823:
Clamp tuklib_physmem() return value to SIZE_T_MAX.

5 years agoMFC r342810:
avos [Sun, 13 Jan 2019 02:23:18 +0000 (02:23 +0000)]
MFC r342810:
powerd(8): allow to force a method of battery state query

This change allows to determine power source via sysctl or /dev/apm
when devd(8) is running (used by default).

Based on patch from PR; other changes on top of it:
- '-f' (force) -> '-s' (source) parameter renaming;
- allow 'apm' -> 'devd' transition when '-s devd' is set
(if APM is enabled);
- man page update.

PR: 125707
Submitted by: Konstantin Stepanov <milezv@yandex.ru>
Reviewed by: bcr, imp
Differential Revision: https://reviews.freebsd.org/D18742

5 years agoMFC r342787:
markj [Sat, 12 Jan 2019 17:00:54 +0000 (17:00 +0000)]
MFC r342787:
Add a bounds check to the tws(4) passthrough ioctl handler.

admbug: 825

5 years agoMFC r342888:
markj [Sat, 12 Jan 2019 16:58:32 +0000 (16:58 +0000)]
MFC r342888:
Complete the removal of obsolete ioctl handlers.

PR: 234706

5 years agoMFC r342886
vmaffione [Sat, 12 Jan 2019 08:30:13 +0000 (08:30 +0000)]
MFC r342886

netmap: fix bridge example in netmap(4)

PR:     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194872
Reported by:    adrian

5 years agoMFC r342885
vmaffione [Sat, 12 Jan 2019 08:29:27 +0000 (08:29 +0000)]
MFC r342885

netmap: fix sysctl variable in vale(4)

PR:     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212333

5 years agoMFC r342784:
kp [Sat, 12 Jan 2019 05:44:10 +0000 (05:44 +0000)]
MFC r342784:

pf: Remove references to pflow from the pf.conf man page

pflow no longer exists. It was removed as part of a pf update back in 2012
(r240233).

PR: 223957

5 years agoMFC r342575, r342580: ar: detect and error out on 32-bit symbol table overflow
emaste [Fri, 11 Jan 2019 19:53:45 +0000 (19:53 +0000)]
MFC r342575, r342580: ar: detect and error out on 32-bit symbol table overflow

BSD ar currently does not support the /SYM64/ 64-bit symbol table, and
previously truncated to 32-bits, silently producing corrupted archives
larger than 4GB.

PR: 234454

5 years agoMFC r342525: MFV r342469: 9630 add lzc_rename and lzc_destroy to libzfs_core
avg [Fri, 11 Jan 2019 12:18:11 +0000 (12:18 +0000)]
MFC r342525: MFV r342469: 9630 add lzc_rename and lzc_destroy to libzfs_core

Relnotes: maybe

5 years agoMFC r342541: MFV r342532: 5882 Temporary pool names
avg [Fri, 11 Jan 2019 11:46:33 +0000 (11:46 +0000)]
MFC r342541: MFV r342532: 5882 Temporary pool names

Note that this commit brings only formatting changes that were done
during the final review of the illumos change, because FreeBSD got the
main changes before illumos.