]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMerge lldb trunk r351319, resolve conflicts, and update FREEBSD-Xlist.
dim [Sun, 20 Jan 2019 15:00:15 +0000 (15:00 +0000)]
Merge lldb trunk r351319, resolve conflicts, and update FREEBSD-Xlist.

5 years agoMerge lld trunk r351319, resolve conflicts, and update FREEBSD-Xlist.
dim [Sun, 20 Jan 2019 14:42:59 +0000 (14:42 +0000)]
Merge lld trunk r351319, resolve conflicts, and update FREEBSD-Xlist.

5 years agoMerge clang trunk r351319, resolve conflicts, and update FREEBSD-Xlist.
dim [Sun, 20 Jan 2019 14:02:54 +0000 (14:02 +0000)]
Merge clang trunk r351319, resolve conflicts, and update FREEBSD-Xlist.

5 years agoMerge llvm trunk r351319, resolve conflicts, and update FREEBSD-Xlist.
dim [Sun, 20 Jan 2019 11:41:25 +0000 (11:41 +0000)]
Merge llvm trunk r351319, resolve conflicts, and update FREEBSD-Xlist.

5 years agonet80211: drop m_pullup call from ieee80211_crypto_decap.
avos [Sat, 19 Jan 2019 16:04:26 +0000 (16:04 +0000)]
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
MFC after: 1 week

