]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoRemove unused miibus_devclass and miibus_fdt_devclass.
John Baldwin [Tue, 19 Apr 2022 19:18:43 +0000 (12:18 -0700)]
Remove unused miibus_devclass and miibus_fdt_devclass.

2 years agoacpi: Remove unused devclass arguments to DRIVER_MODULE.
John Baldwin [Tue, 19 Apr 2022 19:05:21 +0000 (12:05 -0700)]
acpi: Remove unused devclass arguments to DRIVER_MODULE.

2 years agoRemove isa_devclass from ISA bus drivers.
John Baldwin [Tue, 19 Apr 2022 18:58:35 +0000 (11:58 -0700)]
Remove isa_devclass from ISA bus drivers.

2 years agoRemove isab_devclass from ISA bridge drivers.
John Baldwin [Tue, 19 Apr 2022 18:56:41 +0000 (11:56 -0700)]
Remove isab_devclass from ISA bridge drivers.

2 years agoaacraid: Remove unused devclass argument to DRIVER_MODULE.
John Baldwin [Tue, 19 Apr 2022 18:25:45 +0000 (11:25 -0700)]
aacraid: Remove unused devclass argument to DRIVER_MODULE.

2 years agoaac: Remove unused devclass argument to DRIVER_MODULE.
John Baldwin [Tue, 19 Apr 2022 18:24:47 +0000 (11:24 -0700)]
aac: Remove unused devclass argument to DRIVER_MODULE.

2 years agoata: Remove ata_devclass from DRIVER_MODULE invocations.
John Baldwin [Fri, 6 May 2022 22:36:10 +0000 (15:36 -0700)]
ata: Remove ata_devclass from DRIVER_MODULE invocations.

Keep the global variable for its uses in ata-pci.c and
chipsets/ata-fsl.c but initialize it in the existing
ata_module_event_handler.  Move the module event handler a bit earlier
to ensure the variable is set before any devices are attached.

2 years agonvdimm_e820: Use driver->name in identify method.
John Baldwin [Fri, 6 May 2022 21:42:02 +0000 (14:42 -0700)]
nvdimm_e820: Use driver->name in identify method.

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

2 years agonvdimm: Use devclass_lookup to find devclasses.
John Baldwin [Fri, 6 May 2022 21:41:42 +0000 (14:41 -0700)]
nvdimm: Use devclass_lookup to find devclasses.

To avoid hardcoding the nvdimm driver name, move nvdimm_find_by_handle
below the definition of nvdimm_driver.

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

2 years agorpc.tlsservd: Add logging of TLS version and cipher used
Rick Macklem [Fri, 6 May 2022 21:03:43 +0000 (14:03 -0700)]
rpc.tlsservd: Add logging of TLS version and cipher used

This patch adds logging of the version of TLS and cipher
negotiated successfully by the TLS handshake for each client,
if the "-v" command line option has been specified.

This information may be useful for monitoring and debugging
NFS-over-TLS mounts.

MFC after: 2 weeks

2 years agobhyve: Fix virtio-console legacy configuration parsing
Yan Ka Chiu [Fri, 6 May 2022 19:31:56 +0000 (15:31 -0400)]
bhyve: Fix virtio-console legacy configuration parsing

virtio-console is currently missing .pe_legacy_config, which prevents any
portN configuration from being parsed, and therefore no sockets will be
created.

Reviewed by: khng
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35142

2 years agovt: use TERMINAL_DECLARE_EARLY() macro
Mitchell Horne [Mon, 20 Sep 2021 19:50:04 +0000 (16:50 -0300)]
vt: use TERMINAL_DECLARE_EARLY() macro

It simplifies the declaration of the driver structures a little. There
are no current consumers of this macro, in fact it looks like it was
added for exactly this purpose.

This decreases the scope of some variables, so rework the initialization
in vt_init_logos() such that it doesn't require them.

No functional change intended.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34820

2 years agoFix ofw_bus_iommu_map() since there is no limit on amount of maps
Ruslan Bukin [Fri, 6 May 2022 17:03:52 +0000 (18:03 +0100)]
Fix ofw_bus_iommu_map() since there is no limit on amount of maps
described in "iommu-map" DTS property.

Pointed out by: rpokala
Sponsored by: UKRI

2 years agolinux(4): Implement semtimedop syscalls.
Dmitry Chagin [Fri, 6 May 2022 17:02:59 +0000 (20:02 +0300)]
linux(4): Implement semtimedop syscalls.

On i386 are two semtimedop. The old one is called via multiplexor and
uses 32-bit timespec, and new semtimedop_tim64, which is uses 64-bit
timespec.

MFC after: 2 weeks

2 years agolinux(4): Regen for semtimedop syscalls.
Dmitry Chagin [Fri, 6 May 2022 17:02:16 +0000 (20:02 +0300)]
linux(4): Regen for semtimedop syscalls.

MFC after: 2 weeks

