freebsd.git
16 months agolinux: For better compatibility, provide compatible endian.h
Warner Losh [Fri, 20 Jan 2023 23:32:45 +0000 (16:32 -0700)]
linux: For better compatibility, provide compatible endian.h

Add endian.h. This includes sys/endian.h and then adds extra defines
that glibc defines with double underscores for our
_{BIG,BYTE,LITTLE,PDP}_ENDIAN macros. We also define __FLOAT_WORD_ORDER
to be the same as _BYTE_ENDIAN since FreeBSD doesn't currently define
this, and the default with glibc is exactly this for our platforms.
Move common parts of endian.h and sys/endian.h into sys/_endian.h
to limit namespace pollution from endian.h

All this gives us good compatibility with Linux. There may be one or two
upstreams that haven't integrated the patches I tried to send up.

There are some minor differences:
o The extra glibc macros are not defined. These are all
  controlled with either __ at the start, or only defined
  when glibc is being built. We also don't define macros
  that are used internally in glibc that would pollute
  the namespace.
o For complete compatibility, this change must also be
  paired with providing a glibc-compatible byteswap.h.

Sponsored by: Netflix
Reviewed by: mhorne, markj, jhb
Differential Revision: https://reviews.freebsd.org/D31962

16 months agoUPDATING: Remove old entries
Warner Losh [Fri, 20 Jan 2023 23:17:45 +0000 (16:17 -0700)]
UPDATING: Remove old entries

Belatedly remove the entries older than the stable/11 branch point after
stable/13 was created. This should be done shortly after the branch, not
well after the branch point.

Document this policy in UPDATING, though other checklists should likely
be updated as well.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37514

16 months agoelf_common.h: define EF_ARM_EABI_VERSION
Warner Losh [Fri, 20 Jan 2023 23:15:04 +0000 (16:15 -0700)]
elf_common.h: define EF_ARM_EABI_VERSION

The Linux distributions have had the EF_ARM_EABI_VERSION macro for a
while now. The kernel of arm* targets build depends on it being in the
host's elf.h environment. Add it here so it gets pulled in so there's
one fewer hack required to build a Linux kernel on a FreeBSD host.

Sponsored by: Netflix
Reviewed by: jrtc27, kib, jhb
Differential Revision: https://reviews.freebsd.org/D38139

16 months agoUPDATING: update notes on EFI booting
Warner Losh [Fri, 20 Jan 2023 23:13:54 +0000 (16:13 -0700)]
UPDATING: update notes on EFI booting

The notes on EFI booting and updating for ZFS had become dated and only
partially updated. Expand the notes with a few more details and a
pointer to laoder.efi(8) and uefi(8).

Sponsored by: Netflix
Discussed with: pauamma, karels
Differential Revision: https://reviews.freebsd.org/D36629

16 months agoHandle int rank issues in in vn_getsize_locked() and vn_seek()
Konstantin Belousov [Fri, 20 Jan 2023 06:45:35 +0000 (08:45 +0200)]
Handle int rank issues in in vn_getsize_locked() and vn_seek()

In vn_getsize_locked(), when storing vattr.va_size of type u_quad_t into
off_t size, we must avoid overflow.

Then, the check for fsize < 0, introduced in the commit
f45feecfb27ca51067d6789eaa43547cadc4990b 'vfs: add vn_getsize', is nop [1].

Reported and reviewed by: jhb
Coverity CID: 1502346
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38133

16 months agokern_umtx.c do_wait(): correct confusing indent
Konstantin Belousov [Fri, 20 Jan 2023 21:32:27 +0000 (23:32 +0200)]
kern_umtx.c do_wait(): correct confusing indent

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

16 months agohms(4): Fix a copy/paste issue and check both _X and _Y
Yuri [Fri, 20 Jan 2023 20:25:17 +0000 (23:25 +0300)]
hms(4): Fix a copy/paste issue and check both _X and _Y

instead of checking _X 2 times.

Reviewed by: wulf
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D38135

16 months agovmm: fix use after free in ppt_detach()
Robert Wing [Fri, 20 Jan 2023 11:25:27 +0000 (11:25 +0000)]
vmm: fix use after free in ppt_detach()

The vmm module destroys the host_domain before unloading the ppt module
causing a use after free. This can happen when kldunload'ing vmm.

Reviewed by: markj, jhb
Differential Revision: https://reviews.freebsd.org/D38072

16 months agovmm: take exclusive mem_segs_lock in vm_cleanup()
Robert Wing [Fri, 20 Jan 2023 11:10:53 +0000 (11:10 +0000)]
vmm: take exclusive mem_segs_lock in vm_cleanup()

The consumers of vm_cleanup() are vm_reinit() and vm_destroy().

The vm_reinit() call path is, here vmmdev_ioctl() takes mem_segs_lock:
    vmmdev_ioctl()
    vm_reinit()
    vm_cleanup(destroy=false)

The call path for vm_destroy() is (mem_segs_lock not taken):
    sysctl_vmm_destroy()
    vmmdev_destroy()
    vm_destroy()
    vm_cleanup(destroy=true)

Fix this by taking mem_segs_lock in vm_cleanup() when destroy == true.

Reviewed by: corvink, markj, jhb
Fixes:  67b69e76e8ee ("vmm: Use an sx lock to protect the memory map.")
Differential Revision: https://reviews.freebsd.org/D38071

16 months agovmm: take exclusive mem_segs_lock when (un)assigning ppt dev
Robert Wing [Fri, 20 Jan 2023 10:03:59 +0000 (10:03 +0000)]
vmm: take exclusive mem_segs_lock when (un)assigning ppt dev

PR:             268744
Reported by:    mmatalka@gmail.com
Reviewed by: corvink, markj, jhb
Fixes:  67b69e76e8ee ("vmm: Use an sx lock to protect the memory map.")
Differential Revision: https://reviews.freebsd.org/D37962

