]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r343391:
Oleksandr Tymoshenko [Mon, 4 Feb 2019 10:24:16 +0000 (10:24 +0000)]
MFC r343391:

Fix prompt for MFSROOT in tinybsd

tinybsd offers two choices when prompting user for MFSROOT: 'YES'
and 'NO'. Script logic only handles 'yes'. Change offered values
to lower case.

PR: 131059
Submitted by: Brock Williams <brock@cotcomsol.com>

5 years agoMFC r343170:
Oleksandr Tymoshenko [Mon, 4 Feb 2019 10:20:48 +0000 (10:20 +0000)]
MFC r343170:

[aic7xxx] Use correct product name 29320LPE instead of non-existent 39320LPE

The PCI id belongs to Adaptec 29320LPE controller. The same fix also was
merged[1] to OpenBSD driver ~6 years ago.

[1] https://github.com/openbsd/src/commit/f997b5

PR: 172133
Submitted by: henning.petersen@t-online.de

5 years agoMFC r343224, r343533
Oleksandr Tymoshenko [Mon, 4 Feb 2019 10:19:27 +0000 (10:19 +0000)]
MFC r343224, r343533

r343224:
Add KBD_BOOTPROTO quirk for Logitech G510s USB keyboard

PR: 232136
Submitted by: dgilbert@eicat.ca

r343533:
[usb] Add UQ_KBD_BOOTPROTO quirk for Corsair K68 keyboard

PR: 222114
Submitted by: Zane C. Bowers-Hadley <vvelox@vvelox.net>

5 years agoMFC: 343546
Baptiste Daroussin [Mon, 4 Feb 2019 08:38:02 +0000 (08:38 +0000)]
MFC: 343546

Update pci_vendors to 2019.01.29

5 years agoMFC r343524:
Andriy Voskoboinyk [Mon, 4 Feb 2019 03:52:04 +0000 (03:52 +0000)]
MFC r343524:
rsu(4): do not ignore mgmtrate / mcastrate / ucastrate.

Enforce net80211 rates for control / management / multicast / EAPOL frames
and allow to override rate for unicast frames via ifconfig(8) 'ucastrate'
option; by default it still uses f/w rate adaptation for unicast frames.

5 years agoMFC r343576:
Andriy Voskoboinyk [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 r343156:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 22:49:01 +0000 (22:49 +0000)]
MFC r343156:

[usb] Add HID_IGNORE quirks for multiple UPS devices

Without HID_IGNORE quirk enabled these models appear in the system as a uhid
devices while NUT (Network UPS Tool) expects them to be ugen.

PR: 131521
Submitted by: Naoyuki Tai <ntai@smartfruit.com>, John Bayly <john.bayly@tipstrade.net>

5 years agoMFC r343129:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 22:45:50 +0000 (22:45 +0000)]
MFC r343129:

[ata] Add workaround for KingDian S200 SSD crash on receiving TRIM command

- Add ADA_Q_NO_TRIM quirk to be used with the device that falsely advertise TRIM support
- Add ADA_Q_NO_TRIM entry for KingDian S200 SSD

PR: 222802
Submitted by: Bertrand Petit <bsdpr@phoe.frmug.org>

5 years agoMFC r343127:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 21:18:46 +0000 (21:18 +0000)]
MFC r343127:

Fix descriptor/memory leak in compress(1) code

This is mostly a style fix since the code in question is not called multiple
times and doesn't have cummulative effect.

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

5 years agoMFC r343106:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 21:17:26 +0000 (21:17 +0000)]
MFC r343106:

[usb] Add quirk for SmartG2 USB memory key

PR: 167001
Submitted by: Daan Vreeken [PA4DAN] <Daan@vitsch.nl>

5 years agoMFC r343069:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 15:34:09 +0000 (15:34 +0000)]
MFC r343069:

[rpi] Reorganize spigen(4) overlays for Raspberry Pi

- Remove CS=2 entry from spigen-rpi2 since it didn't work
- Add spigen-rpi3 overlay for Raspberry Pi 3
- Enable rpi overlay modules for GENERIC kernel on aarch64

PR: 233489
Submitted by: bobf@mrp3.com
Reviewed by: db
Differential Revision: https://reviews.freebsd.org/D16088