2 years agolinux(4): Change semtimedop syscall definition to match Linux actual one.
Dmitry Chagin [Fri, 6 May 2022 17:01:43 +0000 (20:01 +0300)]
linux(4): Change semtimedop syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agolinux(4): Retire linux_semop implementation.
Dmitry Chagin [Fri, 6 May 2022 17:00:13 +0000 (20:00 +0300)]
linux(4): Retire linux_semop implementation.

In i386 Linux semop called via ipc() multiplexor, so use kern_semop
directly from multiplexor.

MFC after: 2 weeks

2 years agolinux(4): Regen for semop syscall.
Dmitry Chagin [Fri, 6 May 2022 16:59:33 +0000 (19:59 +0300)]
linux(4): Regen for semop syscall.

MFC after: 2 weeks

2 years agolinux(4): Call semop directly.
Dmitry Chagin [Fri, 6 May 2022 16:58:53 +0000 (19:58 +0300)]
linux(4): Call semop directly.

As the Linux semop syscall is not defined in i386, and as it is equal
to the native semop syscall, call it directly.
Fix semop definition to match Linux actual one - nsops is size_t type.

MFC after: 2 weeks

2 years agosysvsem: Add a timeout argument to the semop.
Dmitry Chagin [Fri, 6 May 2022 16:51:48 +0000 (19:51 +0300)]
sysvsem: Add a timeout argument to the semop.

For future use in the Linux emulation layer for the semtimedop syscall
split the sys_semop syscall into two counterparts and add
struct timespec *timeout argument to the last one.

Reviewed by: jhb, kib
Differential revision: https://reviews.freebsd.org/D35121
MFC after: 2 weeks

2 years agoAdd ofw_bus_iommu_map() that maps PCI requester ID to an IOMMU
Ruslan Bukin [Fri, 6 May 2022 15:41:11 +0000 (16:41 +0100)]
Add ofw_bus_iommu_map() that maps PCI requester ID to an IOMMU
specifier based on "iommu-map" DTS property.

Sponsored by: UKRI

2 years agopf: don't reject dummynet-ed packets
Kristof Provost [Fri, 6 May 2022 14:41:34 +0000 (16:41 +0200)]
pf: don't reject dummynet-ed packets

If we pass a packet to dummynet we should indicate we've passed it (but
keep m0 == NULL). Otherwise we'll indicate to the calling layers that
the packet has been rejected.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: dummynet fix
Kristof Provost [Fri, 6 May 2022 14:37:47 +0000 (16:37 +0200)]
pf: dummynet fix

If we don't have a pipe set we shouldn't feed packets into dummynet.
This could occur if we have a 'dnpipe (0, 100)' configuration, for
example. We do want to feed the packet to dummynet in the return
direction, but not in the forward direction. In that case
pf_pdesc_to_dnflow() should return false, rather than pass a pipe number
of 0 to dummynet.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agopf: fix reverse direction dummynet
Kristof Provost [Fri, 6 May 2022 12:37:07 +0000 (14:37 +0200)]
pf: fix reverse direction dummynet

Due to a typo dnrpipe (i.e. the pipe for reverse direction traffic) was
nevern assigned, preventing it from working correctly.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoif: avoid interface destroy race
Kristof Provost [Sun, 27 Mar 2022 18:23:25 +0000 (20:23 +0200)]
if: avoid interface destroy race

When we destroy an interface while the jail containing it is being
destroyed we risk seeing a race between if_vmove() and the destruction
code, which results in us trying to move a destroyed interface.

Protect against this by using the ifnet_detach_sxlock to also covert
if_vmove() (and not just detach).

PR: 262829
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D34704

2 years agoImprove description of the nocache option.
Alexander Leidinger [Fri, 6 May 2022 11:00:37 +0000 (13:00 +0200)]
Improve description of the nocache option.

Discussed with: pstef

2 years agonet80211: simplify code after STA/AP VAPs traffic hang fix
Bjoern A. Zeeb [Thu, 5 May 2022 22:21:03 +0000 (22:21 +0000)]
net80211: simplify code after STA/AP VAPs traffic hang fix

Combine the comment and double-unsetting of OACTIVE into a single case
after e8de31caceaa36caf5d7b4355072f148e2433b82.
This saves the question of why we do it twice--once right before and
one more time right after the state change check.
Also move the XXX comment about kicking the queue up to where it seems
better suited now.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D35135

2 years agoxen: Prevent buffer overflow in privcmd ioctl
Dan Carpenter [Thu, 4 Apr 2019 15:12:17 +0000 (18:12 +0300)]
xen: Prevent buffer overflow in privcmd ioctl

The "call" variable comes from the user in privcmd_ioctl_hypercall().
It's an offset into the hypercall_page[] which has (PAGE_SIZE / 32)
elements.  We need to put an upper bound on it to prevent an out of
bounds access.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Obtained from: Linux
Linux commit: 42d8644bd77dd2d747e004e367cb0c895a606f39
Fixes: bf7313e3b79 ("xen: implement the privcmd user-space device")
Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: royger

