]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r342910:
pfg [Sun, 10 Feb 2019 23:47:37 +0000 (23:47 +0000)]
MFC r342910:
grep(1) outputs NOT-matched lines with multi-byte characters

PR: 113343

5 years agoMFC r343470:
oshogbo [Sun, 10 Feb 2019 22:32:09 +0000 (22:32 +0000)]
MFC r343470:
  zfs: allow to change cache flush sysctl

  There is no reason for this variable to be tunable.
  This variable is used as a barrier in few places.

  Discussed with:       pjd
  MFC after:    2 weeks
  Sponsored by: Fudo Security

5 years agoMFC r343474:
avos [Sun, 10 Feb 2019 21:00:02 +0000 (21:00 +0000)]
MFC r343474:
Remove 2GHz channel list copies from wireless drivers.

Wrap ieee80211_add_channel_list_2ghz into another function
which supplies default (1-14) channel list to it and drop
its copies from drivers.

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

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

PR: 161035

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

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

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

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

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

  Fixed the assertion failure.

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

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

Reported by: jbeich
PR: 234480

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

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

Sponsored by: iXsystems, Inc.

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

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

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

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

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

Sponsored by: Mellanox Technologies

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

It is externally visible since r257065.

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

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

  Fix some filemon path logging issues.

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

  Shar files may be seen as binary by grep.

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

netmap: upgrade sync-kloop support

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

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

Use NLDT to get number of LDTs on i386

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

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

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

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

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

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

netmap: add notifications on kloop stop

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

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

netmap: improvements to the netmap kloop (CSB mode)

Changelist:
    - Add the proper memory barriers in the kloop ring processing
      functions.
    - Fix memory barriers usage in the user helpers (nm_sync_kloop_appl_write,
      nm_sync_kloop_appl_read).
    - Fix nm_kr_txempty() helper to look at rhead rather than rcur. This
      is important since the kloop can read a value of rcur which is ahead
      of the value of rhead (see explanation in nm_sync_kloop_appl_write)
    - Remove obsolete ptnetmap_guest_write_kring_csb() and
      ptnet_guest_read_kring_csb().
    - Prepare in advance the arguments for netmap_sync_kloop_[tr]x_ring(),
      to make the kloop faster.
    - Provide kernel and user implementation for nm_ldld_barrier() and
      nm_ldst_barrier()

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

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

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

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

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

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

PR: 177366

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

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

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

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

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

It is not used since r287197.

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

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

Sponsored by: The FreeBSD Foundation

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

Approved by: so
Security: CVE-2019-5596

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

Approved by: so
Security: CVE-2019-5595

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

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

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

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

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

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

Update pci_vendors to 2019.01.29

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

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

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

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

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

Document the instance context pointer.

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

PR: 234041

5 years agoMFC r343499:
avos [Sat, 2 Feb 2019 04:21:00 +0000 (04:21 +0000)]
MFC r343499:
rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used

They will stop it automatically ('Interface wlan0 is down,
dhclient exiting'); use /etc/rc.d/dhclient stop command only when
none of them is used.

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

vtnet: fix typo in vtnet_free_taskqueues

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

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

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

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

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

Sponsored by: Mellanox Technologies

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

pf: Fix use-after-free of counters

When cleaning up a vnet we free the counters in V_pf_default_rule and
V_pf_status from shutdown_pf(), but we can still use them later, for example
through pf_purge_expired_src_nodes().

Free them as the very last operation, as they rely on nothing else themselves.

PR: 235097

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

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

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

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

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

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

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

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

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

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

MFC r343475:
geom_uzip(4): set 'gp != NULL' assertion on top of the function

There was yet another access to this variable in g_trace() few
lines upper.

PR: 203499
Reported by: cem

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

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

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

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

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

Fix a typo.

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

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

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

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

Remove documentation for the nonexistant cred_update_thread(9).

This was a tangential change submitted as part of D18930.

Submitted by: jack@gandi.net

5 years agoMFC r343295:
kp [Tue, 29 Jan 2019 17:49:39 +0000 (17:49 +0000)]
MFC r343295:

pf: Validate psn_len in DIOCGETSRCNODES

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

Reported by: markj

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

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

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

Update tunefs to allow '_' in label names.

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

Sponsored by: Netflix

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

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

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

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

netmap: fix crash with monitors and VALE ports

Crash report described here:
    https://github.com/luigirizzo/netmap/issues/583
Fixed by providing dummy sync callback in case it is missing.

5 years agoMFC r343459: (parcial)
pfg [Mon, 28 Jan 2019 02:12:48 +0000 (02:12 +0000)]
MFC r343459: (parcial)
ext2fs: Add some extra consistency checks for the superblock.

Maliciously formed, or badly corrupted, filesystems can cause kernel
panics.  In general, such acts of foot-shooting can only be accomplished
by root, but in a world with VM images that is  moving towards automated
mounts it is important to have some form of prevention.

Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert
of Fraunhofer FKIE.
Incidentaly this should also fix a memory corruption issue reported by
Dr Silvio Cesare of InfoSect.

Huge thanks to all reseachers for making us aware of the issue.

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

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

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

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

While here:
- Move cleanup to the function end.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  Sync with OpenBSD.

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

PR: 234430
Obtained from: OpenBSD

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

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

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

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

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

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

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

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

This change does not affect device attach / removal events.

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

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

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

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

PR: 234241

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

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

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

PR: 233343

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

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

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

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

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

This issue was found by running syzkaller.

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

Avoid overfow in vtruncbuf()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Sponsored by: The FreeBSD Foundation

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)