Commit Graph

280537 Commits

Author SHA1 Message Date
John Baldwin
43703bc489 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
2023-01-19 14:48:52 -08:00
Jake Freeland
16fbf01912 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
2023-01-19 22:24:44 +00:00
John Baldwin
fc1901abcf <sys/sysctl.h>: Reduce overly broad header pollution.
Commit d3f96f6610 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
2023-01-19 10:32:45 -08:00
John Baldwin
6a284cacb1 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
2023-01-19 10:30:18 -08:00
John Baldwin
b36b14beda 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
2023-01-19 10:21:50 -08:00
Gordon Bergling
05187f2ffc amd64: Fix a common typo in source code comments
- s/comparision/comparison/

MFC after:	3 days
2023-01-19 14:27:18 +01:00
Gordon Bergling
72e709040f nfs: Fix a common typo in source code comments
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:26:06 +01:00
Gordon Bergling
afc55510b1 mountd(8): Fix a typo in a source code comment
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:23:51 +01:00
Gordon Bergling
74d2a3c16d cxgbetool(8): Fix common typos in sysctl descriptions
- s/addres/address/

MFC after:	5 days
2023-01-19 14:22:00 +01:00
Gordon Bergling
7a184a41c6 bsnmpget.1: Fix a typo in the man page
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:18:52 +01:00
Gordon Bergling
30985d19b0 rc.initdiskless: Fix a typo in a comment
- s/attemping/attempting/

MFC after:5 days
2023-01-19 14:17:37 +01:00
Gordon Bergling
e4b7980c5c ath(4): Fix a sysctl description and a typo in a comment
- s/delimeter/delimiter/

MFC after:	7 days
2023-01-19 14:16:05 +01:00
Gordon Bergling
fa7de6dcb9 ip_gre: Fix a common typo in source code comments
- s/addres/address/

MFC after:	3 days
2023-01-19 14:13:02 +01:00
Gordon Bergling
73e994a998 extra_tcp_stacks: Fix a common typo in source code comments
- s/orginal/original/

MFC after:	3 days
2023-01-19 14:11:00 +01:00
Jason A. Harmening
5a4a83fd0e 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
2023-01-18 22:11:05 -06:00
John Baldwin
846e4a206f 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
2023-01-18 15:39:04 -08:00
Jean-Sébastien Pédron
bb651c77f5
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
2023-01-18 23:02:24 +01:00
Konstantin Belousov
424f1296bd ipsec.c: typos in the comment
Sponsored by:	NVIDIA Networking
MFC after:	3 days
2023-01-18 23:22:35 +02:00
Konstantin Belousov
b1d10b49e2 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
2023-01-18 23:18:39 +02:00
Konstantin Belousov
eac971545b 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
2023-01-18 23:18:39 +02:00
Allan Jude
fd5e921059 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
2023-01-18 21:04:49 +00:00
Pau Amma
5faf9f4dff 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
2023-01-18 21:50:49 +01:00
Steffen Dirkwinkel
8580e334b0
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
2023-01-18 12:17:17 +01:00
Steffen Dirkwinkel
73c3e8b1de
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
2023-01-18 12:17:09 +01:00
Andrew Turner
896f556205 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
2023-01-18 09:31:50 +00:00
Andrew Turner
a85cf421d1 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
2023-01-18 09:31:50 +00:00
Andrew Turner
61f5462fde 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
2023-01-18 09:31:45 +00:00
Andrew Turner
95dd6974b5 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
2023-01-18 09:31:35 +00:00
Juraj Lutter
1d577bedba unbound: Fix config file path
Commit 1838dec318 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:          1838dec318
MFC after:      1 month
X-MFC with:     1838dec318
2023-01-18 08:50:07 +01:00
Justin Hibbits
701bb67bc5 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.
2023-01-17 15:15:51 -05:00
Brooks Davis
b75062f234 riscv: Fix thread0.td_kstack_pages init
Commit 0ef3ca7ae3 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
2023-01-17 16:37:42 +00:00
Brooks Davis
e1b610f76c arm64: Fix thread0.td_kstack_pages init
Commit 86a994d653 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
2023-01-17 16:37:09 +00:00
Dag-Erling Smørgrav
c968598479 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
2023-01-17 16:25:28 +01:00
Mark Johnston
35472cb60a 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
2023-01-17 09:37:33 -05:00
Mark Johnston
e262610007 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
2023-01-17 09:37:21 -05:00
Mark Johnston
d91be0f121 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
2023-01-17 09:36:54 -05:00
Christos Margiolis
e5f5ca7fee 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
2023-01-17 08:08:59 -05:00
Dmitry Luhtionov
0d7064d58f xhci(4): Add new USB IDs.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-01-17 11:45:35 +01:00
Dmitry Luhtionov
f9237e1937 ehci(4): Add new USB IDs.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-01-17 11:45:35 +01:00
Dmitry Luhtionov
986c7be472 uhci(4): Add new USB IDs.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-01-17 11:45:35 +01:00
Tom Jones
fe701c39e8 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
2023-01-17 10:05:50 +00:00
Tom Jones
cef7ab70ff 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
2023-01-17 10:05:49 +00:00
Gregory Neil Shapiro
431d2a81d4 Minor changes to force commit these files so new freebsd*.cf files are
built to use the new sendmail-8.17.1/cf tree.
2023-01-17 06:49:49 +00:00
Gregory Neil Shapiro
021562c502 Sync with vendor sendmail 8.17.1 cf/cf/submit.mc 2023-01-17 06:49:07 +00:00
Alexander V. Chernikov
7f2109f240 netlink: add snl(3) manpage to the build 2023-01-16 20:25:44 +00:00
Ceri Davies
d9499d3f47 bsdconfig: correct name of the wpa_supplicant config file
Approved by:	maintainer timeout (dteske)
Differential Revision:	https://reviews.freebsd.org/D37750
2023-01-16 18:56:45 +00:00
Ceri Davies
4a312c21fa 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
2023-01-16 18:56:13 +00:00
Jean-Sébastien Pédron
e8ce32bea3
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
2023-01-16 19:27:21 +01:00
Jean-Sébastien Pédron
cf8f392260
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
2023-01-16 19:27:16 +01:00
Jean-Sébastien Pédron
ed53e350d7
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
2023-01-16 19:11:58 +01:00