]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r345576: Merge r345574 from vendor-crypto:
Ed Maste [Tue, 7 May 2019 19:48:39 +0000 (19:48 +0000)]
MFC r345576: Merge r345574 from vendor-crypto:

upstream: when checking that filenames sent by the server side

match what the client requested, be prepared to handle shell-style brace
alternations, e.g. "{foo,bar}".

"looks good to me" millert@ + in snaps for the last week courtesy
deraadt@

OpenBSD-Commit-ID: 3b1ce7639b0b25b2248e3a30f561a548f6815f3e

PR: 234965
Discussed with: des
Obtained from: OpenSSH-portable 3d896c157c722bc47adca51a58dca859225b5874

5 years agoMFC of 345758
Kirk McKusick [Mon, 6 May 2019 19:13:04 +0000 (19:13 +0000)]
MFC of 345758

Properly flush outstanding I/Os when forcibly deleteing a memory disk device.

Sponsored by: Netflix

5 years agoMFC r347142:
Toomas Soome [Mon, 6 May 2019 08:32:49 +0000 (08:32 +0000)]
MFC r347142:

loader: validate sectorsize argument in disk_open()

The bug and patch is reported against 11.2, but it is good idea to have
the check in place for all versions.

PR: 236585
Submitted by: john@feith.com
Reported by: john@feith.com

5 years agoMFC r344871:
Justin Hibbits [Mon, 6 May 2019 03:39:25 +0000 (03:39 +0000)]
MFC r344871:

powerpc: Save stack pointer in savectx

This allows 'show acttrace' to show backtrace on processes currently running
on CPUs.

Reported by: Brandon Bergren

5 years agoMFC r344613:
Justin Hibbits [Mon, 6 May 2019 03:35:44 +0000 (03:35 +0000)]
MFC r344613:

powerpc/mpc85xx: Synchronize timebase the platform correct way

Summary:
To safely synchronize timebase we need to disable the timebase on all
cores, set timebase, and resynchronize.  This adds two new devices, mutually
exclusive, which attach on the SoC simplebus, to freeze and unfreeze the
timebase.  The devices are singletons, and platform-specific, so no reason
to make them optional and in separate files.

This was found to be necessary for top(1) to work correctly on an AmigaOne
X5000 (P5020 SoC).  It also fixes bufdaemon and bufspacedaemon hangs at
shutdown.

5 years agoMFC r340262,344730
Justin Hibbits [Mon, 6 May 2019 03:31:27 +0000 (03:31 +0000)]
MFC r340262,344730

r340262: powerpc64: Fix "show spr" command on ELFv2 kernels
r344730: powerpc: fix 'show spr' for ELFv1 powerpc64

5 years agoMFC r339559,344083,344202,344203,344204
Justin Hibbits [Mon, 6 May 2019 03:15:07 +0000 (03:15 +0000)]
MFC r339559,344083,344202,344203,344204

Bulk merge of Book-E pmap changes

r339559: powerpc/booke: Turn tlb*_print_tlbentries() into 'show tlb*' DDB
commands
r344083: powerpc/booke: Use the 'tlbilx' instruction on newer cores
r344202,344204: powerpc/booke: Use DMAP where possible for page copy and zeroing
r344203: powerpc/booke: depessimize MAS register updates

5 years agoMFC: r346856
Rick Macklem [Mon, 6 May 2019 03:06:22 +0000 (03:06 +0000)]
MFC: r346856
Add #ifdef INET6 around declaration of nbuf.

It was reported that without #ifdef INET6 around the declaration of "nbuf",
a build would report an unused variable. For some reason, I didn't see that
warning when I did a build, but it seems reasonable to add these #ifdef INET6's.

5 years agoMFC r347027-r347028: libbe(3) mountpoint handling fixes
Kyle Evans [Mon, 6 May 2019 02:10:04 +0000 (02:10 +0000)]
MFC r347027-r347028: libbe(3) mountpoint handling fixes

r347027:
libbe(3): Properly mount BEs with mountpoint=none

Instead of pretending to successfully mount them while not actually
mounting anything, we'll now actually mount them *and* claim we mounted them
successfully.

Reported by: ler

r347028:
libbe: set mountpoint=none in be_import

If we're going to set a mountpoint at all, mountpoint=none makes more sense
than mountpoint=/.

5 years agoMFC r347021: fdt: Fix installation of aarch64 dtb
Kyle Evans [Mon, 6 May 2019 02:08:52 +0000 (02:08 +0000)]
MFC r347021: fdt: Fix installation of aarch64 dtb

r345519 rewrote parts of how we build .dtb, but mistakenly dropped the
vendor dir for aarch64.  Simply drop the :T for building ${DTB} in the
aarch64 case- it'll get applied at install-time as-needed, with :H:T for
determining the vendor dir.

5 years agoMFC r346854:
Michael Tuexen [Sat, 4 May 2019 13:58:45 +0000 (13:58 +0000)]
MFC r346854:
Some test scripts use ncat --sctp --listen port to run an SCTP discard
server in the background. However, when running in the background,
stdin is closed and ncat initiates a graceful shutdown of the SCTP
association. This is not expected by the client. Therefore, the
ncat-based discard server is replaced by a perl-based one.

In addition, to remove the dependency from ncat, which needs to be
installed via the nmap port, also the code testing for a free SCTP port
is changed to use the perl-based client.

Finally, remove some debug output from the report generated.

Reviewed by: lwhsu@
Differential Revision: https://reviews.freebsd.org/D20086

5 years agoMFC r346400:
Michael Tuexen [Sat, 4 May 2019 13:55:51 +0000 (13:55 +0000)]
MFC r346400:
Improve input validation for the socket option IPV6_CHECKSUM.

When using the IPPROTO_IPV6 level socket option IPV6_CHECKSUM on a raw
IPv6 socket, ensure that the value is either -1 or a non-negative even
number.