16 months agoepoch: replace hand coded assertion
Brooks Davis [Fri, 20 Jan 2023 18:03:39 +0000 (18:03 +0000)]
epoch: replace hand coded assertion

The assertion is equivalent to kstack_contains() so use that rather
than spelling it out.

Suggested by: jhb
Reviewed by: jhb
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D38107

16 months agobhyve: Fix a buffer overread in the PCI hda device model.
John Baldwin [Fri, 20 Jan 2023 17:58:38 +0000 (09:58 -0800)]
bhyve: Fix a buffer overread in the PCI hda device model.

The sc->codecs array contains HDA_CODEC_MAX (15) entries.  The
guest-supplied cad field in the verb provided to hda_send_command is a
4-bit field that was used as an index into sc->codecs without any
bounds checking.  The highest value (15) would overflow the array.

Other uses of sc->codecs in the device model used sc->codecs_no to
determine which array indices have been initialized, so use a similar
check to reject requests for uninitialized or invalid cad indices in
hda_send_command.

PR: 264582
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: corvink, markj, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38128

16 months agobhyve: Fix a global buffer overread in the PCI hda device model.
John Baldwin [Fri, 20 Jan 2023 17:57:45 +0000 (09:57 -0800)]
bhyve: Fix a global buffer overread in the PCI hda device model.

hda_write did not validate the relative register offset before using
it as an index into the hda_set_reg_table array to lookup a function
pointer to execute after updating the register's value.

PR: 264435
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: corvink, markj, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38127

16 months agoRevert "ifconfig: abort if loading a module fails other than for ENOENT"
Alan Somers [Fri, 20 Jan 2023 17:17:21 +0000 (10:17 -0700)]
Revert "ifconfig: abort if loading a module fails other than for ENOENT"

This reverts commit 2c24ad3377a6f584e484656db8390e4eb7cfc119.

This change causes some commands to fail, for example when working with
renamed interfaces or when trying to list a nonexistent interface by
name.

PR: 269042
Reported by: dbaio, Michael Paepcke <bugs.fbsd@paepcke.de>
MFC with: 2c24ad3377a6f584e484656db8390e4eb7cfc119

16 months agoShell-escape assignments to PATH in the top-level makefiles
Alex Richardson [Fri, 20 Jan 2023 10:47:17 +0000 (10:47 +0000)]
Shell-escape assignments to PATH in the top-level makefiles

Since 16fbf0191243e7c9dff6615b1424b5d39186b36c PATH is no longer set
to a hardcoded value on non-FreeBSD build hosts, so we can end up with
spaces in $PATH. Instead of only escaping PATH I updated all `env PATH=`
uses in the toplevel makefile. While many of these currently can't
contain any special characters (since the build would have failed
already), in theory this gets us closer to allowing build/source
directory to contain e.g. spaces.

16 months agovmstat: fix overflow of interrupt name buffer
Elliott Mitchell [Sat, 26 Nov 2022 16:21:33 +0000 (09:21 -0700)]
vmstat: fix overflow of interrupt name buffer

sysctl() provides a count of number of bytes in the buffer.  That is the
actual buffer length.  Whereas looking for an interrupt entry with an
empty name could terminate too early, or overflow the end of the buffer.
The overflow will occur if the table of interrupt names is full.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36628

16 months agovmstat: remove shadow variables
Elliott Mitchell [Wed, 21 Sep 2022 02:18:23 +0000 (19:18 -0700)]
vmstat: remove shadow variables

These appear to simply be the style of arguments are left untouched and
only local variables are modified.  While some may prefer that style
this simply serves to complicate things as they're perfectly writeable.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36628

16 months agomd.c: another style fix
Konstantin Belousov [Fri, 20 Jan 2023 02:39:36 +0000 (04:39 +0200)]
md.c: another style fix

Noted by: jkim
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

16 months agoHandle ERELOOKUP from VOP_FSYNC() in several other places
Konstantin Belousov [Wed, 18 Jan 2023 21:09:10 +0000 (23:09 +0200)]
Handle ERELOOKUP from VOP_FSYNC() in several other places

We need to repeat the operation if the vnode was relocked.

Reported and reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38114

16 months agovm_object.c: minor style
Konstantin Belousov [Thu, 19 Jan 2023 18:32:16 +0000 (20:32 +0200)]
vm_object.c: minor style

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

16 months agostdlib.h: Fix qsort_r compatibility with GCC 12.
John Baldwin [Thu, 19 Jan 2023 22:48:52 +0000 (14:48 -0800)]
stdlib.h: Fix qsort_r compatibility with GCC 12.

GCC 12 (unlike GCC 9) does not match a function argument passed to the
old qsort_r() API (as is used in the qsort_r_compat test) to a
function pointer type via __generic.  It treats the function type as a
distinct type from a function pointer.  As a workaround, add a second
definition of qsort_r for GCC 12 which uses the bare function type.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37410

16 months agoMakefile: Avoid sanitizing PATH on non-FreeBSD systems
Jake Freeland [Thu, 19 Jan 2023 22:24:44 +0000 (22:24 +0000)]
Makefile: Avoid sanitizing PATH on non-FreeBSD systems

Allow the build process to find host binaries during the host-symlinks target when
cross-building on non-FreeBSD systems. Whilst most non-FreeBSD systems have all
the needed tools in /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin (the final
path added by host-symlinks itself), Homebrew for macOS on Arm defaults to
/opt/homebrew/bin, other more niche systems may also deviate and users may
expect tools in a customised PATH to be picked up, unlike on FreeBSD where we
want to ensure everything comes from base. In particular, (un)xz are needed
from Homebrew on macOS, and thus cannot be found on Arm without this.

Note that non-FreeBSD builds enforce BUILD_WITH_STRICT_TMPPATH, and so the
actual main build steps will still use a sanitised PATH.

Reviewed by: jrtc27, arichardson
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37991

16 months ago<sys/sysctl.h>: Reduce overly broad header pollution.
John Baldwin [Thu, 19 Jan 2023 18:32:45 +0000 (10:32 -0800)]
<sys/sysctl.h>: Reduce overly broad header pollution.

