]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 months agopfctl: rule.label is a two-dimensional array
Kristof Provost [Tue, 24 Jan 2023 06:46:46 +0000 (07:46 +0100)]
pfctl: rule.label is a two-dimensional array

Fix checking for a non-empty first string.

PR: 269075
MFC after: 1 week
Reported by: nreilly@blackberry.com

19 months agodtrace: conditionally load the systrace_linux klds when loading dtrace.
Andrew Gallatin [Tue, 24 Jan 2023 01:27:17 +0000 (20:27 -0500)]
dtrace: conditionally load the systrace_linux klds when loading dtrace.

When dtrace starts, it tries to detect if the dtrace klds are loaded,
and if not, it loads them by loading the dtraceall kld. This module
depends on most dtrace modules, including systrace for the native
freebsd and freebsd32 ABIs. However, it does not depend on the
systrace_linux klds, as they in turn depend on the linux ABI klds, and
we don't want to load an ABI module that the user has not explicitly
requested. This can leave a naive user in a state where they think all
syscall providers have been loaded, yet linux ABI syscalls are
"invisible" to dtrace.

To fix this, check to see if the linux ABI modules are loaded. If they
are, then load their systrace klds.

Reviewed by: markj, (emaste & jhb, earlier versions)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37986

19 months agolibcxx: Implement atomic::wait/notify using _umtx_op(2) for 64bit arches
Konstantin Belousov [Fri, 20 Jan 2023 02:57:26 +0000 (04:57 +0200)]
libcxx: Implement atomic::wait/notify using _umtx_op(2) for 64bit arches

Only 64bit architectures can be supported this way, because libcxx
defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit arches
do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation.

LLVM review: https://reviews.llvm.org/D142134

Tested by: emaste
Reviewed by: dim, emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38132

19 months agoUPDATING: fix typo
Warner Losh [Tue, 24 Jan 2023 00:08:12 +0000 (17:08 -0700)]
UPDATING: fix typo

I'd forgotten to fix this from the review, and a couple of people have
pointed it out after the commit.

Sponsored by: Netflix

19 months agoAdd git-blame ignore file
Ed Maste [Mon, 23 Jan 2023 20:27:25 +0000 (15:27 -0500)]
Add git-blame ignore file

.git-blame-ignore-revs lists commit hashes that should be skipped by
`git blame` e.g. non-functional whitespace or style cleanup.

The file is populated with a few sample entries.

Reviewed by: brooks, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36525

fixup ignore revs

19 months agonetmap: Try to count packet drops in emulated mode
Mark Johnston [Mon, 23 Jan 2023 19:42:41 +0000 (14:42 -0500)]
netmap: Try to count packet drops in emulated mode

Right now we have little visibility into packet drops within netmap.
Start trying to make packet loss issues more visible by counting queue
drops in the transmit path, and in the input path for interfaces running
in emulated mode, where we place received packets in a bounded software
queue that is processed by rxsync.

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38064

19 months agonetmap: Correct a comment
Mark Johnston [Mon, 23 Jan 2023 19:42:19 +0000 (14:42 -0500)]
netmap: Correct a comment

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38063

19 months agonetmap: Fix a queue length check in the generic port rx path
Mark Johnston [Mon, 23 Jan 2023 19:41:55 +0000 (14:41 -0500)]
netmap: Fix a queue length check in the generic port rx path

The check is ok by default, since the default value of
netmap_generic_ringsize is 1024.  But we should check against the
configured "ring" size.

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38062

19 months agonetmap: Tell the compiler to avoid reloading ring indices
Mark Johnston [Mon, 23 Jan 2023 19:41:05 +0000 (14:41 -0500)]
netmap: Tell the compiler to avoid reloading ring indices

Per the removed comments these fields should be loaded only once, since
they can in principle be modified concurrently, though this would be a
violation of the userspace contract with netmap.

No functional change intended.

Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38061

19 months agovtblk: secondary fix for dumping
Mitchell Horne [Mon, 9 Jan 2023 17:14:19 +0000 (13:14 -0400)]
vtblk: secondary fix for dumping

The code paths while dumping do not got through busdma. As such,
safeguard against calling bus_dmamap_sync() with a NULL map. The x86
implementation tolerates this but others do not, resulting in a
NULL dereference panic when dumping to a vtblk device on arm64, riscv,
etc.

Fixes: 782105f7c898 ("vtblk: Use busdma")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37990

19 months agoddb: have 'reset' command use normal reboot path
Mitchell Horne [Sat, 7 Jan 2023 18:09:28 +0000 (14:09 -0400)]
ddb: have 'reset' command use normal reboot path

This conditionally gives all registered shutdown handlers a chance to
perform the reboot, with cpu_reset() being the fallback. The '\s'
modifier can be used with the command to get the previous behaviour.

The motivation is that some platforms may not be able do anything
meaningful via cpu_reset(), due to a lack of standardized reset
mechanism and/or firmware shortcomings. However, they may have a
separate device driver attached that normally performs the reboot. Such
is the case for some versions of the Raspberry Pi, where reset via PSCI
fails, but the BCM2835 watchdog driver has a shutdown hook.