2 years agoRemove extraneous devclass argument from DRIVER_MODULE_ORDERED6.
John Baldwin [Fri, 6 May 2022 00:02:39 +0000 (17:02 -0700)]
Remove extraneous devclass argument from DRIVER_MODULE_ORDERED6.

This is the variant of DRIVER_MODULE_ORDERED that does not accept a
devclass argument.

Fixes: 2a99dd30dfaa Deprecate the 'devclass' argument from *DRIVER_MODULE() macros.

2 years agoProperly specify the level of indirect block being looked up.
Kirk McKusick [Thu, 5 May 2022 23:57:03 +0000 (16:57 -0700)]
Properly specify the level of indirect block being looked up.
The value is used only for diagnostic purposes so no functional
change should result.

2 years agoam335x_pwm_config_ecap: Use devclass_find to lookup devclass.
John Baldwin [Thu, 5 May 2022 23:40:43 +0000 (16:40 -0700)]
am335x_pwm_config_ecap: Use devclass_find to lookup devclass.

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

2 years agopbio: Add locking and remove D_NEEDGIANT.
John Baldwin [Thu, 5 May 2022 23:40:04 +0000 (16:40 -0700)]
pbio: Add locking and remove D_NEEDGIANT.

Use a sx lock to permit uiomove directly into/out of the the per-port
buffers.  In addition, the sx lock provides a stronger guarantee that
I think this driver wants which is to single-thread read and write
calls even while paused.  Finally, replace tsleep with dummy wait
channels with calls to pause_sig to more clearly communicate the
intent.

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

2 years agopbio: Return BUS_PROBE_DEFAULT from probe instead of 0.
John Baldwin [Thu, 5 May 2022 23:39:19 +0000 (16:39 -0700)]
pbio: Return BUS_PROBE_DEFAULT from probe instead of 0.

0 should only be returned from probe in legacy drivers that need to
preserve softc state between probe and attach.

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

2 years agopbio: Axe bus_space tag/handle using bus_read/write_1 instead.
John Baldwin [Thu, 5 May 2022 23:38:51 +0000 (16:38 -0700)]
pbio: Axe bus_space tag/handle using bus_read/write_1 instead.

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

2 years agopbio: Store softc in si_drv1 for character devices.
John Baldwin [Thu, 5 May 2022 23:38:25 +0000 (16:38 -0700)]
pbio: Store softc in si_drv1 for character devices.

The port number is still stored in the unit (si_drv0) but is the
entire unit value now.

While here, removed checks for NULL softc since those can never happen
from cdevsw routines.  This also resulted in the close method becoming
a no-op, so it has been removed.

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

2 years agotdfx: Initialize tdfx_devclass via a module event handler.
John Baldwin [Thu, 5 May 2022 23:37:38 +0000 (16:37 -0700)]
tdfx: Initialize tdfx_devclass via a module event handler.

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

2 years agosmapi: Use devclass_find to lookup smapi devclass in unload handler.
John Baldwin [Thu, 5 May 2022 23:35:40 +0000 (16:35 -0700)]
smapi: Use devclass_find to lookup smapi devclass in unload handler.

Move smapi_modevent below the declaration of smapi_driver so that
smapi_driver's name member can be used rather than hardcoding the
device class name.

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

2 years agosmapi: Store softc pointer in si_drv1 of cdev.
John Baldwin [Thu, 5 May 2022 23:35:19 +0000 (16:35 -0700)]
smapi: Store softc pointer in si_drv1 of cdev.

Rather than fetching the softc using the device's unit number as an
index into the devclass.

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

2 years agoipmi: Use devclass_find to lookup ipmi devclass in ipmi_unload.
John Baldwin [Thu, 5 May 2022 23:34:33 +0000 (16:34 -0700)]
ipmi: Use devclass_find to lookup ipmi devclass in ipmi_unload.

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

2 years agobhnd: Use devclass_find to lookup devclass for bhnd.
John Baldwin [Thu, 5 May 2022 23:34:02 +0000 (16:34 -0700)]
bhnd: Use devclass_find to lookup devclass for bhnd.

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

2 years agocxgbe tom: Force unsigned modulus for queue indices.
John Baldwin [Wed, 4 May 2022 22:59:44 +0000 (15:59 -0700)]
cxgbe tom: Force unsigned modulus for queue indices.

The final transmit and receive queue indices need to be positive
values.  However, since txq_idx and rxq_idx are signed (to permit
using -1 to as a marker for uninitialized values), using %= with
another integer type (vi->nofld[tr]xq) yielded a sign-extended modulus
value.  This resulted in negative queue indices and a buffer underrun
when arc4random() returned a value with the sign bit set.  Use a
temporary unsigned variable to hold the "raw" queue index to force
unsigned modulus.

This worked previously because the modulus was previously applied
directly to the return value of arc4random() which is unsigned before
the result was assigned to txq_idx and rxq_idx.

Discussed with: np
Fixes: db28d4a0cd1c cxgbe/t4_tom: Support for round-robin selection of offload queues.
Sponsored by: Chelsio Communications