5 years agoMFC r343060:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 14:56:38 +0000 (14:56 +0000)]
MFC r343060:

[drm] Fix off-by-one error when accessing driver-specific ioctl handlers array

PR: 231513
Submitted by: Young_X <YangX92@hotmail.com>
Approved by: imp

5 years agoMFC r343029:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 14:55:21 +0000 (14:55 +0000)]
MFC r343029:

[led] propagate error from set_led() to the caller

Do not lose error condition by always returning 0 from set_led.
None of the calls to set_led checks for return value at the moment so
none of API consumers in base is affected.

PR: 231567
Submitted by: Bertrand Petit <bsdpr@phoe.frmug.org>

5 years agoMFC r343008:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 14:54:29 +0000 (14:54 +0000)]
MFC r343008:

Add Dell Chromebook to the list of devices with E820 extmem quirk enabled

Just like for Acer C270 chromebook the E820 extmem workaround is required for
FreeBSD to boot on Dell chromebook.

PR: 204916
Submitted by: Keith White <kwhite@site.uottawa.ca>

5 years agoMFC r343222-r343223, r343338
Oleksandr Tymoshenko [Sun, 3 Feb 2019 14:47:22 +0000 (14:47 +0000)]
MFC r343222-r343223, r343338

r343222:
Fix crash in systat(4) when certain commands are called without arguments

Add check for missing arguments to dsmatchselect and dsselect

PR: 219689
Submitted by: Marko Turk <mt@markoturk.info>

r343223:
Fix inconsistency in return values introduced by r343222

Consistently return 1 or the case of missing arguments in both functions

PR: 219689
X-MFC-With: 343222

r343338:
Fix systat's :only command parser for the multiple arguments case

According to systat(1) :only option is supposed to accept multiple drives
but the parser for its arguments stops after first entry. Fix the parser
logic to accept multiple drives.

PR: 59220
Reported by: Andy Farkas <andyf@speednet.com.au>

5 years agoMFC r343009, r343109-r343110, r343128, r343232
Oleksandr Tymoshenko [Sun, 3 Feb 2019 11:07:40 +0000 (11:07 +0000)]
MFC r343009, r343109-r343110, r343128, r343232

r343009:
Add four kerberos CLI utilities to OptionalObsoleteFiles.inc

Add asn1_compile, make-roken, kcc, and slc to the OptionalObsoleteFiles.inc
so they would be removed during delete-old stage if the new world is built
without Kerberos support.

PR: 230725
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>

r343109:
Add optional obsolete files for the installworld without sendmail

Add two more entries for WITHOUT_SENDMAIL install. The /var/spool/clientmqueue
entry would be deleted only if there are no files/dirs in it, so the
content generated during previous lifecycle of the system is safe

PR: 228484
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>

r343110:
Fix conditional obsolete files entry for WITHOUT_EXAMPLES

Add all the files under /usr/share/examples to the MK_EXAMPLES
section. OLD_DIRS entries are not removed if they're not empty so
prior to this change WITHOUT_EXAMPLES didn't have significant effect
on the updated system.

PR: 228484
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru> (original patch)

r343128:
Add ypldap to the list of conditional obsolete files

ypldap should be removed during delete-old if WITHOUT_NIS flag is enabled

PR: 230727
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>

r343232:
Add more profile-enabled libraries to remove when WITHOUT_PROFILE is defined

PR: 230898
Submitted by: Herbert J. Skuhra <herbert@mailbox.org>

5 years agoMFC r343028, r343104
Oleksandr Tymoshenko [Sun, 3 Feb 2019 09:14:53 +0000 (09:14 +0000)]
MFC r343028, r343104

r343028:
[mv_pci] Increase default PCI space size for mv_pci

mv_pci driver reads PCI memory window layout from DTB data and if the
data is incomplete falls back to default value. The value is too small
to fit two PCI spaces for mwlwifi devices on WRT3200ACM so the resource
allocation for them fails. Increase the default to 4Mb from 1Mb so
the devices can be properly attached.

r343104:
[mv] Fix invalid condition in fdt_fixup_ranges

Add parentheses to perform assignment before comparison. The prior
condition worked because fdt_parent_addr_cells returns 1 for the DTB
on which fdt_fixup_ranges is called and accidentally par_addr_cells
ends up to be set to the same value.

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