Commit d3f96f661050e9bd21fe29931992a8b9e67ff189 removed <sys/queue.h>
and replaced it with the very broad <sys/systm.h>.  However, none of
the changes to sysctl.h in that commit require anything defined in
<sys/systm.h>.  On the other hand, <sys/sysctl.h> does still make use
of queue macros.  Drop the include of <sys/systm.h> and re-add
<sys/queue.h>.

Reviewed by: imp, kib, asomers
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D37950

16 months agobhyve: Remove vmctx argument from PCI device model methods.
John Baldwin [Thu, 19 Jan 2023 18:30:18 +0000 (10:30 -0800)]
bhyve: Remove vmctx argument from PCI device model methods.

Most of these arguments were unused.  Device models which do need
access to the vmctx in one of these methods can obtain it from the
pi_vmctx member of the pci_devinst argument instead.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D38096

16 months agobhyve: Avoid triggering false -Wfree-nonheap-object warnings.
John Baldwin [Thu, 19 Jan 2023 18:21:50 +0000 (10:21 -0800)]
bhyve: Avoid triggering false -Wfree-nonheap-object warnings.

XHCI port and slot numbers are 1-based rather than 0-based.  To handle
this, bhyve was subtracting one item from the pointers saved in the
softc so that index 1 accessed index 0 of the allocated array.

However, this is UB and confused GCC 12.  The compiler noticed that
the calls to free() were using an offset and emitted a warning.
Rather than storing UB pointers in the softc, push the decrement
operation into the existing macros that wrap accesses to the relevant
arrays.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D36829

16 months agoamd64: Fix a common typo in source code comments
Gordon Bergling [Thu, 19 Jan 2023 13:27:18 +0000 (14:27 +0100)]
amd64: Fix a common typo in source code comments

- s/comparision/comparison/

MFC after: 3 days

16 months agonfs: Fix a common typo in source code comments
Gordon Bergling [Thu, 19 Jan 2023 13:26:06 +0000 (14:26 +0100)]
nfs: Fix a common typo in source code comments

- s/ingore/ignore/

MFC after: 3 days

16 months agomountd(8): Fix a typo in a source code comment
Gordon Bergling [Thu, 19 Jan 2023 13:23:51 +0000 (14:23 +0100)]
mountd(8): Fix a typo in a source code comment

- s/ingore/ignore/

MFC after: 3 days

16 months agocxgbetool(8): Fix common typos in sysctl descriptions
Gordon Bergling [Thu, 19 Jan 2023 13:22:00 +0000 (14:22 +0100)]
cxgbetool(8): Fix common typos in sysctl descriptions

- s/addres/address/

MFC after: 5 days

16 months agobsnmpget.1: Fix a typo in the man page
Gordon Bergling [Thu, 19 Jan 2023 13:18:52 +0000 (14:18 +0100)]
bsnmpget.1: Fix a typo in the man page

- s/ingore/ignore/

MFC after: 3 days

16 months agorc.initdiskless: Fix a typo in a comment
Gordon Bergling [Thu, 19 Jan 2023 13:17:37 +0000 (14:17 +0100)]
rc.initdiskless: Fix a typo in a comment

- s/attemping/attempting/

MFC after:5 days

16 months agoath(4): Fix a sysctl description and a typo in a comment
Gordon Bergling [Thu, 19 Jan 2023 13:16:05 +0000 (14:16 +0100)]
ath(4): Fix a sysctl description and a typo in a comment

- s/delimeter/delimiter/

MFC after: 7 days

16 months agoip_gre: Fix a common typo in source code comments
Gordon Bergling [Thu, 19 Jan 2023 13:13:02 +0000 (14:13 +0100)]
ip_gre: Fix a common typo in source code comments

- s/addres/address/

MFC after: 3 days

16 months agoextra_tcp_stacks: Fix a common typo in source code comments
Gordon Bergling [Thu, 19 Jan 2023 13:11:00 +0000 (14:11 +0100)]
extra_tcp_stacks: Fix a common typo in source code comments

- s/orginal/original/

MFC after: 3 days

16 months agoImprove debuggability of VOP_* locking assertions
Jason A. Harmening [Mon, 16 Jan 2023 20:07:19 +0000 (14:07 -0600)]
Improve debuggability of VOP_* locking assertions

Include the phase and argument field to make it easier to determine
at a glance where the failure originated.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D38091

16 months agoktls_disable_ifnet_help: Set curvnet around sorele().
John Baldwin [Wed, 18 Jan 2023 23:39:04 +0000 (15:39 -0800)]
ktls_disable_ifnet_help: Set curvnet around sorele().

This is required in kernels with VIMAGE such as GENERIC.

MFC after: 1 week
Sponsored by: Chelsio Communications

16 months agolinuxkpi: Define `hrtimer_try_to_cancel()`
Jean-Sébastien Pédron [Wed, 11 Jan 2023 01:00:57 +0000 (02:00 +0100)]
linuxkpi: Define `hrtimer_try_to_cancel()`

It is the same as callout_stop(9) but the return values are different.

Reviewed by: hselasky
Approved by: hselasky
Differential Revision: https://reviews.freebsd.org/D38081

16 months agoipsec.c: typos in the comment
Konstantin Belousov [Sat, 4 Sep 2021 13:42:33 +0000 (16:42 +0300)]
ipsec.c: typos in the comment

Sponsored by: NVIDIA Networking
MFC after: 3 days

16 months agoif_ipsec(4): handle situations where there are no policy or SADB entry for if
Konstantin Belousov [Tue, 17 Jan 2023 01:59:56 +0000 (03:59 +0200)]
if_ipsec(4): handle situations where there are no policy or SADB entry for if

Reviewed by: ae, hselasky
Sponsored by: NVIDIA Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38093