2 years agorpc.tlsclntd, rpc.tlsservd: Fix getopt_long argument
Rick Macklem [Thu, 5 May 2022 23:22:12 +0000 (16:22 -0700)]
rpc.tlsclntd, rpc.tlsservd: Fix getopt_long argument

The "C" option in the argument to getopt_long() was
missing a ":" for both rpc.tlsclntd.c and rpc.tlsservd.c.
This patch fixes this.

MFC after: 2 weeks

2 years agorpc.tlsservd: Add a -C command line option for preferred_ciphers
Rick Macklem [Thu, 5 May 2022 22:54:14 +0000 (15:54 -0700)]
rpc.tlsservd: Add a -C command line option for preferred_ciphers

rpc.tlsclntd has a -C command line option for setting
preferred_ciphers.  Testing at a recent IETF NFSv4 testing
event showed that setting preferred_ciphers is not normally
needed for the rpc.tlsservd.

This patch modifies rpc.tlsservd to not specify preferred_ciphers
by default, but provides the same -C option as rpc.tlsclntd to
set preferred_ciphers, in case it is needed.

The man page update will be done as a separate commit.

MFC after: 2 weeks

2 years agortw88: update man page for loader tunable for >4GB of main memory
Bjoern A. Zeeb [Thu, 5 May 2022 21:17:40 +0000 (21:17 +0000)]
rtw88: update man page for loader tunable for >4GB of main memory

Mention the loader tunable from 6a50157090f2d0c5ab8c570d9cf2e2e3535dbdbf
that needs to be set for system with more than 4GB of physical memory.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: skbuff: add memlimit tunable for 64bit systems
Bjoern A. Zeeb [Thu, 5 May 2022 20:43:34 +0000 (20:43 +0000)]
LinuxKPI: skbuff: add memlimit tunable for 64bit systems

Some drivers, such as Realtek's rtw88, require 32bit DMA in
a single segment.  busdma(9) has a hard time providing this
currently for 3-ish pages at large quantities
(see lkpi_pci_nseg1_fail in linux_pci.c e86707418c8e8).
Work around this for now by allowing a tunable to enforce
physical addresses allocation limits on 64bit platforms (ignoring PAE)
using "old-school" contigmalloc(9) to avoid bouncing.

A patch needing a custom kernel compiled was tested in the last weeks
by rtw88 users providing the 32bit limit only hardcoded.  The 36bit
limit can be found in iwlwifi so is added as a testing option along.

This is put in as a bandaid for now, so people no longer need to patch
and compile their own kernels to use rtw88 and to allow us to MFC the
driver as well before the amounts of commits to track increases by
much more.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoReenable vnet tests in CI
Ed Maste [Tue, 3 May 2022 22:18:34 +0000 (18:18 -0400)]
Reenable vnet tests in CI

After restoring the associated commits the tests can be enabled again.

This reverts commit 711524d961233cd017ee0fd17e4b87013720f1c8.
This reverts commit c4585b938a04dfb157d7a10fa958be13415145be.

PR: 263767

2 years agombuf: do not restore dying interfaces
Kristof Provost [Thu, 27 Jan 2022 21:01:09 +0000 (22:01 +0100)]
mbuf: do not restore dying interfaces

When we remove an interface it is first removed from the interface list
V_ifnet (by if_unlink_ifnet()) and marked as IFF_DYING. We then wait for
any possible references to stop being used (i.e.
epoch_wait/epoch_drain_callbacks) before we tear it fully down.

However, the index in ifindex_table is not removed, so m_rcvif_restore()
can still find the (now dying) interface.

This results in panics, for example when dummynet restores the rcvif
pointer and passes a packet to ip6_input() we can panic because the
AF_INET6 domain has already been removed (so we end up dereferencing a
NULL pointer there).

Check that the interface is not dying before we restore it, which is
equivalent to checking its presence in V_ifnet, and thus ensures that
future accesses (while in NET_EPOCH) are safe.

Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34076

(cherry picked from commit 703e533da5e2e4743d38bbf4605fec041bc69976)

2 years agonetisr: serialize/restore m_pkthdr.rcvif when queueing mbufs
Gleb Smirnoff [Thu, 27 Jan 2022 05:58:50 +0000 (21:58 -0800)]
netisr: serialize/restore m_pkthdr.rcvif when queueing mbufs

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33268

(cherry picked from commit 6871de9363e559fef6765f0e49acc47f77544999)

2 years agodummynet: use m_rcvif_serialize/restore when queueing packets
Gleb Smirnoff [Thu, 27 Jan 2022 05:58:50 +0000 (21:58 -0800)]
dummynet: use m_rcvif_serialize/restore when queueing packets

This fixed panic with interface being removed while packet
was sitting on a queue.  This allows to pass all dummynet
tests including forthcoming dummynet:ipfw_interface_removal
and dummynet:pf_interface_removal and demonstrates use of
m_rcvif_serialize() and m_rcvif_restore().

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33267

(cherry picked from commit 165746f4e4bf54c5902a103c2d4a3455e651c58f)

