freebsd.git
3 years agoRemove history.immutable from .arcconfig
Alex Richardson [Tue, 13 Apr 2021 11:36:24 +0000 (12:36 +0100)]
Remove history.immutable from .arcconfig

The `history.immutable` setting prevents arcanist from updating
the commit messages with the Differential URL and therefore
makes updating patches awkward with a rebase workflow.

In case this new behaviour is not wanted the old one can be restored
by running `arc set-config --local history.immutable true`.

Test Plan: `arc diff --create HEAD^` adds the metadata now.

Reviewed By: #phabric-admin, imp, lwhsu
Differential Revision: https://reviews.freebsd.org/D27971

3 years agopf: Implement the NAT source port selection of MAP-E Customer Edge
Kurosawa Takahiro [Tue, 13 Apr 2021 08:50:00 +0000 (10:50 +0200)]
pf: Implement the NAT source port selection of MAP-E Customer Edge

MAP-E (RFC 7597) requires special care for selecting source ports
in NAT operation on the Customer Edge because a part of bits of the port
numbers are used by the Border Relay to distinguish another side of the
IPv4-over-IPv6 tunnel.

PR: 254577
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D29468

3 years agoconfig(8): Correct the mentioned paper in the SEE ALSO section
Gordon Bergling [Tue, 13 Apr 2021 04:49:00 +0000 (06:49 +0200)]
config(8): Correct the mentioned paper in the SEE ALSO section

FreeBSD's version of the config(8) utility is based on 4.3BSD not
4.4BSD. So correct the mentioned paper in the SEE ALSO section.

Reported by: imp
Reviewed by: imp
X-MFC-with: 2b59392cb0da804e825c63469beb1934ec4267db
Differential Revision: https://reviews.freebsd.org/D29701

3 years agoroute(8): Add an example how to print the routing tables
Gordon Bergling [Tue, 13 Apr 2021 04:44:04 +0000 (06:44 +0200)]
route(8): Add an example how to print the routing tables

The manual page currently doesn't show an example how to print
the routing table, so add one and .Xr netstat while here.

PR: 231579
Reported by: Pekka Järvinen <pekka dot jarvinen at gmail dot com>
Reviewed by: debdrup
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D29702

3 years agoSpellcheck.
John Baldwin [Mon, 12 Apr 2021 22:12:19 +0000 (15:12 -0700)]
Spellcheck.

Reported by: 0mp

3 years agocxgbe: Ignore doomed virtual interfaces when updating the clip table.
John Baldwin [Mon, 12 Apr 2021 21:36:40 +0000 (14:36 -0700)]
cxgbe: Ignore doomed virtual interfaces when updating the clip table.

A doomed VI does not have a valid ifnet.

Reported by: Jithesh Arakkan @ Chelsio
Reviewed by: np
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29662

3 years agoRELNOTES: Document removal of asym crypto from OCF.
John Baldwin [Mon, 12 Apr 2021 21:34:23 +0000 (14:34 -0700)]
RELNOTES: Document removal of asym crypto from OCF.

Sponsored by: Chelsio Communications

3 years agoOCF: Remove support for asymmetric cryptographic operations.
John Baldwin [Mon, 12 Apr 2021 21:27:42 +0000 (14:27 -0700)]
OCF: Remove support for asymmetric cryptographic operations.

There haven't been any non-obscure drivers that supported this
functionality and it has been impossible to test to ensure that it
still works.  The only known consumer of this interface was the engine
in OpenSSL < 1.1.  Modern OpenSSL versions do not include support for
this interface as it was not well-documented.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29736

3 years agoiscsi: Kick threads out of iscsi_ioctl() during unload.
John Baldwin [Mon, 12 Apr 2021 20:56:16 +0000 (13:56 -0700)]
iscsi: Kick threads out of iscsi_ioctl() during unload.

iscsid can be sleeping in iscsi_ioctl() causing the destroy_dev() to
sleep forever if iscsi.ko is unloaded while iscsid is running.

Reported by: Jithesh Arakkan @ Chelsio
Reviewed by: mav
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29688

3 years agocxgbe: Add counters for iSCSI PDUs transmitted via TOE.
John Baldwin [Mon, 12 Apr 2021 20:56:04 +0000 (13:56 -0700)]
cxgbe: Add counters for iSCSI PDUs transmitted via TOE.

Reviewed by: np
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29297

3 years agohptrr: Move to using .o files
Warner Losh [Mon, 12 Apr 2021 19:41:25 +0000 (13:41 -0600)]
hptrr: Move to using .o files

Use .o files directly. Replace the .o.uu files that we uudecode with .o files.
Adjust the kernel and module build to cope.

Suggestions by: markj@, emaste@
Sposnored by:           Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29636

3 years agohptmv: use .o files directly
Warner Losh [Mon, 12 Apr 2021 19:41:20 +0000 (13:41 -0600)]
hptmv: use .o files directly

uudecode the .o.uu files and commit directly to the tree. Adjust the build
infrastructure to cope with the new location, both for the kernel and modules.