MFC r346401:
Avoid a buffer overwrite in rip6_output() when computing the checksum
as requested by the user via the IPPROTO_IPV6 level socket option
IPV6_CHECKSUM. The check if there are enough bytes in the packet to
store the checksum at the requested offset was wrong by 1.

MFC r346402:
When a checksum has to be computed for a received IPv6 packet because it
is requested by the application using the IPPROTO_IPV6 level socket option
IPV6_CHECKSUM on a raw socket, ensure that the packet contains enough
bytes to contain the checksum at the specified offset.

MFC r346406:
When an IPv6 packet is received for a raw socket which has the
IPPROTO_IPV6 level socket option IPV6_CHECKSUM enabled and the
checksum check fails, drop the message. Without this fix, an
ICMP6 message was sent indicating a parameter problem.

Thanks to bz@ for suggesting a way to simplify this fix.

Reviewed by: bz@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19966
Differential Revision:  https://reviews.freebsd.org/D19967
Differential Revision:  https://reviews.freebsd.org/D19968
Differential Revision:  https://reviews.freebsd.org/D19969

5 years agoMFC: r346715: Acpi MADT table correction for VM_MAXCPU > 21
Rodney W. Grimes [Sat, 4 May 2019 13:43:48 +0000 (13:43 +0000)]
MFC: r346715: Acpi MADT table correction for VM_MAXCPU > 21

The bhyve acpi MADT table was given a static space of 256 (0x100) bytes,
this is enough space to allow VM_MAXCPU to be 21, this patch changes that
so VM_MAXCPU can be of arbitrary value and not overflow the space by
actually calculating the space needed for the table.

PR: 212782
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Approved by: bde (mentor, implicit), jhb (maintainer)
Differential Revision: https://reviews.freebsd.org/D18815

5 years agoMFC r346197:
Michael Tuexen [Sat, 4 May 2019 13:05:21 +0000 (13:05 +0000)]
MFC r346197:
When sending a routing message, don't allow the user to set the
RTF_RNH_LOCKED flag in rtm_flags, since this flag is used only
internally.

Reviewed by: ae@
Differential Revision: https://reviews.freebsd.org/D19898

5 years agoMFC r346182:
Michael Tuexen [Sat, 4 May 2019 13:02:46 +0000 (13:02 +0000)]
MFC r346182:
When sending IPv4 packets on a SOCK_RAW socket using the IP_HDRINCL option,
ensure that the ip_hl field is valid. Furthermore, ensure that the complete
IPv4 header is contained in the first mbuf. Finally, move the length checks
before relying on them when accessing fields of the IPv4 header.

Reported by: jtl@
Reviewed by: jtl@
Differential Revision: https://reviews.freebsd.org/D19181

5 years agoMFC r346134:
Michael Tuexen [Sat, 4 May 2019 13:00:39 +0000 (13:00 +0000)]
MFC r346134:
Fix an SCTP related locking issue. Don't report that the TCB_SEND_LOCK
is owned, when it is not.

This issue was found by running syzkaller.

5 years agoMFC r345525:
Michael Tuexen [Sat, 4 May 2019 12:57:55 +0000 (12:57 +0000)]
MFC r345525:
Fix a double free of an SCTP association in an error path.
This is joint work with rrs@. The issue was found by running
syzkaller.

5 years agoMFC r345505:
Michael Tuexen [Sat, 4 May 2019 12:56:09 +0000 (12:56 +0000)]
MFC r345505:
Initialize scheduler specific data for the FCFS scheduler.
This is joint work with rrs@. The issue was reported by using
syzkaller.

5 years agoMFC r345504:
Michael Tuexen [Sat, 4 May 2019 12:54:24 +0000 (12:54 +0000)]
MFC r345504:
Improve locking when tearing down an SCTP association.
This is joint work with rrs@ and the issue was found by
syzkaller.

5 years agoMFC r345494:
Michael Tuexen [Sat, 4 May 2019 12:52:24 +0000 (12:52 +0000)]
MFC r345494:
Fix the handling of fragmented unordered messages when using DATA chunks
and FORWARD-TSN.

This bug was reported in https://github.com/sctplab/usrsctp/issues/286
for the userland stack.

This is joint work with rrs@.

5 years agoMFC r345465:
Michael Tuexen [Sat, 4 May 2019 12:49:55 +0000 (12:49 +0000)]
MFC r345465:
Fix a signed/unsigned bug when receiving SCTP messages.
This is joint work with rrs@.

MFC r345466:
Fox more signed unsigned issues. This time on the send path.
This is joint work with rrs@ and was found by running syzkaller.

MFC r345467:
Fix build issue for the userland stack.
Joint work with rrs@.

5 years agoMerge r346846 from head to stable/12:
Robert Watson [Sat, 4 May 2019 12:35:12 +0000 (12:35 +0000)]
Merge r346846 from head to stable/12:

  Update the audit(4) man page to talk about dtaudit(4), and also add a
  dtaudit(4) cross reference to auditpipe(4).

  Sponsored by: DARPA, AFRL

5 years agoMerge r346814 from head to stable/12:
Robert Watson [Sat, 4 May 2019 12:34:11 +0000 (12:34 +0000)]
Merge r346814 from head to stable/12:

  Add a man page for the DTrace Audit Provider, since we are now growing a
  set of provider man pages.

  Sponsored by: DARPA, AFRL

5 years agoMFC r345461:
Michael Tuexen [Sat, 4 May 2019 12:07:00 +0000 (12:07 +0000)]
MFC r345461:
Limit the size of messages sent on 1-to-many style SCTP sockets with the
SCTP_SENDALL flag. Allow also only one operation per SCTP endpoint.

This fixes an issue found by running syzkaller and is joint work with rrs@.

