bdrewery [Fri, 23 Jun 2017 20:49:23 +0000 (20:49 +0000)]
MFC r320206,r320207:
r320206:
Follow-up r308602: Don't add missing headers to .depend.tables.h.
r320207:
Tweak r320206: Still create the TABLE but not the .depend entry for missing
headers.
bdrewery [Fri, 23 Jun 2017 20:07:56 +0000 (20:07 +0000)]
MFC r319862,r319996,r320030:
r319862:
META_MODE: Show .ERROR_CMD in error.
r319996:
WITH_META_MODE: Don't try showing command if .ERROR_META_FILE is empty.
r320030:
WITH_META_MODE: End each ERROR_CMD CMD line with ';'.
bdrewery [Fri, 23 Jun 2017 19:44:20 +0000 (19:44 +0000)]
MFC r320012,r320028,r320061,r320118:
r320012:
Fix LIBAMU location to fix 'stale .depend' rebuilds in usr.sbin/amd.
r320028:
Fix more incorrect library directories fix 'stale .depend' rebuilds.
r320061:
Fix Makefiles which override LIBDIR to not add incorrect dependencies into
.depend.
r320118:
Follow-up r320061: Need to respect make.conf/env LIBDIR overrides.
cperciva [Thu, 22 Jun 2017 05:30:27 +0000 (05:30 +0000)]
MFC r319491:
Skip setting the MTU in the netfront driver (xn# devices) if the new MTU
is the same as the old MTU. In particular, on Amazon EC2 "T2" instances
without this change, the network interface is reinitialized every 30
minutes due to the MTU being (re)set when a new DHCP lease is obtained.
cperciva [Thu, 22 Jun 2017 05:26:08 +0000 (05:26 +0000)]
MFC r31956[12]: Teach primes(6) to enumerate primes up to 2^64 - 1.
Approved by: re (delphij)
Relnotes: primes(6) now enumerates primes beyond 3825123056546413050,
up to a new limit of 2^64 - 1.
> Description of fields to fill in above: 76 columns --|
> PR: If and which Problem Report is related.
> Submitted by: If someone else sent in the change.
> Reported by: If someone else reported the issue.
> Reviewed by: If someone else reviewed your modification.
> Approved by: If you needed approval for this commit.
> Obtained from: If the change is from a third party.
> MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email.
> MFH: Ports tree branch name. Request approval for merge.
> Relnotes: Set to 'yes' for mention in release notes.
> Security: Vulnerability reference (one per line) or description.
> Sponsored by: If the change was sponsored by an organization.
> Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed).
> Empty fields above will be automatically removed.
_M .
M usr.bin/factor/factor.6
M usr.bin/primes/primes.c
M usr.bin/primes/primes.h
M usr.bin/primes/spsp.c
jhb [Wed, 21 Jun 2017 14:36:25 +0000 (14:36 +0000)]
MFC 319702: Fix an off-by-one error in the VM page array on some systems.
r313186 changed how the size of the VM page array was calculated to be
less wasteful. For most systems, the amount of memory is divided by
the overhead required by each page (a page of data plus a struct vm_page)
to determine the maximum number of available pages. However, if the
remainder for the first non-available page was at least a page of data
(so that the only memory missing was a struct vm_page), this last page
was left in phys_avail[] but was not allocated an entry in the VM page
array. Handle this case by explicitly excluding the page from
phys_avail[].
brooks [Tue, 20 Jun 2017 20:19:57 +0000 (20:19 +0000)]
MFC r318968:
Add missing usage and getopt(3) options
- Add the missing option 'n' to the getopt(3) string
- Add the missing options 'libxo' and 'N' to the usage message
- Add the missing options 'M' and 'N' to the man-page
davidcs [Tue, 20 Jun 2017 19:16:06 +0000 (19:16 +0000)]
MFC r319964
Upgrade STORMFW to 8.30.0.0 and ecore version to 8.30.0.0
Add support for pci deviceID 0x8070 for QLE41xxx product line which
supports 10GbE/25GbE/40GbE
jhb [Tue, 20 Jun 2017 15:55:15 +0000 (15:55 +0000)]
MFC 319490: Remove stale cap_rights_get(2) manpage.
The documentation moved to section 3 several years ago, but
'man cap_rights_get' pulls up cap_rights_limit(2) (which is
MLINKed to cap_rights_get.2) instead of cap_rights_get(3).
sbruno [Mon, 19 Jun 2017 15:03:47 +0000 (15:03 +0000)]
Direct commit to stable/11 to correctly setting the EIAC and IMS
registers to the same values when processing interrupts. This reverts a
change made in r286831 that was not fully reverted in r311979
This resolves PR https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211219
avg [Mon, 19 Jun 2017 14:45:20 +0000 (14:45 +0000)]
MFC r318867: fix vmxnet3 crash when LRO is enabled
The crash can occur when all of the following conditions are true:
- a packet consists of multiple segments (requires LRO enabled)
- there has been a failure to allocate an mbuf for the packet and
the packet has to be dropped
- a host (vmware) still owned at least one segment of the packet,
so the driver had to wait for another interrupt to proceed to
discarding the remaining segment(s)
Reviewed by: rstone
Approved by: re (gjb)
Sponsored by: Panzura
gjb [Mon, 19 Jun 2017 13:26:38 +0000 (13:26 +0000)]
MFC r319942 (jhb):
Don't try to assign interrupts to a CPU on single-CPU systems.
All interrupts are routed to the sole CPU in that case implicitly.
This is a regression in EARLY_AP_STARTUP. Previously the 'assign_cpu'
variable was only set when a multi-CPU system finished booting, so
its value both meant that interrupts could be assigned and that
there was more than one CPU.
PR: 219882
Approved by: re (kib)
Sponsored by: The FreeBSD Foundation
emaste [Mon, 19 Jun 2017 03:07:00 +0000 (03:07 +0000)]
bsdinstall: use consistent EFI configuration across platforms
MFC r320007:
- increase arm64 EFI partition to 200M, as x86
- use EFI_BOOTPART_SIZE and EFI_BOOTPART_PATH macros on x86
- increase ZFS EFI partition to 200M
MFC r320008: bsdinstall: correct comment after r320007
PR: 201898
Approved by: re (kib)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
jhibbits [Sun, 18 Jun 2017 17:20:48 +0000 (17:20 +0000)]
MFC r317928
Add necessary bits to get FreeBSD booting on the Unifi Security Gateway
Summary:
The Ubiquiti Unifi Security Gateway is virtually identical to the
EdgeRouter Lite, with a smaller PCB and apparently a different board identifier.
Simply adding the new board identifier alongside the ERL identifier, FreeBSD
boots successfully, and can access the needed peripherals.
hselasky [Sun, 18 Jun 2017 11:46:17 +0000 (11:46 +0000)]
MFC r319972:
Use static device numbering instead of dynamic one when creating
mlx4en network interfaces. This prevents infinite unit number growth
typically when the mlx4en driver is used inside virtual machines which
support runtime PCI attach and detach.
Approved by: re (gjb)
Sponsored by: Mellanox Technologies
emaste [Sat, 17 Jun 2017 19:00:12 +0000 (19:00 +0000)]
lld: Fix weak symbols on arm and aarch64
MFC r319955: lld: sort relocations
No functional change; applied to facilitate merge of later LLD commit.
MFC r319956: lld: Fix weak symbols on arm and aarch64
Given
.weak target
.global _start
_start:
b target
The intention is that the branch goes to the instruction after the
branch, effectively turning it on a nop. The branch adds the runtime
PC, but we were adding it statically too.
I noticed the oddity by inspection, but llvm-objdump seems to agree,
since it now prints things like:
b #-4 <_start+0x4>
Obtained from: LLD r298797, r305212
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
alc [Thu, 15 Jun 2017 18:49:46 +0000 (18:49 +0000)]
MFC r319540
The data type returned by vmoff() is too narrow in its range. This could
break the transmission of files longer than 4 GB on 32-bit architectures.
alc [Thu, 15 Jun 2017 17:06:04 +0000 (17:06 +0000)]
MFC r318995
In r118390, the swap pager's approach to striping swap allocation over
multiple devices was changed. However, swapoff_one() was not fully and
correctly converted. In particular, with r118390's introduction of a per-
device blist, the maximum swap block size, "dmmax", became irrelevant to
swapoff_one()'s operation. Moreover, swapoff_one() was performing out-of-
range operations on the per-device blist that were silently ignored by
blist_fill().
This change corrects both of these problems with swapoff_one(), which will
allow us to potentially increase MAX_PAGEOUT_CLUSTER. Previously,
swapoff_one() would panic inside of blist_fill() if you increased
MAX_PAGEOUT_CLUSTER.
MFC r319001
After r118390, the variable "dmmax" was neither the correct strip size
nor the correct maximum block size. Moreover, after r318995, it serves
no purpose except to provide information to user space through a read-
sysctl.
This change eliminates the variable "dmmax" but retains the sysctl. It
also corrects the value returned by the sysctl.
MFC r319604
Halve the memory being internally allocated by the blist allocator. In
short, half of the memory that is allocated to implement the radix tree is
wasted because we did not change "u_daddr_t" to be a 64-bit unsigned int
when we changed "daddr_t" to be a 64-bit (signed) int. (See r96849 and
r96851.)
MFC r319612
When the function blist_fill() was added to the kernel in r107913, the swap
pager used a different scheme for striping the allocation of swap space
across multiple devices. And, although blist_fill() was intended to support
fill operations with large counts, the old striping scheme never performed a
fill larger than the stripe size. Consequently, the misplacement of a
sanity check in blst_meta_fill() went undetected. Now, moving forward in
time to r118390, a new scheme for striping was introduced that maintained a
blist allocator per device, but as noted in r318995, swapoff_one() was not
fully and correctly converted to the new scheme. This change completes what
was started in r318995 by fixing the underlying bug in blst_meta_fill() that
stops swapoff_one() from simply performing a single blist_fill() operation.
MFC r319627
Starting in r118390, swaponsomething() began to reserve the blocks at the
beginning of a swap area for a disk label. However, neither r118390 nor
r118544, which increased the reservation from one to two blocks, correctly
accounted for these blocks when updating the variable "swap_pager_avail".
This change corrects that error.
MFC r319655
Originally, this file could be compiled as a user-space application for
testing purposes. However, over the years, various changes to the kernel
have broken this feature. This revision applies some fixes to get user-
space compilation working again. There are no changes in this revision
to code that is used by the kernel.
delphij [Thu, 15 Jun 2017 15:24:15 +0000 (15:24 +0000)]
MFC r319852:
Fix buffer lengths.
After r319369, the RPC code validates caller supplied buffer length in
taddr2uaddr. When no -h is specified, the sizeof(ai_addr) is used,
which is always smaller than the required size and therefore uaddr
would be NULL, causing the kernel to copyin() from userland NULL
and fail with EFAULT.
dexuan [Wed, 14 Jun 2017 13:44:32 +0000 (13:44 +0000)]
MFC: 319690
Approved by: re (marius)
r319690
hyperv/pcib: use the device serial number as PCI domain
Currently the PCI domain is initialized with the instance GUID in
vmbus_pcib_attach(). It turns out the GUID can change across VM reboot,
while some users want a persistent value for PCI domain. The solution is
that we can change to use the device serial number, which starts with 1
and is unique within a VM.
Obtained from: Haiyang Zhang
Sponsored by: Microsoft
emaste [Tue, 13 Jun 2017 18:59:34 +0000 (18:59 +0000)]
MFC r317428 (cognet): fix arm64 MSI
In arm_gicv2m_alloc_msi(), if we found a suitable irq range, leave the loop
before we increase irq again, or we'd end up choosing an irq, and then
really using the next one, even if it's not available.
Also in the inner loop, correct the end check so that we check every irq,
even the last one.
This makes the msk(4) adapter able to use MSI on Softiron Overdrive 1000.
ngie [Mon, 12 Jun 2017 17:37:18 +0000 (17:37 +0000)]
MFC r313398:
Approved by: re (gjb)
Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD
YYINT on FreeBSD is int, not short
I'll work with the upstream maintainer or come up with a build
method of modifying their definitions on install instead of
having to modify tests to match our forked YYINT definition.
glebius [Thu, 8 Jun 2017 22:13:29 +0000 (22:13 +0000)]
MFC r317806:
The nandsim(4) simulator driver doesn't have any protection against
races at least in its ioctl handler, and at the same time it creates
device entry with 0666 permissions.
To plug possible issues in it:
- Mark it as needing Giant.
- Switch device mode to 0600.
Submitted by: C Turt
Reviewed by: imp
Security: Possible double free in ioctl handler
Approved by: re (marius)
glebius [Thu, 8 Jun 2017 22:12:10 +0000 (22:12 +0000)]
MFC r318677:
Fix regression in ndis(4) after r286410. This adds a bunch of checks for
whether this is a Ethernet or 802.11 device and does proper dereferencing.
PR: 213237
Submitted by: <ota j.email.ne.jp>
Approved by: re (marius)
gjb [Thu, 8 Jun 2017 17:54:27 +0000 (17:54 +0000)]
MFC r319621:
Ensure ${_CW} is uppercase when passing '-c' to mk-vmimage.sh,
otherwise with 'CLOUDWARE=vagrant-virtualbox', the path to the
configuration file may be incorrect.
Approved by: re (marius)
Sponsored by: The FreeBSD Foundation
manu [Thu, 8 Jun 2017 15:50:50 +0000 (15:50 +0000)]
Currently stable/11 is using custom DTS for beaglebone(-black) while CURRENT
is using the upstream ones from Linux.
U-Boot ports have been changed to use the upstream names so 11.1-PRERELEASE
doesn't boot.
Since we cannot MFC the DTS easily (a lot of drivers would have to be modified)
add links on the dts with upstream names.
gjb [Thu, 8 Jun 2017 15:47:52 +0000 (15:47 +0000)]
MFC r319603, r319608, r319609:
Create a hard link for sun7i-a20-cubieboard2.dtb to allow the
cubieboard2 to find the correct dtb file.
Note: r319608 and r319609 are included, but are no-op changes to
the original change, and only included to prevent these commits
from showing up on the MFC tracking page.
Approved by: re (marius)
Sponsored by: The FreeBSD Foundation
mav [Thu, 8 Jun 2017 14:33:47 +0000 (14:33 +0000)]
MFC r318966: Improve applying unified capabilities to the lagg ports.
Some NICs have some capabilities dependent, so that disabling one
require disabling some other (TXCSUM/RXCSUM on em). This code tries to
reach the consensus more insistently.
tuexen [Wed, 7 Jun 2017 12:50:54 +0000 (12:50 +0000)]
MFC r319556:
Fix the ICMP6 handling for TCP.
The ICMP6 packets might not be contained in a single mbuf. So don't
assume this. Keep the IPv4 and IPv6 code in sync and make explicit
that the syncache code only need the TCP sequence number, not the
complete TCP header.
gjb [Tue, 6 Jun 2017 14:46:23 +0000 (14:46 +0000)]
MFC r318943 (avg):
MFV r318942: 8166 zpool scrub thinks it repaired offline device
https://www.illumos.org/issues/8166
If we do a scrub while a leaf device is offline (via "zpool offline"),
we will inadvertently clear the DTL (dirty time log) of the offline
device, even though it is still damaged. When the device comes back
online, we will incompletely resilver it, thinking that the scrub
repaired blocks written before the scrub was started. The incomplete
resilver can lead to data loss if there is a subsequent failure of a
different leaf device.
The fix is to never clear the DTL of offline devices. Note that if a
device is onlined while a scrub is in progress, the scrub will be
restarted.
The problem can be worked around by running "zpool scrub" after
"zpool online".
See also https://github.com/zfsonlinux/zfs/issues/5806
PR: 219537
Approved by: re (kib)
Sponsored by: The FreeBSD Foundation
trasz [Tue, 6 Jun 2017 08:33:19 +0000 (08:33 +0000)]
MFC r318398:
Bump default MAXTSIZ (kern.maxtsiz) from 128MB to 32GB. The old limit
prevents one from running eg clang built with debug; the new one is
arbitrary (equal to MAXDSIZ) and... well, should be quite future-proof.
Same fix might be applicable to other 64 bit architectures; I'll ask
their respective maintainers to make sure it won't break anything.
MFC r319118:
Disable IPsec debugging code by default when IPSEC_DEBUG kernel option
is not specified.
Due to the long call chain IPsec code can produce the kernel stack
exhaustion on the i386 architecture. The debugging code usually is not
used, but it requires a lot of stack space to keep buffers for strings
formatting. This patch conditionally defines macros to disable building
of IPsec debugging code.
IPsec currently has two sysctl variables to configure debug output:
* net.key.debug variable is used to enable debug output for PF_KEY
protocol. Such debug messages are produced by KEYDBG() macro and
usually they can be interesting for developers.
* net.inet.ipsec.debug variable is used to enable debug output for
DPRINTF() macro and ipseclog() function. DPRINTF() macro usually
is used for development debugging. ipseclog() function is used for
debugging by administrator.
The patch disables KEYDBG() and DPRINTF() macros, and formatting buffers
declarations when IPSEC_DEBUG is not present in kernel config. This
reduces stack requirement for up to several hundreds of bytes.
The net.inet.ipsec.debug variable still can be used to enable ipseclog()
messages by administrator.
PR: 219476
MFC r319412:
Build kdebug_secreplay() function only when IPSEC_DEBUG is defined.
This should fix the build on sparc.
bdrewery [Sun, 4 Jun 2017 19:09:50 +0000 (19:09 +0000)]
MFC r318194,r319481:
r318194:
Tell bmake (meta mode) to ignore changes to /usr/local/etc/libmap.d/*
r319481:
META_MODE: Move ignoring of /usr/local/etc/libmap.d to proper place.
hselasky [Sun, 4 Jun 2017 08:45:13 +0000 (08:45 +0000)]
MFC r319413:
Free hardware queue resource after port is stopped in the mlx4en(4)
driver. Else if the port is up the resource might still be busy and
the MTT free will fail.
PR: 216493
Approved by: re (kib)
Sponsored by: Mellanox Technologies
hselasky [Sun, 4 Jun 2017 08:25:28 +0000 (08:25 +0000)]
MFC r319414:
Allow communication between functions on the same host when using the
mlx4en(4) driver in SRIOV mode.
Place a copy of the destination MAC address in the send WQE only under
SRIOV/eSwitch configuration or when the device is in selftest. This
allows communication between functions on the same host.
PR: 216493
Approved by: re (kib)
Sponsored by: Mellanox Technologies
MFC r318734:
Fix possible double releasing for SA reference.
There are two possible ways how crypto callback are called: directly from
caller and deffered from crypto thread.
For inbound packets the direct call chain is the following:
IPSEC_INPUT() method -> ipsec_common_input() -> xform_input() ->
-> crypto_dispatch() -> crypto_invoke() -> crypto_done() ->
-> xform_input_cb() -> ipsec[46]_common_input_cb() -> netisr_queue().
The SA reference is held while crypto processing is not finished.
The error handling code wrongly expected that crypto callback always called
from the crypto thread context, and it did SA reference releasing in
xform_input_cb(). But when the crypto callback called directly, in case of
error (e.g. data authentification failed) the error handling in
ipsec_common_input() also did SA reference releasing.
To fix this, remove error handling from ipsec_common_input() and do it
in xform_input() before crypto_dispatch().
PR: 219356
MFC r318738:
Fix possible double releasing for SA and SP references.
There are two possible ways how crypto callback are called: directly from
caller and deffered from crypto thread.
For outbound packets the direct call chain is the following:
IPSEC_OUTPUT() method -> ipsec[46]_common_output() ->
-> ipsec[46]_perform_request() -> xform_output() ->
-> crypto_dispatch() -> crypto_invoke() -> crypto_done() ->
-> xform_output_cb() -> ipsec_process_done() -> ip[6]_output().
The SA and SP references are held while crypto processing is not finished.
The error handling code wrongly expected that crypto callback always called
from the crypto thread context, and it did references releasing in
xform_output_cb(). But when the crypto callback called directly, in case of
error the error handling code in ipsec[46]_perform_request() also did
references releasing.
To fix this, remove error handling from ipsec[46]_perform_request() and do it
in xform_output() before crypto_dispatch().
ngie [Fri, 2 Jun 2017 01:00:40 +0000 (01:00 +0000)]
MFC r318210,r318211:
Approved by: re (gjb)
r318210:
ssp_test:read:: query the value of MAXPATHLEN via getconf(1)
In the event the value of PATH_MAX was changed, the assumption that
MAXPATHLEN is 1024 (and hence the buffer length required to trigger
SSP to fail for read(2)) would be invalidated. Query getconf(1) for
the actual value of MAXPATHLEN via _XOPEN_PATH_MAX instead, and
increment the value by 1 to ensure that the SSP support tests the
stack smashing support properly.
r318211:
Fix up previous commit
- Apply the logic to the FreeBSD block
- Fix a typo with the getconf(1) call that I would have caught, were
it not for the fact that I got the blocks wrong.
- Consolidate the hardcoded buffer sizes to the NetBSD block.
This would have been discovered had I run the test on a system where
PATH_MAX != 1024 (I don't have that at my disposal right at this moment).