16 months agoif_ipsec(4): protect against user supplying unknown address family
Konstantin Belousov [Tue, 17 Jan 2023 01:37:45 +0000 (03:37 +0200)]
if_ipsec(4): protect against user supplying unknown address family

Reviewed by: ae, hselasky
Sponsored by: NVIDIA Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38093

16 months agoAdd CPU Ident for Qualcomm Kryo 400 (used in MS Dev Kit)
Allan Jude [Tue, 20 Dec 2022 21:31:38 +0000 (21:31 +0000)]
Add CPU Ident for Qualcomm Kryo 400 (used in MS Dev Kit)

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

16 months agoRefresh CPU types and classes from sys/sys/pmc.h.
Pau Amma [Sat, 28 May 2022 18:49:17 +0000 (18:49 +0000)]
Refresh CPU types and classes from sys/sys/pmc.h.

While here, fix a few nits.

Inspired by reviewing D35342.

Sources for trademark info
- https://www.arm.com/company/policies/trademarks (no Arm8, curiously)
- https://www.ibm.com/legal/copytrade?mhsrc=ibmsearch_a&mhq=trademark

Reviewed by: carlavilla, luporl, mhorne
Approved by: carlavilla (mentor), mhorne (src)
Differential Revision: https://reviews.freebsd.org/D35344

16 months agoumodem: ignore CDC_CM descriptor for baltech smartcard reader
Steffen Dirkwinkel [Fri, 4 Nov 2022 14:46:07 +0000 (15:46 +0100)]
umodem: ignore CDC_CM descriptor for baltech smartcard reader

The CDC_CM descriptor points to the wrong interface for serial port use.
Ignore it to use the CDC_UNION descriptor.