5 years agoMFC r345460:
Michael Tuexen [Sat, 4 May 2019 12:02:41 +0000 (12:02 +0000)]
MFC r345460:
Limit the number of bytes which can be queued for SCTP sockets.
This is joint work with rrs@.

5 years agoMFC r345458:
Michael Tuexen [Sat, 4 May 2019 11:24:19 +0000 (11:24 +0000)]
MFC r345458:
Add sysctl variable net.inet.tcp.rexmit_initial for setting RTO.Initial
used by TCP.

Reviewed by: rrs@, 0mp@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19355

5 years agoMFC r345441:
Michael Tuexen [Sat, 4 May 2019 11:21:41 +0000 (11:21 +0000)]
MFC r345441:
Fix a KASSERT() in tcp_output().

When checking the length of the headers at this point, the IP level
options have not been added to the mbuf chain.
So don't take them into account.

Reviewed by: rrs@
Sponsored by: Netflix, Inc.

5 years agoMFC r344925:
Michael Tuexen [Sat, 4 May 2019 11:18:39 +0000 (11:18 +0000)]
MFC r344925:
Fix locking bug.

5 years agoMFC r344924:
Michael Tuexen [Sat, 4 May 2019 11:17:20 +0000 (11:17 +0000)]
MFC r344924:
Some cleanup and consistency improvements.

5 years agoMFC r344872:
Michael Tuexen [Sat, 4 May 2019 11:15:01 +0000 (11:15 +0000)]
MFC r344872:
After removing an entry from the stream scheduler list, set the pointers
to NULL, since we are checking for it in case the element gets inserted
again.

This issue was found by running syzkaller.

5 years agoMFC r344742:
Michael Tuexen [Sat, 4 May 2019 11:13:03 +0000 (11:13 +0000)]
MFC r344742:
Allocate an assocition id and register the stcb with holding the lock.
This avoids a race where stcbs can be found, which are not completely
initialized.

This was found by running syzkaller.

5 years agoMFC r344726:
Michael Tuexen [Sat, 4 May 2019 11:11:03 +0000 (11:11 +0000)]
MFC r344726:
Remove debug output.

5 years agoMFC r344724:
Michael Tuexen [Sat, 4 May 2019 11:07:35 +0000 (11:07 +0000)]
MFC r344724:
Allow SCTP stream reconfiguration operations only in ESTABLISHED
state.

This issue was found by running syzkaller.

5 years agoMFC r344723:
Michael Tuexen [Sat, 4 May 2019 11:05:57 +0000 (11:05 +0000)]
MFC r344723:
Handle the case when calling the IPPROTO_SCTP level socket option
SCTP_STATUS on an association with no primary path (early state).

This issue was found by running syzkaller.

5 years agoMFC r344722:
Michael Tuexen [Sat, 4 May 2019 11:03:10 +0000 (11:03 +0000)]
MFC r344722:
Use correct buffer sizes in sctp_get[lp]addrs().

5 years agoMFC r344721:
Michael Tuexen [Sat, 4 May 2019 11:01:31 +0000 (11:01 +0000)]
MFC r344721:
Report the correct length when using the IPPROTO_SCTP level
socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES.

5 years agoMFC r344708:
Michael Tuexen [Sat, 4 May 2019 10:59:13 +0000 (10:59 +0000)]
MFC r344708:
Honor the memory limits provided when processing the IPPROTO_SCTP
level socket option SCTP_GET_LOCAL_ADDRESSES in a getsockopt() call.

Thanks to Thomas Barabosch for reporting the issue which was found by
running syzkaller.

5 years agoMFC r344704:
Michael Tuexen [Sat, 4 May 2019 10:56:57 +0000 (10:56 +0000)]
MFC r344704:
Improve consistency, no functional change.

5 years agoMFC r344368:
Michael Tuexen [Sat, 4 May 2019 10:38:54 +0000 (10:38 +0000)]
MFC r344368:
Reduce the TCP initial retransmission timeout from 3 seconds to
1 second as allowed by RFC 6298.

Reviewed by: kbowling@, Richard Scheffenegger
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D18941

5 years agoMFC r344367:
Michael Tuexen [Sat, 4 May 2019 10:36:16 +0000 (10:36 +0000)]
MFC r344367:
Use exponential backoff for retransmitting SYN segments as specified
in the TCP RFCs.

Reviewed by: rrs@, Richard Scheffenegger
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D18974

5 years agoMFC r344148:
Michael Tuexen [Sat, 4 May 2019 10:33:31 +0000 (10:33 +0000)]
MFC r344148:
Fix a byte ordering issue for the advertised receiver window in ACK
segments sent in TIMEWAIT state, which I introduced in r336937.

Sponsored by: Netflix, Inc.

5 years agoMFC r344048:
Michael Tuexen [Sat, 4 May 2019 10:13:37 +0000 (10:13 +0000)]
MFC r344048:
Improve input validation for raw IPv4 socket using the IP_HDRINCL
option.

This issue was found by running syzkaller on OpenBSD.
Greg Steuck made me aware that the problem might also exist on FreeBSD.

Reported by: Greg Steuck
Differential Revision: https://reviews.freebsd.org/D18834

5 years agoMFC r343961:
Michael Tuexen [Sat, 4 May 2019 10:09:25 +0000 (10:09 +0000)]
MFC r343961:
Fix a locking issue when reporing outbound messages.

5 years agoMFC r343960:
Michael Tuexen [Sat, 4 May 2019 10:06:17 +0000 (10:06 +0000)]
MFC r343960:
Fix a locking issue in the IPPROTO_SCTP level SCTP_PEER_ADDR_THLDS socket
option. The problem affects only setsockopt with invalid parameters.

This issue was found by syzkaller.

5 years agoMFC r340179:
Michael Tuexen [Sat, 4 May 2019 10:04:00 +0000 (10:04 +0000)]
MFC r340179:
Don't use a function when neither INET nor INET6 are defined.
This is a valid case for the userland stack, where this fixes
two set-but-not-used warnings in this case.

