]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r356675 (by mhorne):
Mark Johnston [Fri, 24 Apr 2020 13:20:37 +0000 (13:20 +0000)]
MFC r356675 (by mhorne):
RISC-V: fix global symbol lookups for mpentry with lld

4 years agoMFC r360165:
Li-Wen Hsu [Fri, 24 Apr 2020 08:31:13 +0000 (08:31 +0000)]
MFC r360165:

Also update est(4) as r360162 and r360164

4 years agoMFC r359758:
Konstantin Belousov [Thu, 23 Apr 2020 09:48:02 +0000 (09:48 +0000)]
MFC r359758:
libc: Fix possible overflow in binuptime().

4 years agoMFC r359118: Fix race condition in catopen(3).
Xin LI [Thu, 23 Apr 2020 04:51:32 +0000 (04:51 +0000)]
MFC r359118: Fix race condition in catopen(3).

4 years agoMFC r359736: Always install backward compatibility timezones, as they
Xin LI [Thu, 23 Apr 2020 04:27:55 +0000 (04:27 +0000)]
MFC r359736: Always install backward compatibility timezones, as they
are installed on all major Linux distributions as well as NetBSD and
OpenBSD.

4 years agoMFC: r359720
Rick Macklem [Wed, 22 Apr 2020 21:08:08 +0000 (21:08 +0000)]
MFC: r359720
Fix an interoperability issue w.r.t. the Linux client and the NFSv4 server.

Luoqi Chen reported a problem on freebsd-fs@ where a Linux NFSv4 client
was able to open and write to a file when the file's permissions were
not set to allow the owner write access.

Since NFS servers check file permissions on every write RPC, it is standard
practice to allow the owner of the file to do writes, regardless of
file permissions. This provides POSIX like behaviour, since POSIX only
checks permissions upon open(2).
The traditional way NFS clients handle this is to check access via the
Access operation/RPC and use that to determine if an open(2) on the
client is allowed.

It appears that, for NFSv4, the Linux client expects the NFSv4 Open (not a
POSIX open) operation to fail with NFSERR_ACCES if the file is not being
created and file permissions do not allow owner access, unlike NFSv3.
Since both the Linux and OpenSolaris NFSv4 servers seem to exhibit this
behaviour, this patch changes the FreeBSD NFSv4 server to do the same.
A sysctl called vfs.nfsd.v4openaccess can be set to 0 to return the
NFSv4 server to its previous behaviour.

Since both the Linux and FreeBSD NFSv4 clients seem to exhibit correct
behaviour with the access check for file owner in Open enabled, it is enabled
by default.

Reported by: luoqi.chen@gmail.com

4 years agoMFC r359938:
Brooks Davis [Wed, 22 Apr 2020 17:14:02 +0000 (17:14 +0000)]
MFC r359938:

Remove bogus use of useracc() in (clock_)nanosleep.

There's no point in pre-checking that we can access the user's rmtp
pointer before we do it in copyout().

While here, improve style(9) compliance.

Reviewed by: imp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24409

4 years agoMFC 360074:
Mateusz Piotrowski [Wed, 22 Apr 2020 13:52:40 +0000 (13:52 +0000)]
MFC 360074:

Use the Ic macro for find(1) primaries consistently

4 years agoMFC r359897:
Navdeep Parhar [Wed, 22 Apr 2020 07:24:30 +0000 (07:24 +0000)]
MFC r359897:

cxgbe(4): Make sure 'flags' is at the same offset in structs toepcb and
synq_entry.  TAILQ_ENTRY isn't always the same size as two pointers.

Reported by: rmacklem@
Sponsored by: Chelsio Communications

4 years agoMFC r359952:
Navdeep Parhar [Wed, 22 Apr 2020 07:12:18 +0000 (07:12 +0000)]
MFC r359952:

cxgbe/iw_cxgbe: Do not start the EP timer if soaccept fails.

This fixes a panic that would occur when the timer tried to close a
stale socket.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

4 years agoMFC r358988: Remove unneeded checks for prelen.
Xin LI [Wed, 22 Apr 2020 05:54:46 +0000 (05:54 +0000)]
MFC r358988: Remove unneeded checks for prelen.

4 years agoMFC r360104: Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are
Xin LI [Wed, 22 Apr 2020 05:08:42 +0000 (05:08 +0000)]
MFC r360104: Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are
removing elements in the middle.

This fixes a panic when detaching USB mouse.

PR: 245732
Reviewed by: wulf

4 years agoMFC r348996 (by jtl):
Alexander Motin [Tue, 21 Apr 2020 16:52:56 +0000 (16:52 +0000)]
MFC r348996 (by jtl):
The current IPMI KCS code is waiting 100us for all transitions (roughly
between each byte either sent or received). However, most transitions
actually complete in 2-3 microseconds.

By polling the status register with a delay of 4us with exponential
backoff, the performance of most IPMI operations is significantly
improved:
  - A BMC update on a Supermicro x9 or x11 motherboard goes from ~1 hour
    to ~6-8 minutes.
  - An ipmitool sensor list time improves by a factor of 4.

Testing showed no significant improvements on a modern server by using
a lower delay.

The changes should also generally reduce the total amount of CPU or
I/O bandwidth used for a given IPMI operation.

4 years agoMFC: r360146
Gordon Tetlow [Tue, 21 Apr 2020 15:47:58 +0000 (15:47 +0000)]
MFC: r360146
Fix OpenSSL remote denial of service.

See https://www.openssl.org/news/secadv/20200421.txt for details.

Approved by: so
Security: FreeBSD-SA-20:11.openssl
Security: CVE-2020-1967

4 years agoMFC: r359679
Rick Macklem [Tue, 21 Apr 2020 04:47:42 +0000 (04:47 +0000)]
MFC: r359679
Fix noisy NFSv4 server printf.