2 years agoifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif
Gleb Smirnoff [Thu, 27 Jan 2022 05:58:50 +0000 (21:58 -0800)]
ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif

Supplement ifindex table with generation count and use it to
serialize & restore an ifnet pointer.

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33266
Fun note: git show e6abef09187a

(cherry picked from commit e1882428dcbbafd2814d7e17b977a8f686784b39)

2 years agoifnet: make if_index global
Gleb Smirnoff [Thu, 27 Jan 2022 05:58:44 +0000 (21:58 -0800)]
ifnet: make if_index global

Now that ifindex is static to if.c we can unvirtualize it.  For lifetime
of an ifnet its index never changes.  To avoid leaking foreign interfaces
the net.link.generic.system.ifcount sysctl and the ifnet_byindex() KPI
filter their returned value on curvnet.  Since if_vmove() no longer
changes the if_index, inline ifindex_alloc() and ifindex_free() into
if_alloc() and if_free() respectively.

API wise the only change is that now minimum interface index can be
greater than 1.  The holes in interface indexes were always allowed.

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33672

(cherry picked from commit 91f44749c6feb50f39af8805dd803e860f0418f1)

2 years agorelease: Use full window size for installer over serial lines
Jessica Clarke [Thu, 5 May 2022 18:07:54 +0000 (19:07 +0100)]
release: Use full window size for installer over serial lines

When running over a serial line we end up defaulting to 80x24, which is
rather cramped for many dialog boxes and occupies very little screen
space for most modern terminals. Thus, run resizewin -z to set the
terminal size if not already known before starting the installer, just
as we do for csh and sh login shells already in their default dotfiles.

Reviewed by: jhb, gjb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D34414

2 years agolibc: Add HISTORY sections to the manual pages
Gordon Bergling [Thu, 5 May 2022 16:46:32 +0000 (18:46 +0200)]
libc: Add HISTORY sections to the manual pages

There are some sections which could be improved
and work to do so is on going. The work will be
covered via 'X-MFC-WITH' commits.

Obtained from: OpenBSD
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D34759

2 years agofusefs: annotate more file descriptor leaks in the tests
Alan Somers [Thu, 5 May 2022 15:06:04 +0000 (09:06 -0600)]
fusefs: annotate more file descriptor leaks in the tests

The fusefs tests intentionally leak file descriptors.  Annotate all of
the leakages in order to hopefully pacify Coverity.

Reported by: Coverity (20 different CIDs)
MFC after: 2 weeks
Sponsored by: Axcient

2 years agofusefs: fix an undefined variable access
Alan Somers [Thu, 5 May 2022 14:43:51 +0000 (08:43 -0600)]
fusefs: fix an undefined variable access

In an error path, a dtrace probe could access an undefined variable.

Reported by: Coverity (CID 1471986)
MFC after: 2 weeks
Sponsored by: Axcient

2 years agoIf setkey(8) is used without ipsec.ko loaded beforehand,
Eugene Grosbein [Thu, 5 May 2022 12:02:29 +0000 (19:02 +0700)]
If setkey(8) is used without ipsec.ko loaded beforehand,
its attempt to install SA/SPD into the kernel results in cryptic
EINVAL error code.

Let it be a bit more user-friendly and try to load ipsec.ko
automatically if it is not loaded, just like ifconfig(8) does it
for modules it needs.

PR: 263379
MFC after: 2 weeks

2 years agoibcore: Remove set, but not used variable.
Hans Petter Selasky [Thu, 5 May 2022 10:31:17 +0000 (12:31 +0200)]
ibcore: Remove set, but not used variable.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agopf: clear PF_TAG_DUMMYNET for dummynet fast path
Kristof Provost [Thu, 5 May 2022 07:21:32 +0000 (09:21 +0200)]
pf: clear PF_TAG_DUMMYNET for dummynet fast path

ip_dn_io_ptr() (i.e. dummynet_io()) can return the mbuf immediately (as
opposed to owning it and later passing it through dummynet_send(), which
returns it to pf_test()). In that case we must clear the PF_TAG_DUMMYNET
flag to ensure we don't skip any subsequent firewall passes.

This can happen if we process a packet in PFIL_IN, set PF_TAG_DUMMYNET
on it, pass it to ip_dn_io_ptr() but have it returned immediately. The
packet continues its normal path, eventually hitting
pf_test(dir=PFIL_OUT), where we'd skip when we're not supposed to.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoiosched: remove stray debug
Warner Losh [Thu, 5 May 2022 02:28:00 +0000 (20:28 -0600)]
iosched: remove stray debug

This printf was designed to catch misqueued bio requests. Prior to
supporting read_bias == 0, we couldn't get anything but reads and writes
in this queue. However, for read_bias == 0 we queue everything except
BIO_DELETE to this queue, so remove the printf. We don't need to update
any statistics.

Sponsored by: Netflix

2 years agoada: Move comment
Warner Losh [Wed, 4 May 2022 22:53:03 +0000 (16:53 -0600)]
ada: Move comment