Thanks to Christian Wright for reporting the issue.

5 years agoMFC r343954:
Michael Tuexen [Sat, 4 May 2019 09:28:11 +0000 (09:28 +0000)]
MFC r343954:
Fix a locking bug in the IPPROTO_SCTP level SCTP_EVENT socket option.
This occurs when call setsockopt() with invalid parameters.

This issue was found by syzkaller.

5 years agoMFC r343951:
Michael Tuexen [Sat, 4 May 2019 09:25:32 +0000 (09:25 +0000)]
MFC r343951:
Fix locking for IPPROTO_SCTP level SCTP_DEFAULT_PRINFO socket option.
This problem occurred when calling setsockopt() will invalid parameters.

This issue was found by running syzkaller.

5 years agoMFC r343770:
Michael Tuexen [Sat, 4 May 2019 09:18:19 +0000 (09:18 +0000)]
MFC r343770:
Only reduce the PMTU after the send call. The only way to increase it, is
via PMTUD.

This fixes an MTU issue reported by Timo Voelker.

5 years agoMFC r343769:
Michael Tuexen [Sat, 4 May 2019 09:15:57 +0000 (09:15 +0000)]
MFC r343769:
Fix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
socketoption.

This was found by running syzkaller.

5 years agoMFC r343742:
Michael Tuexen [Sat, 4 May 2019 09:13:52 +0000 (09:13 +0000)]
MFC r343742:
Add missing SCTP_EOR entry.

5 years agoMFC r343661:
Michael Tuexen [Sat, 4 May 2019 09:11:17 +0000 (09:11 +0000)]
MFC r343661:
When handling SYN-ACK segments in the SYN-RCVD state, set tp->snd_wnd
consistently.

This inconsistency was observed when working on the bug reported in
PR 235256, although it does not fix the reported issue. The fix for
the PR will be a separate commit.

PR: 235256
Reviewed by: rrs@, Richard Scheffenegger
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19033

5 years agoMFC r343525:
Michael Tuexen [Sat, 4 May 2019 09:07:53 +0000 (09:07 +0000)]
MFC r343525:
Fix the detection of ECN-setup SYN-ACK packets.

RFC 3168 defines an ECN-setup SYN-ACK packet as on with the ECE flags
set and the CWR flags not set. The code was only checking if ECE flag
is set. This patch adds the check to verify that the CWR flags is not
set.

Submitted by: Richard Scheffenegger
Reviewed by: tuexen@
Differential Revision: https://reviews.freebsd.org/D18996

5 years agoMFC r343401:
Michael Tuexen [Sat, 4 May 2019 09:01:56 +0000 (09:01 +0000)]
MFC r343401:
Update a comment to reflect the current reality.
SYN-cache entries live for abaut 12 seconds, not 45, when default
setting are used.

MFC r343402:
Kill a trailing whitespace character...

MFC r343403:
Get the arithmetic right...

Sponsored by: Netflix, Inc.

5 years agoMFC: r346266
Peter Jeremy [Fri, 3 May 2019 23:06:35 +0000 (23:06 +0000)]
MFC: r346266
Specify correct Ethernet phy for RPI-B

Approved by: grog, jhb (mentors)

5 years agoMFC: r346265
Peter Jeremy [Fri, 3 May 2019 23:02:15 +0000 (23:02 +0000)]
MFC: r346265
Fix cpufreq(4) on RPI-B

Approved by: grog, jhb (mentors)

5 years agoMFC r343953:
Peter Jeremy [Fri, 3 May 2019 22:54:56 +0000 (22:54 +0000)]
MFC r343953:
Replace calls to sin(x) and cos(x) with a single call to sincos().
Replace calls to sinf(x) and cosf(x) with a single call to sincosf().

Approved by: grog, jhb (mentors)

5 years agoMFC r346762: Add mutex_destroy() missed in r334844.
Alexander Motin [Fri, 3 May 2019 03:35:36 +0000 (03:35 +0000)]
MFC r346762: Add mutex_destroy() missed in r334844.

5 years agoMFC r346760: Fix minor mismerges.
Alexander Motin [Fri, 3 May 2019 03:34:22 +0000 (03:34 +0000)]
MFC r346760: Fix minor mismerges.

No functional change.

5 years agoMFC: r346424
Rick Macklem [Fri, 3 May 2019 02:58:33 +0000 (02:58 +0000)]
MFC: r346424
Add support for the ModeSetMasked attribute to the NFSv4.1 server.

I do not know of an extant NFSv4.1 client that currently does a Setattr
operation for the ModeSetMasked, but it has been discussed on the linux-nfs
mailing list.
This patch adds support for doing a Setattr of ModeSetMasked, so that it
will work for any future NFSv4.1 client that chooses to do so.
Tested via a hacked FreeBSD NFSv4.1 client.

5 years agoMFC: r346423
Rick Macklem [Fri, 3 May 2019 02:44:57 +0000 (02:44 +0000)]
MFC: r346423
Replace "vp" with NULL to make the code more readable.

At the time of this nfsv4_sattr() call, "vp == NULL", so this patch doesn't
change the semantics, but I think it makes the code more readable.
It also makes it consistent with the nfsv4_sattr() call a few lines above
this one. Found during code inspection.

5 years agoMFC: r346365
Rick Macklem [Fri, 3 May 2019 02:03:29 +0000 (02:03 +0000)]
MFC: r346365
Fix the NFSv4.0 server so that it does not support NFSv4.1 attributes.

During inspection of a packet trace, I noticed that an NFSv4.0 mount
reported that it supported attributes that are only defined for NFSv4.1.
In practice, this bug appears to be benign, since NFSv4.0 clients will
not use attributes that were added for NFSv4.1.
However, this was not correct and this patch fixes the NFSv4.0 server
so that it only supports attributes defined for NFSv4.0.
It also adds a definition for NFSv4.1 attributes that can only be set,
although it is only defined as 0 for now.
This is anticipation of the addition of support for the NFSv4.1 mode+mask
attribute soon.