5 years agoMFC r343443, r343446, r343448, r343452
Oleksandr Tymoshenko [Sun, 3 Feb 2019 08:53:03 +0000 (08:53 +0000)]
MFC r343443, r343446, r343448, r343452

r343443:
[mips] remove dublicate values in enable mask in nlm_usb_intr_en

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

r343446:
[mips] remove check that is always false (unsinged < 0)

cpuid and local cpu variable are unsigned so checking if value is less than zero
always yields false.

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

r343448:
[mips] Fix counter mask in jz4780 timer driver

Fix dublicate value in what is apparent copypaste mistake. The last value
in mask is supposed to be for counter 7, not counter 3.

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

r343452:
[mips] Fix error condition check that always evaluates to false

Use proper logical operand when checking the value of srcid

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

5 years agoMFC r343450:
Oleksandr Tymoshenko [Sun, 3 Feb 2019 08:45:01 +0000 (08:45 +0000)]
MFC r343450:

[mips] Unbreak kernel build for CI20

- Include header required for boot_parse_XXX functions
- Use boot_parse_args when parsing argc/argv style arguments
- Remove unused function

5 years agoMFC r343607:
Konstantin Belousov [Sun, 3 Feb 2019 00:41:14 +0000 (00:41 +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:
Konstantin Belousov [Sun, 3 Feb 2019 00:39:35 +0000 (00:39 +0000)]
MFC r343484:
Remove now redundand ifunc relocation code which should have been
removed as part of r341441.

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

Document the instance context pointer.

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

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

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

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

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

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

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

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

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

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

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

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

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

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

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

PR: 234041

5 years agoMFC r343518:
Andriy Voskoboinyk [Sat, 2 Feb 2019 04:27:47 +0000 (04:27 +0000)]
MFC r343518:
rtwn_usb(4): add new USB id.

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

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

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

5 years agoMFC r343353:
Mark Johnston [Fri, 1 Feb 2019 18:19:33 +0000 (18:19 +0000)]
MFC r343353:
Correct uma_prealloc()'s use of domainset iterators after r339925.

5 years agoMFC r343552
Vincenzo Maffione [Fri, 1 Feb 2019 12:22:48 +0000 (12:22 +0000)]
MFC r343552

vtnet: fix typo in vtnet_free_taskqueues

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

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

5 years agoMFC r343453:
Hans Petter Selasky [Fri, 1 Feb 2019 10:08:34 +0000 (10:08 +0000)]
MFC r343453:
Add new USB quirk.

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

5 years agoMFC r343451:
Hans Petter Selasky [Fri, 1 Feb 2019 10:05:50 +0000 (10:05 +0000)]
MFC r343451:
Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI.

Sponsored by: Mellanox Technologies

5 years agoMFC r343418:
Kristof Provost [Fri, 1 Feb 2019 10:04:53 +0000 (10:04 +0000)]
MFC r343418:

pf: Fix use-after-free of counters

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

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

PR: 235097

5 years agoBuild fix for missing NET_EPOCH_XXX() dependencies after r343650.
Hans Petter Selasky [Fri, 1 Feb 2019 09:18:44 +0000 (09:18 +0000)]
Build fix for missing NET_EPOCH_XXX() dependencies after r343650.
This patch is to be reverted when the relevant changes are MFC'ed.
This is a direct commit.

Sponsored by: Mellanox Technologies

5 years agoMFC r343395:
Hans Petter Selasky [Fri, 1 Feb 2019 09:08:19 +0000 (09:08 +0000)]
MFC r343395:
Fix refcounting leaks in IPv6 MLD code leading to loss of IPv6
connectivity.

Looking at past changes in this area like r337866, some refcounting
bugs have been introduced, one by one. For example like calling
in6m_disconnect() and in6m_rele_locked() in mld_v1_process_group_timer()
where previously no disconnect nor refcount decrement was done.
Calling in6m_disconnect() when it shouldn't causes IPv6 solitation to no
longer work, because all the multicast addresses receiving the solitation
messages are now deleted from the network interface.

This patch reverts some recent changes while improving the MLD
refcounting and concurrency model after the MLD code was converted
to using EPOCH(9).

List changes:
- All CK_STAILQ_FOREACH() macros are now properly enclosed into
  EPOCH(9) sections. This simplifies assertion of locking inside
  in6m_ifmultiaddr_get_inm().
- Corrected bad use of in6m_disconnect() leading to loss of IPv6
  connectivity for MLD v1.
- Factored out checks for valid inm structure into
  in6m_ifmultiaddr_get_inm().

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
Sponsored by: Mellanox Technologies

5 years agoMFC r343394:
Hans Petter Selasky [Fri, 1 Feb 2019 09:07:27 +0000 (09:07 +0000)]
MFC r343394:
When detaching a network interface drain the workqueue freeing the inm's
because the destructor will access the if_ioctl() callback in the ifnet
pointer which is about to be freed. This prevents use-after-free.

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
Sponsored by: Mellanox Technologies

5 years agoMFC r343393:
Hans Petter Selasky [Fri, 1 Feb 2019 09:06:40 +0000 (09:06 +0000)]
MFC r343393:
Add debugging sysctl to disable incoming MLD v2 messages similar to the
existing sysctl for MLD v1 messages.

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
Sponsored by: Mellanox Technologies

5 years agoMFC r343392:
Hans Petter Selasky [Fri, 1 Feb 2019 09:05:41 +0000 (09:05 +0000)]
MFC r343392:
Fix duplicate acquiring of refcount when joining IPv6 multicast groups.
This was observed by starting and stopping rpcbind(8) multiple times.

PR: 233535
Differential Revision: https://reviews.freebsd.org/D18887
Reviewed by: bz (net)
Tested by: ae
Sponsored by: Mellanox Technologies

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

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

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

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

5 years agoMFC r343497:
Andriy Voskoboinyk [Fri, 1 Feb 2019 03:01:19 +0000 (03:01 +0000)]
MFC r343497:
Unbreak devd.conf(5) regex after r343249

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

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

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

5 years agoMFC r343147:
Konstantin Belousov [Fri, 1 Feb 2019 00:37:55 +0000 (00:37 +0000)]
MFC r343147:
i386/PAE busdma: allow more bounce pages.

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

5 years agoMFC r342928:
Sean Eric Fagan [Thu, 31 Jan 2019 22:06:46 +0000 (22:06 +0000)]
MFC r342928:
   Change ZFS quotas to return EINVAL when not present (matches man page).

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

5 years agoMFC r343124:
Toomas Soome [Thu, 31 Jan 2019 17:06:59 +0000 (17:06 +0000)]
MFC r343124:

libsa: add asprintf()

asprintf() is a nice tool for string processing.

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

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

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

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

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

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

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

PR: 203499
Reported by: cem

5 years agoMFC r343077:
Marcelo Araujo [Thu, 31 Jan 2019 07:08:37 +0000 (07:08 +0000)]
MFC r343077:

Fix broken uart on Win2016 guest.

Obtained from: Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4)

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

PR: 232495

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

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

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

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

r340195:
capsicum: Add ppoll and freebsd32_ppoll to compat32.

PR: 232495
Pointed out by: brooks

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

Reported by: jhb

5 years agoMFC r340242:
Brooks Davis [Wed, 30 Jan 2019 23:36:02 +0000 (23:36 +0000)]
MFC r340242:

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

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

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

5 years agoMFC: r343481
Marius Strobl [Wed, 30 Jan 2019 11:56:10 +0000 (11:56 +0000)]
MFC: r343481

- In _iflib_fl_refill(), don't mark an RX buffer as available in the
  corresponding bitmap before adding an mbuf has actually succeeded.
  Previously, m_gethdr(M_NOWAIT, ...) failing caused a "hole" in the
  RX ring but not in its bitmap. One implication of such a hole was
  that in a subsequent call to _iflib_fl_refill() with the RX buffer
  accounting still indicating another reclaimable buffer, bit_ffc(3)
  nevertheless returned -1 in frag_idx which in turn caused havoc
  when used as an index. Thus, additionally assert that frag_idx is
  0 or greater.
  Another possible consequence of a hole in the RX ring was a NULL-
  dereference when trying to use the unallocated mbuf, for example
  in iflib_rxd_pkt_get().
  This bug was introduced with r341095, MFCed to stable/12 in r343304.

  While at it, make the variable declarations in _iflib_fl_refill()
  conform to style(9) and remove redundant checks already performed
  by bit_ffc{,_at}(3).

- In iflib_queues_alloc(), don't pass redundant M_ZERO to bit_alloc(3).

Reported and tested by: pho

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

Fix a typo.

5 years agoMFC r343366:
Brooks Davis [Tue, 29 Jan 2019 18:08:46 +0000 (18:08 +0000)]
MFC r343366:

Remove documentation for the nonexistant cred_update_thread(9).

This was a tangential change submitted as part of D18930.

Submitted by: jack@gandi.net

5 years agoMFC r343305:
Brooks Davis [Tue, 29 Jan 2019 18:06:35 +0000 (18:06 +0000)]
MFC r343305:

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

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

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

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

pf tests: Check size validation in DIOCGETSRCNODES

Ensure that invalid sizes for DIOCGETSRCNODES do not cause panics.

5 years agoMFC r343295:
Kristof Provost [Tue, 29 Jan 2019 17:49:38 +0000 (17:49 +0000)]
MFC r343295:

pf: Validate psn_len in DIOCGETSRCNODES

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

Reported by: markj

5 years agoMFC r343038: Use TD_IS_IDLETHREAD instead of unrolled version.
Xin LI [Tue, 29 Jan 2019 07:47:57 +0000 (07:47 +0000)]
MFC r343038: Use TD_IS_IDLETHREAD instead of unrolled version.

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

5 years agoMFC of 343449 and 343483
Kirk McKusick [Mon, 28 Jan 2019 21:46:05 +0000 (21:46 +0000)]
MFC of 343449 and 343483

Update tunefs to allow '_' in label names.

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

Sponsored by: Netflix

5 years agoMFC r343247:
Mark Johnston [Mon, 28 Jan 2019 16:18:17 +0000 (16:18 +0000)]
MFC r343247:
Fix cmp(1) tests for "special" mode.

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

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

  Fix an iflib driver unload panic introduced in r343085

  The new loop to sync and unload descriptors was indexed
  by "i", rather than "j".   The panic was caused by "i"
  being advanced rather than "j", and eventually becoming
  out of bounds.

Reviewed by: kib
Sponsored by: Netflix

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

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

5 years agoMFC r343413
Vincenzo Maffione [Mon, 28 Jan 2019 09:18:28 +0000 (09:18 +0000)]
MFC r343413

netmap: fix crash with monitors and VALE ports

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

5 years agoMFC r342379, r342383:
Pedro F. Giffuni [Mon, 28 Jan 2019 02:26:05 +0000 (02:26 +0000)]
MFC r342379, r342383:
gai_strerror() - Update string error messages according to RFC 3493.

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

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

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

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

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

While here:
- Move cleanup to the function end.
- Reuse IEEE80211_IS_DATA() macro.

5 years agoMFC r343459:
Pedro F. Giffuni [Mon, 28 Jan 2019 01:36:55 +0000 (01:36 +0000)]
MFC r343459:
ext2fs: Add some extra consistency checks for the superblock.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

o In sdhci(4):
  - Make pointers const were applicable,
  - replace a few device_printf(9) calls with slot_printf() for
    consistency, and
  - sync some local functions with their prototypes WRT static.

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

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

PR: 234239

5 years agoMFC: r342964
Yoshihiro Takahashi [Sun, 27 Jan 2019 13:56:44 +0000 (13:56 +0000)]
MFC: r342964

  Sync with OpenBSD.

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

PR: 234430
Obtained from: OpenBSD

5 years agoMFC r343213:
Andriy Voskoboinyk [Sun, 27 Jan 2019 12:39:35 +0000 (12:39 +0000)]
MFC r343213:
net80211: resolve ioctl <-> detach race for ieee80211com structure

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

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

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

5 years agoAdd ZFS usage tips to freebsd-tips.
Benedict Reuschling [Sun, 27 Jan 2019 11:52:16 +0000 (11:52 +0000)]
Add ZFS usage tips to freebsd-tips.

Add a bunch of examples on how to use ZFS features like:
- listing available space,
- setting and displaying a userquota,
- displaying pool I/O statistics and pool history,
- displaying the compression ratio for a dataset,
- various list options (sorting, removing headers),
- performing a dry-run of a snapshot delete,
- removing a range of snapshots,
- setting a custom property,
- preventing removal of a snapshot with ZFS holds,
- permission sets for zfs send/receive.

Additionally, clarify the existing examples a bit when
it comes to displaying space by mentioning UFS explicitly.
Other examples include displaying I/O in top(1), querying
sysctl(8) for active CPUs and available RAM. Mention systat(1)
and its options, too.
While here, reformat the example to upload a dmesg(8) a bit
to wrap properly.

Thanks to Allan Jude for his help with some of the ZFS examples.

Reviewed by: dru,allanjude
Approved by: allanjude (earlier version)
Relnotes: yes (ZFS examples in freebsd-tips)
Differential Revision: https://reviews.freebsd.org/D18541

5 years agoMFC r343249:
Andriy Voskoboinyk [Sat, 26 Jan 2019 13:17:19 +0000 (13:17 +0000)]
MFC r343249:
Fix duplicate wpa_supplicant(8) / hostapd(8) startup with devd(8)

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

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

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

This change does not affect device attach / removal events.

5 years agoMFC r343244:
Andriy Voskoboinyk [Sat, 26 Jan 2019 12:55:45 +0000 (12:55 +0000)]
MFC r343244:
devd.conf(5): add otus(4) into wifi-driver-regex

5 years agoMFC r343190:
Andriy Voskoboinyk [Sat, 26 Jan 2019 12:28:47 +0000 (12:28 +0000)]
MFC r343190:
net80211: drop m_pullup call from ieee80211_crypto_decap.

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

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

PR: 234241

5 years agoMFC r343363, r343364:
Mark Johnston [Fri, 25 Jan 2019 20:24:53 +0000 (20:24 +0000)]
MFC r343363, r343364:
Fix an LLE lookup race.

PR: 234296

5 years agoMFC r342557, r342559: Reimplement nvd(4) detach handling.
Alexander Motin [Fri, 25 Jan 2019 19:56:06 +0000 (19:56 +0000)]
MFC r342557, r342559: Reimplement nvd(4) detach handling.

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

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

5 years agoMFC r343047:
Stephen Hurd [Fri, 25 Jan 2019 18:30:12 +0000 (18:30 +0000)]
MFC r343047:

Fix window update issue when scaling disabled

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

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

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

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

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

5 years agoMFC r343089:
Michael Tuexen [Fri, 25 Jan 2019 15:46:30 +0000 (15:46 +0000)]
MFC r343089:

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

This issue was found by running syzkaller.

5 years agoMFC r342879:
Michael Tuexen [Fri, 25 Jan 2019 15:44:53 +0000 (15:44 +0000)]
MFC r342879:

Fix getsockopt() for IP_OPTIONS/IP_RETOPTS.

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

This issue was found by syzkaller.

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

5 years agoMFC r342857:
Michael Tuexen [Fri, 25 Jan 2019 15:39:33 +0000 (15:39 +0000)]
MFC r342857:

Avoid overfow in vtruncbuf()

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

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

5 years agoMFC r343145:
Konstantin Belousov [Fri, 25 Jan 2019 11:14:20 +0000 (11:14 +0000)]
MFC r343145:
MI VM: Make it possible to set size of superpage at boot instead of compile
time.

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

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

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

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

5 years agoMFC r343105: libedit: Avoid out of bounds read in 'bind' command
Jilles Tjoelker [Thu, 24 Jan 2019 22:34:30 +0000 (22:34 +0000)]
MFC r343105: libedit: Avoid out of bounds read in 'bind' command

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

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

PR: 233343

5 years agoMFC r339960 (cem): freebsd-update: add a progress report
Ed Maste [Thu, 24 Jan 2019 22:25:52 +0000 (22:25 +0000)]
MFC r339960 (cem): freebsd-update: add a progress report

for the "fetching files..."

After patching step is done.

PR: 232857
Submitted by: mat

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

Sponsored by: The FreeBSD Foundation

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

Sponsored by: Chelsio Communications

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

Sponsored by: Amazon, Inc.

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

admbugs: 765

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

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