Sposnored by:           Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29635

3 years agohpt27xx: store the .o files directly in the tree
Warner Losh [Mon, 12 Apr 2021 19:41:14 +0000 (13:41 -0600)]
hpt27xx: store the .o files directly in the tree

Store the .o files directly in the tree. We no longer need to play uuencode
games like we did in the CVS days. Adjust the build infrastructure to match.

Reviewed by:            markj@
Sposnored by:           Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29634

3 years agohptnr: Store the .o files directly in the repo
Warner Losh [Mon, 12 Apr 2021 19:40:43 +0000 (13:40 -0600)]
hptnr: Store the .o files directly in the repo

We no longer need to use uuencode to uuencode files in our tree.  Store the .o
file directly instead. Adjust the build to cope with the new arrangement.

Suggestions by: emaste, bz, donner
Reviewed by: markm
Sposnored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29632

3 years agobhyve: Move the gdb_active check to gdb_cpu_suspend().
John Baldwin [Mon, 12 Apr 2021 18:43:34 +0000 (11:43 -0700)]
bhyve: Move the gdb_active check to gdb_cpu_suspend().

The check needs to be in the public routine (gdb_cpu_suspend()), not
in the internal routine called from various places
(_gdb_cpu_suspend()).  All the other callers of _gdb_cpu_suspend()
already check gdb_active, and this breaks the use of snapshots when
the debug server is not enabled since gdb_cpu_suspend() tries to lock
an uninitialized mutex.

Reported by: Darius Mihai, Elena Mihailescu
Reviewed by: elenamihailescu22_gmail.com
Fixes: 621b5090487de9fed1b503769702a9a2a27cc7bb
Differential Revision: https://reviews.freebsd.org/D29538

3 years agopfctl, libpfctl: introduce pfctl_pool
Kurosawa Takahiro [Mon, 12 Apr 2021 14:03:40 +0000 (16:03 +0200)]
pfctl, libpfctl: introduce pfctl_pool

Introduce pfctl_pool to be able to extend the pool part of the pf rule
without breaking the ABI.

Reviewed by: kp
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D29721

3 years agoMerge commit 'd0e943077d94e6266ece9856789c5d5313676e38'
Mark Johnston [Mon, 12 Apr 2021 15:29:47 +0000 (11:29 -0400)]
Merge commit 'd0e943077d94e6266ece9856789c5d5313676e38'

3 years agosyncache: simplify syncache_add() KPI to return struct socket pointer
Gleb Smirnoff [Fri, 19 Mar 2021 05:05:22 +0000 (22:05 -0700)]
syncache: simplify syncache_add() KPI to return struct socket pointer
directly, not overwriting the listen socket pointer argument.
Not a functional change.

3 years agoUpdate capsicum-test to ea66424d921bb393539b298c108a46edee5c3051
Mark Johnston [Mon, 12 Apr 2021 15:20:39 +0000 (11:20 -0400)]
Update capsicum-test to ea66424d921bb393539b298c108a46edee5c3051

This adds regression tests for a recent FreeBSD commit to restrict
certain socket operations in capability mode.

3 years agotcp_input/syncache: acquire only read lock on PCB for SYN,!ACK packets
Gleb Smirnoff [Fri, 19 Mar 2021 02:06:13 +0000 (19:06 -0700)]
tcp_input/syncache: acquire only read lock on PCB for SYN,!ACK packets

When packet is a SYN packet, we don't need to modify any existing PCB.
Normally SYN arrives on a listening socket, we either create a syncache
entry or generate syncookie, but we don't modify anything with the
listening socket or associated PCB. Thus create a new PCB lookup
mode - rlock if listening. This removes the primary contention point
under SYN flood - the listening socket PCB.

Sidenote: when SYN arrives on a synchronized connection, we still
don't need write access to PCB to send a challenge ACK or just to
drop. There is only one exclusion - tcptw recycling. However,
existing entanglement of tcp_input + stacks doesn't allow to make
this change small. Consider this patch as first approach to the problem.

Reviewed by: rrs
Differential revision: https://reviews.freebsd.org/D29576

3 years agobhyve: add SMBIOS Baseboard Information
Chuck Tuffli [Mon, 12 Apr 2021 15:09:52 +0000 (08:09 -0700)]
bhyve: add SMBIOS Baseboard Information

Add the System Management BIOS Baseboard (or Module) Information
a.k.a. Type 2 structure to the SMBIOS emulation.

Reviewed by: rgrimes, bcran, grehan
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29657

3 years agormlock(9): add an RM_DUPOK flag
Mitchell Horne [Thu, 8 Apr 2021 17:41:19 +0000 (14:41 -0300)]
rmlock(9): add an RM_DUPOK flag

Allows for duplicate locks to be acquired without witness complaining.
Similar flags exists already for rwlock(9) and sx(9).

Reviewed by: markj
MFC after: 3 days
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
NetApp PR: 52
Differential Revision: https://reviews.freebsd.org/D29683n