5 years agoMFC r346959:
Glen Barber [Fri, 3 May 2019 00:45:31 +0000 (00:45 +0000)]
MFC r346959:
  Reduce the default image size for virtual machine disk images from
  30GB to 3GB.  The raw images can be resized using truncate(1), and
  other formats can be resized with tools included in hypervisors.

  Enable the growfs(8) rc(8) at firstboot if the disk was resized
  prior to booting the virtual machine for the first time.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r345798:
Andrey V. Elsukov [Thu, 2 May 2019 17:43:47 +0000 (17:43 +0000)]
MFC r345798:
  Create 64bit mibII counters for all interfaces.

  PR: 157015
  Obtained from: Yandex LLC

5 years agoMFC r346712:
Johannes Lundberg [Thu, 2 May 2019 02:26:42 +0000 (02:26 +0000)]
MFC r346712:
Don't call cdev_init where cdev_alloc is called. cdev_alloc already
handles initialization.

Reviewed by: hps
Approved by: imp (mentor)

5 years agoMFC: r346709
Rick Macklem [Thu, 2 May 2019 01:02:26 +0000 (01:02 +0000)]
MFC: r346709
Add support to nfsdumpstate for printing of INET6 addresses for locks.

r346190 added support for printing of INET6 addresses for the "-o" option
(all opens) but missed adding support for INET6 addresses for the "-l" option.
This patch adds that support.

5 years agoMFC 345712: Don't check the inp socket pointer in in_pcboutput_eagain.
John Baldwin [Wed, 1 May 2019 21:54:21 +0000 (21:54 +0000)]
MFC 345712: Don't check the inp socket pointer in in_pcboutput_eagain.

5 years agoMFC 345655: Remove nested epochs from lagg(4).
John Baldwin [Wed, 1 May 2019 21:45:15 +0000 (21:45 +0000)]
MFC 345655: Remove nested epochs from lagg(4).

lagg_bcast_start appeared to have a bug in that was using the last
lagg port structure after exiting the epoch that was keeping that
structure alive.  However, upon further inspection, the epoch was
already entered by the caller (lagg_transmit), so the epoch enter/exit
in lagg_bcast_start was actually unnecessary.

This commit generally removes uses of the net epoch via LAGG_RLOCK to
protect the list of ports when the list of ports was already protected
by an existing LAGG_RLOCK in a caller, or the LAGG_XLOCK.

It also adds a missing epoch enter/exit in lagg_snd_tag_alloc while
accessing the lagg port structures.  An ifp is still accessed via an
unsafe reference after the epoch is exited, but that is true in the
current code and will be fixed in a future change.

5 years agoMFC 345659: Use a dedicated malloc type for lagg(4)'s structures.
John Baldwin [Wed, 1 May 2019 21:26:33 +0000 (21:26 +0000)]
MFC 345659: Use a dedicated malloc type for lagg(4)'s structures.

5 years agoMFC 346066: Refine r330113 to honor the ProducerConsumer flag most of the time.
John Baldwin [Wed, 1 May 2019 18:17:42 +0000 (18:17 +0000)]
MFC 346066: Refine r330113 to honor the ProducerConsumer flag most of the time.

While it is true that the ACPI spec says that the flag is only valid
on Extended Address Space Descriptors, examples of other descriptors
in the spec use the ProducerConsumer flag explicitly, and real
hardware uses it as well.  In fact, even in the ASL of the Thunder X2
for which r330113 was a workaround, some devices use this flag on
non-Extended Address Space Descriptors correctly.  Instead, only
ignore the flag for resources associated with the UART devices on the
Thunder X2 using the "ARMH0011" HID to identify these devices.

This should fix regressions from ignoring this flag in other contexts
such as Hyper-V.

PR: 235876

5 years agoMFC 346063: Don't pre-reserve resources for CPU devices when they are set.
John Baldwin [Wed, 1 May 2019 17:30:14 +0000 (17:30 +0000)]
MFC 346063: Don't pre-reserve resources for CPU devices when they are set.

CPUs can use shared (RF_SHAREABLE) resources for the I/O port used for
entering and exiting C states.  If this I/O port is included in an ACPI
system resource device, then this happens to still work, but if the port
wasn't part of a system resource device, only the first CPU could allocate
the I/O port and use C states since resource_list_reserve() was always
allocating the resource from nexus0 without RF_SHAREABLE.  By avoiding
the reservation, the flags from the bus_alloc_resource() in the CPU driver
(which include RF_SHAREABLE) are honored.

PR: 236513

5 years agoMFC r346644: Call delist_dev() before destroy_dev_sched_cb().
Alexander Motin [Wed, 1 May 2019 13:42:56 +0000 (13:42 +0000)]
MFC r346644: Call delist_dev() before destroy_dev_sched_cb().

destroy_dev_sched_cb() is excessively asynchronous, and during media change
retaste new provider may appear sooner then device of the previous one get
destroyed.

Sponsored by: iXsystems, Inc.

5 years agoMFC r345843:
Andrey V. Elsukov [Wed, 1 May 2019 09:05:48 +0000 (09:05 +0000)]
MFC r345843:
  Follow the declared behaviour that specifies server string format in
  bsnmpclient(3).

  snmp_parse_server() function accepts string where some fields can be
  omitted: [trans::][community@][server][:port]

  "trans" field can be "udp", "udp6", "dgram" and "stream".
  "community" can be empty string, if it is omitted, the default value
  will be used. For read_community it is "public", for write_comminity
  it is "private". "server" field can be hostname, IPv4 address or IPv6
  address. IPv6 address should be specified in brackets "[]".
  If port is omitted, the default value "snmp" will be used for "udp"
  and "udp6" transports. So, now for bsnmpget(1) and bsnmwalk(1) it is
  not required to specify all fields in argument of '-s' option. E.g.

    # bsnmpget -s 127.1 sysName.0
    # bsnmpget -s "udp::127.1" sysName.0
    # bsnmpget -s "udp::public@127.1" sysName.0
    # bsnmpget -s "udp::public@127.1:161" sysName.0
    # bsnmpget -s "udp::[::1]" sysName.0
    # bsnmpget -s "udp6::[::1]" sysName.0
    # bsnmpget -s "[fe80::1%lo0]" sysName.0

  PR: 236664
  Reported by: olivier