Peter reported that his dmesg was getting cluttered with
nfsrv_cache_session: no session
messages when he rebooted his NFS server and they did not seem useful.
He was correct, in that these messages are "normal" and expected when
NFSv4.1 or NFSv4.2 are mounted and the server is rebooted.
This patch silences the printf() during the grace period after a reboot.
It also adds the client IP address to the printf(), so that the message
is more useful if/when it occurs. If this happens outside of the
server's grace period, it does indicate something is not working correctly.
Instead of adding yet another nd_XXX argument, the arguments for
nfsrv_cache_session() were simplified to take a "struct nfsrv_descript *".

4 years agoMFC r360053: hdac: update comment to match function name
Ed Maste [Mon, 20 Apr 2020 19:08:45 +0000 (19:08 +0000)]
MFC r360053: hdac: update comment to match function name

snd_hda was rewritten in r230130; one function retained a comment
referencing the previous name.

4 years agoMFC r348629 (by cem): daemon(8): Don't block SIGTERM during restart delay
Alexander Motin [Mon, 20 Apr 2020 16:31:05 +0000 (16:31 +0000)]
MFC r348629 (by cem): daemon(8): Don't block SIGTERM during restart delay

I believe this was introduced in the original '-r' commit, r231911 (2012).
At the time, the scope was limited to a 1 second sleep.  r332518 (2018)
added '-R', which increased the potential duration of the affected interval
(from 1 to N seconds) by permitting arbitrary restart intervals.

Instead, handle SIGTERM normally during restart-sleep, when the monitored
process is not running, and shut down promptly.

(I noticed this behavior when debugging a child process that exited quickly
under the 'daemon -r -R 30' environment.  'kill <daemonpid>' had no
immediate effect and the monitor process slept until the next restart
attempt.  This was annoying.)

4 years agoMFC r359894:
Mark Johnston [Mon, 20 Apr 2020 13:19:23 +0000 (13:19 +0000)]
MFC r359894:
snd_hda(4): Recognize the ALC257 codec.

PR: 245524

4 years agoMFC r359893:
Mark Johnston [Mon, 20 Apr 2020 13:18:36 +0000 (13:18 +0000)]
MFC r359893:
Fix sendto() on unconnected SOCK_STREAM/SEQPACKET unix sockets.

4 years agoMFC r360040: jail(8): improve manual and usage information
Eugene Grosbein [Mon, 20 Apr 2020 08:12:40 +0000 (08:12 +0000)]
MFC r360040: jail(8): improve manual and usage information
with more clear description for "jail -e" mode
to show that it does not take additional jail name argument.

Reported by: David Marec <david.marec@davenulle.org>

4 years agoMFC: r359643
Rick Macklem [Mon, 20 Apr 2020 01:17:00 +0000 (01:17 +0000)]
MFC: r359643
Change the xid for client side krpc over UDP to a global value.

Without this patch, the xid used for the client side krpc requests over
UDP was initialized for each "connection". A "connection" for UDP is
rather sketchy and for the kernel NLM a new one is created every 2minutes.
A problem with client side interoperability with a Netapp server for the NLM
was reported and it is believed to be caused by reuse of the same xid.
Although this was never completely diagnosed by the reporter, I could see
how the same xid might get reused, since it is initialized to a value
based on the TOD clock every two minutes.
I suspect initializing the value for every "connection" was inherited from
userland library code, where having a global xid was not practical.
However, implementing a global "xid" for the kernel rpc is straightforward
and will ensure that an xid value is not reused for a long time. This
patch does that and is hoped it will fix the Netapp interoperability
problem.

PR: 245022

4 years agoMFC r358848:
Michael Reifenberger [Sun, 19 Apr 2020 17:19:29 +0000 (17:19 +0000)]
MFC r358848:

Untangle TPR shadowing and APIC virtualization.
  This speeds up Windows guests tremendously.

  The patch does:
  Add a new tuneable 'hw.vmm.vmx.use_tpr_shadowing' to disable TLP shadowing.
  Also add 'hw.vmm.vmx.cap.tpr_shadowing' to be able to query if TPR shadowing is used.

  Detach the initialization of TPR shadowing from the initialization of APIC virtualization.
  APIC virtualization still needs TPR shadowing, but not vice versa.
  Any CPU that supports APIC virtualization should also support TPR shadowing.

  When TPR shadowing is used, the APIC page of each vCPU is written to the VMCS_VIRTUAL_APIC field of the VMCS
  so that the CPU can write directly to the page without intercept.

  On vm exit, vlapic_update_ppr() is called to update the PPR.

  GeƤnderte Pfade:
     M /head/sys/amd64/vmm/intel/vmx.c M /head/sys/amd64/vmm/io/vlapic.c M
     /head/sys/amd64/vmm/io/vlapic.h

Submitted by: Yamagi Burmeister
Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D22942

4 years agoMFC r360025: Alert devd when acpi_video brightness changes
Colin Percival [Sun, 19 Apr 2020 02:49:05 +0000 (02:49 +0000)]
MFC r360025: Alert devd when acpi_video brightness changes

4 years agoMFC r359634:
Konstantin Belousov [Sat, 18 Apr 2020 03:14:16 +0000 (03:14 +0000)]
MFC r359634:
Make p_vaddr % p_align == p_offset % p_align for (some) TLS segments.

4 years agoMFC r359778:
Mark Johnston [Fri, 17 Apr 2020 13:50:26 +0000 (13:50 +0000)]
MFC r359778:
Properly handle disconnected sockets in uipc_ready().

4 years agoMFC 359916:
Mateusz Piotrowski [Fri, 17 Apr 2020 07:40:56 +0000 (07:40 +0000)]
MFC 359916:

Improve manual page formatting

- Use appropriate macros for command arguments.
- Increase option list indentation for better readability.