3 years agorc: replace NETWORK with NETWORKING
Edward Tomasz Napierala [Mon, 5 Apr 2021 15:57:44 +0000 (16:57 +0100)]
rc: replace NETWORK with NETWORKING

This improves consistency; the NETWORKING script provides both,
so there should be no functional change.

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

3 years agorc: remove the 'archdep' script
Edward Tomasz Napierala [Mon, 12 Apr 2021 13:38:16 +0000 (14:38 +0100)]
rc: remove the 'archdep' script

It was unused since 405c3050f10, which removed iBCS support.

This also moves the 'linux' rc script slightly earlier, which
might help in some setups.  The original version of this patch
moved it even more, before 'mountcritlocal', which would fixe
mount(8) errors due to missing /dev/shm in setups with entries
for /path/to/chroot/dev/shm without the "late" flag; however,
in the end 'kldxref' turned out to depend on 'mountcritlocal'
anyway.

Reported By: pstef
Reviewed By: dchagin
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29590

3 years agoFix build of stand/usb .
Hans Petter Selasky [Mon, 12 Apr 2021 14:12:18 +0000 (16:12 +0200)]
Fix build of stand/usb .

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoRename struct device to struct _device
Mark Johnston [Mon, 12 Apr 2021 13:32:30 +0000 (09:32 -0400)]
Rename struct device to struct _device

types.h defines device_t as a typedef of struct device *.  struct device
is defined in subr_bus.c and almost all of the kernel uses device_t.
The LinuxKPI also defines a struct device, so type confusion can occur.

This causes bugs and ambiguity for debugging tools.  Rename the FreeBSD
struct device to struct _device.

Reviewed by: gbe (man pages)
Reviewed by: rpokala, imp, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29676

3 years agolinuxkpi: Fix pcie_set_readrq()
Mark Johnston [Mon, 12 Apr 2021 13:32:21 +0000 (09:32 -0400)]
linuxkpi: Fix pcie_set_readrq()

We were passing a LinuxKPI struct device * to a pci(4) function that
expects a device_t.

Reviewed by: manu, hselasky, bz
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29675

3 years agoqlnxr: Properly initialize the Linux device structure
Mark Johnston [Mon, 12 Apr 2021 13:32:08 +0000 (09:32 -0400)]
qlnxr: Properly initialize the Linux device structure

The driver needs to provide a LinuxKPI device structure to register
itself with the IB subsystem.  It was erroneously using a copy of its
FreeBSD device structure for this purpose.

Use linux_pci_attach_device() instead, following the example of the
Chelsio iwarp driver.  Also ensure that we don't leak the faked device
during detach.

Reviewed by: hselasky
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29595

3 years agocxgb: Use device_t in preference to struct device *
Mark Johnston [Mon, 12 Apr 2021 13:32:04 +0000 (09:32 -0400)]
cxgb: Use device_t in preference to struct device *

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoal_eth: Use device_t in preference to struct device *
Mark Johnston [Mon, 12 Apr 2021 13:32:02 +0000 (09:32 -0400)]
al_eth: Use device_t in preference to struct device *

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agogenet: Use device_t in preference to struct device *
Mark Johnston [Mon, 12 Apr 2021 13:31:58 +0000 (09:31 -0400)]
genet: Use device_t in preference to struct device *

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agopf: Ensure that we don't use kif passed to pfi_kkif_attach()
Kristof Provost [Mon, 12 Apr 2021 09:45:48 +0000 (11:45 +0200)]
pf: Ensure that we don't use kif passed to pfi_kkif_attach()

Once a kif is passed to pfi_kkif_attach() we must ensure we never re-use
it for anything else.
Set the kif to NULL afterwards to guarantee this.

Reported-by: syzbot+be5d4f4a7a4c295e659a@syzkaller.appspotmail.com
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoRemove versatile support
Andrew Turner [Sun, 11 Apr 2021 13:26:50 +0000 (13:26 +0000)]
Remove versatile support

It was used for testing armv6 under QEMU, however since then we added
support for the QEMU virt platform.

Reviewed by: imp, manu
Differential Revision: https://reviews.freebsd.org/D29707

3 years agoCreate VM_MEMATTR_DEVICE on all architectures
Andrew Turner [Sat, 10 Apr 2021 07:59:29 +0000 (07:59 +0000)]
Create VM_MEMATTR_DEVICE on all architectures

This is intended to be used with memory mapped IO, e.g. from
bus_space_map with no flags, or pmap_mapdev.

Use this new memory type in the map request configured by
resource_init_map_request, and in pciconf.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D29692

3 years agocxgbe/tom: Fix potential leak in t4_aiotx_process_job.
Navdeep Parhar [Sun, 4 Apr 2021 22:04:31 +0000 (15:04 -0700)]
cxgbe/tom: Fix potential leak in t4_aiotx_process_job.

The mbuf allocated could be a chain and must be freed with m_freem.

Reviewed by: jhb@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29579

3 years agonfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661
Rick Macklem [Sun, 11 Apr 2021 23:51:25 +0000 (16:51 -0700)]
nfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661