5 years agoMFC r345797:
Andrey V. Elsukov [Wed, 1 May 2019 09:04:14 +0000 (09:04 +0000)]
MFC r345797:
  Add IPv6 transport for bsnmp.

  This patch adds a new table begemotSnmpdTransInetTable that uses the
  InetAddressType textual convention and can be used to create listening
  ports for IPv4, IPv6, zoned IPv6 and based on DNS names. It also supports
  future extension beyond UDP by adding a protocol identifier to the table
  index. In order to support this gensnmptree had to be modified.

  Submitted by:   harti
  Relnotes:       yes
  Differential Revision:  https://reviews.freebsd.org/D16654

5 years agoMFC r346263:
Mariusz Zaborski [Wed, 1 May 2019 07:00:56 +0000 (07:00 +0000)]
MFC r346263:
  tcpdump: disable Capsicum if -E option is provided.

  The -E is used to provide a secret for decrypting IPsec.
  The secret may be provided through command line or as the file.
  The problem is that tcpdump doesn't support yet opening files in capability mode
  and the file may contain a list of the files to open.

  As a workaround, for now, let's just disable capsicum if the -E
  the option is provided.

  PR:           236819

5 years agoMFC r346459:
Cy Schubert [Wed, 1 May 2019 01:53:19 +0000 (01:53 +0000)]
MFC r346459:

  MFV r346450:

  Update sqlite3-3.27.1 (3270100) --> sqlite3-3.27.2 (3270200)

5 years agoMFC r346804:
Cy Schubert [Wed, 1 May 2019 01:49:33 +0000 (01:49 +0000)]
MFC r346804:

Left justify a function header brace as it should be.
No functional change.

5 years agoMFC r341759, r341796, r341839, r341989, r346591:
Cy Schubert [Wed, 1 May 2019 01:42:38 +0000 (01:42 +0000)]
MFC r341759, r341796, r341839, r341989, r346591:
The following five MFCs update wpa 2.6 --> 2.8.

r341759:
MFV r341618: Update wpa 2.6 --> 2.7.

r341796:
Clean stale wpa dependencies and objects after r341759

The wpa update added some source files with the same name as a file in
another directory (found via .PATH in the previous version).  Having a
stale entry in a .depend file means the new file won't be built, so test
for this case and if found remove all of wpa's dependency files.

Sponsored by:   The FreeBSD Foundation

r341839:
Set default ciphers.

Submitted by:   jkim@

r341989:
Makefile.inc1: update stale wpa dependency removal statement

Only stale .depend files are removed; do not mention object files.

r346591:
Update wpa_supplicant/hostapd 2.7 --> 2.8

Upstream documents the following advisories:

- https://w1.fi/security/2019-1/sae-side-channel-attacks.txt
- https://w1.fi/security/2019-2/eap-pwd-side-channel-attack.txt
- https://w1.fi/security/2019-3/sae-confirm-missing-state-validation.txt
- https://w1.fi/security/2019-4/eap-pwd-missing-commit-validation.txt
- https://w1.fi/security/2019-5/eap-pwd-message-reassembly-issue-\
  with-unexpected-fragment.txt

Security: CVE-2019-9494, VU#871675, CVE-2019-9495, CVE-2019-9496,
CVE-2019-9497, CVE-2019-9498, CVE-2019-9499

Relnotes: yes

5 years agoMFC 344711: Fix missed posted interrupts in VT-x in bhyve.
John Baldwin [Tue, 30 Apr 2019 23:53:54 +0000 (23:53 +0000)]
MFC 344711: Fix missed posted interrupts in VT-x in bhyve.

When a vCPU is HLTed, interrupts with a priority below the processor
priority (PPR) should not resume the vCPU while interrupts at or above
the PPR should.  With posted interrupts, bhyve maintains a bitmap of
pending interrupts in PIR descriptor along with a single 'pending'
bit.  This bit is checked by a CPU running in guest mode at various
places to determine if it should be checked.  In addition, another CPU
can force a CPU in guest mode to check for pending interrupts by
sending an IPI to a special IDT vector reserved for this purpose.

bhyve had a bug in that it would only notify a guest vCPU of an
interrupt (e.g. by sending the special IPI or by resuming it if it was
idle due to HLT) if an interrupt arrived that was higher priority than
PPR and no interrupts were currently pending.  This assumed that if
the 'pending' bit was set, any needed notification was already in
progress.  However, if the first interrupt sent to a HLTed vCPU was
lower priority than PPR and the second was higher than PPR, the first
interrupt would set 'pending' but not notify the vCPU, and the second
interrupt would not notify the vCPU because 'pending' was already set.
To fix this, track the priority of pending interrupts in a separate
per-vCPU bitmask and notify a vCPU anytime an interrupt arrives that
is above PPR and higher than any previously-received interrupt.

This was found and debugged in the bhyve port to SmartOS maintained by
Joyent.  Relevant SmartOS bugs with more background:

https://smartos.org/bugview/OS-6829
https://smartos.org/bugview/OS-6930
https://smartos.org/bugview/OS-7354

5 years agoAllow no_hash to appear in manifest.
Simon J. Gerraty [Tue, 30 Apr 2019 23:01:13 +0000 (23:01 +0000)]
Allow no_hash to appear in manifest.