4 years agoMFC r359766:
Konstantin Belousov [Fri, 17 Apr 2020 01:06:51 +0000 (01:06 +0000)]
MFC r359766:
ufs: apply suspension for non-forced rw unmounts.

4 years agoMFC r359801: wc(1): document SIGINFO handling in the manual page.
Eugene Grosbein [Thu, 16 Apr 2020 11:47:53 +0000 (11:47 +0000)]
MFC r359801: wc(1): document SIGINFO handling in the manual page.

4 years agoMFC r348873: Enable touch and trackpads by default
Niclas Zeising [Wed, 15 Apr 2020 19:47:19 +0000 (19:47 +0000)]
MFC r348873: Enable touch and trackpads by default

Enable synaptics and elantech touchpads, as well as IBM/Lenovo TrackPoints
by default, instead of having users find and toggle a loader tunable.
This makes things like two finger scroll and other modern features work out
of the box with X.  By enabling these settings by default, we get a better
desktop experience in X, since xserver and evdev can make use of the more
advanced synaptics and elantech features.

Approved by: imp

4 years agoMFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.
Alexander Motin [Wed, 15 Apr 2020 13:59:51 +0000 (13:59 +0000)]
MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.

JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1.
JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2.

Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors.

4 years agoMFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.
Alexander Motin [Wed, 15 Apr 2020 13:58:42 +0000 (13:58 +0000)]
MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.

JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1.
JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2.

Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors.

4 years agoMFC 359125:
Mateusz Piotrowski [Wed, 15 Apr 2020 08:11:19 +0000 (08:11 +0000)]
MFC 359125:

Document geli(8) loader variables conventions

The geli(8) manual page has an example for preloading keyfiles during boot.
There is no detail though on how the lookup of these variables actually
works.

Let's document that the name of a device does not have to be a part
of the variable.

PR: 243261
Submitted by: johannes@jo-t.de
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D24114

4 years agoMFC r359727:
Hans Petter Selasky [Wed, 15 Apr 2020 04:56:27 +0000 (04:56 +0000)]
MFC r359727:
Clone the RCU interface into a sleepable and a non-sleepable part
in the LinuxKPI.

This allows synchronize RCU to be used inside a SRCU read section.
No functional change intended.

Bump the __FreeBSD_version to force recompilation of external kernel modules.

PR: 242272
Sponsored by: Mellanox Technologies

4 years agoMFC r359726:
Hans Petter Selasky [Wed, 15 Apr 2020 04:52:10 +0000 (04:52 +0000)]
MFC r359726:
Some fixes for SRCU in the LinuxKPI.
- Make sure to use READ_ONCE() when deferring variables.
- Remove superfluous zero initializer.

Sponsored by: Mellanox Technologies

4 years agoMFC r359520:
Konstantin Belousov [Wed, 15 Apr 2020 00:36:00 +0000 (00:36 +0000)]
MFC r359520:
x86 tsc: fall back to CPUID if calibration results looks unbelievable.

4 years agoMFC of 359627
Kirk McKusick [Wed, 15 Apr 2020 00:18:19 +0000 (00:18 +0000)]
MFC of 359627

Update dump and restore to compile with -fno-common.

4 years agoadd my (rscheff) mentor relationship
Richard Scheffenegger [Tue, 14 Apr 2020 18:24:59 +0000 (18:24 +0000)]
add my (rscheff) mentor relationship

Reviewed by: rgrimes (mentor), tuexen (mentor)
Approved by: rgrimes (mentor), tuexen (mentor)
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24318

4 years agoMFC: r356618, r357959, r359346
Jung-uk Kim [Tue, 14 Apr 2020 08:34:34 +0000 (08:34 +0000)]
MFC: r356618, r357959, r359346

Merge ACPICA 20200326.

4 years agoDo not claim libbearssl et al are INTERNALLIB
Simon J. Gerraty [Tue, 14 Apr 2020 01:07:58 +0000 (01:07 +0000)]
Do not claim libbearssl et al are INTERNALLIB

If INTERNALLIB is defined we need PIE and bsd.incs.mk is
not included.

MFC of r359502

PR: 245189
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org//D24233

4 years agoInclude ${.CURDIR}/local.init.mk if it exists
Simon J. Gerraty [Tue, 14 Apr 2020 01:05:11 +0000 (01:05 +0000)]
Include ${.CURDIR}/local.init.mk if it exists

This is handy for making local hacks to an app
(eg to build it as tool for non-BSD host)
without making a mess of the code base.

MFC of r359488

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org//D24101

4 years agoImprove interaction of vectx and tftp
Simon J. Gerraty [Tue, 14 Apr 2020 00:57:50 +0000 (00:57 +0000)]
Improve interaction of vectx and tftp

On slow platforms, it helps to spread the hashing load
over time so that tftp does not timeout.

Also, some .4th files are too big to fit in cache of pkgfs,
so increase cache size and ensure fully populated.

MFC of r359700

Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D24287

4 years agoMFC r359428:
Vladimir Kondratyev [Mon, 13 Apr 2020 22:18:49 +0000 (22:18 +0000)]
MFC r359428:
evdev: Add COMPAT_FREEBSD32 support for amd64 arch

Incompatibility between i386 and amd64 evdev ABIs was caused by presence of
'struct timeval' in evdev protocol. Replace it with 'struct timeval32' for
32 bit binaries.

Big-endian platforms may require additional work due to bitstr_t (array of
unsigned longs) usage in ioctl interface.

MFC r359429:
evdev: return error rather than zero-length data on blocked read()
if blocked process has been woken up by evdev device destruction.

4 years agoMFC r359903:
Li-Wen Hsu [Mon, 13 Apr 2020 21:23:39 +0000 (21:23 +0000)]
MFC r359903:

Ensure `kyua list` working when there is no /dev/nvme*