Recent testing of network partitioning a FreeBSD NFSv4.1
server from a Linux NFSv4.1 client identified problems
with both the FreeBSD server and Linux client.

Sometimes, after some Linux NFSv4.1/4.2 clients establish
a new TCP connection, they will advance the sequence number
for a session slot by 2 instead of 1.
RFC5661 specifies that a server should reply
NFS4ERR_SEQ_MISORDERED for this case.
This might result in a system call error in the client and
seems to disable future use of the slot by the client.
Since advancing the sequence number by 2 seems harmless,
allow this case if vfs.nfs.linuxseqsesshack is non-zero.

Note that, if the order of RPCs is actually reversed,
a subsequent RPC with a smaller sequence number value
for the slot will be received.  This will result in
a NFS4ERR_SEQ_MISORDERED reply.
This has not been observed during testing.
Setting vfs.nfs.linuxseqsesshack to 0 will provide
RFC5661 compliant behaviour.

This fix affects the fairly rare case where a NFSv4
Linux client does a TCP reconnect and then apparently
erroneously increments the sequence number for the
session slot twice during the reconnect cycle.

PR: 254816
MFC after: 2 weeks

3 years agohv_kbd: Fix leaked $FreeBSD$ expansion
Vladimir Kondratyev [Sun, 11 Apr 2021 23:16:22 +0000 (02:16 +0300)]
hv_kbd: Fix leaked $FreeBSD$ expansion

MFC with: c2a159286c76

3 years agohv_kbd: Add support for K_XLATE and K_CODE modes for gen 2 VMs
Vladimir Kondratyev [Sun, 11 Apr 2021 23:08:36 +0000 (02:08 +0300)]
hv_kbd: Add support for K_XLATE and K_CODE modes for gen 2 VMs

That fixes disabled keyboard input after Xorg server has been stopped.

Reviewed by: whu
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D28171

3 years agohv_kbd: Add evdev protocol support for gen 2 VMs
Vladimir Kondratyev [Sun, 11 Apr 2021 23:07:35 +0000 (02:07 +0300)]
hv_kbd: Add evdev protocol support for gen 2 VMs

Reviewed by: whu
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D28170

3 years agoAdd a note to indicate "don't run the nfscbd(8) without this patch.
Rick Macklem [Sun, 11 Apr 2021 22:14:47 +0000 (15:14 -0700)]
Add a note to indicate "don't run the nfscbd(8) without this patch.

3 years agosetclassenvironment: trim leading spaces in variable names
Yuri Pankov [Sun, 11 Apr 2021 22:02:12 +0000 (01:02 +0300)]
setclassenvironment: trim leading spaces in variable names

Trim leading spaces in variable names when the list is e.g.
pretty-formatted in /etc/login.conf or ~/.login_conf.

PR: 247947
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D25649

3 years agoAdd an UPDATING entry for commit 7763814fc9c2
Rick Macklem [Sun, 11 Apr 2021 21:59:11 +0000 (14:59 -0700)]
Add an UPDATING entry for commit 7763814fc9c2

3 years agoparam.h: bump __FreeBSD_version for commit 7763814fc9c2
Rick Macklem [Sun, 11 Apr 2021 21:47:36 +0000 (14:47 -0700)]
param.h: bump __FreeBSD_version for commit 7763814fc9c2

Commit 7763814fc9c2 changed the internal KAPI between the krpc
and NFS.  As such, the krpc, nfscommon and nfscl modules must
all be rebuilt from sources.

3 years agoee: restore the stdin/stdout terminal check
Yuri Pankov [Sun, 11 Apr 2021 21:44:29 +0000 (00:44 +0300)]
ee: restore the stdin/stdout terminal check

This seems to have been lost during updates from upstream, and
was reported (on IRC) as a nice feature to have (again).

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D28689

3 years agonfsv4 client: do the BindConnectionToSession as required
Rick Macklem [Sun, 11 Apr 2021 21:34:57 +0000 (14:34 -0700)]
nfsv4 client: do the BindConnectionToSession as required

During a recent testing event, it was reported that the NFSv4.1/4.2
server erroneously bound the back channel to a new TCP connection.
RFC5661 specifies that the fore channel is implicitly bound to a
new TCP connection when an RPC with Sequence (almost any of them)
is done on it.  For the back channel to be bound to the new TCP
connection, an explicit BindConnectionToSession must be done as
the first RPC on the new connection.

Since new TCP connections are created by the "reconnect" layer
(sys/rpc/clnt_rc.c) of the krpc, this patch adds an optional
upcall done by the krpc whenever a new connection is created.
The patch also adds the specific upcall function that does a
BindConnectionToSession and configures the krpc to call it
when required.

This is necessary for correct interoperability with NFSv4.1/NFSv4.2
servers when the nfscbd daemon is running.

If doing NFSv4.1/NFSv4.2 mounts without this patch, it is
recommended that the nfscbd daemon not be running and that
the "pnfs" mount option not be specified.