Move the comment about releasing ccb before periph to adaprobedone()
where it belongs.

Sponsored by: Netflix

2 years agonfsd: Add a sanity check for Owner/OwnerGroup string length
Rick Macklem [Wed, 4 May 2022 20:58:22 +0000 (13:58 -0700)]
nfsd: Add a sanity check for Owner/OwnerGroup string length

Robert Morris reported that, if a client sends an absurdly
large Owner/OwnerGroup string, the kernel malloc() for the
large size string can block forever.

This patch adds a sanity limit for Owner/OwnerGroup string
length.  Since the RFCs do not specify any limit and FreeBSD
can handle a group name greater than 1Kbyte, the limit is
set at a generous 10Kbytes.

Reported by: rtm@lcs.mit.edu
PR: 260546
MFC after: 2 weeks

2 years agonfsd: Fix handling of Open/Create for the pNFS server
Rick Macklem [Wed, 4 May 2022 20:52:33 +0000 (13:52 -0700)]
nfsd: Fix handling of Open/Create for the pNFS server

When the MDS of a pNFS service receives an Open/Create
and the file already exists, it must do a Setattr of
size == 0.  Without this patch, this was eroneously
done via a VOP_SETAATR() call, which would set the
length of the MDS file to 0 (which is already is,
since all data lives on the DSs).

This patch fixes the problem by doing a nfsvno_setattr()
instead of VOP_SETATTR(), which knows to do a proxied
Setattr on the DSs.

For a non-pNFS server, the change has no effect, since
nfsvno_setattr() only does a VOP_SETATTR() for that case.

This was found during a recent IETF NFSv4 testing event.

MFC after: 2 weeks

2 years agoOpenSSL: KTLS: Enable KTLS for receiving as well in TLS 1.3
John Baldwin [Wed, 4 May 2022 20:08:36 +0000 (13:08 -0700)]
OpenSSL: KTLS: Enable KTLS for receiving as well in TLS 1.3

This removes a guard condition that prevents KTLS being enabled for
receiving in TLS 1.3.  Use the correct sequence number and BIO for
receive vs transmit offload.

Approved by: jkim
Obtained from: OpenSSL commit 7c78932b9a4330fb7c8db72b3fb37cbff1401f8b
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34976

2 years agoOpenSSL: KTLS: Handle TLS 1.3 in ssl3_get_record.
John Baldwin [Wed, 4 May 2022 20:08:27 +0000 (13:08 -0700)]
OpenSSL: KTLS: Handle TLS 1.3 in ssl3_get_record.

- Don't unpad records, check the outer record type, or extract the
  inner record type from TLS 1.3 records handled by the kernel.  KTLS
  performs all of these steps and returns the inner record type in the
  TLS header.

- When checking the length of a received TLS 1.3 record don't allow
  for the extra byte for the nested record type when KTLS is used.

- Pass a pointer to the record type in the TLS header to the
  SSL3_RT_INNER_CONTENT_TYPE message callback.  For KTLS, the old
  pointer pointed to the last byte of payload rather than the record
  type.  For the non-KTLS case, the TLS header has been updated with
  the inner type before this callback is invoked.

Approved by: jkim
Obtained from: OpenSSL commit a5fb9605329fb939abb536c1604d44a511741624
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34975

2 years agoOpenSSL: KTLS: Add using_ktls helper variable in ssl3_get_record().
John Baldwin [Wed, 4 May 2022 20:08:17 +0000 (13:08 -0700)]
OpenSSL: KTLS: Add using_ktls helper variable in  ssl3_get_record().

When KTLS receive is enabled, pending data may still be present due to
read ahead.  This data must still be processed the same as records
received without KTLS.  To ease readability (especially in
consideration of additional checks which will be added for TLS 1.3),
add a helper variable 'using_ktls' that is true when the KTLS receive
path is being used to receive a record.

Approved by: jkim
Obtained from: OpenSSL commit 031132c297e54cbc20404a0bf8de6ed863196399
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34974

2 years agoOpenSSL: KTLS: Check for unprocessed receive records in ktls_configure_crypto.
John Baldwin [Wed, 4 May 2022 20:08:03 +0000 (13:08 -0700)]
OpenSSL: KTLS: Check for unprocessed receive records in ktls_configure_crypto.

KTLS implementations currently assume that the start of the in-kernel
socket buffer is aligned with the start of a TLS record for the
receive side.  The socket option to enable KTLS specifies the TLS
sequence number of this initial record.

When read ahead is enabled, data can be pending in the SSL read buffer
after negotiating session keys.  This pending data must be examined to
ensurs that the kernel's socket buffer does not contain a partial TLS
record as well as to determine the correct sequence number of the
first TLS record to be processed by the kernel.

In preparation for enabling receive kernel offload for TLS 1.3, move
the existing logic to handle read ahead from t1_enc.c into ktls.c and
invoke it from ktls_configure_crypto().

Approved by: jkim
Obtained from: OpenSSL commit 85773128d0e80cd8dcc772a6931d385b8cf4acd1
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34973