Sponsored by: The FreeBSD Foundation

4 years agoMFC r359446:
Hans Petter Selasky [Mon, 13 Apr 2020 16:33:10 +0000 (16:33 +0000)]
MFC r359446:
Add support for multiple playback and recording devices per physical USB audio
device. This requires some structural refactoring inside the driver, mostly
about converting existing audio channel structures into arrays.

The main audio mixer is provided by the first PCM instance.
The non-first audio instances may only have a software mixer for PCM playback.

Tested by: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r359440:
Hans Petter Selasky [Mon, 13 Apr 2020 16:31:13 +0000 (16:31 +0000)]
MFC r359440:
Implement new mixer API to return the device pointer based on the mixer pointer.

Sponsored by: Mellanox Technologies

4 years agoMFC r359356:
Hans Petter Selasky [Mon, 13 Apr 2020 16:29:03 +0000 (16:29 +0000)]
MFC r359356:
Change default microphone level from 0 to 25.

Discussed with: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r359355:
Hans Petter Selasky [Mon, 13 Apr 2020 16:27:05 +0000 (16:27 +0000)]
MFC r359355:
Improve USB audio mixer support for USB audio class 1 and 2.
- make sure volume controls are correctly mapped to "pcm" and "rec" depending
  on how they deliver audio to the USB host.
- make sure there are no duplicate record selections.
- remove internal only mixer class type.
- don't add software volume controls for recording only.
- some minor mixer code cleanup.

Tested by: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r359323:
Hans Petter Selasky [Mon, 13 Apr 2020 16:25:11 +0000 (16:25 +0000)]
MFC r359323:
Be more intelligent when classifying USB audio terminal types, so that we
don't end up using SOUND_MIXER_VOLUME for all undefined types.

Sponsored by: Mellanox Technologies

4 years agoMFC r359322:
Hans Petter Selasky [Mon, 13 Apr 2020 16:23:10 +0000 (16:23 +0000)]
MFC r359322:
Make mute controls available for USB audio mixers.

Submitted by: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r359321:
Hans Petter Selasky [Mon, 13 Apr 2020 16:21:03 +0000 (16:21 +0000)]
MFC r359321:
Factor out USB audio mixer value range check.

Sponsored by: Mellanox Technologies

4 years agoMFC r359320:
Hans Petter Selasky [Mon, 13 Apr 2020 16:18:38 +0000 (16:18 +0000)]
MFC r359320:
Avoid scaling USB audio mixer values twice.

Sponsored by: Mellanox Technologies

4 years agoMFC r359209:
Hans Petter Selasky [Mon, 13 Apr 2020 16:14:21 +0000 (16:14 +0000)]
MFC r359209:
Add new USB ID.

Submitted by: Konrad Jopek <kjopek@gmail.com>
Differential Revision: https://reviews.freebsd.org/D24142
Sponsored by: Mellanox Technologies

4 years agoMFC r359862:
Li-Wen Hsu [Mon, 13 Apr 2020 14:43:35 +0000 (14:43 +0000)]
MFC r359862:

Install expected output file of test missed in r359585

Sponsored by: The FreeBSD Foundation

4 years agoMFC r359662: Relax too strict SES element descriptors check in r355430.
Alexander Motin [Mon, 13 Apr 2020 13:33:01 +0000 (13:33 +0000)]
MFC r359662: Relax too strict SES element descriptors check in r355430.

SES specifications allows the string to be NULL-terminated, while previous
code was considering it as invalid due to incorrectly ordered conditions.

4 years agoMFC r359724:
Hans Petter Selasky [Mon, 13 Apr 2020 09:08:47 +0000 (09:08 +0000)]
MFC r359724:
Account out of buffer as dropped packets in mlx5en(4).

Sponsored by: Mellanox Technologies

4 years agoMFC r359723:
Hans Petter Selasky [Mon, 13 Apr 2020 09:04:32 +0000 (09:04 +0000)]
MFC r359723:
Remove obsolete bufring stats in mlx5en(4).

Leftover from when DRBR was removed.

Sponsored by: Mellanox Technologies

4 years agoMFC r359653:
Hans Petter Selasky [Mon, 13 Apr 2020 08:56:19 +0000 (08:56 +0000)]
MFC r359653:
Count number of times transmit ring is out of buffers in mlx5en(4).

Differential Revision: https://reviews.freebsd.org/D24273
Sponsored by: Mellanox Technologies

4 years agoMFC r359655:
Hans Petter Selasky [Mon, 13 Apr 2020 08:41:24 +0000 (08:41 +0000)]
MFC r359655:
Don't drop packets having too many TCP option headers in mlx5en(4).

When using SACK it can happen there are multiple option headers.
Don't drop these packets, but instead limit the amount of inlining
to the maximum supported.

Sponsored by: Mellanox Technologies

4 years agoMFC r359654:
Hans Petter Selasky [Mon, 13 Apr 2020 08:27:19 +0000 (08:27 +0000)]
MFC r359654:
Ensure a minimum inline size of 16 bytes in mlx5en(4).

This includes 14 bytes of ethernet header and 2 bytes of VLAN header.

This allows for making assumptions about the inline size limit
in the fast transmit path later on.

Use a signed integer variable to catch underflow.

Sponsored by: Mellanox Technologies

4 years agoMFC r359756:
Justin Hibbits [Mon, 13 Apr 2020 00:50:35 +0000 (00:50 +0000)]
MFC r359756:

Add support for BCM54618SE PHY

Sponsored by:   Juniper Networks, Inc

4 years agoMFC r359451: capabilities.conf: add info about capmode permitted syscalls
Ed Maste [Mon, 13 Apr 2020 00:38:02 +0000 (00:38 +0000)]
MFC r359451: capabilities.conf: add info about capmode permitted syscalls