PR: 254840
Comments by: asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29475

3 years agonetmap: don't use linux type struct device *
Vincenzo Maffione [Sun, 11 Apr 2021 21:06:43 +0000 (21:06 +0000)]
netmap: don't use linux type struct device *

Such type cannot be used in code that is in common between
FreeBSD and Linux. Use the FreeBSD type instead.

MFC after: 3 days
Reported by: markj
Differential Revision: https://reviews.freebsd.org/D29677

3 years agoObsoleteFiles.inc: Add comment regarding optional files
Stefan Eßer [Sun, 11 Apr 2021 21:00:39 +0000 (23:00 +0200)]
ObsoleteFiles.inc: Add comment regarding optional files

I had added entries that depended on some build option to this file
and have been informed, that those go into a different file in another
directory.

Mentioning /usr/src/tools/build/mk/OptionalObsoleteFiles.inc in this
file should help other committers (and me) to not repeat that mistake.

MFC after: 1 week

3 years agoacpi(4): mention NONE as possible setting for hw.acpi.power_button_state
Yuri Pankov [Sun, 11 Apr 2021 20:17:06 +0000 (23:17 +0300)]
acpi(4): mention NONE as possible setting for hw.acpi.power_button_state

Reviewed by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D29577

3 years agoif_smsc: Add the ability to disable "turbo_mode", also called RX frame batching,
Hans Petter Selasky [Sun, 11 Apr 2021 18:24:41 +0000 (20:24 +0200)]
if_smsc: Add the ability to disable "turbo_mode", also called RX frame batching,
similarly to the Linux driver, by a tunable read only sysctl.

Submitted by: Oleg Sidorkin <osidorkin@gmail.com>
PR: 254884
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix vlan creation for the older ifconfig(8) binaries.
Alexander V. Chernikov [Sun, 11 Apr 2021 16:47:03 +0000 (17:47 +0100)]
Fix vlan creation for the older ifconfig(8) binaries.

Reported by: allanjude
MFC after: immediately

3 years agoMake 20201030 a separate entry (insert forgotten newline).
Jens Schweikhardt [Sun, 11 Apr 2021 16:41:59 +0000 (18:41 +0200)]
Make 20201030 a separate entry (insert forgotten newline).

3 years agocam: make sure to clear even more CCBs allocated on the stack
Edward Tomasz Napierala [Sat, 10 Apr 2021 10:25:22 +0000 (11:25 +0100)]
cam: make sure to clear even more CCBs allocated on the stack

This is my second pass, this time over all of CAM except
for the SCSI target bits.  There should be no functional
changes.

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D29549

3 years agorc: kldxref needs mountcritlocal, not root
Edward Tomasz Napierala [Sun, 11 Apr 2021 14:19:33 +0000 (15:19 +0100)]
rc: kldxref needs mountcritlocal, not root

As pointed out by tijl@, kldxref(8) is in /usr/sbin, thus requires
/usr to be mounted.

Fixes: 44f3b1aa980
Sponsored By: EPSRC

3 years agoUse if ... else when printing memory attributes
Andrew Turner [Sun, 11 Apr 2021 09:00:00 +0000 (09:00 +0000)]
Use if ... else when printing memory attributes

In vmstat there is a switch statement that converts these attributes to
a string. As some values can be duplicate we have to hide these from
userspace.

Replace this switch statement with an if ... else macro that lets us
repeat values without a compiler error.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D29703

3 years agoptrace: restructure comments around reparenting on PT_DETACH
Konstantin Belousov [Sun, 11 Apr 2021 09:06:21 +0000 (12:06 +0300)]
ptrace: restructure comments around reparenting on PT_DETACH

style code, and use {} for both branches.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoptrace: remove dead call to FIX_SSTEP()
Konstantin Belousov [Sun, 11 Apr 2021 09:02:34 +0000 (12:02 +0300)]
ptrace: remove dead call to FIX_SSTEP()

It was an alias for procfs_fix_sstep() long time ago.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agogetdirentries.2: remove unnecessary space
Piotr Pawel Stefaniak [Sun, 11 Apr 2021 09:17:01 +0000 (11:17 +0200)]
getdirentries.2: remove unnecessary space

3 years agoBalance parentheses in sysctl descriptions
Piotr Pawel Stefaniak [Sun, 11 Apr 2021 08:29:34 +0000 (10:29 +0200)]
Balance parentheses in sysctl descriptions

3 years agortld_lock.h: add some comments about versioning of struct RtldLockInfo
Konstantin Belousov [Sun, 11 Apr 2021 08:12:48 +0000 (11:12 +0300)]
rtld_lock.h: add some comments about versioning of struct RtldLockInfo

Sponsored by: The FreeBSD Foundation
MFC after: 6 days

3 years agosh: fix debug build
Piotr Pawel Stefaniak [Sun, 11 Apr 2021 07:09:28 +0000 (09:09 +0200)]
sh: fix debug build

Approved by: jilles