Reported by: bz
Reviewed by: markj (slightly earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37981

19 months agokern_reboot: unconditionally call shutdown_reset()
Mitchell Horne [Mon, 23 Jan 2023 18:47:11 +0000 (14:47 -0400)]
kern_reboot: unconditionally call shutdown_reset()

Currently shutdown_reset() is registered as the final entry of the
shutdown_final event handler. However, if a panic occurs early in boot
before the event is registered (SI_SUB_INTRINSIC), we may end up
spinning in the subsequent infinite for loop and failing to reset
altogether. Instead we can simply call this function unconditionally.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37981

19 months agoAdd kf_file_nlink field to kf_file and populate it
Jiajie Chen [Mon, 23 Jan 2023 16:36:59 +0000 (00:36 +0800)]
Add kf_file_nlink field to kf_file and populate it

This will allow user-space programs (e.g. lsof) to locate deleted files
whose nlink equals zero. Prior to this commit, programs has to use
stat(kf_path) to get nlink, but that will fail if the file is deleted.

[mjg: s/fail/file in the commit message]

Reviewed by: mjg
Differential Revision:  https://reviews.freebsd.org/D38169

19 months agoblacklistd: diff reduction against upstream
Ed Maste [Mon, 23 Jan 2023 16:19:46 +0000 (11:19 -0500)]
blacklistd: diff reduction against upstream

Add `conf_` prefix, maching https://github.com/zoulasc/blocklist

Sponsored by: The FreeBSD Foundation

19 months agogrowfs(7): conditionalize mention of adding dump device
Mike Karels [Mon, 23 Jan 2023 14:37:07 +0000 (08:37 -0600)]
growfs(7): conditionalize mention of adding dump device

The growfs_fstab script will add a new swap partition as a dump
device as well, but only if dumpdev is set to AUTO.

MFC after: 3 days
Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D38166

19 months agoMFV: xz 5.4.1.
Xin LI [Mon, 23 Jan 2023 00:49:43 +0000 (16:49 -0800)]
MFV: xz 5.4.1.

MFC after: 3 days

19 months agonetinet6: honor blackhole/unreach routes in the non-fastforwading code.
Alexander V. Chernikov [Sun, 22 Jan 2023 16:57:36 +0000 (16:57 +0000)]
netinet6: honor blackhole/unreach routes in the non-fastforwading code.

Currently, under the conditions specified below, IPv6 ingress packet
 processing can ignore blackhole/reject flag on the prefix. The packet
 will instead be looped locally till TTL expiration and a single ICMPv6
 unreachable message will be send to the source even in case of
 RTF_BLACKHOLE.
The following conditions needs hold to make the scenario happen:
* IPv6 forwarding is enabled
* Packet is not fast-forwarded
* Destination prefix has either RTF_BLACKHOLE or RTF_REJECT flag
Fix this behavior by checking for the blackhole/reject flags in
ip6_forward().

Reported by: Dmitriy Smirnov <fox@sage.su>
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D38164
MFC after: 3 days

19 months agoVendor import of xz 5.4.1 (trimmed)
Xin LI [Sun, 22 Jan 2023 17:32:29 +0000 (09:32 -0800)]
Vendor import of xz 5.4.1 (trimmed)

19 months agostress2: Added a regression test
Peter Holm [Sun, 22 Jan 2023 09:35:28 +0000 (10:35 +0100)]
stress2: Added a regression test

19 months agoDocument another example for "binat".
Poul-Henning Kamp [Sun, 22 Jan 2023 09:31:18 +0000 (09:31 +0000)]
Document another example for "binat".

19 months agonetpfil tests: improve pfsync_defer.py
Kajetan Staszkiewicz [Fri, 20 Jan 2023 09:43:02 +0000 (10:43 +0100)]
netpfil tests: improve pfsync_defer.py

Return different exit code depending on which failure was encountered.
The pfsync test expect a very particular failure, not just any.

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

19 months agonetpfil tests: improve pft_ping.py
Kajetan Staszkiewicz [Sat, 21 Jan 2023 02:44:52 +0000 (03:44 +0100)]
netpfil tests: improve pft_ping.py

Multiple improvements to pft_ping.py:

* Automatically use IPv6 when IPv6 addresses are used, --ip6 is not needed.
* Building of ping requests and parsing of ping replies is done layer by
  layer. This way most arguments are available both for IPv6 and IPv4,
  for ICMP and TCP.
* Use argument groups for improved readability.
* Change ToS and TTL argument name to TC and HL to reflect the modern
  IPv6 nomenclature. The argument still set related IPv4 header fields
  properly.
* Instead of sniffing for the very specific case of duplicated packets,
  allow for sniffing on multiple interfaces.
* Report which sniffer has failed by setting bits of error code.
* Raise meaningful exceptions when irrecoverable errors happen.
* Make IPv4 fragmentation flags configurable.
* Make IPv6 HL / IPv4 TTL configurable.
* Make TCP MSS configurable.
* Make TCP sequence number configurable.
* Make ICMP payload size configurable.
* Add debug output.
* Move command line argument parsing out of network functions.
* Make the code somehow PEP-8 compliant.

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

19 months agonetpfil tests: improve sniffer.py
Kajetan Staszkiewicz [Fri, 20 Jan 2023 01:40:34 +0000 (02:40 +0100)]
netpfil tests: improve sniffer.py

Multiple improvements to sniffer.py:

* Remove ambiguity of configuring recvif, it must be now explicitly specified.
* Don't catch exceptions around creating the sniffer, let it properly
  fail and display the whole stack trace.
* Count correct packets so that duplicates can be found.

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

19 months agovm: centralize VM_BATCHQUEUE_SIZE definition
Andrew Gallatin [Sat, 21 Jan 2023 19:26:25 +0000 (14:26 -0500)]
vm: centralize VM_BATCHQUEUE_SIZE definition

Remove the platform-specific definitions of VM_BATCHQUEUE_SIZE
for amd64 and powerpc64, and instead treat all 64-bit platforms
identically.  This has the effect of increasing the arm64
and riscv VM_BATCHQUEUE_SIZE to match that of other platforms.

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

19 months agonetlink: fix OOB write when creating attribute bitmask.
Alexander V. Chernikov [Sat, 21 Jan 2023 18:03:47 +0000 (18:03 +0000)]
netlink: fix OOB write when creating attribute bitmask.

Fix wrong arithmetics by moving to the standard bitset(9) functions.

Reported by: markj, KASAN

19 months agonetlink: allow creating sockets with SOCK_DGRAM.
Alexander V. Chernikov [Sat, 21 Jan 2023 14:36:23 +0000 (14:36 +0000)]
netlink: allow creating sockets with SOCK_DGRAM.

Some existing applications setup Netlink socket with
SOCK_DGRAM instead of SOCK_RAW. Update the manpage to clarify
that the default way of creating the socket should be with
SOCK_RAW. Update the code to support both SOCK_RAW and SOCK_DGRAM.

Reviewed By: pauamma
Differential Revision: https://reviews.freebsd.org/D38075

19 months agoelf: EF_ARM_EABI_VERSION_UNKNOWN is no longer used, retire
Warner Losh [Sat, 21 Jan 2023 05:11:00 +0000 (22:11 -0700)]
elf: EF_ARM_EABI_VERSION_UNKNOWN is no longer used, retire

EF_ARM_EABI_VERSION_UNKNOWN was used when we could run either eabi or
oabi. That was armv[45] only, and went away when we migrated to eabi
many major releases ago. No standard defines this symbol, so retire it.

Pointed out by: jrtc27
Sponsored by: Netflix

19 months agoasmc: Add MacbookAir6,2
Adrian Chadd [Sat, 21 Jan 2023 04:34:31 +0000 (04:34 +0000)]
asmc: Add MacbookAir6,2

Add in the zones for my MacbookAir6,2, a 2013 Macbook Air.

Tested - said Macbook Air 2013.  Thermal Zones and keyboard backlight
control works fine.

Differential Revision: https://reviews.freebsd.org/D38073
Approved by: jrtc27

19 months agoelf: Catch up with defining EF_ARM_EABI_VERSION in elf_common.h
Warner Losh [Sat, 21 Jan 2023 02:15:52 +0000 (19:15 -0700)]
elf: Catch up with defining EF_ARM_EABI_VERSION in elf_common.h

FreeBSD defines EF_ARM_EABI_VERSION in a non-standard way (at least
differently than everybody else). We use this only in elf*machdep.c to
make sure the image is new enough. Switch to the more standard way of
defining this and adjust other constants to match.

Fixes: c52c98e69a2e
Sponsored by: Netflix

19 months agoelf_common.h: Add parens to EF_ARM_EABI_VERSION macro
Warner Losh [Fri, 20 Jan 2023 23:46:05 +0000 (16:46 -0700)]
elf_common.h: Add parens to EF_ARM_EABI_VERSION macro

Due to my haste, I missed John's suggestion in the review that I add ()
here. Belatedly add them. It didn't matter for my test case, but there's
some pathological uses where it might matter.

Suggested by: jrtc23, jhb
Sponsored by: Netflix

19 months agobyteswap.h: Add a glibc/linux compatible byteswap.h
Warner Losh [Fri, 20 Jan 2023 23:33:37 +0000 (16:33 -0700)]
byteswap.h: Add a glibc/linux compatible byteswap.h

For endian.h to work instead of sys/endian.h, some software needs
byteswap.h available. It must define {__,}byteswap_{16,32,64}.
Included sys/_endian.h to get an appropriate __byteswap16, etc
and defines the new macros in terms of them. Enhance _endian.h
to allow it to be included from here too.

Sponsored by: Netflix
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D32051

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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.

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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.

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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.

20 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

20 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

20 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

20 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

20 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

20 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