Sponsored by: The FreeBSD Foundation

4 years agoMFC r359717:
David Bright [Sun, 12 Apr 2020 22:11:29 +0000 (22:11 +0000)]
MFC r359717:

Add a basic test for nvmecontrol

I recently made some bug fixes in nvmecontrol. It occurred to me that
since nvmecontrol lacks any kyua tests, I should convert the informal
testing I did into a more formal automated test. The test in this
change should be considered just a starting point; it is neither
complete nor thorough. While converting the test to ATF/kyua, I
discovered a small bug in nvmecontrol; the nvmecontrol devlist command
would always exit with an unsuccessful status. So I included the fix
for that, too, so that the test won't fail.

Sponsored by: Dell EMC Isilon

4 years agoMFC r359367
Chuck Tuffli [Sun, 12 Apr 2020 19:25:28 +0000 (19:25 +0000)]
MFC r359367

bhyve: fix NVMe emulation update of SQHD

4 years agoMFC r359366
Chuck Tuffli [Sun, 12 Apr 2020 19:21:44 +0000 (19:21 +0000)]
MFC r359366

bhyve: fix NVMe emulation missed interrupts

4 years agoMFC r359365
Chuck Tuffli [Sun, 12 Apr 2020 19:18:26 +0000 (19:18 +0000)]
MFC r359365

bhyve: use STAILQ in NVMe emulation

4 years agoMFC r359364
Chuck Tuffli [Sun, 12 Apr 2020 19:14:27 +0000 (19:14 +0000)]
MFC r359364

bhyve: implement NVMe deallocate command

4 years agoMFC r359363
Chuck Tuffli [Sun, 12 Apr 2020 19:02:34 +0000 (19:02 +0000)]
MFC r359363

bhyve: refactor NVMe namespace initialization

4 years agoMFC r359362
Chuck Tuffli [Sun, 12 Apr 2020 15:30:00 +0000 (15:30 +0000)]
MFC r359362

bhyve: refactor NVMe PRP memcpy

4 years agoMFC r359498:
Andrey V. Elsukov [Sat, 11 Apr 2020 09:35:48 +0000 (09:35 +0000)]
MFC r359498:
  Ignore ND6 neighbor advertisement received for static link-layer entries.

  Previously such NA could override manually created LLE.

  Reported by: Martin Beran <martin at mber cz>

4 years agoMFC: r359631
Yoshihiro Takahashi [Sat, 11 Apr 2020 07:31:16 +0000 (07:31 +0000)]
MFC: r359631

Remove extra spaces for the load average of machines that are down.

PR: 245296
Submitted by: martin _at_ lispworks.com

4 years agoMFC r359501: deadlkres: include thread name in panic messages
Jason A. Harmening [Sat, 11 Apr 2020 05:12:38 +0000 (05:12 +0000)]
MFC r359501: deadlkres: include thread name in panic messages

4 years agoMFC r359585, r359587
Oleksandr Tymoshenko [Fri, 10 Apr 2020 22:18:13 +0000 (22:18 +0000)]
MFC r359585, r359587

r359585:
Fix calculation of the recurring weekdays

Both the result of the first_dayofweek_of_year and the target
weekday are zero-based (0 fo sunday) while the target month-day
or year-day is 1-based. Adjust logic accordingly.

Also add testcase for this PR to the kyua test suite

PR: 201062
Submitted by: Richard Narron <comet.berkeley@gmail.com>

r359587:
Remove hardcoded US Election Day from calendar.usholiday

calendar(1) syntax is not capable of representing the rules for the
US Election Day. The hardcoded date was set in r15066 in 1996 and
hasn't changed since then.

PR: 173389
Reported by: Steve Ames <steve@energistic.com>

4 years agoveloader use vectx API for kernel and modules
Simon J. Gerraty [Fri, 10 Apr 2020 05:13:15 +0000 (05:13 +0000)]
veloader use vectx API for kernel and modules

The vectx API, computes the hash for verifying a file as it is read.
This avoids the overhead of reading files twice - once to verify, then
again to load.

For doing an install via loader, avoiding the need to rewind
large files is critical.

This API is only used for modules, kernel and mdimage as these are the
biggest files read by the loader.
The reduction in boot time depends on how expensive the I/O is
on any given platform.  On a fast VM we see 6% improvement.

For install via loader the first file to be verified is likely to be the
kernel, so some of the prep work (finding manifest etc) done by
verify_file() needs to be factored so it can be reused for
vectx_open().

For missing or unrecognized fingerprint entries, we fail
in vectx_open() unless verifying is disabled.

Otherwise fingerprint check happens in vectx_close() and
since this API is only used for files which must be verified
(VE_MUST) we panic if we get an incorrect hash.

MFC of r358811

Reviewed by: imp,tsoome
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org//D23827

4 years agoMFC r359596:
Mark Johnston [Fri, 10 Apr 2020 01:37:00 +0000 (01:37 +0000)]
MFC r359596:
xargs: Fix exit status expression when a child process fails to exec.

PR: 244327

4 years agoMFC r359595:
Mark Johnston [Fri, 10 Apr 2020 01:23:06 +0000 (01:23 +0000)]
MFC r359595:
geom_journal: Only stop the switcher process if one was started.

PR: 243196

4 years agoMFC r359680: mail/gprof/tip: tap with the ugly stick
Kyle Evans [Fri, 10 Apr 2020 00:27:19 +0000 (00:27 +0000)]
MFC r359680: mail/gprof/tip: tap with the ugly stick

The ugly stick here is this bit in the respective headers:

#ifndef EXTERN
#define EXTERN extern
#endif

with a follow-up #define EXTERN in a single .c file to push all of their
definitions into one spot. A pass should be made over these three later to
push these definitions into the correct files instead, but this will suffice
for now and at a more leisurely pace.