sbin/veriexec will ignore entries that have no hash anyway,
but loader needs to be explicitly told that such files are
ok to ignore (not verify).

We will report as Unverified depending on verbose level,
but with no reason - because we are not rejecting the file.

MFC r346604

5 years agoMFC r346567:
Navdeep Parhar [Tue, 30 Apr 2019 21:27:32 +0000 (21:27 +0000)]
MFC r346567:

cxgbe(4): Make sure bundled_fw is always initialized before use.

This fixes a bug that prevented the driver from auto-flashing the
firmware when it didn't see one on the card.  This feature was
introduced in r321390 and this bug was introduced in r343269.

Reported by: gallatin@
Sponsored by: Chelsio Communications

5 years agoMFC r340375 (by jch@):
Navdeep Parhar [Tue, 30 Apr 2019 21:24:44 +0000 (21:24 +0000)]
MFC r340375 (by jch@):

cxgbe/netmap: Fix cxgbe netmap when interface is DOWN

A kernel panic can occur if the cxgbe interface is DOWN
when activating netmap. This patch prevents the driver
from freeing up cxgbe netmap resources when they have not
been allocated.

Submitted by: Nicolas Witkowski <nwitkowski@verisign.com>
Reviewed by: np
Sponsored by: Verisign, Inc.
Differential Revision: https://reviews.freebsd.org/D17802

5 years agoMFC r346596:
Konstantin Belousov [Tue, 30 Apr 2019 18:36:56 +0000 (18:36 +0000)]
MFC r346596:
ipoib: assign link-local address according to RFC.

5 years agoMFC r346267, 346269:
Fedor Uporov [Tue, 30 Apr 2019 09:10:45 +0000 (09:10 +0000)]
MFC r346267, 346269:
ext2fs: Initial version of DTrace support.

Reviewed by:    pfg, gnn

Differential Revision:    https://reviews.freebsd.org/D19848

5 years agoMFC r345056, r345058, r345059
Kashyap D Desai [Tue, 30 Apr 2019 07:10:11 +0000 (07:10 +0000)]
MFC r345056, r345058, r345059

r345056

fw_outstanding"(outstanding IOs at firmware level) counter gets screwed up when R1 fastpath
writes are running. Some of the cases which are not handled properly in driver are:

1. With R1 fastpath supported, single write from CAM layer can consume 2 MPT frames
at driver/firmware level for fastpath qualification(if fw_outstanding < controller Queue Depth).
Due to this driver has to throttle IOs coming from CAM layer as well as second fastpath
write(of R1 write) against Adapter Queue Depth.
If "fw_outstanding" reaches to adapter queue depth, driver should return IOs from CAM layer with
device busy status.While allocating second MPT frame(corresponding to R1 FP write) also, driver
should ensure fw_outstanding should not exceed adapter QD.

2. For R1 fastpath writes completion, driver decrements "fw_oustanding" counter without
really returning MPT frame to free pool. It may cause IOs(with heavy IOs running, consuming whole
adapter Queue Depth) consuming MPT frames reserved for DCMDs(management commands) and
DCMDs(internal and sent by application) not getting MPT frame will start failing.