3 years agovnode_pager_setsize.9: Some clarifications on the manpage
Ka Ho Ng [Sun, 11 Apr 2021 06:45:37 +0000 (14:45 +0800)]
vnode_pager_setsize.9: Some clarifications on the manpage

A number of changes:
- Clarifies the locking rules when calling the routine.
- Correct the description regarding the content range to be purged.
- Document the effects on page fault handler.

MFC after: 3 days
MFC with: 86a52e262a6f
Sponsored by: The FreeBSD Foundation
Reviewed by: bcr, kib
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29637

3 years agozfs: avoid memory allocation in arc_prune_async
Mateusz Guzik [Sun, 11 Apr 2021 05:15:41 +0000 (07:15 +0200)]
zfs: avoid memory allocation in arc_prune_async

3 years agozfs: make vnlru_free_vfsops use conditional on version
Mateusz Guzik [Sun, 11 Apr 2021 04:49:24 +0000 (06:49 +0200)]
zfs: make vnlru_free_vfsops use conditional on version

Diff reduction against upstream.

3 years agonfsd: fix replies from session cache for multiple retries
Rick Macklem [Sat, 10 Apr 2021 22:50:25 +0000 (15:50 -0700)]
nfsd: fix replies from session cache for multiple retries

Recent testing of network partitioning a FreeBSD NFSv4.1
server from a Linux NFSv4.1 client identified problems
with both the FreeBSD server and Linux client.

Commit 05a39c2c1c18 fixed replying with the cached reply in
in the session slot if same session slot sequence#.
However, the code uses the reply and, as such,
will fail for a subsequent retry of the RPC.
A subsequent retry would be an extremely rare event,
but this patch fixes this, so long as m_copym(..M_NOWAIT)
does not fail, which should also be a rare event.

This fix affects the exceedingly rare case where a NFSv4
client retries a non-idempotent RPC, such as a lock
operation, multiple times.  Note that retries only occur
after the client has needed to create a new TCP connection,
with a new TCP connection for each retry.

MFC after: 2 weeks

3 years agozfs: change format string in zio_fini to get rid of the cast
Mateusz Guzik [Sat, 10 Apr 2021 19:12:00 +0000 (19:12 +0000)]
zfs: change format string in zio_fini to get rid of the cast

3 years agoFix direct route installation with net/bird.
Alexander V. Chernikov [Sat, 10 Apr 2021 15:25:24 +0000 (16:25 +0100)]
Fix direct route installation with net/bird.