4 years agoMFC r359689: config(8): "fix" a couple of buffer overflows
Kyle Evans [Fri, 10 Apr 2020 00:25:14 +0000 (00:25 +0000)]
MFC r359689: config(8): "fix" a couple of buffer overflows

Recently added/changed lines in various kernel configs have caused some
buffer overflows that went undetected. These were detected with a config
built using -fno-common as these line buffers smashed one of our arrays,
then further triaged with ASAN.

Double the sizes; this is really not a great fix, but addresses the
immediate need until someone rewrites config. While here, add some bounds
checking so that we don't need to detect this by random bus errors or other
weird failures.

4 years agoMFC r359688: stand: -fno-common fixes for !x86 loaders
Kyle Evans [Fri, 10 Apr 2020 00:23:34 +0000 (00:23 +0000)]
MFC r359688: stand: -fno-common fixes for !x86 loaders

- beriloader: archsw is declared extern and defined elsewhere
- ofwloader: ofw_elf{,64} are defined in elf_freebsd.c and
  ppc64_elf_freebsd.c respectively
- ubldr: syscall_ptr is defined in start.S for whichever ubldr platform is
  building

-fno-common will become the default in GCC10/LLVM11.

4 years agogas: mark dwarf2_loc_mark_labels as extern
Kyle Evans [Thu, 9 Apr 2020 20:49:01 +0000 (20:49 +0000)]
gas: mark dwarf2_loc_mark_labels as extern

Compiling with -fno-common complains as this header's included in multiple
compilation units. In fact, the proper definition of dwarf2_loc_mark_labels
already exists in dwarf2dbg.c, so simply mark this declaration with extern.

4 years agoMFC -fno-common fixes: r359389, r359394, r359397-r359399, r359403-r359404,
Kyle Evans [Thu, 9 Apr 2020 20:35:35 +0000 (20:35 +0000)]
MFC -fno-common fixes: r359389, r359394, r359397-r359399, r359403-r359404,
r359406, r359413-r359416, r359424-r359425, r359427, r359432-r359433,
r359443, r359675-r359678

Note: this is not necessarily a complete fix to get these programs to build
with -fno-common applied; further work may be needed in this branch.

r359389:
config(8): fixes for -fno-common

Move this handful of definitions into main.c, properly declare these as
extern in config.h. This fixes the config(8) build with -fno-common.

Unexplained in my previous commit to gas, -fno-common will become the
default in GCC10 and LLVM11, so it's worth addressing these in advance.

r359394:
MFV r359393: tcsh: import 6974bc35a5cd

This removes an extra variable definition that causes the -fno-common build
to fail, which will be a new default in GCC10/LLVM11.

r359397:
zfs: fix -fno-common issues

A similar (or identical?) fix has already landed in OpenZFS.

-fno-common will become the default in GCC10/LLVM11.

r359398:
sh: remove duplicate el definition

el is declared extern in myhistedit.h and defined in histedit.c. Remove the
duplicate definition in input.c to appease the -fno-common build.

-fno-common will become the default in GCC10/LLVM11.

r359399:
telnet: remove some duplicate definitions, mark terminaltype extern

Most of these were already properly declared and defined elsewhere, this is
effectively just a minor cleanup that fixes the -fno-common build.

-fno-common will become the default in GCC10/LLVM11.

r359403:
Revert 359399: telnet -fno-common bits

There was a large misfire from my local diff that I need to investigate, and
this version committed did not build.

r359404:
Re-apply r359399: telnet -fno-common fix

line and auth_level's redefinitions are just extraneous

telnetd will #define extern and then include ext.h to allocate storage for
all of these extern'd vars; however, two of them are actually defined in
libtelnet instead. Instead of doing an #ifdef extern dance around those
function pointers, just add an EXTERN macro to make it easier to
differentiate by sight which ones will get allocated in globals.c and which
ones are defined elsewhere.

r359406:
telnet: kill off remaining duplicate definition

r359413:
ipfilter: remove duplicate definition of 'thishost'

thishost is already defined in lib/initparse.c; no need for this one. This
fixes the ipfilter build with -fno-common.

-fno-common will become the default in GCC10/LLVM11.

r359414:
iscontrol: move definition of vflag/iscsidev to iscontrol.c

Mark the declaration extern as these are used elsewhere; this fixes the
build with -fno-common.

r359415:
userboot: mark host_fsops as extern

This is already defined elsewhere; mark this declaration extern to the fix
the -fno-common build.

r359416:
systat: remove redundant definition of kd

kd is already properly declared in extern.h and defined in main.c, rendering
this definition useless. This fixes the -fno-common build.

r359424:
openssh: -fno-common fix from upstream f47d72ddad

This is currently staged in vendor/ as part of the 8.0p1 import, which isn't
quite ready to land. Given that this is a simple one-line fix, apply it now
as the fallout will be pretty minimal.

-fno-common will become the default in GCC10/LLVM11.

r359425:
locate: fix -fno-common build

Just a single variable declaration to extern and define elsewhere here,
myctype.

-fno-common will become a default in GCC10/LLVM11.

r359427:
fsck_ffs/fsdb: fix -fno-common build

This one is also a small list:

- 3x duplicate definition (ufs2_zino, returntosingle, nflag)
- 5x 'needs extern', 3/5 of which are referenced in fsdb

-fno-common will become the default in GCC10/LLVM11.

r359432:
gdb: compile with -fcommon explicitly

As described in the comment, gdb relies on some of the linker magic that
happens with -fcommon. I suspect the life expectancy of gdb-in-base is low
enough that this isn't worth spending much time addressing, especially given
the vintage. Hit it with the -fcommon hammer so that it continues to just
work.

r359433:
bmake: fix -fno-common build

debug was declared extern, but debug_file was not; correct this and define
debug_file in main.c (as debug is) to fix the -fno-common build.

