]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r343479: Fix potential buffer overflow and undefined behavior.
Stefan Eßer [Sat, 9 Feb 2019 14:21:29 +0000 (14:21 +0000)]
MFC r343479: Fix potential buffer overflow and undefined behavior.

The buffer allocated in read_chat() could be 1 element too short, if the
chatstr parameter passed in is 1 or 3 charachters long (e.g. "a" or "a b").
The allocation of the pointer array does not account for the terminating
NULL pointer in that case.

Overlapping source and destination strings are undefined in strcpy().
Instead of moving a string to the left by one character just increment the
char pointer before it is assigned to the results array.

5 years agoMFC r343408: Silence Clang Scan warnings regarding unsafe use of strcp().
Stefan Eßer [Sat, 9 Feb 2019 14:19:09 +0000 (14:19 +0000)]
MFC r343408: Silence Clang Scan warnings regarding unsafe use of strcp().

While these warnings are false positives, the use of strdup() instead of
malloc() and strcpy() simplifies and clarifies the code.

A bogus assignment to a variable (whose previous value may be required in
a later block) has also been removed.

5 years agoMFC r343339: Silence Clang Scan warning about use of unitialized variable.
Stefan Eßer [Sat, 9 Feb 2019 14:13:49 +0000 (14:13 +0000)]
MFC r343339: Silence Clang Scan warning about use of unitialized variable.

The logic is changed to depend on actual "beep" parameters instead of on a
flag that may be set for invalid parameters.

An embedded literal escape character is replaced by "\e".

5 years agoMFC r343303: Silence a CI warning regarding the use of strcpy().
Stefan Eßer [Sat, 9 Feb 2019 14:07:04 +0000 (14:07 +0000)]
MFC r343303: Silence a CI warning regarding the use of strcpy().

While this is a false positive (a sufficiently large buffer has been
allocated in the line above), the use of strdup() simplifies and clarifies
the code.