Slighly relax the gateway validation rules imposed by the
 2fe5a79425c7, by requiring only first 8 bytes (everyhing
 before sdl_data to be present in the AF_LINK gateway.

Reported by: olivier

3 years agortld: make dlerror() thread-local
Konstantin Belousov [Wed, 7 Apr 2021 22:02:33 +0000 (01:02 +0300)]
rtld: make dlerror() thread-local

PR: 95339
Discussed with: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29633

3 years agortld: workaround for broken ABI
Konstantin Belousov [Sat, 10 Apr 2021 12:32:24 +0000 (15:32 +0300)]
rtld: workaround for broken ABI

Right now, libthr does not initialize RtldLockInfo.rtli_version when calling
_rtld_thread_init(), which makes versioning the interface troublesome.

Add a workaround: if the calling object of _rtld_thread_init() exports
the "_pli_rtli_version" symbol, then consider rtli_version initialized.
Otherwise, forcibly set it to RTLI_VERSION_ONE, currently defined as
RTLI_VERSION.

Export "_pli_rtli_version" from libthr and properly initialize rtli_version.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29633

3 years agortld: unstaticise lockinfo and obj_from_addr()
Konstantin Belousov [Sat, 10 Apr 2021 12:30:59 +0000 (15:30 +0300)]
rtld: unstaticise lockinfo and obj_from_addr()

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29633

3 years agoOnly use -fp-exception-behavior=maytrap on x86, for now
Dimitry Andric [Sat, 10 Apr 2021 14:02:49 +0000 (16:02 +0200)]
Only use -fp-exception-behavior=maytrap on x86, for now

After 3b00222f156d, it turns out that clang only supports strict
floating point semantics for SystemZ and x86 at the moment, while for
other architectures it is still experimental.

Therefore, only use -fp-exception-behavior=maytrap on x86 for now,
otherwise this option results in "error: overriding currently
unsupported use of floating point exceptions on this target
[-Werror,-Wunsupported-floating-point-opt]" on other architectures.

Fixes: 3b00222f156d
PR: 254911
MFC after: 1 week

3 years agoAppease -Wsign-compare in radix.c
Alexander V. Chernikov [Sat, 10 Apr 2021 13:48:25 +0000 (13:48 +0000)]
Appease -Wsign-compare in radix.c

Differential Revision: https://reviews.freebsd.org/D29661
Submitted by: zec
MFC after 2 weeks

3 years agoAllow to specify debugnet fib in sysctl/tunable.
Alexander V. Chernikov [Mon, 5 Apr 2021 19:48:07 +0000 (19:48 +0000)]
Allow to specify debugnet fib in sysctl/tunable.

Differential Revision: https://reviews.freebsd.org/D29593
Reviewed by: donner
MFC after: 2 weeks

3 years agoAlways use inp fib in the inp_lookup_mcast_ifp().
Alexander V. Chernikov [Mon, 5 Apr 2021 19:58:57 +0000 (19:58 +0000)]
Always use inp fib in the inp_lookup_mcast_ifp().

inp_lookup_mcast_ifp() is static and is only used in the inp_join_group().
The latter function is also static, and is only used in the inp_setmoptions(),
 which relies on inp being non-NULL.

As a result, in the current code, inp_lookup_mcast_ifp() is always called
 with non-NULL inp. Eliminate unused RT_DEFAULT_FIB condition and always
 use inp fib instead.

Differential Revision: https://reviews.freebsd.org/D29594
Reviewed by: kp
MFC after: 2 weeks

3 years agolibnv: Use PICFLAG rather than -fPIC
Kristof Provost [Sat, 10 Apr 2021 09:23:57 +0000 (11:23 +0200)]
libnv: Use PICFLAG rather than -fPIC

Suggested by: andrew
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoAvoid raising unexpected floating point exceptions in libm
Dimitry Andric [Fri, 9 Apr 2021 23:07:54 +0000 (01:07 +0200)]
Avoid raising unexpected floating point exceptions in libm

When using clang with x86_64 CPUs that support AVX, some floating point
transformations may raise exceptions that would not have been raised by
the original code. To avoid this, use the -fp-exception-behavior=maytrap
flag, introduced in clang 10.0.0.

In particular, this fixes a number of test failures with ctanhf(3) and
ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID
exception is then raised, because clang emits vdivps instructions to
perform certain divides. (The vdivps instruction operates on multiple
single-precision float operands simultaneously, but the exceptions may
be influenced by unused parts of the XMM registers. In this particular
case, it was calculating 0 / 0, which results in FE_INVALID.)

If -fp-exception-behavior=maytrap is specified however, clang uses
vdivss instructions instead, which work on one operand, and should not
raise unexpected exceptions.

Reported by: olivier
Reviewed by: arichardson
PR: 254911
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29686

3 years agoAdjust .arcconfig to land onto 'main' by default
Dimitry Andric [Sat, 10 Apr 2021 11:51:16 +0000 (13:51 +0200)]
Adjust .arcconfig to land onto 'main' by default

Otherwise, commands like "arc land" will default to 'master' instead.

MFC after: immediately

3 years agolibpfctl: Fix u_* counters
Kristof Provost [Thu, 8 Apr 2021 08:36:18 +0000 (10:36 +0200)]
libpfctl: Fix u_* counters

struct pf_rule had a few counter_u64_t counters. Those couldn't be
usefully comminicated with userspace, so the fields were doubled up in
uint64_t u_* versions.

Now that we use struct pfctl_rule (i.e. a fully userspace version) we
can safely change the structure and remove this wart.

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29645

3 years agolibpfctl: Switch to pfctl_rule
Kristof Provost [Thu, 8 Apr 2021 08:31:46 +0000 (10:31 +0200)]
libpfctl: Switch to pfctl_rule

Stop using the kernel's struct pf_rule, switch to libpfctl's pfctl_rule.
Now that we use nvlists to communicate with the kernel these structures
can be fully decoupled.

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29644

3 years agopf: Move prototypes for userspace functions to userspace header
Kristof Provost [Wed, 7 Apr 2021 17:49:51 +0000 (19:49 +0200)]
pf: Move prototypes for userspace functions to userspace header

These functions no longer exist in the kernel, so there's no reason to
keep the prototypes in a kernel header. Move them to pfctl where they're
actually implemented.

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29643

3 years agobsnmp: Use libpfctl
Kristof Provost [Mon, 29 Mar 2021 15:43:25 +0000 (17:43 +0200)]
bsnmp: Use libpfctl

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29642

3 years ago(t)ftp-proxy: use libpfctl
Kristof Provost [Mon, 29 Mar 2021 12:03:39 +0000 (14:03 +0200)]
(t)ftp-proxy: use libpfctl

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29641

3 years agopfctl: Move ioctl abstraction functions into libpfctl
Kristof Provost [Fri, 26 Mar 2021 10:38:58 +0000 (11:38 +0100)]
pfctl: Move ioctl abstraction functions into libpfctl

Introduce a library to wrap the pf ioctl interface.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29562

3 years agolibnv: Build PIC
Kristof Provost [Fri, 2 Apr 2021 15:06:02 +0000 (17:06 +0200)]
libnv: Build PIC

Build libnv as position independent code so we can use it from shared
libraries.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29561

3 years agopfctl: Use the new DIOCGETRULENV ioctl
Kristof Provost [Fri, 26 Mar 2021 10:22:15 +0000 (11:22 +0100)]
pfctl: Use the new DIOCGETRULENV ioctl

Create wrapper functions to handle the parsing of the nvlist and move
that code into pfctl_ioctl.c.
At some point this should be moved into a libpfctl.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29560

3 years agopf: Implement nvlist variant of DIOCGETRULE
Kristof Provost [Thu, 25 Mar 2021 09:39:14 +0000 (10:39 +0100)]
pf: Implement nvlist variant of DIOCGETRULE

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29559

3 years agopfctl: Move to DIOCADDRULENV
Kristof Provost [Fri, 12 Mar 2021 17:03:14 +0000 (18:03 +0100)]
pfctl: Move to DIOCADDRULENV

Start using the new nvlist based ioctl to add rules.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29558

3 years agopf: Introduce nvlist variant of DIOCADDRULE
Kristof Provost [Thu, 11 Mar 2021 15:21:23 +0000 (16:21 +0100)]
pf: Introduce nvlist variant of DIOCADDRULE

This will make future extensions of the API much easier.
The intent is to remove support for DIOCADDRULE in FreeBSD 14.

Reviewed by: markj (previous version), glebius (previous version)
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29557

3 years agoCross-reference camcontrol(8) and zonectl(8) man pages.
Edward Tomasz Napierala [Sat, 10 Apr 2021 09:13:29 +0000 (10:13 +0100)]
Cross-reference camcontrol(8) and zonectl(8) man pages.

3 years agorc: kldxref only needs to depend on rootfs, not FILESYSTEMS
Edward Tomasz Napierala [Sat, 10 Apr 2021 08:19:25 +0000 (09:19 +0100)]
rc: kldxref only needs to depend on rootfs, not FILESYSTEMS

This makes it run a bit earlier in the startup, which will
be useful for the linux rc script later on.

Reviewed By: imp (earlier version)
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29589

3 years agoRegen src.conf.5 after 9d178c925fb9
Ed Maste [Sat, 10 Apr 2021 02:22:05 +0000 (22:22 -0400)]
Regen src.conf.5 after 9d178c925fb9

3 years agoDrop 'Set to' from most src.conf(5) knobs
Ed Maste [Sat, 10 Apr 2021 02:23:03 +0000 (22:23 -0400)]
Drop 'Set to' from most src.conf(5) knobs

The description is clearly what effect the knob has when set, so the
additional text was unnecessary.

Reviewed by: jhb, se
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29583

3 years agoamd64: clear debug registers on execing 32bit Linux binary
Konstantin Belousov [Fri, 9 Apr 2021 23:25:06 +0000 (02:25 +0300)]
amd64: clear debug registers on execing 32bit Linux binary

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29687

3 years agoamd64: clear debug registers on execing 32bit native binary
Konstantin Belousov [Fri, 9 Apr 2021 23:23:54 +0000 (02:23 +0300)]
amd64: clear debug registers on execing 32bit native binary

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29687

3 years agoamd64 linux64: use x86_clear_dbregs()
Konstantin Belousov [Fri, 9 Apr 2021 23:22:48 +0000 (02:22 +0300)]
amd64 linux64: use x86_clear_dbregs()

instead of manually inlining it

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29687

3 years agox86: use x86_clear_dbregs() on fork
Konstantin Belousov [Fri, 9 Apr 2021 23:20:55 +0000 (02:20 +0300)]
x86: use x86_clear_dbregs() on fork

instead of manual zeroing of the debug registers file in pcb.
This centralizes the cleaning code, but the practical difference is
that PCB_DBREGS flag is cleared, saving some operations on context
switching.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29687

3 years agox86: add x86_clear_dbregs() helper
Konstantin Belousov [Fri, 9 Apr 2021 23:19:23 +0000 (02:19 +0300)]
x86: add x86_clear_dbregs() helper

Move the code from exec_setregs() to reset debug registers state on exec,
to the x86_clear_dbregs() helper

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29687

3 years agoFix a typo in a comment: frame -> framework.
John Baldwin [Tue, 16 Mar 2021 22:33:20 +0000 (15:33 -0700)]
Fix a typo in a comment: frame -> framework.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agonlmrsa: Remove this deprecated driver.
John Baldwin [Tue, 16 Mar 2021 21:48:02 +0000 (14:48 -0700)]
nlmrsa: Remove this deprecated driver.

Relnotes: yes
Sponsored by: Chelsio Communications

3 years agoefivar: use bool for booleans
Warner Losh [Fri, 9 Apr 2021 22:35:50 +0000 (16:35 -0600)]
efivar: use bool for booleans

Rather than int flags we ++, use booleans for all command line args.
No functional change intended.

Reviewed by: markj@
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29621

3 years agoefivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name
Warner Losh [Fri, 9 Apr 2021 22:35:17 +0000 (16:35 -0600)]
efivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name

Due to how we're parsing UUIDs, we were disallowing setting, printing or
deleting any UEFI variable with a '-' in it when you attempted to do that
operation with the exact name (wildcard reporting was unaffected). Fix the
parser to loop over all the dashes in the name and only give up when all
possible matches are exhausted.

Reviewed by: markj@
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29620