-fno-common will become the default with GCC10/LLVM11.

r359443:
MFV r359442: bmake: import -fno-common fix build back from upstream

sjg@ committed the local patch previously committed upstream; pull it in to
vendor/ to ease any potential stress of future imports.

r359675:
kqueue tests: fix -fno-common build

vnode_fd and kqfd are both shared among multiple CU; define them exactly
once.

In the case of vnode_fd, it was simply the declaration that needed
correction.

-fno-common will become the default in GCC10/LLVM11.

r359676:
ntpd: fix build with -fno-common

Only a small nit here: psl should be declared extern and defined exactly
once.

-fno-common will become the default in GCC10/LLVM11.

r359677:
yp*: fix -fno-common build

This is mostly two problems spread out far and wide:
- ypldap_process should be declared properly
- debug is defined differently in many programs

For the latter, just extern it and define it everywhere that actually needs
it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the
assignment at the beginning of main in favor of defining it properly.

-fno-common will become the default in GCC10/LLVM11.

r359678:
indent: fix the -fno-common build

Spread the globals far and wide, hopefully to the files that make the most
sense.

-fno-common will become the default in GCC10/LLVM11.

4 years agoMFC r359562:
David Bright [Thu, 9 Apr 2020 18:17:07 +0000 (18:17 +0000)]
MFC r359562:

Fix various Coverity-detected errors in nvmecontrol

This fixes several Coverity-detected errors in nvmecontrol. While in
here, a couple additional errors with shift/mask confusion that were
not diagnosed by Coverity are also fixed.

CIDs addressed: 104029910403001403972140397314039851403988,
1403990140437414044271404469140451014045341418118

CID 1403657 (resource leak of shared library handle) was marked
"intentional" in the Coverity scan database.

Sponsored by: Dell EMC Isilon

4 years agoMFC (effectively) r359645: src.conf(5): re-roll after LLVM_ASSERTIONS
Kyle Evans [Thu, 9 Apr 2020 16:24:57 +0000 (16:24 +0000)]
MFC (effectively) r359645: src.conf(5): re-roll after LLVM_ASSERTIONS

On stable/12, this ends up including just a couple other things that
src.conf(5) hadn't been regenerated for.

4 years agoMFV r359401: OpenBSM: import ee79d73e8df5: auditreduce: add a zone filter
Kyle Evans [Thu, 9 Apr 2020 16:02:20 +0000 (16:02 +0000)]
MFV r359401: OpenBSM: import ee79d73e8df5: auditreduce: add a zone filter

This allows one to select audit records that match a -z zone glob.

4 years agoMFC r359644: llvm: add a build knob for enabling assertions
Kyle Evans [Thu, 9 Apr 2020 15:58:06 +0000 (15:58 +0000)]
MFC r359644: llvm: add a build knob for enabling assertions

For head/, this will remain eternally default-on to maintain the status quo.
For stable/ branches, it should be flipped to default-off to maintain the
status quo.

There's value in being able to flip it one way or the other easily on head
or stable branches, whether you want to gain some performance back on head/
(for machines there's little chance you'll actually hit an assertion) or
potentially diagnose a problem with the version of llvm on an older branch.

Currently, stable branches get the CFLAGS+= -ndebug line uncommented; going
forward, they will instead have the default of LLVM_ASSERTIONS flipped.

[MFC note: that last comment just happened for these two branches]

4 years agoMFC r359327,359328:
Andrey V. Elsukov [Thu, 9 Apr 2020 07:11:59 +0000 (07:11 +0000)]
MFC r359327,359328:
  Add property-based filters for syslogd.

  Property-based filters allow substring and regular expressions
  (see re_format(7)) matching against various message attributes.
  Filter specification starts with '#:' or ':' followed by three
  comma-separated fields property, operator, "value". Value must be
  double-quoted. A double quote and backslash must be escaped by a
  backslash.

  Following properties are supported as test value:
  o msg - body of the message received;
  o programname - program name sent the message;
  o hostname - hostname of message's originator;
  o source - an alias for hostname.

  Supported operators:
  o contains - true if filter value is found as a substring of property;
  o isequal - true if filter value is equal to property;
  o startswith - true if property starts with filter value;
  o regex - true if property matches basic regular expression defined
      in filter value;
  o ereregex - true if property matches extended regular expression
      defined in filter value;

  Operator may be prefixed by '!' to invert compare logic or by
  'icase_' to make comparison function case insensitive.

  Submitted by: Boris N. Lytochkin <lytboris at gmail com>
  Relnotes: yes
  Differential Revision: https://reviews.freebsd.org/D23468

4 years agoRevert MFC of 359612 due to reported problems.
Kirk McKusick [Thu, 9 Apr 2020 06:32:51 +0000 (06:32 +0000)]
Revert MFC of 359612 due to reported problems.

4 years agoveloader use vectx API for kernel and modules
Simon J. Gerraty [Thu, 9 Apr 2020 04:50:19 +0000 (04:50 +0000)]
veloader use vectx API for kernel and modules

The vectx API, computes the hash for verifying a file as it is read.
This avoids the overhead of reading files twice - once to verify, then
again to load.

For doing an install via loader, avoiding the need to rewind
large files is critical.

This API is only used for modules, kernel and mdimage as these are the
biggest files read by the loader.
The reduction in boot time depends on how expensive the I/O is
on any given platform.  On a fast VM we see 6% improvement.

For install via loader the first file to be verified is likely to be the
kernel, so some of the prep work (finding manifest etc) done by
verify_file() needs to be factored so it can be reused for
vectx_open().

For missing or unrecognized fingerprint entries, we fail
in vectx_open() unless verifying is disabled.

Otherwise fingerprint check happens in vectx_close() and
since this API is only used for files which must be verified
(VE_MUST) we panic if we get an incorrect hash.