5 years agoVendor import of lldb trunk r351319 (just before the release_80 branch
dim [Sat, 19 Jan 2019 10:06:29 +0000 (10:06 +0000)]
Vendor import of lldb trunk r351319 (just before the release_80 branch
point):
https://llvm.org/svn/llvm-project/lldb/trunk@351319

5 years agoVendor import of lld trunk r351319 (just before the release_80 branch
dim [Sat, 19 Jan 2019 10:05:49 +0000 (10:05 +0000)]
Vendor import of lld trunk r351319 (just before the release_80 branch
point):
https://llvm.org/svn/llvm-project/lld/trunk@351319

5 years agoVendor import of clang trunk r351319 (just before the release_80 branch
dim [Sat, 19 Jan 2019 10:04:05 +0000 (10:04 +0000)]
Vendor import of clang trunk r351319 (just before the release_80 branch
point):
https://llvm.org/svn/llvm-project/cfe/trunk@351319

5 years agoVendor import of llvm trunk r351319 (just before the release_80 branch
dim [Sat, 19 Jan 2019 10:01:25 +0000 (10:01 +0000)]
Vendor import of llvm trunk r351319 (just before the release_80 branch
point):
https://llvm.org/svn/llvm-project/llvm/trunk@351319

5 years ago[aic7xxx] Use correct product name 29320LPE instead of non-existent 39320LPE
gonzo [Sat, 19 Jan 2019 05:31:48 +0000 (05:31 +0000)]
[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
MFC after:  1 week

5 years agodpaa: fix 32-bit build
jhibbits [Sat, 19 Jan 2019 05:20:31 +0000 (05:20 +0000)]
dpaa: fix 32-bit build

Book-E powerpc uses 64-bit vm_paddr_t, and 32-bit powerpc has 32-bit pointers,
so gcc errors with cast to pointer from integer of different size.  As this will
not actually be used in reality anyway, simply quiet the warning by casting
through uintptr_t.

MFC after: 3 weeks
MFC with: r343168

5 years agopowerpc/dpaa: Handle DMAP virtual addresses in DPAA
jhibbits [Sat, 19 Jan 2019 04:54:12 +0000 (04:54 +0000)]
powerpc/dpaa: Handle DMAP virtual addresses in DPAA

sendfile(2) appears to now use DMAP wherever possible.  These addresses are not
managed by pmap, so pmap_kextract() returns a 0 physical address, causing
failure.

This change fixes nginx running on P5020 SoC.

MFC after: 3 weeks

5 years agopowerpc: Fix opaque irq data initialization
jhibbits [Sat, 19 Jan 2019 04:47:19 +0000 (04:47 +0000)]
powerpc: Fix opaque irq data initialization

The powerpc_intr structure is not zero-initialized, so on an invariants
build would panic in the xics driver with an invalid pointer.  Also fix the
xics driver to share the private data setup code between xics_enable() and
xics_bind().

Reported by: Leonardo Bianconi

5 years agovmm(4): Mask Spectre feature bits on AMD hosts
cem [Fri, 18 Jan 2019 23:54:51 +0000 (23:54 +0000)]
vmm(4): Mask Spectre feature bits on AMD hosts

For parity with Intel hosts, which already mask out the CPUID feature
bits that indicate the presence of the SPEC_CTRL MSR, do the same on
AMD.

Eventually we may want to have a better support story for guests, but
for now, limit the damage of incorrectly indicating an MSR we do not yet
support.

Eventually, we may want a generic CPUID override system for
administrators, or for minimum supported feature set in heterogenous
environments with failover.  That is a much larger scope effort than
this bug fix.

PR: 235010
Reported by: Rys Sommefeldt <rys AT sommefeldt.com>
Sponsored by: Dell EMC Isilon

5 years agoFix top(1) long options handling
jhibbits [Fri, 18 Jan 2019 23:26:31 +0000 (23:26 +0000)]
Fix top(1) long options handling

getopt_long(3) requires the long options be terminated by a NULL block.
Without the terminator, an invalid long option results in a segmentation
fault.

Reported by: Brandon Bergren
MFC after: 1 week

5 years agoClarify error messages a bit.
marck [Fri, 18 Jan 2019 23:00:52 +0000 (23:00 +0000)]
Clarify error messages a bit.

X-Found-With: r343112
MFC after: 1 month

5 years agopsm(4): detect Lenovo top-button clickpads
wulf [Fri, 18 Jan 2019 22:20:29 +0000 (22:20 +0000)]
psm(4): detect Lenovo top-button clickpads

libinput has special handling for Lenovo ThinkPad *40 series, where it
treats clicks on the top button area as if they came from the TrackPoint:
https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html

Detect these devices and set the corresponding evdev property.

Submitted by: Greg V <greg@unrelenting.technology>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18676

5 years agoMake SIFTR work again after r342125 (D18443).
brooks [Fri, 18 Jan 2019 21:46:38 +0000 (21:46 +0000)]
Make SIFTR work again after r342125 (D18443).

Correct a logic error.

Only disable when already enabled or enable when disabled.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Obtained from: Cheng Cui
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18885

5 years agoUse a private definition of osockaddr rather then relying on type
brooks [Fri, 18 Jan 2019 21:30:06 +0000 (21:30 +0000)]
Use a private definition of osockaddr rather then relying on type
namespace polution in sys/socket.h.

Also remove support for operation on 4.3BSD.

PR: 224529
Differential Revision: https://reviews.freebsd.org/D14505

5 years ago[usb] Add HID_IGNORE quirks for multiple UPS devices
gonzo [Fri, 18 Jan 2019 21:00:54 +0000 (21:00 +0000)]
[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>
MFC after: 1 week

5 years agoRemove leading slash from OLD_DIRS assignment in ObsoleteFiles.inc. The
dim [Fri, 18 Jan 2019 20:35:24 +0000 (20:35 +0000)]
Remove leading slash from OLD_DIRS assignment in ObsoleteFiles.inc.  The
"make delete-old" mechanism will already take care of such prefixes, and
this prevents a double leading slash from being displayed.

5 years agofreebsd-update.8: mandoc -Tlint fixes
emaste [Fri, 18 Jan 2019 18:22:47 +0000 (18:22 +0000)]
freebsd-update.8: mandoc -Tlint fixes

PR: 185389
Reported by: bcr
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agofreebsd-update: Use BASEDIR when checking for src component
emaste [Fri, 18 Jan 2019 17:41:45 +0000 (17:41 +0000)]
freebsd-update: Use BASEDIR when checking for src component

src could potentially be installed under the based dir
and not under the root or vice versa.

PR: 224048
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18849

5 years agoi386/PAE busdma: allow more bounce pages.
kib [Fri, 18 Jan 2019 13:43:11 +0000 (13:43 +0000)]
i386/PAE busdma: allow more bounce pages.

If i386 has more than 4G of memory, allow the same number of busdma
bounce pages as for amd64.  In fact, in this case bouncing sometimes
is much heavier than on amd64.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D18854

5 years agox86 busdma: fix mis-use of bus_addr_t where vm_paddr_t is assumed.
kib [Fri, 18 Jan 2019 13:38:56 +0000 (13:38 +0000)]
x86 busdma: fix mis-use of bus_addr_t where vm_paddr_t is assumed.

Right now bus_addr_t and vm_paddr_t are always aliased to the same
underlying integer type on x86, which makes the interchange hard to
detect.  Shortly, i386 kernel would use uint64_t for vm_paddr_t to
enable automatic use of PAE paging structures if hardware allows it,
while bus_addr_t would be extended to 64bit only when PAE option is
specified.

Fix all places that were identified as using bus_addr_t while page
address was assumed.  This was performed by testing the complete PAE
merging patch on machine with > 4G of RAM enabled.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D18854

5 years agoMI VM: Make it possible to set size of superpage at boot instead of compile time.
kib [Fri, 18 Jan 2019 13:35:06 +0000 (13:35 +0000)]
MI VM: Make it possible to set size of superpage at boot instead of compile time.

In order to allow single kernel to use PAE pagetables on i386 if
hardware supports it, and fall back to classic two-level paging
structures if not, superpage code should be able to adopt to either 2M
or 4M superpages size.  There I make MI VM structures large enough to
track the biggest possible superpage, by allowing architecture to
define VM_NFREEORDER_MAX and VM_LEVEL_0_ORDER_MAX constants.
Corresponding VM_NFREEORDER and VM_LEVEL_0_ORDER symbols can be
defined as runtime values and must be less than the _MAX constants.
If architecture does not define _MAXs, it is assumed that _MAX ==
normal constant.

Reviewed by: markj
Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18853

5 years agonvdimm: initialize SPA uuids statically.
kib [Fri, 18 Jan 2019 10:54:36 +0000 (10:54 +0000)]
nvdimm: initialize SPA uuids statically.

The SPA ids are published numbers, so it's safe (if not a bit
annoying) to copy them into a source file.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18733

5 years agonvdimm: add a driver for the NVDIMM root device
kib [Fri, 18 Jan 2019 10:45:27 +0000 (10:45 +0000)]
nvdimm: add a driver for the NVDIMM root device

The NVDIMM root device is parent to the individual ACPI NVDIMM
devices.  Add a driver for the NVDIMM root device that can own
enumeration of NVDIMM devices as well as NVDIMM SPA ranges that the
system has.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18346

5 years agopf: fix pfsync breaking carp
kp [Fri, 18 Jan 2019 08:19:54 +0000 (08:19 +0000)]
pf: fix pfsync breaking carp

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

This regression was introduce by r342051.

PR: 235005
Submitted by: smh@FreeBSD.org
Pointy hat to: kp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18882

5 years ago[ata] Add workaround for KingDian S200 SSD crash on receiving TRIM command
gonzo [Fri, 18 Jan 2019 04:23:52 +0000 (04:23 +0000)]
[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>
MFC after: 1 week

5 years agoAdd ypldap to the list of conditional obsolete files
gonzo [Fri, 18 Jan 2019 00:39:17 +0000 (00:39 +0000)]
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>
MFC after: 1 week

5 years agoFix descriptor/memory leak in compress(1) code
gonzo [Fri, 18 Jan 2019 00:26:25 +0000 (00:26 +0000)]
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>
MFC after: 1 week

5 years agoioat(4): Set __result_use_check on ioat_acquire_reserve
cem [Thu, 17 Jan 2019 23:21:02 +0000 (23:21 +0000)]
ioat(4): Set __result_use_check on ioat_acquire_reserve

Even M_WAITOK callers must check for failure.  For example, if the device is
quiescing, either due to automatic error-recovery induced reset, or due to
administrative detach, the routine will return ENXIO and the acquire
reference will not be held.  So, there is no mode in which it is safe to
assume the routine succeeds without checking.

Sponsored by: Dell EMC Isilon

5 years agolibsa: add asprintf()
tsoome [Thu, 17 Jan 2019 22:00:02 +0000 (22:00 +0000)]
libsa: add asprintf()

asprintf() is a nice tool for string processing.

MFC after: 2 weeks

5 years agoloader should ignore active multi_vdev_crash_dump feature on zpool
tsoome [Thu, 17 Jan 2019 21:52:41 +0000 (21:52 +0000)]
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

MFC after: 2 weeks

5 years agofreebsd-update: Clarify unsupported release upgrade error message
emaste [Thu, 17 Jan 2019 21:38:57 +0000 (21:38 +0000)]
freebsd-update: Clarify unsupported release upgrade error message

Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: yuri
Reviewed by: bcran
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18803

5 years agoWorkaround for nscd(8) failure with large entries.
trasz [Thu, 17 Jan 2019 20:01:06 +0000 (20:01 +0000)]
Workaround for nscd(8) failure with large entries.

It fixes a case where eg a 2KB group entry would take several seconds
to complete with cache enabled in nsswitch.conf.

MFC after: 2 weeks
Sponsored by: Chalmers University of Technology
Differential Revision: https://reviews.freebsd.org/D18392

5 years agoAdd definitions for AMD Spectre/Meltdown CPUID information
cem [Thu, 17 Jan 2019 19:44:47 +0000 (19:44 +0000)]
Add definitions for AMD Spectre/Meltdown CPUID information

No functional change, aside from printing recognized bits in CPU
identification.

The bits are documented in 111006-B "Indirect Branch Control Extension"[1] and
124441 "Speculative Store Bypass Disable."[2]

Notably missing (left as future work):
  * Integration with hw.spec_store_bypass_disable and hw_ssb_active flag,
    which are currently Intel-specific
  * Integration with hw_ibrs_active global flag, which are currently
    Intel-specific
  * SSB_NO integration in hw_ssb_recalculate()
  * Bhyve integration (PR 235010)

[1]:
https://developer.amd.com/wp-content/resources/111006-B_AMD64TechnologyIndirectBranchControlExtenstion_WP_7-18Update_FNL.pdf

[2]:
https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf

PR: 235010 (related, but does not fix)
MFC after: a week

5 years agoRevert r343095
kevans [Thu, 17 Jan 2019 18:51:56 +0000 (18:51 +0000)]
Revert r343095

This was intended to fix the soft reset timeout on boot for OrangePi One/R1
with internal PHY, but seems to cause other problems later on due to soft
resetting around some state changes that may or may not make the NIC
non-functional.

Reverting this for now while a better solution is sought out.

5 years agoRe-add new small tool trim(8) to delete contents for blocks
eugen [Thu, 17 Jan 2019 18:07:59 +0000 (18:07 +0000)]
Re-add new small tool trim(8) to delete contents for blocks
on devices using wear-leveling algorithms as a few weeks passed
after review and discussion of trim(8) ceased and
we still have no utility to perform the job.

Reviewed by: hackers@
MFC after: 2 weeks

5 years agoFix handling of rights on stdio streams.
markj [Thu, 17 Jan 2019 17:36:18 +0000 (17:36 +0000)]
Fix handling of rights on stdio streams.

- Limit rights on stdio before opening input files.  Otherwise, open()
  may return one of the standard descriptors and we end up limiting
  rights such that we cannot read from one of the input files.
- Use caph_limit_stdio(), which suppresses EBADF, to ensure that
  we don't emit an error if one of the stdio streams is closed.
- Don't bother further limiting rights on stdin when stdin isn't going
  to be used.  Doing so correctly requires checking for a number of
  edge cases, and it doesn't provide any significant benefit.

PR: 234885
Reviewed by: oshogbo
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18860

5 years agoRevert r343093 until I can address the issues raised by kib@.
des [Thu, 17 Jan 2019 16:50:50 +0000 (16:50 +0000)]
Revert r343093 until I can address the issues raised by kib@.

5 years agoTruely fix #if defined broken in -r343111
mckusick [Thu, 17 Jan 2019 16:26:59 +0000 (16:26 +0000)]
Truely fix #if defined broken in -r343111

Pointy-hat-to: mckusick
5 years agoProper definition of elast3.
mckusick [Thu, 17 Jan 2019 15:42:10 +0000 (15:42 +0000)]
Proper definition of elast3.

Reported by: Oliver Pinter <oliver.pinter@hardenedbsd.org>

5 years agoFix #if defined broken in -r343111
mckusick [Thu, 17 Jan 2019 15:35:04 +0000 (15:35 +0000)]
Fix #if defined broken in -r343111

Pointy-hat-to: mckusick
5 years agojail(8): stop crashing with SIGSEGV inside run_command() function
eugen [Thu, 17 Jan 2019 14:09:55 +0000 (14:09 +0000)]
jail(8): stop crashing with SIGSEGV inside run_command() function
while processing not entirely correct jail.conf(5) file
having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
so extrap variable stays NULL.

Reported by: marck
MFC after: 1 month

5 years agoCreate new EINTEGRITY error with message "Integrity check failed".
mckusick [Thu, 17 Jan 2019 06:35:45 +0000 (06:35 +0000)]
Create new EINTEGRITY error with message "Integrity check failed".

An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Reviewed by:    gnn, dim, brueffer, imp
Discussed with: kib, cem, emaste, ed, jilles
Differential Revision: https://reviews.freebsd.org/D18765

5 years agoFix conditional obsolete files entry for WITHOUT_EXAMPLES
gonzo [Thu, 17 Jan 2019 06:34:39 +0000 (06:34 +0000)]
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)
MFC after: 1 week

5 years agoAdd optional obsolete files for the installworld without sendmail
gonzo [Thu, 17 Jan 2019 06:22:14 +0000 (06:22 +0000)]
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>
MFC after: 1 week

5 years agoTrim whitespace at EoL, use tabs instead of spaces for indent.
kib [Thu, 17 Jan 2019 05:15:25 +0000 (05:15 +0000)]
Trim whitespace at EoL, use tabs instead of spaces for indent.

PR:  235004
Submitted by: Jose Luis Duran <jlduran@gmail.com>
MFC after: 3 days

5 years agoRe-wrap long line after r341827.
kib [Thu, 17 Jan 2019 04:51:05 +0000 (04:51 +0000)]
Re-wrap long line after r341827.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years ago[usb] Add quirk for SmartG2 USB memory key
gonzo [Wed, 16 Jan 2019 22:29:34 +0000 (22:29 +0000)]
[usb] Add quirk for SmartG2 USB memory key

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

5 years agolibedit: Avoid out of bounds read in 'bind' command
jilles [Wed, 16 Jan 2019 21:59:18 +0000 (21:59 +0000)]
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
Submitted by: Yuichiro NAITO
Obtained from: NetBSD
MFC after: 1 week

5 years ago[mv] Fix invalid condition in fdt_fixup_ranges
gonzo [Wed, 16 Jan 2019 21:13:50 +0000 (21:13 +0000)]
[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>
MFC after: 1 week

5 years agoRemove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
cy [Wed, 16 Jan 2019 20:46:39 +0000 (20:46 +0000)]
Remove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
no longer needed.

MFC after: 1 week

5 years agoFix mistake in r343030: move nswbuf calculation back to
glebius [Wed, 16 Jan 2019 20:20:38 +0000 (20:20 +0000)]
Fix mistake in r343030: move nswbuf calculation back to
kern_vfs_bio_buffer_alloc(), because in init_param2() nbuf
isn't really initialized yet.

Pointed out by: bde

5 years agoDo not reserve KVA for paging bufs in vm_ksubmap_init(), since now
glebius [Wed, 16 Jan 2019 20:14:16 +0000 (20:14 +0000)]
Do not reserve KVA for paging bufs in vm_ksubmap_init(), since now
they allocate it in pbuf_init(). This should have been done together
with r343030.

5 years agoawg: Move MAC soft reset to awg_init_locked to avoid soft reset timeout
kevans [Wed, 16 Jan 2019 14:42:33 +0000 (14:42 +0000)]
awg: Move MAC soft reset to awg_init_locked to avoid soft reset timeout

From NetBSD: Since the MAC can get stuck in reset state with no link, ignore
reset timeouts and continue with initializing the device.

Fixes "soft reset timeout" issue at boot with no network cable plugged in.

awg_init may be called multiple times throughout normal interface usage, so
the tx/rx descriptor base address registers must be written after each MAC
reset and are moved as such.

This problem has been observed on FreeBSD, H3/H2+ devices with an internal
PHY (includes OrangePi R1, OrangePi One at least).

Reviewed by: manu, ganbold
Obtained from: NetBSD
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18844

5 years agoiwn(4): (partially) rewrite A-MPDU Tx path
avos [Wed, 16 Jan 2019 12:33:06 +0000 (12:33 +0000)]
iwn(4): (partially) rewrite A-MPDU Tx path

Generic Tx stats fixes:
- do not try to parse "aggregation status" for single frames; send them
to iwn_tx_done() instead;
- try to attach mbuf / node reference pair to reported BA events;
allows to fix reported status for ieee80211_tx_complete() and ifnet counters
(previously all A-MPDU frames were counted as failed - see PR 210211);
requires few more firmware bug workarounds;
- preserve short / long retry counters for wlan_amrr(4)
(disabled for now - causes significant performance degradation).
- Add new IWN_DEBUG_AMPDU debug category.
- Add one more check into iwn_tx_data() to prevent aggregation ring
overflow.
- Workaround 'seqno % 256' != 'current Tx slot' case (until D9195 is not
in the tree).
- Improve watchdog timer updates (previously watchdog check was omitted
when at least one frame was transmitted).
- Stop Tx when memory leak in currently used ring was detected (unlikely
to happen).
- Few other minor fixes.

Was previously tested with:
 - Intel 6205, STA mode (Tx aggregation behaves much better now).
 - Intel 4965AGN, STA mode (still unstable).

PR: 192641, 210211
Reviewed by: adrian, dhw
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10728

5 years agoImplement dlopenat(3).
des [Wed, 16 Jan 2019 12:12:40 +0000 (12:12 +0000)]
Implement dlopenat(3).

MFC after: 3 weeks

5 years agortwn(4): clear 'basic' rate bit before calculating RTS/CTS rate.
avos [Wed, 16 Jan 2019 12:11:29 +0000 (12:11 +0000)]
rtwn(4): clear 'basic' rate bit before calculating RTS/CTS rate.

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

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

Tested with RTL8821AU, HOSTAP mode.

MFC after: 5 days

5 years agoLimit the user-controllable amount of memory the kernel allocates
tuexen [Wed, 16 Jan 2019 11:33:47 +0000 (11:33 +0000)]
Limit the user-controllable amount of memory the kernel allocates
via IPPROTO_SCTP level socket options.

This issue was found by running syzkaller.

MFC after: 1 week

5 years agortwn_usb(4): add new USB id for RTL8821AU
avos [Wed, 16 Jan 2019 10:33:51 +0000 (10:33 +0000)]
rtwn_usb(4): add new USB id for RTL8821AU

Reported by: Mike Tancsa <mike@sentex.net>
Tested by: Mike Tancsa <mike@sentex.net>
MFC after: 3 days

5 years agoStyle(9) fixes for x86/busdma_bounce.c.
kib [Wed, 16 Jan 2019 06:10:55 +0000 (06:10 +0000)]
Style(9) fixes for x86/busdma_bounce.c.

Remove extra parentheses.  Adjust indents and lines fill.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoRemove unused prototype.
kib [Wed, 16 Jan 2019 05:51:03 +0000 (05:51 +0000)]
Remove unused prototype.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoImprove iflib busdma(9) KPI use.
kib [Wed, 16 Jan 2019 05:44:14 +0000 (05:44 +0000)]
Improve iflib busdma(9) KPI use.

- Specify BUS_DMA_NOWAIT for bus_dmamap_load() on rx refill, since
  callbacks are not supposed to be used.
- Match tso/non-tso tags to corresponding tx map operations.  Create
  separate tso maps for tx descriptors.  In particular, do not use
  non-tso tag to load, unload, or destroy a map created with tso tag.
- Add missed bus_dmamap_sync() calls.
  Submitted by: marius.

Reported and tested by: pho
Reviewed by: marius
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoImplement shmat(2) flag SHM_REMAP.
kib [Wed, 16 Jan 2019 05:15:57 +0000 (05:15 +0000)]
Implement shmat(2) flag SHM_REMAP.

Based on the description in Linux man page.

Reviewed by: markj, ngie (previous version)
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18837

5 years agoTrim spaces at the end of lines.
kib [Wed, 16 Jan 2019 05:09:29 +0000 (05:09 +0000)]
Trim spaces at the end of lines.

Reviewed by: markj, ngie
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18837

5 years agoWhitespace.
glebius [Wed, 16 Jan 2019 04:02:08 +0000 (04:02 +0000)]
Whitespace.

5 years agopowerpc: Fix FPU fsqrt emulation special case results
jhibbits [Wed, 16 Jan 2019 03:52:43 +0000 (03:52 +0000)]
powerpc: Fix FPU fsqrt emulation special case results

If fsqrts is emulated with +INF as its argument, the 0 return value causes a
NULL pointer dereference, panicking the system.  Follow the PowerISA and
return +INF with no FP exception.

MFC after: 1 week

5 years agoFix broken uart on Win2016 guest.
araujo [Wed, 16 Jan 2019 03:46:27 +0000 (03:46 +0000)]
Fix broken uart on Win2016 guest.

Obtained from: Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4)
MFC after: 3 weeks.

5 years agovmm(4): Take steps towards multicore bhyve AMD support
cem [Wed, 16 Jan 2019 02:19:04 +0000 (02:19 +0000)]
vmm(4): Take steps towards multicore bhyve AMD support

vmm's CPUID emulation presented Intel topology information to the guest, but
disabled AMD topology information and in some cases passed through garbage.
I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but
guest CPUs can migrate between host threads, so the information presented
was not consistent.  This could easily be observed with 'cpucontrol -i 0xfoo
/dev/cpuctl0'.

Slightly improve this situation by enabling the AMD topology feature flag
and presenting at least the CPUID fields used by FreeBSD itself to probe
topology on more modern AMD64 hardware (Family 15h+).  Older stuff is
probably less interesting.  I have not been able to empirically confirm it
is sufficient, but it should not regress anything either.

Reviewed by: araujo (previous version)
Relnotes: sure

5 years agoSuppress excessive error prints in ENA TX hotpath
mw [Wed, 16 Jan 2019 02:13:21 +0000 (02:13 +0000)]
Suppress excessive error prints in ENA TX hotpath

In FreeBSD, this is normal situation that the Tx ring is being full. In
hat case, the packet is put back into drbr and the next attempt to send
it is taken after the cleanup.

Too much logs like this can cause system instability and even cause the
device reset (because keep alive or cleanup could be missed).

To fix that, the log level of this message is changed to debug.

Upon this change upgrade the driver version to v0.8.2.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

5 years agoRemove an IRIX-only source file.
cy [Wed, 16 Jan 2019 02:05:42 +0000 (02:05 +0000)]
Remove an IRIX-only source file.

MFC after: 1 week

5 years ago[rpi] Reorganize spigen(4) overlays for Raspberry Pi
gonzo [Wed, 16 Jan 2019 01:08:34 +0000 (01:08 +0000)]
[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
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16088

5 years agoUse capsicum_helpers(3) that allow us to simplify the code and its functions
araujo [Wed, 16 Jan 2019 00:39:23 +0000 (00:39 +0000)]
Use capsicum_helpers(3) that allow us to simplify the code and its functions
will return success when the kernel is built without support of
the capability mode.

It is important to note, that I'm taking a more conservative approach
with these changes and it will be done in small steps.

Reviewed by: jhb
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D18744

5 years agoFix STAGE_DIR.* to handle indirect *DIR variables.
sjg [Tue, 15 Jan 2019 23:37:49 +0000 (23:37 +0000)]
Fix STAGE_DIR.* to handle indirect *DIR variables.

bsd.{files,conf}.mk recently changed to allow *DIR to name a variable
rather than a path.
STAGE_DIR.* need to adapt.

Reviewed by: bdrewery
Differential Revision: D18847

5 years agoUse .undef per variable
sjg [Tue, 15 Jan 2019 23:35:53 +0000 (23:35 +0000)]
Use .undef per variable

Attempting to expand a variable to a list of vars to .undef
does not actually work.

Reviewed by: bdrewery
Differential Revision: D17251

5 years agoWith the sync from Dragonfly BSD in r318216 a bug slipped in (also still present
bz [Tue, 15 Jan 2019 22:31:54 +0000 (22:31 +0000)]
With the sync from Dragonfly BSD in r318216 a bug slipped in (also still present
upstream it seems).

The tlv variable was changed to a pointer but the advancement of the data pointer
was left as sizeof(tlv).  While the sizeof the (now) pointer equals the
sizeof 2 x uint32_t (size of the struct) on 64bit platforms, on 32bit platforms
the size of the advancement of the data pointer was wrong leading to
firmware load issues.

Correctly advance the data pointer by the size of the structure and not by
the size of a pointer.

PR: 219683
Submitted by: waddlesplash gamil.com (Haiku) on irc
MFC after: 1 week

5 years ago[drm] Fix off-by-one error when accessing driver-specific ioctl handlers array
gonzo [Tue, 15 Jan 2019 21:06:58 +0000 (21:06 +0000)]
[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
MFC after: 1 week

5 years agoFix compilation failures on different arches that have vm_machdep.c not
glebius [Tue, 15 Jan 2019 19:33:47 +0000 (19:33 +0000)]
Fix compilation failures on different arches that have vm_machdep.c not
aware of counter_u64_t by including counter.h into uma_int.h. I'm not
happy about this inclusion, but it fixes compilation ASAP.

5 years agoReject new sessions if the necessary queues aren't initialized.
jhb [Tue, 15 Jan 2019 18:53:45 +0000 (18:53 +0000)]
Reject new sessions if the necessary queues aren't initialized.

ccr reuses the control queue and first rx queue from the first port on
each adapter.  The driver cannot send requests until those queues are
initialized.  Refuse to create sessions for now if the queues aren't
ready.  This is a workaround until cxgbe allocates one or more
dedicated queues for ccr.

PR: 233851
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D18478

5 years agostyle(9): break long line.
glebius [Tue, 15 Jan 2019 18:50:11 +0000 (18:50 +0000)]
style(9): break long line.

5 years agoRemove harmless leftover from code that cycles over zone's kegs. Just use +
glebius [Tue, 15 Jan 2019 18:49:31 +0000 (18:49 +0000)]
Remove harmless leftover from code that cycles over zone's kegs. Just use +
instead of +=. There is no functional change.

5 years agoThis was missed in r343051: make uz_allocs, uz_frees and uz_fails counter(9).
glebius [Tue, 15 Jan 2019 18:47:19 +0000 (18:47 +0000)]
This was missed in r343051: make uz_allocs, uz_frees and uz_fails counter(9).

5 years agoOnly do uz_items accounting for zones that have a limit set in uz_max_items.
glebius [Tue, 15 Jan 2019 18:32:26 +0000 (18:32 +0000)]
Only do uz_items accounting for zones that have a limit set in uz_max_items.
This reduces amount of locking required for these zones.

Also, for cache only zones (UMA_ZFLAG_CACHE) accounting uz_items wasn't
correct at all, since they may allocate items directly from their backing
store and then free them via UMA underflowing uz_items.

Tested by: pho

5 years agoMake uz_allocs, uz_frees and uz_fails counter(9). This removes some
glebius [Tue, 15 Jan 2019 18:24:34 +0000 (18:24 +0000)]
Make uz_allocs, uz_frees and uz_fails counter(9). This removes some
atomic updates and reduces amount of data protected by zone lock.

During startup point these fields to EARLY_COUNTER. After startup
allocate them for all early zones.

Tested by: pho

5 years agoUpdate the note about the need for COMPAT_FREEBSD<n> kernel options.
jhb [Tue, 15 Jan 2019 18:20:20 +0000 (18:20 +0000)]
Update the note about the need for COMPAT_FREEBSD<n> kernel options.

Rather than mentioning the requirement for 4.x binaries but not
explaining why (it was assuming an upgrade from 4.x to 5.0-current),
explain when compat options are needed (for running existing host
binaries) in a more general way while using a more modern example
(COMPAT_FREEBSD11 for 11.x binaries).  While here, explicitly mention
that a GENERIC kernel should always work.

Reported by: Robert Huff <roberthuff@rcn.com>
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18740

5 years agoFix window update issue when scaling disabled
shurd [Tue, 15 Jan 2019 17:40:19 +0000 (17:40 +0000)]
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.

MFC after: 1 week
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D18821

5 years agoscp: disallow empty or current directory
emaste [Tue, 15 Jan 2019 15:35:14 +0000 (15:35 +0000)]
scp: disallow empty or current directory

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

5 years agoEnsure the I-Cache is correctly handled in arm64_icache_sync_range
andrew [Tue, 15 Jan 2019 09:48:18 +0000 (09:48 +0000)]
Ensure the I-Cache is correctly handled in arm64_icache_sync_range

The cache_handle_range macro to handle the arm64 instruction and data
cache operations would return when it was complete. This causes problems
for arm64_icache_sync_range and arm64_icache_sync_range_checked as they
assume they can execute the i-cache handling instruction after it has been
called.

Fix this by making this assumption correct.

While here add missing instruction barriers and adjust the style to
match the rest of the assembly.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18838

5 years agopf: silence a runtime warning
kp [Tue, 15 Jan 2019 08:59:51 +0000 (08:59 +0000)]
pf: silence a runtime warning

Sometimes, for negated tables, pf can log 'pfr_update_stats: assertion failed'.
This warning does not clarify anything for users, so silence it, just as
OpenBSD has.

PR: 234874
MFC after: 1 week

5 years agoUse TD_IS_IDLETHREAD instead of unrolled version.
delphij [Tue, 15 Jan 2019 06:44:37 +0000 (06:44 +0000)]
Use TD_IS_IDLETHREAD instead of unrolled version.

MFC after: 2 weeks

5 years agoFix compilation on 32-bit.
glebius [Tue, 15 Jan 2019 03:43:46 +0000 (03:43 +0000)]
Fix compilation on 32-bit.

5 years agoRemove pbuf(9) manual page that is now nearly 100% outdated.
glebius [Tue, 15 Jan 2019 01:19:29 +0000 (01:19 +0000)]
Remove pbuf(9) manual page that is now nearly 100% outdated.

5 years agoAllocate pager bufs from UMA instead of 80-ish mutex protected linked list.
glebius [Tue, 15 Jan 2019 01:02:16 +0000 (01:02 +0000)]
Allocate pager bufs from UMA instead of 80-ish mutex protected linked list.

o In vm_pager_bufferinit() create pbuf_zone and start accounting on how many
  pbufs are we going to have set.
  In various subsystems that are going to utilize pbufs create private zones
  via call to pbuf_zsecond_create(). The latter calls uma_zsecond_create(),
  and sets a limit on created zone. After startup preallocate pbufs according
  to requirements of all pbuf zones.

  Subsystems that used to have a private limit with old allocator now have
  private pbuf zones: md(4), fusefs, NFS client, smbfs, VFS cluster, FFS,
  swap, vnode pager.

  The following subsystems use shared pbuf zone: cam(4), nvme(4), physio(9),
  aio(4). They should have their private limits, but changing that is out of
  scope of this commit.

o Fetch tunable value of kern.nswbuf from init_param2() and while here move
  NSWBUF_MIN to opt_param.h and eliminate opt_swap.h, that was holding only
  this option.
  Default values aren't touched by this commit, but they probably should be
  reviewed wrt to modern hardware.

This change removes a tight bottleneck from sendfile(2) operation, that
uses pbufs in vnode pager. Other pagers also would benefit from faster
allocation.

Together with: gallatin
Tested by: pho

5 years ago[led] propagate error from set_led() to the caller
gonzo [Tue, 15 Jan 2019 00:52:41 +0000 (00:52 +0000)]
[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>
MFC after: 1 week

5 years ago[mv_pci] Increase default PCI space size for mv_pci
gonzo [Tue, 15 Jan 2019 00:37:37 +0000 (00:37 +0000)]
[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.

MFC after: 1 week

5 years agoAdd flag LK_NEW for lockinit() that is converted to LO_NEW and passed
glebius [Tue, 15 Jan 2019 00:35:19 +0000 (00:35 +0000)]
Add flag LK_NEW for lockinit() that is converted to LO_NEW and passed
down to lock_init().  This allows for lockinit() on a not prezeroed
memory.

5 years agoo Move zone limit from keg level up to zone level. This means that now
glebius [Tue, 15 Jan 2019 00:02:06 +0000 (00:02 +0000)]
o Move zone limit from keg level up to zone level. This means that now
  two zones sharing a keg may have different limits. Now this is going
  to work:

  zone = uma_zcreate();
  uma_zone_set_max(zone, limit);
  zone2 = uma_zsecond_create(zone);
  uma_zone_set_max(zone2, limit2);

  Kegs no longer have uk_maxpages field, but zones have uz_items. When
  set, it may be rounded up to minimum possible CPU bucket cache size.
  For small limits bucket cache can also be reconfigured to be smaller.
  Counter uz_items is updated whenever items transition from keg to a
  bucket cache or directly to a consumer. If zone has uz_maxitems set and
  it is reached, then we are going to sleep.

o Since new limits don't play well with multi-keg zones, remove them. The
  idea of multi-keg zones was introduced exactly 10 years ago, and never
  have had a practical usage. In discussion with Jeff we came to a wild
  agreement that if we ever want to reintroduce the idea of a smart allocator
  that would be able to choose between two (or more) totally different
  backing stores, that choice should be made one level higher than UMA,
  e.g. in malloc(9) or in mget(), or whatever and choice should be controlled
  by the caller.

o Sleeping code is improved to account number of sleepers and wake them one
  by one, to avoid thundering herd problem.

o Flag UMA_ZONE_NOBUCKETCACHE removed, instead uma_zone_set_maxcache()
  KPI added. Having no bucket cache basically means setting maxcache to 0.

o Now with many fields added and many removed (no multi-keg zones!) make
  sure that struct uma_zone is perfectly aligned.

Reviewed by: markj, jeff
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D17773