Below is one test case to hit the issue described above-
1. Run heavy IOs (outstanding IOs should hit adapter Queue Depth).
2. Run management tool (Broadcom's storcli tool) querying adapter in loop (run command- "storcli64 /c0 show" in loop).
3. Management tool's requests would start failing due to non-availability of free MPT frames as all frames would be consumed by IOs.

Fix: Increment/decrement of "fw_outstanding" counter should be in sync with MPT frame get/return.

r345058

Allocated MFI frames should be same as MPT frames reserved for DCMDs

r345059

Update driver version to 07.709.04.00-fbsd

5 years agoMFC r346751:
Ian Lepore [Tue, 30 Apr 2019 00:59:59 +0000 (00:59 +0000)]
MFC r346751:

Add a manpage for elf_aux_info(3)

5 years agoMFC r346713:
Ian Lepore [Tue, 30 Apr 2019 00:58:43 +0000 (00:58 +0000)]
MFC r346713:

Fix typo: the 4th argument to GPIO_PIN_ACCESS_32 is the set of pins to
change, not the variable used to return the original pin state.

PR: 237378
Reported by: Mori Hiroki <yamori813@yahoo.co.jp>

5 years agoMFC r346489:
Ian Lepore [Tue, 30 Apr 2019 00:54:31 +0000 (00:54 +0000)]
MFC r346489:

Move the reporting of spurious interrupts under bootverbose control, because
occasional spurious interrupts are a normal thing on this hardware.  Also,
change the name of the cpu-local interrupt controller driver from local_intc
to lintc, because the name gets built into interrupt names, which have to
fit into a 19-byte field for stats reporting (so this allows 5 more bytes
of the actual interrupt name to be displayed).

5 years agoMFC r345351:
Enji Cooper [Mon, 29 Apr 2019 23:07:19 +0000 (23:07 +0000)]
MFC r345351:
r345351 (by bdrewery):

Build common kernel dependencies before modules.

This ensures files like genassym.o and awk/mfiles are generated before
descending into the modules build.  It may also allow some module builds
to not recreate files that are already present in the KERNBUILDDIR.

This fixes a rare build race where genassym.o is missing and assym.inc
is empty.

More work is planned around this to reduce some redundant dependency
generation in modules.

PR: 233339

5 years agoMFC 345041:
John Baldwin [Mon, 29 Apr 2019 21:39:09 +0000 (21:39 +0000)]
MFC 345041:
Update ccr(4) to note recent support for SHA2-224 and plain SHA hashes.

5 years agoMFC r346571,r346572:
Enji Cooper [Mon, 29 Apr 2019 19:34:09 +0000 (19:34 +0000)]
MFC r346571,r346572:

Update the spelling of my name

Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use Enji
instead for clarity.

While here, remove "All Rights Reserved" from copyrights I "own".

5 years agoMFC r345723:
Enji Cooper [Mon, 29 Apr 2019 19:32:11 +0000 (19:32 +0000)]
MFC r345723:

PROG_OVERRIDE_VARS should override default values if specified

The behavior prior to this change would not override default values if set in
`bsd.own.mk`, or (in the more general case) globally before `bsd.progs.mk` was
included. This affected `bsd.test.mk` as well, since it consumes
`bsd.progs.mk`.

Some examples of this failing behavior are as follows:

* `BINMODE` defaults to 0555 per `bsd.own.mk`. If someone wanted to set the
  `BINMODE` to `NOBINMODE` (0444) for `prog`, for example, like
  `BINMODE.prog= ${NOBINMODE}`, `bsd.progs.mk` would not honor the per-PROG
  setting.
* An application, `prog`, does not build at `WARNS?= 6`. Before this change,
  setting to a lower `WARNS` value, e.g., `WARNS.prog= 3`, would have been
  impossible, requiring that `prog` be built from another directory,
  the global `WARNS` be lowered, or a per-PROG value needing to be set
  across the board. None of the above workarounds is desirable.

This change unbreaks variables defined in `PROG_OVERRIDE_VARS` which have
defaults set before `bsd.progs.mk` is included, by setting them to their
defined values if set on a per-PROG basis.

5 years agoMFC r346539:
Enji Cooper [Mon, 29 Apr 2019 19:12:47 +0000 (19:12 +0000)]
MFC r346539:

Fix `get_int_via_sysctlbyname(..)` on Jenkins

Initialize `oldlen` to the size of the value, instead of leaving the value
unitialized. Leaving it unitialized seems to work by accident on amd64 when
running 64-bit programs, but not on i386.

This matches patterns in use in other programs.

PR: 237458
Tested on: ^/head (amd64), ^/stable/11 (i386)

5 years agoMFC r344192 (by sef): Add support for a virtual hostname to nfsd
Alexander Motin [Mon, 29 Apr 2019 19:10:24 +0000 (19:10 +0000)]
MFC r344192 (by sef): Add support for a virtual hostname to nfsd

Specifically, this allows (via "-V vhostname") telling nfsd what principal
to use, instead of the hostname.  This is used at iXsystems for fail-over in
HA systems.

Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D19191

5 years agoMFC r346542:
Enji Cooper [Mon, 29 Apr 2019 19:09:44 +0000 (19:09 +0000)]
MFC r346542:

Fix sys.kern.coredump_phnum_test.coredump_phnum on i386

The zero-padding when printing out the Size field is on 32-bit architectures is
5, not 15. Adjust the regular expression to work with both the 32-bit and
64-bit case.

5 years agoMFC r346113:
Mariusz Zaborski [Mon, 29 Apr 2019 18:56:39 +0000 (18:56 +0000)]
MFC r346113:
 libnv: fix compilation warnings

 When building libnv without a debug those arguments are no longer used
 because assertions will be changed to NOP.

 Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org>

5 years agoMFC r346112:
Mariusz Zaborski [Mon, 29 Apr 2019 18:54:39 +0000 (18:54 +0000)]
MFC r346112:
  libnv: fix compilation warnings

  When building libnv without a debug those arguments are no longer used
  because assertions will be changed to NOP.

  Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org>

MFC r346115:
  The nvlist_report_missing is also used by the cnvlist.
  It can't be a static one.

  Reported by:  jenkins

5 years agoMFC ar: implement support for /SYM64/ 64-bit archives
Ed Maste [Mon, 29 Apr 2019 18:34:11 +0000 (18:34 +0000)]
MFC ar: implement support for /SYM64/ 64-bit archives

r346079: ar: implement support for /SYM64/ 64-bit archives

Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: imp (earlier)

r346568: ar: test for writing 64-bit format only if symbol count is nonzero

This is a minor simplification; if we do not have any symbols the empty
symbol table can be in 32-bit format.

r346569: ar: use array notation to access s_so

This is somewhat more readable than pointer arithmetic.  Also remove an
unnecessary cast while here.

r346582: ar: shuffle symbol offsets during conversion for 32-bit ar archives

During processing we maintain symbol offsets in the 64-bit s_so array,
and when writing the archive convert to 32-bit if no offsets are greater
than 4GB.  However, this was somewhat inefficient as we looped over the
array twice: first, converting to big endian and second, writing each
32-bit value one at a time (and incorrectly so on big-endian platforms).

Instead, when writing a 32-bit archive shuffle convert symbol data to
big endian (as required by the ar format) and shuffle to the beginning
of the allocation at the same time.

Also correct emission of the symbol count on big endian platforms.

Further changes are planned, but this should fix powerpc64.

Reported by: jhibbits, mlinimon
Reviewed by: jhibbits, Gerald Aryeetey (earlier)
Tested by: jhibbits

PR: 234454
Sponsored by: The FreeBSD Foundation

5 years agoMFC r339648: ar: report errno on warning/error
Ed Maste [Mon, 29 Apr 2019 18:25:39 +0000 (18:25 +0000)]
MFC r339648: ar: report errno on warning/error

Previously ar would report an error like "ar: fatal: Write error"
without including additional errno information.  Change warnings and
errors to include archive_errno() so that the user may have some idea
of the reason for the failure.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r346016:
Mitchell Horne [Mon, 29 Apr 2019 16:16:00 +0000 (16:16 +0000)]
MFC r346016:
Add option to build LLVM RISC-V target

Approved by:  markj (mentor)

5 years agoMFC r346544:
Mark Johnston [Mon, 29 Apr 2019 13:20:24 +0000 (13:20 +0000)]
MFC r346544:
Clarify the relationship between INVARIANTS and DIAGNOSTIC a bit.