2 years agoOpenSSL: Cleanup record length checks for KTLS
John Baldwin [Wed, 4 May 2022 20:07:36 +0000 (13:07 -0700)]
OpenSSL: Cleanup record length checks for KTLS

In some corner cases the check for packets
which exceed the allowed record length was missing
when KTLS is initially enabled, when some
unprocessed packets are still pending.

Approved by: jkim
Obtained from: OpenSSL commit 8fff986d52606e1a33f9404504535e2e2aee3e8b
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34972

2 years agomfc-candidates.sh: Set default target branch for ports
Joseph Mingrone [Wed, 4 May 2022 19:43:20 +0000 (16:43 -0300)]
mfc-candidates.sh: Set default target branch for ports

Approved by: emaste, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35096

2 years agoasmc: Add support for Macmini 5,1 (2011) and 5,3 and 7,1 (2014) models
Trev [Wed, 4 May 2022 15:00:40 +0000 (11:00 -0400)]
asmc: Add support for Macmini 5,1 (2011) and 5,3 and 7,1 (2014) models

PR: 262456
MFC after: 2 weeks

2 years agoasmc: Style
Mark Johnston [Wed, 4 May 2022 14:54:33 +0000 (10:54 -0400)]
asmc: Style

MFC after: 2 weeks

2 years agoasmc: Add support for MacBook Pro 9,1 (mid 2012)
Daniel W. Delâtre [Wed, 4 May 2022 14:51:18 +0000 (10:51 -0400)]
asmc: Add support for MacBook Pro 9,1 (mid 2012)

PR: 261981
MFC after: 2 weeks

2 years agoasmc: Make the model table const and local to asmc.c
Mark Johnston [Wed, 4 May 2022 14:44:54 +0000 (10:44 -0400)]
asmc: Make the model table const and local to asmc.c

No functional change intended.

MFC after: 2 weeks

2 years agoasmc: Add support for MacPro 6,1 (2013)
Adam S [Wed, 4 May 2022 14:42:39 +0000 (10:42 -0400)]
asmc: Add support for MacPro 6,1 (2013)

PR: 260781
MFC after: 2 weeks

2 years agoasmc: Add support for MacBook Air 4,1 and 4,2 (2011)
Mark Johnston [Wed, 4 May 2022 14:33:40 +0000 (10:33 -0400)]
asmc: Add support for MacBook Air 4,1 and 4,2 (2011)

PR: 218574
Submitted by: NapoleonWils0n <t43InvisibleMan@gmail.com>
Submitted by: John Hay <john@sanren.ac.za>
MFC after: 2 weeks

2 years agostand/zfs: Fix const-qual warnings
Mark Johnston [Fri, 29 Apr 2022 13:19:34 +0000 (09:19 -0400)]
stand/zfs: Fix const-qual warnings

The input buffer is read-only, update casts to match.

No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agobwn: eliminate dead writes in BWN_GPL_PHY
Greg V [Wed, 4 May 2022 13:32:59 +0000 (09:32 -0400)]
bwn: eliminate dead writes in BWN_GPL_PHY

This fixes the newly Werror'ed useless write warnings with options
BWN_GPL_PHY.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35105

2 years agolinux(4): Implement recvmmsg_time64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:53 +0000 (13:06 +0300)]
linux(4): Implement recvmmsg_time64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Regen for recvmmsg_time64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:52 +0000 (13:06 +0300)]
linux(4): Regen for recvmmsg_time64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Change recvmmsg_time64 syscall definition to match Linux actual one.
Dmitry Chagin [Wed, 4 May 2022 10:06:52 +0000 (13:06 +0300)]
linux(4): Change recvmmsg_time64 syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agolinux(4): Implement timerfd_gettime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:52 +0000 (13:06 +0300)]
linux(4): Implement timerfd_gettime64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Regen for timerfd_gettime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:51 +0000 (13:06 +0300)]
linux(4): Regen for timerfd_gettime64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Change timerfd_gettime64 syscall definition to match Linux actual one.
Dmitry Chagin [Wed, 4 May 2022 10:06:51 +0000 (13:06 +0300)]
linux(4): Change timerfd_gettime64 syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agolinux(4): Implement timerfd_settime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:50 +0000 (13:06 +0300)]
linux(4): Implement timerfd_settime64 syscall.

MFC after: 2weeks