usbconfig dump (spec at: https://usb.org/sites/default/files/CDC1.2_WMC1.1_012011.zip):
ugen0.2: <Baltech AG Smartcard Reader> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (300mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x13ad
  idProduct = 0xf019
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <Baltech AG>
  iProduct = 0x0002  <Smartcard Reader>
  iSerialNumber = 0x0003  <45031910>
  bNumConfigurations = 0x0001

 Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x0064
    bNumInterfaces = 0x0003
    bConfigurationValue = 0x0001
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080
    bMaxPower = 0x0096

    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0003  <HID device>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x21
      bDescriptorSubType = 0x11
       RAW dump:
       0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0xd0,
       0x08 | 0x00

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040
        bInterval = 0x0001
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x08
      bDescriptorType = 0x0b
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x08, 0x0b, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00

    Interface 1
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0002  <Communication device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x00
       RAW dump:
       0x00 | 0x05, 0x24, 0x00, 0x10, 0x01

      Additional Descriptor

      bLength = 0x04
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x04, 0x24, 0x02, 0x00

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x06
       RAW dump:
       0x00 | 0x05, 0x24, 0x06, 0x01, 0x02

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x05, 0x24, 0x01, 0x00, 0x01

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0085  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0008
        bInterval = 0x0010
        bRefresh = 0x0000
        bSynchAddress = 0x0000

    Interface 2
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0002
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0002
      bInterfaceClass = 0x000a  <CDC-data>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0086  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

     Endpoint 1
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0006  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

Reviewed by: manu
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37942

16 months agoumodem: add quirk to ignore CDC_CM descriptor
Steffen Dirkwinkel [Tue, 17 Jan 2023 07:58:46 +0000 (08:58 +0100)]
umodem: add quirk to ignore CDC_CM descriptor

Some devices have CDC_CM descriptors that would point us to
the wrong interfaces. Add a quirk to ignore those (prefering the
CDC_UNION descriptor effectively)

Reviewed by: manu
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37942

16 months agoAdd the fixed memory type to the pci ecam driver
Andrew Turner [Wed, 18 Jan 2023 09:30:46 +0000 (09:30 +0000)]
Add the fixed memory type to the pci ecam driver

Add ACPI_RESOURCE_TYPE_FIXED_MEMORY32 to the PCI ECAM driver. This is
used on the Microsoft Dev Kit 2023 and reportedly the Lenovo x13s.

Reviewed by: Robert Clausecker <fuz@fuz.su> (Earlier version)
Tested by: Robert Clausecker <fuz@fuz.su> (Earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38031

16 months agoReduce an arm64 VFP critical section
Andrew Turner [Wed, 18 Jan 2023 09:30:36 +0000 (09:30 +0000)]
Reduce an arm64 VFP critical section

In set_fpcontext we only need a critical section around vfp_discard.
The remainder of the code can run without it.

While here add an assert to check the passed in thread is the
current thread as the code already this.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38000

16 months agoAlways store the arm64 VFP context
Andrew Turner [Wed, 18 Jan 2023 09:30:32 +0000 (09:30 +0000)]
Always store the arm64 VFP context

If a thread enters a kernel FP context the PCB_FP_STARTED may be
unset when calling get_fpcontext even if the VFP unit has been used
by the current thread.

Reduce the use of this flag to just decide when to store the VFP state.

While here add an assert to check the assumption that the passed in
thread is the current thread and remove the unneeded critical section.
The latter is unneeded as the only place we would need it is in
vfp_save_state and this already has a critical section when needed.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D37998

16 months agoAlways read the VFP regs in the arm64 fill_fpregs
Andrew Turner [Wed, 18 Jan 2023 09:30:20 +0000 (09:30 +0000)]
Always read the VFP regs in the arm64 fill_fpregs

The PCB_FP_STARTED is used to indicate that the current VFP context
has been used since either 1. the start of the thread, or 2. exiting
a kernel FP context.

When case 2 was added to the kernel this could cause incorrect results
to be returned when a thread exits the kernel FP context and fill_fpregs
is called before it has restored the VFP state, e.g. by trappin on a
userspace VFP instruction.

In both of the cases the base save area is still valid so reduce the
use of the PCB_FP_STARTED flag check to help decide if we need to
store the current threads VFP state.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D37994

16 months agounbound: Fix config file path
Juraj Lutter [Tue, 17 Jan 2023 17:25:47 +0000 (18:25 +0100)]
unbound: Fix config file path

Commit 1838dec31895fd4752fa8631322ab93be0705a66 changed the
config file path to /usr/local/etc/unbound/unbound.conf which
is wrong for unbound in base.

Reported by: Ihor Antonov <ihor_AT_antonovs_family>
Reviewed by: zlei
Approved by: zlei
Differential Revision: https://reviews.freebsd.org/D38106

Fixes:          1838dec31895fd4752fa8631322ab93be0705a66
MFC after:      1 month
X-MFC with:     1838dec31895fd4752fa8631322ab93be0705a66

16 months agoifnet: Rename DrvAPI to "IfAPI"
Justin Hibbits [Tue, 17 Jan 2023 20:08:43 +0000 (15:08 -0500)]
ifnet: Rename DrvAPI to "IfAPI"

"DrvAPI" is too generic a name.  Make the name more specific as "IfAPI"
(InterFace API).

Sponsored by: Juniper Networks, Inc.

16 months agoriscv: Fix thread0.td_kstack_pages init
Brooks Davis [Tue, 17 Jan 2023 16:36:15 +0000 (16:36 +0000)]
riscv: Fix thread0.td_kstack_pages init

Commit 0ef3ca7ae37c70e9dc83475dc2e68e98e1c2a418 initialized
thread0.td_kstack_pages to KSTACK_PAGES.  Due to the lack of an
include of opt_kstack_pages.h it used the fallback value of 4 from
machine/param.h.  This meant that increasing KSTACK_PAGES in the kernel
config resulted in a panic in _epoch_enter_preempt as the following
assertion was false during network stack setup:

MPASS((vm_offset_t)et >= td->td_kstack &&
    (vm_offset_t)et + sizeof(struct epoch_tracker) <=
    td->td_kstack + td->td_kstack_pages * PAGE_SIZE);

Switch to initializing with kstack_pages following other architectures.

Reviewed by: imp, markj
Sponsored by:   DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D38049

16 months agoarm64: Fix thread0.td_kstack_pages init
Brooks Davis [Tue, 17 Jan 2023 16:35:08 +0000 (16:35 +0000)]
arm64: Fix thread0.td_kstack_pages init

Commit 86a994d6537d7b5e1efb1019e466d86a688fd570 initialized
thread0.td_kstack_pages to KSTACK_PAGES.  Due to the lack of an
include of opt_kstack_pages.h it used the fallback value of 4 from
machine/param.h.  This meant that increasing KSTACK_PAGES in the kernel
config resulted in a panic in _epoch_enter_preempt as the following
assertion was false during network stack setup:

        MPASS((vm_offset_t)et >= td->td_kstack &&
    (vm_offset_t)et + sizeof(struct epoch_tracker) <=
    td->td_kstack + td->td_kstack_pages * PAGE_SIZE);

Switch to initializing with kstack_pages following other architectures.

Reviewed by: imp, markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D38048

16 months agodf: Return non-zero status on write failure.
Dag-Erling Smørgrav [Tue, 17 Jan 2023 13:40:05 +0000 (14:40 +0100)]
df: Return non-zero status on write failure.

While here, complete the libxo conversion and switch return value to standard constants.

MFC after: 1 week
Sponsored by: Klara, Inc.
Differential revision: https://reviews.freebsd.org/D38097

16 months agonetlink: Fix indentation in netlink_message_writer.c
Mark Johnston [Tue, 17 Jan 2023 14:37:33 +0000 (09:37 -0500)]
netlink: Fix indentation in netlink_message_writer.c

This file is indented with a mixture of tabs and spaces.  No functional
change intended.

Reviewed by: melifaro
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38100

16 months agonetlink: Make the writers function table static and const
Mark Johnston [Tue, 17 Jan 2023 14:37:21 +0000 (09:37 -0500)]
netlink: Make the writers function table static and const

No functional change intended.

Reviewed by: melifaro
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38099

16 months agonetlink: Zero-initialize mbuf messages
Mark Johnston [Tue, 17 Jan 2023 14:36:54 +0000 (09:36 -0500)]
netlink: Zero-initialize mbuf messages

Some users of nlmsg_reserve_object() and nlmsg_reserve_data() are not
careful to fully initialize pad and reserved fields, allowing
uninitialized bytes to leak to userspace.  For example, dump_nhgrp()
doesn't set nhm->resvd = 0.

Meanwhile, nlmsg_get_ns_buf() and nlmsg_get_ns_lbuf() zero-initialize
the buffer, so nlmsg_get_ns_mbuf() is inconsistent.  Let's just make
them all behave the same here.

Reported by: KMSAN
Reviewed by: melifaro
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38098

16 months agomixer(3): remove redundant argument in _mixer_readvol()
Christos Margiolis [Tue, 17 Jan 2023 13:08:59 +0000 (08:08 -0500)]
mixer(3): remove redundant argument in _mixer_readvol()

There's no reason to pass the mixer as an argument since we can fetch it
from mix_dev.  No functional change intended.

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

16 months agoxhci(4): Add new USB IDs.
Dmitry Luhtionov [Tue, 17 Jan 2023 10:43:40 +0000 (11:43 +0100)]
xhci(4): Add new USB IDs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

16 months agoehci(4): Add new USB IDs.
Dmitry Luhtionov [Tue, 17 Jan 2023 10:43:33 +0000 (11:43 +0100)]
ehci(4): Add new USB IDs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

16 months agouhci(4): Add new USB IDs.
Dmitry Luhtionov [Tue, 17 Jan 2023 10:43:24 +0000 (11:43 +0100)]
uhci(4): Add new USB IDs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

16 months agoif_tun: Add basic connectivity test with nc tun support
Tom Jones [Tue, 17 Jan 2023 10:05:00 +0000 (10:05 +0000)]
if_tun: Add basic connectivity test with nc tun support

Reviewed by:    kevans
Sponsored by:   Zenarmor
Sponsored by:   OPNsense
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D37435

16 months agonetcat: Allow nc to be an if_tun tunnel broker
Tom Jones [Tue, 17 Jan 2023 10:02:06 +0000 (10:02 +0000)]
netcat: Allow nc to be an if_tun tunnel broker

Reviewed by: kevans
Relnotes: yes
Sponsored by:   Zenarmor
Sponsored by:   OPNsense
Sponsored by:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37435

16 months agoMinor changes to force commit these files so new freebsd*.cf files are
Gregory Neil Shapiro [Tue, 17 Jan 2023 06:49:49 +0000 (06:49 +0000)]
Minor changes to force commit these files so new freebsd*.cf files are
built to use the new sendmail-8.17.1/cf tree.

16 months agoSync with vendor sendmail 8.17.1 cf/cf/submit.mc
Gregory Neil Shapiro [Tue, 17 Jan 2023 06:49:07 +0000 (06:49 +0000)]
Sync with vendor sendmail 8.17.1 cf/cf/submit.mc

16 months agonetlink: add snl(3) manpage to the build
Alexander V. Chernikov [Mon, 16 Jan 2023 20:24:49 +0000 (20:24 +0000)]
netlink: add snl(3) manpage to the build

16 months agobsdconfig: correct name of the wpa_supplicant config file
Ceri Davies [Mon, 16 Jan 2023 18:56:45 +0000 (18:56 +0000)]
bsdconfig: correct name of the wpa_supplicant config file

Approved by: maintainer timeout (dteske)
Differential Revision: https://reviews.freebsd.org/D37750

16 months agolagg.4: update wireless example, document laggtype
Ceri Davies [Mon, 16 Jan 2023 18:53:30 +0000 (18:53 +0000)]
lagg.4: update wireless example, document laggtype

The wireless example in lagg(4)'s manpage no longer works, so update.

laggtype is not documented in the manpage other than in the example,
so add a paragraph about it.

While here, move section on rc.conf somewhere it sits more logically.

Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D31315

16 months agolinuxkpi: Define EBADSLT to 57
Jean-Sébastien Pédron [Mon, 2 Jan 2023 22:48:16 +0000 (23:48 +0100)]
linuxkpi: Define EBADSLT to 57

This is the same error code as Linux.

As emaste@ noted in the review, FreeBSD defines the following errno
values in `sys/errno.h`:
* 56 is `EISCONN`
* 57 is `ENOTCONN`

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D37935

16 months agolinuxkpi: Add `memalloc_noreclaim_save()` and `memalloc_noreclaim_restore()`
Jean-Sébastien Pédron [Mon, 2 Jan 2023 20:59:17 +0000 (21:59 +0100)]
linuxkpi: Add `memalloc_noreclaim_save()` and `memalloc_noreclaim_restore()`

They are no-ops.

Reviewed by: emaste, manu
Approved by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D37933

16 months agolinuxkpi: Define `ioremap_cache()`
Jean-Sébastien Pédron [Fri, 30 Dec 2022 10:36:24 +0000 (11:36 +0100)]
linuxkpi: Define `ioremap_cache()`

It uses the `VM_MEMATTR_WRITE_BACK` flag on FreeBSD.

It replaces `ioremap_wb()` which doesn't exist in Linux. Perhaps it
existed in the past and was removed.

Reviewed by: emaste, manu
Approved by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D37916

16 months agolinuxkpi: Add `gfp_mask` field to `struct shrink_control`
Jean-Sébastien Pédron [Fri, 30 Dec 2022 09:56:46 +0000 (10:56 +0100)]
linuxkpi: Add `gfp_mask` field to `struct shrink_control`

bz@ asked if the KBI breakage is a concern here. My answer was that this
is the first time in the DRM drivers in Linux 5.13 (the version I'm
working on) that this structure is initialized (as a variable local to
the function in this case), so it shouldn't be a problem for the DRM
drivers.

However, I can't speak for other drivers maintained outside of the src
tree.

Reviewed by: emaste, manu
Approved by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D37913

16 months agolinuxkpi: Define `GFP_NOFS` in `linux/gfp.h`
Jean-Sébastien Pédron [Fri, 30 Dec 2022 09:49:08 +0000 (10:49 +0100)]
linuxkpi: Define `GFP_NOFS` in `linux/gfp.h`

Reviewed by: emaste, manu
Approved by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D37910

16 months agobsdconfig, bsdinstall: Refresh mirrors list
Danilo G. Baio [Tue, 10 Jan 2023 01:06:57 +0000 (22:06 -0300)]
bsdconfig, bsdinstall: Refresh mirrors list

The mirrors list is in sync with the Handbook / Mirrors section [1],
which was refreshed a few months ago. Mirrors removed were not
responding or had duplicated addresses (aliases) with another mirror.

1 - https://docs.freebsd.org/en/books/handbook/mirrors/

Reviewed by: philip (clusteradm)
Approved by: philip
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38014

16 months agovm_object: Fix a kernel memory disclosure via the vm_object list sysctl
Mark Johnston [Mon, 16 Jan 2023 15:53:59 +0000 (10:53 -0500)]
vm_object: Fix a kernel memory disclosure via the vm_object list sysctl

Reported by: Chris J-D <chris@accessvector.net>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

16 months agoipsec: Clear pad bytes in PF_KEY messages
Mark Johnston [Mon, 16 Jan 2023 15:46:20 +0000 (10:46 -0500)]
ipsec: Clear pad bytes in PF_KEY messages

Various handlers for SADB messages will allocate a new mbuf and populate
some structures in it.  Some of these structures, such as struct
sadb_supported, contain small reserved fields that are not initialized
and are thus leaked to userspace.

Fix the problem by adding a helper to allocate zeroed mbufs.  This
reduces code duplication and the overhead of zeroing these messages
isn't harmful.

Reviewed by: zlei, melifaro
Reported by: KMSAN
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38068

16 months agoopenssh: remove mention of now-unused svn:keywords
Ed Maste [Mon, 16 Jan 2023 14:52:00 +0000 (09:52 -0500)]
openssh: remove mention of now-unused svn:keywords

Reported by: gshapiro

16 months agoatomic.9: Remove the stated dependency on types.h
Mark Johnston [Mon, 16 Jan 2023 13:04:01 +0000 (08:04 -0500)]
atomic.9: Remove the stated dependency on types.h

All machine/atomic.h necessarily include sys/atomic_common.h, which
brings in types.h.

Reviewed by: imp, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38040

16 months agoatomic: Remove cdefs.h includes from atomic_*.h
Mark Johnston [Mon, 16 Jan 2023 13:03:20 +0000 (08:03 -0500)]
atomic: Remove cdefs.h includes from atomic_*.h

Avoid including cdefs.h in system headers.  Both headers now include
types.h, and we can assume that that pulls in cdefs.h (required for
__typeof usage in some of the atomic macro expansions).

No functional change intended.

Reviewed by: imp, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38039

16 months agomixer: Fix default_unit switching with mixers that have no devices
Mark Johnston [Mon, 16 Jan 2023 13:02:54 +0000 (08:02 -0500)]
mixer: Fix default_unit switching with mixers that have no devices

Apparently it's possible for a mixer to have no devices:

$ mixer -f /dev/mixer2
pcm2:mixer: <USB audio> at ? kld snd_uaudio (rec)
$

If this is the default sound device, an attempt to change the default
unit using mixer -d fails with a segfault because mod_dunit is called
with a NULL device pointer, which is dereferenced to get the parent
mixer.

ctl_dunit seems to be a dummy, i.e., we don't actually need it and can
simply pass the mixer to mod_dunit() directly.  This patch removes that
structure and associated indirection to fix the crash.

Reviewed by: christos, hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38060

16 months agonetlink: fix compatibility with older netlink applications.
Alexander V. Chernikov [Mon, 16 Jan 2023 12:14:35 +0000 (12:14 +0000)]
netlink: fix compatibility with older netlink applications.

Some apps try to provide only the non-zero part of the required message
 header instead of the full one. It happens when fetching routes or
 interface addresses, where the first header byte is the family.
This behavior is "illegal" under the "strict" Netlink socket option,
 however there are many applications out there doing things in the
 "old" way.

Support this usecase by copying the provided bytes into the temporary
 zero-filled header and running the parser on this header instead.

Reported by: Goran Mekić <meka@tilda.center>

16 months agonetlink: fix typo in netlink(4)
Alexander V. Chernikov [Mon, 16 Jan 2023 10:56:10 +0000 (10:56 +0000)]
netlink: fix typo in netlink(4)

Reported by: Ihor Antonov <ihor@antonovs.family>

16 months agortsock: fix socket closure.
Alexander V. Chernikov [Sun, 15 Jan 2023 13:40:28 +0000 (13:40 +0000)]
rtsock: fix socket closure.

Currently `close(2)` erroneously return `EOPNOTSUPP` for `PF_ROUTE` sockets.
It happened after making rtsock socket implementation self-contained (
36b10ac2cd18 ). Rtsock code marks socket as connected in `rts_attach()`.
`soclose()` tries to disconnect such socket using `.pr_disconnect` callback.
Rtsock does not implement this callback, resulting in the default method being
substituted. This default method returns `ENOTSUPP`, failing `soclose()` logic.

This diff restores the previous behaviour by adding custom `pr_disconnect()`
returning `ENOTCONN`.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D38059

16 months agopf tests: properly destroy renamed interfaces
Kajetan Staszkiewicz [Mon, 16 Jan 2023 06:19:41 +0000 (07:19 +0100)]
pf tests: properly destroy renamed interfaces

The pfsync:pbr tests leaves  lot of interfaces when they finish, making
other tests slower due to long time of loading scapy from pft_ping.py
when more interfaces are present. When both sides of epair are assigned
to jails, they are both removed from created_interfaces.lst and thus
won't be removed during cleanup from this file. An interface assigned to
jail is stored in created_jails.lst but if it is renamed, it won't be
cleaned up either. Furthermore this test uses identical names for
multiple interfaces across multiple jails which after destroying those
jails adds to overall confusion.

To address this issue a new function is provided for renaming interfaces
in jails and storing their new names in created_jails.lst for deletion
during cleanup.

MFC after: 1 week
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D38024

16 months agoRequire INVARIANTS and WITNESS if DEBUG_VFS_LOCKS is set
Konstantin Belousov [Sun, 15 Jan 2023 21:33:10 +0000 (23:33 +0200)]
Require INVARIANTS and WITNESS if DEBUG_VFS_LOCKS is set

Reported by: pho
Reviewed by: markj, mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38070

16 months agonfsserver: Fix handling of SP4_NONE
Rick Macklem [Sun, 15 Jan 2023 22:07:40 +0000 (14:07 -0800)]
nfsserver: Fix handling of SP4_NONE

For NFSv4.1/4.2, when the client specifies SP4_NONE for
state protection in the ExchangeID operation arguments,
the server MUST allow the state management operations for
any user credentials.  (I misread the RFC and thought that
SP4_NONE meant "at the server's discression" and not MUST
be allowed.)

This means that the "sec=XXX" field of the "V4:" exports(5)
line only applies to NFSv4.0.

This patch fixes the server to always allow state management
operations for SP4_NONE, which is the only state management
option currently supported. (I have patches that add support
for SP4_MACH_CRED to the server. These will be in a future commit.)

In practice, this bug does not seem to have caused
interoperability problems.

MFC after: 2 weeks

16 months agosendmail 8.17.1 included this fix, though in a different location so
Gregory Neil Shapiro [Sun, 15 Jan 2023 21:25:39 +0000 (21:25 +0000)]
sendmail 8.17.1 included this fix, though in a different location so
removing the FreeBSD local code in favor of the vendor branch version

16 months agoAdd -DSTARTTLS CFLAG in order to enable DANE in sendmail builds
Gregory Neil Shapiro [Sun, 15 Jan 2023 21:24:38 +0000 (21:24 +0000)]
Add -DSTARTTLS CFLAG in order to enable DANE in sendmail builds

16 months agoUpdate for new library files in sendmail 8.17.1
Gregory Neil Shapiro [Sun, 15 Jan 2023 21:23:27 +0000 (21:23 +0000)]
Update for new library files in sendmail 8.17.1

16 months agoMerge commit '28fbd2825d216dafca4d991ad96d05b312f4f9a3'
Gregory Neil Shapiro [Sun, 15 Jan 2023 21:20:22 +0000 (21:20 +0000)]
Merge commit '28fbd2825d216dafca4d991ad96d05b312f4f9a3'

Merge vendor sendmail 8.17.1 into HEAD

16 months agoImport sendmail 8.17.1
Gregory Neil Shapiro [Sun, 15 Jan 2023 19:15:36 +0000 (19:15 +0000)]
Import sendmail 8.17.1

16 months agoDocument the mntopts(3) functions.
Kirk McKusick [Sun, 15 Jan 2023 18:20:48 +0000 (10:20 -0800)]
Document the mntopts(3) functions.

The mntopts(3) functions support operations associated with a mount
point. The main purpose of this commit is to document the mntopts(3)
functions that now appear in 18 utilities in the base system. See
mntopts(3) for the documentation details.

The getmntopts() function appeared in 4.4BSD. The build_iovec(),
build_iovec_argf(), free_iovec(), checkpath(), and rmslashes()
functions were added with nmount(8) in FreeBSD 5.0. The getmntpoint()
and chkdoreload() functions are being added in this commit.

These functions should be in a library but for historic reasons are
in a file in the sources for the mount(8) program. Thus, to access
them the following lines need to be added to the Makefile of the
program wanting to use them:

SRCS+= getmntopts.c
MOUNT= ${SRCTOP}/sbin/mount
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

Once these changes have been MFC'ed to 13 they may be made into
a library.

Reviewed by:  kib, gbe
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907

16 months agond6: fix panic in lltable_drop_entry_queue()
Alexander V. Chernikov [Sun, 15 Jan 2023 15:10:48 +0000 (15:10 +0000)]
nd6: fix panic in lltable_drop_entry_queue()

nd6_resolve_slow() can be called without mbuf. If the LLE entry
 is not reachable, nd6_resolve_slow() will add this NULL mbuf to
 the holdchain via lltable_append_entry_queue, which will "append"
 NULL to the end of the queue (effectively no-op) and bump la_numhold
 value. When this entry gets freed, the kernel will panic due to the
 inconsistency between the amount of mbufs in the queue and the value
 of la_numhold.

Fix the panic by checking of mbuf is not NULL prior to inserting it
 into the holdchain.

Reported by: kib
MFC after: 3 days

16 months agoman: add Netlink reference to socket(2)
Alexander V. Chernikov [Sat, 14 Jan 2023 17:35:43 +0000 (17:35 +0000)]
man: add Netlink reference to socket(2)

Reviewed by: lwhsu, pauamma, gbe
Differential Revision: https://reviews.freebsd.org/D38054

16 months agounbound: Fix config.h
Cy Schubert [Sun, 15 Jan 2023 06:55:05 +0000 (22:55 -0800)]
unbound: Fix config.h

FreeBSD src does not support HAVE_DECL_EVSIGNAL_ASSIGN. While reviewing
the new config.h after regenerating it, this definition was not removed.

Updating config.h is a manual process of configuring the port and
copying/merging the generated config.h into src. This definition was
missed and not removed (#undef'd).

Fixes: 1838dec31895fd4752fa8631322ab93be0705a66
MFC after: 1 month
X-MFC with: 1838dec31895fd4752fa8631322ab93be0705a66

16 months agounbound: Vendor import 1.17.1
Cy Schubert [Sun, 15 Jan 2023 05:39:31 +0000 (21:39 -0800)]
unbound: Vendor import 1.17.1

Release notes at
    https://www.nlnetlabs.nl/news/2023/Jan/12/unbound-1.17.1-released/.

MFC after:      1 month

Merge commit '7699e1386a16236002b26107ffd2dcbde375e197' into main

16 months agomixer(3): Add HEADNAME to TAILQ_HEAD declarations
Christos Margiolis [Sun, 15 Jan 2023 02:33:58 +0000 (21:33 -0500)]
mixer(3): Add HEADNAME to TAILQ_HEAD declarations

This allows us to use the TAILQ_PREV and TAILQ_FOREACH_REVERSE_* macros,
useful for an out-of-tree consumer.

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

16 months agostress2: Added a regression test
Peter Holm [Sat, 14 Jan 2023 19:19:05 +0000 (20:19 +0100)]
stress2: Added a regression test

16 months agoAllow a comma-separated list in login class capabilities,
Sean Eric Fagan [Sat, 14 Jan 2023 18:37:31 +0000 (10:37 -0800)]
Allow a comma-separated list in login class capabilities,
by adding a version of strcspn that allows quoting.

16 months agoffs_syncvnode(): avoid a LoR for SU
Konstantin Belousov [Sat, 7 Jan 2023 12:22:18 +0000 (14:22 +0200)]
ffs_syncvnode(): avoid a LoR for SU

There is another case where SU code does ffs_syncvnode(dvp) for the
parent directory dvp while the child vnode vp is locked.  Avoid the
issue by relocking and returning ERELOOKUP to indicate the need of
resync.

Reported by: jkim
Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37997

16 months agoStop cleaning MNT_LOCAL on unmount
Konstantin Belousov [Fri, 6 Jan 2023 16:38:44 +0000 (18:38 +0200)]
Stop cleaning MNT_LOCAL on unmount

There is no point in clearing just this flag.  Flags are reset on the
struct mount re-allocation for reuse anyway.

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