Fix pkgfs stat so it satisfies libsecureboot

We need a valid st_dev, st_ino and st_mtime
to correctly track which files have been verified
and to update our notion of time.

ve_utc_set(): ignore utc if it would jump our current time
by more than VE_UTC_MAX_JUMP (20 years).

Allow testing of install command via userboot.
Need to fix its stat implementation too.

bhyveload also needs stat fixed - due to change to userboot.h

Call ve_error_get() from vectx_close() when hash is wrong.

Track the names of files we have hashed into pcr

For the purposes of measured boot, it is important
to be able to reproduce the hash reflected in
loader.ve.pcr
so loader.ve.hashed provides a list of names in the order they
were added.

Avoid unused vars when VE_ECDSA_HASH_AGAIN undefined

MFC of r358744 r358767 r359307 r355962

Reviewed by: imp,tsoome,emaste
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org//D23827 https://reviews.freebsd.org//D24027

4 years agoMFC r359303
Ryan Moeller [Wed, 8 Apr 2020 06:06:13 +0000 (06:06 +0000)]
MFC r359303

MFOpenZFS: ZVOLs should not be allowed to have children

zfs create, receive and rename can bypass this hierarchy rule. Update
both userland and kernel module to prevent this issue and use pyzfs
unit tests to exercise the ioctls directly.

Note: this commit slightly changes zfs_ioc_create() ABI. This allow to
differentiate a generic error (EINVAL) from the specific case where we
tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Approved by:    mav (mentor)
openzfs/zfs@d8d418ff0cc90776182534bce10b01e9487b63e4

4 years agoMFC r349729:
Bryan Drewery [Tue, 7 Apr 2020 19:44:37 +0000 (19:44 +0000)]
MFC r349729:

  Consider *clean targets as non-build targets as well.

4 years agoMFC r353771:
Bryan Drewery [Tue, 7 Apr 2020 19:40:11 +0000 (19:40 +0000)]
MFC r353771:

  Fix spelling of DPSRCS.

4 years agoMFC r357353:
Bryan Drewery [Tue, 7 Apr 2020 19:39:08 +0000 (19:39 +0000)]
MFC r357353:

  make all is needed to generate .depend.*

4 years agoMFC r359289:
Mitchell Horne [Tue, 7 Apr 2020 18:41:52 +0000 (18:41 +0000)]
MFC r359289:

Makefile.inc1: override MACHINE for native-xtools

4 years agoMFC r357053 by markj: ng_nat: Pass IPv6 packets through.
Eugene Grosbein [Tue, 7 Apr 2020 17:49:36 +0000 (17:49 +0000)]
MFC r357053 by markj: ng_nat: Pass IPv6 packets through.

ng_nat implements NAT for IPv4 traffic only.  When connected to an
ng_ether node it erroneously handled IPv6 packets as well.

This change is not sufficient: ng_nat does not do any validation of IP
packets in this mode, even though they have not yet passed through
ip_input().

PR: 243096
Reported by: Robert James Hernandez <rob@sarcasticadmin.com>
Reviewed by: julian
Differential Revision: https://reviews.freebsd.org/D23080

4 years agoMFC r356943,356944: Correct "service ipfw status" for INET6-only systems.
Eugene Grosbein [Tue, 7 Apr 2020 16:52:45 +0000 (16:52 +0000)]
MFC r356943,356944: Correct "service ipfw status" for INET6-only systems.

4 years agoMFC r342168,357786: Allow ng_nat to be attached to a ethernet interface
Eugene Grosbein [Tue, 7 Apr 2020 16:44:14 +0000 (16:44 +0000)]
MFC r342168,357786: Allow ng_nat to be attached to a ethernet interface

Allow ng_nat to be attached to a ethernet interface directly via ng_ether(4)
or the likes. Add new control message types: setdlt and getdlt to switch
from default DLT_RAW (no encapsulation) to DLT_EN10MB (ethernet).

Submitted by: sobomax
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D18535
Relnotes: yes

4 years agoMFC r357092,357787: Add support for RFC 6598/Carrier Grade NAT subnets
Eugene Grosbein [Tue, 7 Apr 2020 16:27:58 +0000 (16:27 +0000)]
MFC r357092,357787: Add support for RFC 6598/Carrier Grade NAT subnets
to libalias and ipfw.

In libalias, a new flag PKT_ALIAS_UNREGISTERED_RFC6598 is added.
This is like PKT_ALIAS_UNREGISTERED_ONLY, but also is RFC 6598 aware.
Also, we add a new NAT option to ipfw called unreg_cgn, which is like
unreg_only, but also is RFC 6598-aware.  The reason for the new
flags/options is to avoid breaking existing networks, especially those
which rely on RFC 6598 as an external address.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Reviewed by: melifaro, rgrimes, Lutz Donnerhacke
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D22877
Differential Revision: https://reviews.freebsd.org/D23448

4 years agoMFC r359277:
Mark Johnston [Tue, 7 Apr 2020 16:15:53 +0000 (16:15 +0000)]
MFC r359277:
Add regression tests for newsyslog.conf's p flag.

4 years agoMFC r359276:
Mark Johnston [Tue, 7 Apr 2020 16:15:35 +0000 (16:15 +0000)]
MFC r359276:
newsyslog: Fix stack corruption when initializing a zipwork structure.

4 years agoMFC of 359612
Kirk McKusick [Mon, 6 Apr 2020 22:12:42 +0000 (22:12 +0000)]
MFC of 359612

Use proper boolean expressions for soft update macros.

Sponsored by: Netflix

4 years agoMFC r359468:
Konstantin Belousov [Mon, 6 Apr 2020 18:52:40 +0000 (18:52 +0000)]
MFC r359468:
kern_sendfile.c: add specific malloc type.