2 years agolinux(4): Regen for timerfd_settime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:50 +0000 (13:06 +0300)]
linux(4): Regen for timerfd_settime64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Change timerfd_settime64 syscall definition to match Linux actual one.
Dmitry Chagin [Wed, 4 May 2022 10:06:50 +0000 (13:06 +0300)]
linux(4): Change timerfd_settime64 syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agolinux(4): Implement timer_settime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:49 +0000 (13:06 +0300)]
linux(4): Implement timer_settime64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Regen for timer_settime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:49 +0000 (13:06 +0300)]
linux(4): Regen for timer_settime64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Change timer_settime64 syscall definition to match Linux actual one.
Dmitry Chagin [Wed, 4 May 2022 10:06:48 +0000 (13:06 +0300)]
linux(4): Change timer_settime64 syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agolinux(4): Implement timer_gettime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:48 +0000 (13:06 +0300)]
linux(4): Implement timer_gettime64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Regen for timer_gettime64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:48 +0000 (13:06 +0300)]
linux(4): Regen for timer_gettime64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Change timer_gettime64 syscall definition to match Linux actual one.
Dmitry Chagin [Wed, 4 May 2022 10:06:47 +0000 (13:06 +0300)]
linux(4): Change timer_gettime64 syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agolinux(4): Implement sched_rr_get_interval_time64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:47 +0000 (13:06 +0300)]
linux(4): Implement sched_rr_get_interval_time64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Regen for sched_rr_get_interval_time64 syscall.
Dmitry Chagin [Wed, 4 May 2022 10:06:46 +0000 (13:06 +0300)]
linux(4): Regen for sched_rr_get_interval_time64 syscall.

MFC after: 2 weeks

2 years agolinux(4): Change sched_rr_get_interval_time64 syscall definition to match Linux actua...
Dmitry Chagin [Wed, 4 May 2022 10:06:45 +0000 (13:06 +0300)]
linux(4): Change sched_rr_get_interval_time64 syscall definition to match Linux actual one.

MFC after: 2 weeks

2 years agoxhci(4): Tweak USB port speed checks to allow newer super speed generations.
Hans Petter Selasky [Tue, 3 May 2022 20:20:27 +0000 (22:20 +0200)]
xhci(4): Tweak USB port speed checks to allow newer super speed generations.

This allows setting the U1 and U2 port timeout values.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoxhci(4): Properly define all basic USB port speeds.
Hans Petter Selasky [Tue, 3 May 2022 20:19:35 +0000 (22:19 +0200)]
xhci(4): Properly define all basic USB port speeds.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agotests: vnet tests started failing in CI, disable temporarily
Marko Zec [Wed, 4 May 2022 04:19:46 +0000 (06:19 +0200)]
tests: vnet tests started failing in CI, disable temporarily

As a fallout of backing out 91f44749c6fe, vnet tests started
failing in CI.  Temporarily broadly disable vnet tests until
specific cases can be resolved, and file a bug.

PR: 263767
Differential Revision: https://reviews.freebsd.org/D35119
Submitted by: kbowling

2 years agoOpenSSL: Merge OpenSSL 1.1.1o
Jung-uk Kim [Tue, 3 May 2022 19:12:42 +0000 (15:12 -0400)]
OpenSSL: Merge OpenSSL 1.1.1o

2 years agoOpenSSL: Merge OpenSSL 1.1.1o
Jung-uk Kim [Tue, 3 May 2022 19:07:06 +0000 (15:07 -0400)]
OpenSSL: Merge OpenSSL 1.1.1o

Merge commit 'cf0ffd7607ed8f39829c6951a65a55fa1eb3aafe'

2 years agoVNET: Revert "ifnet: make if_index global"
Marko Zec [Tue, 3 May 2022 14:57:55 +0000 (16:57 +0200)]
VNET: Revert "ifnet: make if_index global"

This reverts commit 91f44749c6feb50f39af8805dd803e860f0418f1.

Devirtualization of V_if_index and V_ifindex_table was rushed into
the tree lacking proper context, discussion, and declaration of intent,
so I'm backing it out as harmful to VNET on the following grounds:

1) The change repurposed the decades-old and stable if_index KBI for
new, unclear goals which were omitted from the commit note.

2) The change opened up a new resource exhaustion vector where any vnet
could starve the system of ifnet indices, including vnet0.

3) To circumvent the newly introduced problem of separating ifnets
belonging to different vnets from the globalized ifindex_table, the
author introduced sysctl_ifcount() which does a linear traversal over
the (potentially huge) global ifnet list just to return a simple upper
bound on existing ifnet indices.

4) The change effectively led to nonuniform ifnet index allocation
among vnets.

5) The commit note clearly stated that the patch changed the implicit
if_index ABI contract where ifnet indices were assumed to be starting
from one.  The commit note also included a correct observation that
holes in interface indices were always allowed, but failed to declare
that the userland-observable ifindex tables could now include huge
empty spans even under modest operating conditions.

6) The author had an earlier proposal in the works which did not
affect per-vnet ifnet lists (D33265) but which he abandoned without
providing the rationale behind his decision to do so, at the expense
of sacrificing the vnet isolation contract and if_index ABI / KBI.

Furthermore, the author agreed to back out his changes himself and
to follow up with a proposal for a less intrusive alternative, but
later silently declined to act.  Therefore, I decided to resolve the
status-quo by backing this out myself.  This in no way precludes a
future proposal aiming to mitigate ifnet-removal related system
crashes or panics to be accepted, provided it would not unnecessarily
compromise the goal of as strict as possible isolation between vnets.

Obtained from: github.com/glebius/FreeBSD/commits/backout-ifindex