5 years agoMFC r342592:
Dimitry Andric [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: r343753
Marius Strobl [Sat, 9 Feb 2019 11:51:59 +0000 (11:51 +0000)]
MFC: r343753

o As illustrated by e. g. figure 7-14 of the Intel 82599 10 GbE
  controller datasheet revision 3.3, in the context of Ethernet
  MACs the control data describing the packet buffers typically
  are named "descriptors". Each of these descriptors references
  one buffer, multiple of which a packet can be composed of.
  By contrast, in comments, messages and the names of structure
  members, iflib(4) refers to DMA resources employed for RX and
  TX buffers (rather than control data) as "desc(riptors)".
  This odd naming convention of iflib(4) made reviewing r343085
  and identifying wrong and missing bus_dmamap_sync(9) calls in
  particular way harder than it already is. This convention may
  also explain why the netmap(4) part of iflib(4) pairs the DMA
  tags for control data with DMA maps of buffers and vice versa
  in calls to bus_dma(9) functions.
  Therefore, change iflib(4) to refer to buf(fers) when buffers
  and not the usual understanding of descriptors is meant. This
  change does not include corrections to the DMA resources used
  in the netmap(4) parts. However, it revises error messages to
  state which kind of allocation/creation failed. Specifically,
  the "Unable to allocate tx_buffer (map) memory" copy & pasted
  inappropriately on several occasions was replaced with proper
  messages.
o Enhance some other error messages to indicate which half - RX
  or TX - they apply to instead of using identical text in both
  cases and generally canonicalize them.
o Correct the descriptions of iflib_{r,t}xsd_alloc() to reflect
  reality; current code doesn't use {r,t}x_buffer structures.
o In iflib_queues_alloc():
  - Remove redundant BUS_DMA_NOWAIT of iflib_dma_alloc() calls,
  - change the M_WAITOK from malloc(9) calls into M_NOWAIT. The
    return values are already checked, deferred DMA allocations
    not being an option at this point, BUS_DMA_NOWAIT has to be
    used anyway and prior malloc(9) calls in this function also
    specify M_NOWAIT.

Reviewed by: shurd
Differential Revision: https://reviews.freebsd.org/D19067

5 years agoMFC: r343288
Marius Strobl [Sat, 9 Feb 2019 11:49:07 +0000 (11:49 +0000)]
MFC: r343288

Fix various resource leaks that can occur in the error paths of
iflib_device_register() and iflib_pseudo_register().

Reviewed by: shurd
Differential Revision: https://reviews.freebsd.org/D18760

5 years agoMFC r342908:
Andrey V. Elsukov [Sat, 9 Feb 2019 11:05:03 +0000 (11:05 +0000)]
MFC r342908:
  Reduce the size of struct ip_fw_args from 240 to 128 bytes on amd64.
  And refactor the code to avoid unneeded initialization to reduce overhead
  of per-packet processing.

  ipfw(4) can be invoked by pfil(9) framework for each packet several times.
  Each call uses on-stack variable of type struct ip_fw_args to keep the
  state of ipfw(4) processing. Currently this variable has 240 bytes size
  on amd64.  Each time ipfw(4) does bzero() on it, and then it initializes
  some fields.

  glebius@ has reported that they at Netflix discovered, that initialization
  of this variable produces significant overhead on packet processing.
  After patching I managed to increase performance of packet processing on
  simple routing with ipfw(4) firewalling to about 11% from 9.8Mpps up to
  11Mpps (Xeon E5-2660 v4@ + Mellanox 100G card).

  Introduced new field flags, it is used to keep track of what fields was
  initialized. Some fields were moved into the anonymous union, to reduce
  the size. They all are mutually exclusive. dummypar field was unused, and
  therefore it is removed.  The hopstore6 field type was changed from
  sockaddr_in6 to a bit smaller struct ip_fw_nh6. And now the size of struct
  ip_fw_args is 128 bytes.

  ipfw_chk() was modified to properly handle ip_fw_args.flags instead of
  rely on checking for NULL pointers.

  Reviewed by: gallatin
  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D18690

MFC r342909:
  Fix the build with INVARIANTS.

MFC r343551:
  Fix the bug introduced in r342908, that causes problems with dynamic
  handling for protocols without ports numbers.

  Since port numbers were uninitialized for protocols like ICMP/ICMPv6,
  ipfw_chk() used some non-zero values to create dynamic states, and due
  this it failed to match replies with created states.

  Reported by: Oliver Hartmann, Boris Lytochkin

5 years agoMFC r343673: Fix integer math overflow in UMA hash_alloc().
Alexander Motin [Sat, 9 Feb 2019 02:09:29 +0000 (02:09 +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 r343626:
Mark Johnston [Fri, 8 Feb 2019 16:38:30 +0000 (16:38 +0000)]
MFC r343626:
Prevent some kobj memory allocation failures from panicking the system.

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

5 years agoMFC r343603:
Andriy Voskoboinyk [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:
Hans Petter Selasky [Fri, 8 Feb 2019 10:25:42 +0000 (10:25 +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:
Andriy Voskoboinyk [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 r343690:
Andriy Voskoboinyk [Fri, 8 Feb 2019 04:36:30 +0000 (04:36 +0000)]
MFC r343690:
ifconfig(8): interpret VHT rates correctly for 'list roam / txparam' options

They are represented via MCS rate index, not as a 'speed in MBps' * 2.

5 years agoMFC r343417:
Andriy Voskoboinyk [Fri, 8 Feb 2019 04:32:41 +0000 (04:32 +0000)]
MFC r343417:
net80211: reuse TICKS_2_MSEC / MSEC_2_TICKS macros from sys/time.h

Replace in-place implementation with system-wide one; since it
guarantees non-zero result drop all less-than-one checks from
drivers and net80211.

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

5 years agoMFC r343633:
Bryan Drewery [Thu, 7 Feb 2019 22:49:49 +0000 (22:49 +0000)]
MFC r343633:

  Shar files may be seen as binary by grep.

5 years agoMFC r343689
Vincenzo Maffione [Thu, 7 Feb 2019 10:44:03 +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: r343578 (partial)
Marius Strobl [Thu, 7 Feb 2019 10:30:11 +0000 (10:30 +0000)]
MFC: r343578 (partial)

- Stop iflib(4) from leaking MSI messages on detachment by calling
  bus_teardown_intr(9) before pci_release_msi(9).
- Ensure that iflib(4) and associated drivers pass correct RIDs to
  bus_release_resource(9) by obtaining the RIDs via rman_get_rid(9)
  on the corresponding resources instead of using the RIDs initially
  passed to bus_alloc_resource_any(9) as the latter function may
  change those RIDs. Solely em(4) for the ioport resource (but not
  others) and bnxt(4) were using the correct RIDs by caching the ones
  returned by bus_alloc_resource_any(9).
- Change the logic of iflib_msix_init() around to only map the MSI-X
  BAR if MSI-X is actually supported, i. e. pci_msix_count(9) returns
  > 0. Otherwise the "Unable to map MSIX table " message triggers for
  devices that simply don't support MSI-X and the user may think that
  something is wrong while in fact everything works as expected.
- Put some (mostly redundant) debug messages emitted by iflib(4)
  and em(4) during attachment under bootverbose. The non-verbose
  output of em(4) seen during attachment now is close to the one
  prior to the conversion to iflib(4).
- Replace various variants of spelling "MSI-X" (several in messages)
  with "MSI-X" as used in the PCI specifications.
- Remove some trailing whitespace from messages emitted by iflib(4)
  and change them to consistently start with uppercase.
- Remove some obsolete comments about releasing interrupts from
  drivers and correct a few others.

Reviewed by: erj, Jacob Keller, shurd
Differential Revision: https://reviews.freebsd.org/D18980

5 years agoMFC r343748:
Dimitry Andric [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:
Konstantin Belousov [Thu, 7 Feb 2019 01:54:34 +0000 (01:54 +0000)]
MFC r343757:
Update CPUID bits definitions and CPU identification based on changes
in SDM rev. 069.

5 years agoMFC r343629:
Konstantin Belousov [Thu, 7 Feb 2019 01:51:52 +0000 (01:51 +0000)]
MFC r343629:
nvdimm: only enumerate present nvdimm devices

5 years agoMFC r343628:
Konstantin Belousov [Thu, 7 Feb 2019 01:49:59 +0000 (01:49 +0000)]
MFC r343628:
nvdimm: enumerate NVDIMM SPA ranges from the root device

5 years agoMFC r343719:
Mark Johnston [Wed, 6 Feb 2019 18:43:30 +0000 (18:43 +0000)]
MFC r343719:
Fix a race in vm_page_dequeue_deferred().

5 years agoMFC r343584:
Hans Petter Selasky [Wed, 6 Feb 2019 18:02:43 +0000 (18:02 +0000)]
MFC r343584:
Export vendor specific USB MIDI device list to PnP info.

Sponsored by: Mellanox Technologies

5 years agoMFC r343549
Vincenzo Maffione [Wed, 6 Feb 2019 09:59:20 +0000 (09:59 +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
Vincenzo Maffione [Wed, 6 Feb 2019 09:23:39 +0000 (09:23 +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(), and update if_ptnet(4) to use those.
    - 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
Vincenzo Maffione [Wed, 6 Feb 2019 09:21:44 +0000 (09:21 +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
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D18876

5 years agoMFC r343682:
Andriy Voskoboinyk [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 r343577:
Andriy Voskoboinyk [Wed, 6 Feb 2019 02:30:14 +0000 (02:30 +0000)]
MFC r343577:
rsu(4): add support for ifconfig(8) 'maxretry' option

5 years agoMFC r343681:
Andriy Voskoboinyk [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:
Andriy Voskoboinyk [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:
Andriy Voskoboinyk [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:
Andriy Voskoboinyk [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:
Andriy Voskoboinyk [Wed, 6 Feb 2019 01:42:26 +0000 (01:42 +0000)]
MFC r343542:
upgt(4): unbreak build with UPGT_DEBUG

5 years agoMFC r343784:
Mark Johnston [Tue, 5 Feb 2019 17:56:22 +0000 (17:56 +0000)]
MFC r343784:
Avoid leaking fp references when truncating SCM_RIGHTS control messages.

Approved by: so
Security: CVE-2019-5596

5 years agoMFC r343780:
Konstantin Belousov [Tue, 5 Feb 2019 17:52:06 +0000 (17:52 +0000)]
MFC r343780:
amd64: clear callee-preserved registers on syscall exit.

Approved by: so
Security: CVE-2019-5595

5 years agoMFC r343532:
Benedict Reuschling [Tue, 5 Feb 2019 13:48:26 +0000 (13:48 +0000)]
MFC r343532:
A few corrections and clarifications to r343406.

- Use "in" instead of "on" when referring to directory and UFS partition.
- Switch from hw.physmem to hw.realmem and add a description to
distinguish the two.
- Explain why the "df" command is having trouble displaying ZFS sizes
correctly. Add a bit more descriptive text to help why the output of
"zfs list -o space" should be used.
- Switch to vmstat instead of iostat display for systat(1) as it shows
more information on one screen. Describe what is displayed based on the
text of the man page. Change the list of the other values accordingly.
- Sort the flags to "zfs destroy" alphabetically.

Reviewed by: rgrimes
Approved by: rgrimes
Differential Revision: https://reviews.freebsd.org/D18993

5 years agoMFC r342813: Remove unneeded headers.
Xin LI [Tue, 5 Feb 2019 08:05:42 +0000 (08:05 +0000)]
MFC r342813: Remove unneeded headers.

5 years agoMFC r343541:
Andriy Voskoboinyk [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 Schubert [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 r343587:
Brooks Davis [Mon, 4 Feb 2019 22:38:34 +0000 (22:38 +0000)]
MFC r343587:

Add a simple port filter to SIFTR.

SIFTR does not allow any kind of filtering, but captures every packet
processed by the TCP stack.
Often, only a specific session or service is of interest, and doing the
filtering in post-processing of the log adds to the overhead of SIFTR.

This adds a new sysctl net.inet.siftr.port_filter. When set to zero, all
packets get captured as previously. If set to any other value, only
packets where either the source or the destination ports match, are
captured in the log file.

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

5 years agoMFC r343516:
Oleksandr Tymoshenko [Mon, 4 Feb 2019 10:25:29 +0000 (10:25 +0000)]
MFC r343516:

Fix whiteout support in find(1)

find(1) ignores -type w passed to it. With this patch find(1) properly
identifies and prints whiteouts.

PR: 126384, 156703
Submitted by: oleg@mamontov.net

5 years agoMFC r343458:
Oleksandr Tymoshenko [Mon, 4 Feb 2019 10:24:57 +0000 (10:24 +0000)]
MFC r343458:

Fix format/arg mismatch

USe correct format for int arguments

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

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