]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agossh: update to OpenSSH v8.8p1
Ed Maste [Sun, 19 Dec 2021 16:02:02 +0000 (11:02 -0500)]
ssh: update to OpenSSH v8.8p1

OpenSSH v8.8p1 was motivated primarily by a security update and
deprecation of RSA/SHA1 signatures.  It also has a few minor bug fixes.

The security update was already applied to FreeBSD as an independent
change, and the RSA/SHA1 deprecation is excluded from this commit but
will immediately follow.

MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

2 years agoinet6: fix a LOR between rip and rawinp
Mateusz Guzik [Thu, 16 Dec 2021 14:11:42 +0000 (15:11 +0100)]
inet6: fix a LOR between rip and rawinp

Running sys/netpfil/pf/fragmentation v6 results in:

lock order reversal:
 1st 0xfffffe00050429a8 rip (rip, sleep mutex) @ /usr/src/sys/netinet6/raw_ip6.c:803
 2nd 0xfffff8009491e1d0 rawinp (rawinp, rw) @ /usr/src/sys/netinet6/raw_ip6.c:804
lock order rawinp -> rip established at:
0xffffffff8068e26a at witness_lock_order_add+0x28a
0xffffffff8068d087 at witness_checkorder+0x627
0xffffffff805a9f05 at __mtx_lock_flags+0x205
0xffffffff808102e4 at in_pcballoc+0x204
0xffffffff808d53c6 at rip6_attach+0x116
0xffffffff806dc4e8 at socreate+0x368
0xffffffff806eaedc at kern_socket+0xfc
0xffffffff806eadcd at sys_socket+0x2d
0xffffffff80abc774 at syscallenter+0x5c4
0xffffffff80abbeeb at amd64_syscall+0x1b
 0xffffffff80a8044b at fast_syscall_common+0xf8
lock order rip -> rawinp attempted at:
0xffffffff8068dc2a at witness_checkorder+0x11ca
0xffffffff805d1b7f at _rw_wlock_cookie+0x18f
0xffffffff808d596c at rip6_connect+0x19c
0xffffffff806e0842 at soconnectat+0x142
0xffffffff806ebe36 at kern_connectat+0x136
0xffffffff806ebcdf at sys_connect+0x4f
0xffffffff80abc774 at syscallenter+0x5c4
0xffffffff80abbeeb at amd64_syscall+0x1b
0xffffffff80a8044b at fast_syscall_common+0xf8

Reviewed by: glebius
Fixes: de2d47842e880281 ("SMR protection for inpcbs")
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33508

2 years agoTry to fix syntax of "strht" instruction so that clang is happy.
Hans Petter Selasky [Sun, 19 Dec 2021 12:51:37 +0000 (13:51 +0100)]
Try to fix syntax of "strht" instruction so that clang is happy.

This fixes compilation of usb(4) after 0ec590d24e415dd36e38648630a0b963412ad87e .

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomips: Implement suword16
Jessica Clarke [Sun, 19 Dec 2021 12:48:49 +0000 (12:48 +0000)]
mips: Implement suword16

This fixes building USB-using kernels after 0ec590d24e41.

Fixes: 0ec590d24e41 ("usb: add 32-bit compat for FIFOs")

2 years agoImplement suword16() for 32-bit and 64-bit PowerPC architecture.
Hans Petter Selasky [Sun, 19 Dec 2021 12:16:59 +0000 (13:16 +0100)]
Implement suword16() for 32-bit and 64-bit PowerPC architecture.

This fixes compilation of usb(4) after 0ec590d24e415dd36e38648630a0b963412ad87e .

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoImplement suword16() for the 32/64-bit PowerPC architecture.
Hans Petter Selasky [Sun, 19 Dec 2021 11:19:53 +0000 (12:19 +0100)]
Implement suword16() for the 32/64-bit PowerPC architecture.

This fixes compilation of usb(4) after 0ec590d24e415dd36e38648630a0b963412ad87e .

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoImplement suword16() for the 32-bit ARMv6/v7 architecture.
Hans Petter Selasky [Sun, 19 Dec 2021 11:12:58 +0000 (12:12 +0100)]
Implement suword16() for the 32-bit ARMv6/v7 architecture.

This fixes compilation of usb(4) after 0ec590d24e415dd36e38648630a0b963412ad87e .

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agotwsi: use twsi_error() to handle wrong bus status when starting
Andriy Gapon [Sun, 19 Dec 2021 09:28:02 +0000 (11:28 +0200)]
twsi: use twsi_error() to handle wrong bus status when starting

MFC after: 1 week

2 years agotwsi: fix handling of consecuitve write messages in transaction
Andriy Gapon [Sun, 19 Dec 2021 09:26:40 +0000 (11:26 +0200)]
twsi: fix handling of consecuitve write messages in transaction

Make sure to reset 'message_done' flag when jumping from a message to the
next one within the same interrupt handler call.  This happens only when
a write with no-stop flag message is followed by a write with no-start
flag message.
Without this fix the second message would be prematurely "completed"
without waiting for an ACK (or NACK) for its first byte and without
sending subsequent bytes (if any).

Fixes: ff1e8581 twsi: support more message combinations in transfers
MFC after: 4 days

2 years agocarp: fix send error demotion recovery
Gleb Smirnoff [Sun, 19 Dec 2021 01:19:26 +0000 (17:19 -0800)]
carp: fix send error demotion recovery

The problem is that carp(4) would clear the error counter on first
successful send, and stop counting successes after that.  Fix this
logic and document it in human language.

PR: 260499
Differential revision: https://reviews.freebsd.org/D33536

2 years agoMove ve_check_hash prototype to libsecureboot-priv.h
Simon J. Gerraty [Sun, 19 Dec 2021 00:34:58 +0000 (16:34 -0800)]
Move ve_check_hash prototype to libsecureboot-priv.h

Reviewed by: stevek

2 years agoif_oce: fix epoch handling
Michael Tuexen [Sat, 18 Dec 2021 22:43:00 +0000 (23:43 +0100)]
if_oce: fix epoch handling

Thanks to gallatin@ for suggesting the patch.

PR: 260330
Reported by: Vincent Milum Jr.
Reviewed by: gallatin, glebius
Tested by: Vincent Milum Jr.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D33395

2 years agoUpdate dirdeps.mk et al to 20211212 versions
Simon J. Gerraty [Sat, 18 Dec 2021 21:37:07 +0000 (13:37 -0800)]
Update dirdeps.mk et al to 20211212 versions

dirdeps.mk: simplify computation of qualified vs unqualified dirdeps.
Note the importance of avoiding unresolved variables in DIRDEPS
Fix DIRDEP_LOADAVG_REPORT - expr(1) fails if expression evaluates to 0
Trim ${SRCTOP}/ from debug etc messages to make comparison easier.
Include number of DIRDEPS in debug output.
Trim ${SRCTOP}/ when exporting to env while building DIRDEPS_CACHE
to help avoid env exhaustion.
Use DIRDEPS_ALL_MACHINES_FILTER to better handle ALL_MACHINES
in complex build environments.

dirdeps-options.mk: use separate .undef for each variable

dirdeps-targets.mk: allow for '.' in DIRDEPS_TARGETS_DIRS

meta.autodep.mk: leverage ${.SUFFIXES} if we can.

meta.sys.mk: allow use in META_MODE vs DIRDEPS_BUILD

meta2deps.py: compute a list of dirdep extensions that map to current
TARGET_SPEC to avoid confusion.

Reviewed by: stevek

2 years agousb(4): Fix build on 32-bit platforms after 0ec590d24e415dd36e38648630a0b963412ad87e.
Hans Petter Selasky [Sat, 18 Dec 2021 20:29:26 +0000 (21:29 +0100)]
usb(4): Fix build on 32-bit platforms after 0ec590d24e415dd36e38648630a0b963412ad87e.

Cast pointer to "long" for now, to match the fueword() prototype.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agousb(4): Fix build after 45b48cbc2b5819cd6e3dee3632d66e55d5d7c101.
Hans Petter Selasky [Sat, 18 Dec 2021 20:26:57 +0000 (21:26 +0100)]
usb(4): Fix build after 45b48cbc2b5819cd6e3dee3632d66e55d5d7c101.

Make sure local variable is initialized when COMPAT_32BIT is not defined.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoAfter-import bmake-20211212
Simon J. Gerraty [Sat, 18 Dec 2021 18:14:39 +0000 (10:14 -0800)]
After-import bmake-20211212

2 years agoMerge bmake-20211212
Simon J. Gerraty [Sat, 18 Dec 2021 18:09:14 +0000 (10:09 -0800)]
Merge bmake-20211212

commit '2935fe8237c83c1dcb113dd5335733263e68e6fd'

2 years agoman: Remove obsolete meteor.4
Marius Strobl [Sat, 18 Dec 2021 13:56:16 +0000 (14:56 +0100)]
man: Remove obsolete meteor.4

The corresponding interface has been deorbited as part of
daba5ace03e83a930c128ae644afd186e1fe4341.

2 years agosafexcel: plug set-but-not-used vars
Mateusz Guzik [Sat, 18 Dec 2021 13:29:32 +0000 (13:29 +0000)]
safexcel: plug set-but-not-used vars

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

2 years agoipfw: plug set-but-not-used vars
Mateusz Guzik [Sat, 18 Dec 2021 13:21:03 +0000 (13:21 +0000)]
ipfw: plug set-but-not-used vars

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

2 years agoiicbus: plug set-but-not-used vars
Mateusz Guzik [Sat, 18 Dec 2021 13:14:04 +0000 (13:14 +0000)]
iicbus: plug set-but-not-used vars

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

2 years agolinux: plug set-but-not-used vars
Mateusz Guzik [Sat, 18 Dec 2021 13:12:15 +0000 (13:12 +0000)]
linux: plug set-but-not-used vars

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

2 years agointro(3): Fix formatting
Edward Tomasz Napierala [Sat, 18 Dec 2021 11:51:42 +0000 (11:51 +0000)]
intro(3): Fix formatting

This makes the left column narrower, leaving more space for the text.

Reviewed By: debdrup, 0mp
Differential Revision: https://reviews.freebsd.org/D33385

2 years agohier(7): add some new Xrs, remove some unrelated ones
Edward Tomasz Napierala [Sat, 18 Dec 2021 11:50:07 +0000 (11:50 +0000)]
hier(7): add some new Xrs, remove some unrelated ones

Reviewed By: debdrup, imp, 0mp
Differential Revision: https://reviews.freebsd.org/D33386

2 years agogeom(4): Fix some of the "set but not used" warnings
Edward Tomasz Napierala [Mon, 13 Dec 2021 15:19:56 +0000 (15:19 +0000)]
geom(4): Fix some of the "set but not used" warnings

The few I've left in place look like potential bugs.

Sponsored By: EPSRC

2 years agoImport bmake-20211212
Simon J. Gerraty [Sat, 18 Dec 2021 07:27:22 +0000 (23:27 -0800)]
Import bmake-20211212

Relevant changes see ChangeLog for details:

Add support for ${.SUFFIXES} as read-only variable.

Fix memory leak in cond.c

Punt on write errors - ENOSPC etc.

Lots of code refactoring, rework to reduce memory allocations.

More unit-tests.

2 years agocrypto: Encrypt the XORed input block for Camellia-CBC.
John Baldwin [Sat, 18 Dec 2021 00:46:09 +0000 (16:46 -0800)]
crypto: Encrypt the XORed input block for Camellia-CBC.

This fixes a regression in the previous change to move CBC chaining
into enc_xform_camellia which passed the raw input into the encrypt
function (thus not actually doing the chaining).  This still works
when using the same buffer for input and output which is why my
initial testing with cryptocheck didn't catch it.

Fixes: f84d708b484b crypto: Move CBC handling into enc_xform_camellia.
Sponsored by: The FreeBSD Foundation

2 years agocryptosoft: Use POLY1305_BLOCK_LEN instead of a magic number.
John Baldwin [Fri, 17 Dec 2021 21:58:59 +0000 (13:58 -0800)]
cryptosoft: Use POLY1305_BLOCK_LEN instead of a magic number.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33528

2 years agocryptosoft: Consolidate calls to explicit_bzero.
John Baldwin [Fri, 17 Dec 2021 21:58:58 +0000 (13:58 -0800)]
cryptosoft: Consolidate calls to explicit_bzero.

Group sensitive on-stack variables into anonymous structs so that they
can be cleared with a single call to explicit_bzero rather than
multiple calls.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33527

2 years agocryptosoft: Reuse 'blk' to hold the initial nonce in swcr_gmac.
John Baldwin [Fri, 17 Dec 2021 21:58:58 +0000 (13:58 -0800)]
cryptosoft: Reuse 'blk' to hold the initial nonce in swcr_gmac.

Reusing the storage removes the need for an additional explicit_bzero.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33526

2 years agocryptosoft: Remove unused 'iv' in swcr_ccm_cbc_mac.
John Baldwin [Fri, 17 Dec 2021 21:58:58 +0000 (13:58 -0800)]
cryptosoft: Remove unused 'iv' in swcr_ccm_cbc_mac.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33525

2 years agousb: remove COMPAT_32BIT ifdefs
Brooks Davis [Fri, 17 Dec 2021 21:28:14 +0000 (21:28 +0000)]
usb: remove COMPAT_32BIT ifdefs

Now that we have proper 32-bit compat support, remove COMPAT_32BIT
ifdefs to allow 32-bit code to use the 64-bit layout of USB ioctl
structs and struct usb_fs_endpoint.

This includes the removal of redundant alignment directives that had
no effect in practice.

Reviewed by: hselasky, jrtc27 (prior version)

2 years agolibusb: remove use of COMPAT_32BIT
Brooks Davis [Fri, 17 Dec 2021 21:28:14 +0000 (21:28 +0000)]
libusb: remove use of COMPAT_32BIT

This codepath used uint64_t's in place of pointers in structs and
arrays to allow 32-bit code to use 64-bit version of ioctls.  Now
that we support 32-bit compat natively this is no longer needed.

Reviewed by: hselasky, jrtc27 (prior version)

2 years agousb: add 32-bit compat for FIFOs
Brooks Davis [Fri, 17 Dec 2021 21:28:14 +0000 (21:28 +0000)]
usb: add 32-bit compat for FIFOs

Unlike most 32-bit compatability code, this isn't just a simple thunk
in the ioctl code.  An ioctl (USB_FS_INIT) is used to install a
pointer to an array of usb_fs_endpoint structs which are then used
by the ugen fifo code.  These struct contains an array of pointers
which requires translation.  We change the interfaces around
struct usb_fs_endpoint as follows:
 - We store the size of struct usb_fs_endpoint in struct usb_fifo
   in the USB_FS_INIT handler so we know the ABI of the userspace
   array.
 - APIs to manipulate userspace struct usb_fs_endpoint objects now
   take a struct usb_fifo and an index rather than a pointer to
   the object.  This allows most code to remain oblivious to the
   different struct usb_fs_endpoint sizes.
 - Add ugen_fs_copyin() which copies the struct usb_fs_endpoint
   from userspace, thunking it to the native size if required.
 - Uses of struct usb_fs_endpoint's ppBuffer member are now
   via ugen_fs_getbuffer() which produces a native pointer.
 - Updates to userspace are now handled by ugen_fs_update().

For clarity, single, fixed-sized members now are accessed with
fueword/suword rather than copyin/copyout.

Reviewed by: hselasky, jrtc27 (prior version)

2 years agousb: real freebsd32 support for most ioctls
Brooks Davis [Fri, 17 Dec 2021 21:28:13 +0000 (21:28 +0000)]
usb: real freebsd32 support for most ioctls

Use thunks or alternative access methods to support ioctls without
the COMPAT_32BIT hacks that store pointers in uint64_t's on 32-bit
platforms.  This should allow a normal i386 libusb to work.

On CheriBSD, the sizes of the structs will differ between CheriABI
(the default) and freebsd64 no matter what so we need proper compat
support there.  This change paves the way.

Reviewed by: hselasky, jrtc27 (prior version)

2 years agopci: add missing PCI id of Coffee Lake GPU
Corvin Köhne [Fri, 17 Dec 2021 21:09:32 +0000 (23:09 +0200)]
pci: add missing PCI id of Coffee Lake GPU

The PCI id of an UHD Graphics 630 for Coffee Lake GPUs is missing in
the PCI id list of all Intel GPUs.

You can take a look at
https://dgpu-docs.intel.com/devices/hardware-table.html to check that
this device id exists.  Or check the linux code:
https://github.com/torvalds/linux/commit/d0e062ebb3a44b56a7e672da568334c76f763552

MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33460

2 years agoahci(4): Allow enclosure emulation without hardware.
Alexander Motin [Fri, 17 Dec 2021 20:24:56 +0000 (15:24 -0500)]
ahci(4): Allow enclosure emulation without hardware.

After 53f5ac1310e allowed SATA device mapping to enclosure slots,
it may have sense to provide enclosure device emulation even without
real hardware interface like SGPIO just for purposes of physical
device location tracking (still assuming straight cabling).

MFC after: 1 week
Sponsored by: iXsystems, Inc.

2 years agotcp: allocate statistics in the main tcp_init()
Gleb Smirnoff [Fri, 17 Dec 2021 18:50:56 +0000 (10:50 -0800)]
tcp: allocate statistics in the main tcp_init()

No reason to have a separate SYSINIT.

2 years agotests: Add some regression tests for a couple of KERN_PROC_* sysctls
Mark Johnston [Thu, 16 Dec 2021 21:06:55 +0000 (16:06 -0500)]
tests: Add some regression tests for a couple of KERN_PROC_* sysctls

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

2 years agofd: Avoid truncating output buffers for KERN_PROC_{CWD,FILEDESC}
Mark Johnston [Thu, 16 Dec 2021 21:07:04 +0000 (16:07 -0500)]
fd: Avoid truncating output buffers for KERN_PROC_{CWD,FILEDESC}

These sysctls failed to return an error if the caller had provided too
short an output buffer.  Change them to return ENOMEM instead, to ensure
that callers can detect truncation in the face of a concurrently
changing fd table.

PR: 228432
Discussed with: cem, jhb
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D15607

2 years agofd: Initialize more export_fd_buf fields in kern_proc_cwd_out()
Mark Johnston [Thu, 16 Dec 2021 21:53:59 +0000 (16:53 -0500)]
fd: Initialize more export_fd_buf fields in kern_proc_cwd_out()

In particular, we need to initialize efbuf->flags, since
export_vnode_to_sb() loads that field.  This was mostly harmless since
the flag only determines whether the output kinfo_file is packed, and
KERN_PROC_CWD only ever emits a single kinfo_file anyway.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

2 years agoqat: Address -Wunused-but-set-variable warnings
Mark Johnston [Fri, 10 Dec 2021 15:52:30 +0000 (10:52 -0500)]
qat: Address -Wunused-but-set-variable warnings

MFC after: 1 week

2 years agodtrace: Disable getf() as it is broken on FreeBSD
Domagoj Stolfa [Fri, 17 Dec 2021 16:01:54 +0000 (11:01 -0500)]
dtrace: Disable getf() as it is broken on FreeBSD

getf() on FreeBSD calls _sx_slock(), _sx_sunlock() and fget_locked().
Furthermore, it does not set the per-core fault flag, meaning it
usually ends up in a double fault panic once getf() does get called,
especially from fbt.

Reviewing the DTrace Toolkit + a number of other scripts scattered
around FreeBSD, I have not been able to find one use of getf(). Given
how broken the implementation currently is, we disable it until it
can be implemented properly.

Also comment out a test in aggs/tst.subr.d for getf().

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

2 years agoktls: Add a regression test to exercise socket error handling
Mark Johnston [Fri, 17 Dec 2021 16:00:19 +0000 (11:00 -0500)]
ktls: Add a regression test to exercise socket error handling

Prior to commit 916c61a5ed37 ("Fix handling of errors from
pru_send(PRUS_NOTREADY)") this test triggered a kernel panic due to an
mbuf double free.

Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33517

2 years agounix: Increase the default datagram recv buffer size
Mark Johnston [Fri, 17 Dec 2021 15:59:29 +0000 (10:59 -0500)]
unix: Increase the default datagram recv buffer size

syslog(3) was recently change to support larger messages, up to 8KB.
Our syslogd handles this fine, as it adjusts /dev/log's recv buffer to a
large size.  rsyslog, however, uses the system default of 4KB.  This
leads to problems since our syslog(3) retries indefinitely when a send()
returns ENOBUFS, but if the message is large enough this will never
succeed.

Increase the default recv buffer size for datagram sockets to support
8KB syslog messages without requiring the logging daemon to adjust its
buffers.

PR: 260126
Reviewed by: asomers
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33380

2 years agobhyve: Only snapshot initialized VirtIO queues
Vitaliy Gusev [Thu, 16 Dec 2021 16:06:08 +0000 (11:06 -0500)]
bhyve: Only snapshot initialized VirtIO queues

If the virtio device is not fully initialized, then suspend fails with:

  vi_pci_snapshot_queues: invalid address: vq->vq_desc
  Failed to snapshot virtio-rnd; ret=14

MFC after: 1 week
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D26268

2 years agonetinet6: ip6_setpktopt() requires NET_EPOCH
Kristof Provost [Wed, 15 Dec 2021 13:53:41 +0000 (14:53 +0100)]
netinet6: ip6_setpktopt() requires NET_EPOCH

ip6_setpktopt() can call ifnet_byindex() which requires epoch. Mark the
function as requiring NET_EPOCH, and ensure we enter it priot to calling
it.

Reported-by: syzbot+92526116441688fea8a3@syzkaller.appspotmail.com
Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33462

2 years agoREADME.md: update gnu directory description
Ed Maste [Fri, 17 Dec 2021 13:43:47 +0000 (08:43 -0500)]
README.md: update gnu directory description

(At this point in main we have just LGPL libdialog and dialog, and GPL
diff3, left in gnu/.)

Reported by: bapt
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agotest-includes: update badfiles.inc
Kristof Provost [Thu, 16 Dec 2021 08:55:11 +0000 (09:55 +0100)]
test-includes: update badfiles.inc

Rebuild badfiles.inc after recent fixes.

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

2 years agotest-includes: use the same header set for badfiles.inc as for testing
Kristof Provost [Thu, 16 Dec 2021 08:53:42 +0000 (09:53 +0100)]
test-includes: use the same header set for badfiles.inc as for testing

This ensures we don't end up listing files we've excluded (e.g. those
starting with _).
Add a slight hack to preserve the existing order (sys, then net) in
badfiles.inc.

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

2 years agosys: make filedesc.h self-contained
Kristof Provost [Thu, 16 Dec 2021 14:03:23 +0000 (15:03 +0100)]
sys: make filedesc.h self-contained

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

2 years agopf: make if_pfsync.h self-contained
Kristof Provost [Wed, 15 Dec 2021 19:59:38 +0000 (20:59 +0100)]
pf: make if_pfsync.h self-contained

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

2 years agopf: make if_pflog.h self-contained
Kristof Provost [Wed, 15 Dec 2021 19:54:19 +0000 (20:54 +0100)]
pf: make if_pflog.h self-contained

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

2 years agonet: make if_bridgevar.h self-contained
Kristof Provost [Wed, 15 Dec 2021 19:49:41 +0000 (20:49 +0100)]
net: make if_bridgevar.h self-contained

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

2 years agonet: make ethernet.h self-contained
Kristof Provost [Wed, 15 Dec 2021 19:44:23 +0000 (20:44 +0100)]
net: make ethernet.h self-contained

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

2 years agosys: make callout.h self-contained
Kristof Provost [Wed, 15 Dec 2021 19:22:41 +0000 (20:22 +0100)]
sys: make callout.h self-contained

Avoid including sys/types.h from sys/_callout.h (as we try to avoid having
headers starting with underscores depending on non-underscore headers)
by introducing __sbintime_t in sys/_types.h and including that header
instead.

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

2 years agopf: make pfvar.h self-contained
Kristof Provost [Wed, 15 Dec 2021 19:04:48 +0000 (20:04 +0100)]
pf: make pfvar.h self-contained

Ensure that the pfvar.h header can be included without including any
other headers.

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

2 years agoif_stf: make if_stf.h self-contained
Kristof Provost [Wed, 15 Dec 2021 18:50:28 +0000 (19:50 +0100)]
if_stf: make if_stf.h self-contained

Ensure that the if_stf.h header can be included without including any
other headers.

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

2 years agofollow up to 18679ab1, actually change size of mmc_sim::name to 16
Andriy Gapon [Fri, 17 Dec 2021 11:20:47 +0000 (13:20 +0200)]
follow up to 18679ab1, actually change size of mmc_sim::name to 16

The change was made locally but was not squashed into the commit.

Fixes: 18679ab1 mmc_sim: fix setting of the mutex name
MFC after: 8 days

2 years agosnd_uaudio(4): Loosen up the USB MIDI permissions.
Hans Petter Selasky [Fri, 17 Dec 2021 10:52:00 +0000 (11:52 +0100)]
snd_uaudio(4): Loosen up the USB MIDI permissions.

This makes USB MIDI more userfriendly for desktop users.

PR: 260489
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agopcf85063: Set RTC device to work in 24h mode
Hubert Mazur [Thu, 16 Dec 2021 08:16:22 +0000 (09:16 +0100)]
pcf85063: Set RTC device to work in 24h mode

Sometimes the device did not set default hour mode setting correctly,
which lead to conversion errors. Explicitly set device to work in 24h
mode by clearing flag in register, instead of allowing defaults.

Reviewed by: imp
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D33497

2 years agotzsetup: Fix unicode support
Alfonso Siciliano [Fri, 17 Dec 2021 08:25:07 +0000 (09:25 +0100)]
tzsetup: Fix unicode support

Differential revision: https://reviews.freebsd.org/D33532

2 years agosched.h: Use pid_t type for pid argument
David CARLIER [Fri, 17 Dec 2021 06:22:21 +0000 (08:22 +0200)]
sched.h: Use pid_t type for pid argument

MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33533

2 years agosched_get/setaffinity(3): pid 0 should designate current process
Math Ieu [Fri, 17 Dec 2021 05:31:09 +0000 (07:31 +0200)]
sched_get/setaffinity(3): pid 0 should designate current process

while FreeBSD' native sched_get/setaffinity use pid -1 for this.

PR: 260487
MFC after: 1 week

2 years agosysent: regenerate files every time
Kyle Evans [Thu, 9 Dec 2021 05:20:16 +0000 (23:20 -0600)]
sysent: regenerate files every time

This forces everything to be regenerated by marking makesyscalls.lua
as .PHONY, which may be helpful in, e.g., rebase scenarios, which may
have unexpected effects on mtimes but still really need a regen.

For now we apply this to the default sysent target, which is ran
manually and not as a part of buildkernel.  We can reconsider this if
someone manually running it has issues with the runtime, but the top
level sysent target can run each in parallel; I recommend -j4 or so.

Requested by: kib
Reviewed by: brooks, kib (both earlier version)
Differential Revision: https://reviews.freebsd.org/D33357

2 years agosysent: regenerate
Kyle Evans [Thu, 9 Dec 2021 04:42:43 +0000 (22:42 -0600)]
sysent: regenerate

2 years agosysent: move away from allowing all compat options for other ABIs
Kyle Evans [Thu, 9 Dec 2021 04:37:28 +0000 (22:37 -0600)]
sysent: move away from allowing all compat options for other ABIs

Notably, the current compat_options only makes sense for native and
freebsd32 ABIs.  For the others, it just adds cruft. Switch to having
sets of compat options, and default to the native set.  Setup the other
ABIs where it doesn't make sense to opt-out of the native set.

This removes some redundant COMPAT_FREEBSD* stuff from Linuxolator bits.

line_expr in makesyscalls.lua is fixed to allow empty strings to be
specified, since they're harmless.

Reviewed by: brooks, kib (both earlier version)
Differential Revision: https://reviews.freebsd.org/D33356

2 years agoinpcb: don't leak the port zone in in_pcbinfo_destroy()
Gleb Smirnoff [Thu, 16 Dec 2021 23:15:02 +0000 (15:15 -0800)]
inpcb: don't leak the port zone in in_pcbinfo_destroy()

2 years agonfscl: Partially revert commit 867c27c23a5c
Rick Macklem [Thu, 16 Dec 2021 22:30:37 +0000 (14:30 -0800)]
nfscl: Partially revert commit 867c27c23a5c

Commit 867c27c23a5c enabled the n_directio_opens code
in open/close, which sets/clears NNONCACHE, for
IO_APPEND. This code should not be enabled unless
newnfs_directio_enable is non-zero.

This patch reverts that part of commit 867c27c23a5c.

A future patch that fixes the case where the
file that is being written IO_APPEND is mmap()'d.

MFC after: 3 months

2 years agocryptocheck: Test Camellia-CBC cipher and RIPEMD-160 HMAC.
John Baldwin [Thu, 16 Dec 2021 21:48:39 +0000 (13:48 -0800)]
cryptocheck: Test Camellia-CBC cipher and RIPEMD-160 HMAC.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33518

2 years agocryptosoft: Remove CBC handling from swcr_encdec.
John Baldwin [Thu, 16 Dec 2021 21:48:15 +0000 (13:48 -0800)]
cryptosoft: Remove CBC handling from swcr_encdec.

All of the CBC ciphers now handle block chaining in the enc_xform.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33489

2 years agocrypto: Move CBC handling into enc_xform_camellia.
John Baldwin [Thu, 16 Dec 2021 21:48:02 +0000 (13:48 -0800)]
crypto: Move CBC handling into enc_xform_camellia.

Add an IV to the context that is initialized by the reinit hook.
Encrypt and decrypt operations handle cipher block chaining along with
updating the IV saved in the context.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33488

2 years agocrypto: Move CBC handling into enc_xform_aes_cbc.
John Baldwin [Thu, 16 Dec 2021 21:47:44 +0000 (13:47 -0800)]
crypto: Move CBC handling into enc_xform_aes_cbc.

Add an IV to the context that is initialized by the reinit hook.
Encrypt and decrypt operations handle cipher block chaining along with
updating the IV saved in the context.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33487

2 years agocrypto: Consistently use AES instead of Rijndael128 for the AES-CBC cipher.
John Baldwin [Thu, 16 Dec 2021 21:47:27 +0000 (13:47 -0800)]
crypto: Consistently use AES instead of Rijndael128 for the AES-CBC cipher.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33486

2 years agocrypto: Define POLY1305_BLOCK_LEN constant.
John Baldwin [Thu, 16 Dec 2021 21:47:16 +0000 (13:47 -0800)]
crypto: Define POLY1305_BLOCK_LEN constant.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33485

2 years agoSort libsodium sources by path in sys/modules/crypto/Makefile.
John Baldwin [Thu, 16 Dec 2021 21:47:03 +0000 (13:47 -0800)]
Sort libsodium sources by path in sys/modules/crypto/Makefile.

This matches the order used in sys/conf/files to make it easier to
keep these two files in sync.

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

2 years agoSort libsodium entries by path in sys/conf/files.
John Baldwin [Thu, 16 Dec 2021 21:46:48 +0000 (13:46 -0800)]
Sort libsodium entries by path in sys/conf/files.

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

2 years agoCorrect type size format error in KASSERT.
Doug Moore [Thu, 16 Dec 2021 19:48:58 +0000 (13:48 -0600)]
Correct type size format error in KASSERT.
Reported by: jenkins
Fixes: 6f1c8908272f vm: Don't break vm reserv that can't meet align reqs

2 years agoRemove 'All Rights Reserved' from xlocale FreeBSD Foundation copyrights
Ed Maste [Thu, 16 Dec 2021 19:28:19 +0000 (14:28 -0500)]
Remove 'All Rights Reserved' from xlocale FreeBSD Foundation copyrights

Sponsored by: The FreeBSD Foundation

2 years agovm: Don't break vm reserv that can't meet align reqs
Doug Moore [Thu, 16 Dec 2021 18:20:56 +0000 (12:20 -0600)]
vm: Don't break vm reserv that can't meet align reqs

Function vm_reserv_test_contig has incorrectly used its alignment
and boundary parameters to find a well-positioned range of empty pages
in a reservation.  Consequently, a reservation could be broken
mistakenly when it was unable to provide a satisfactory set of pages.

Rename the function, correct the errors, and add assertions to detect
the error in case it appears again.

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

2 years agoloader.efi: Do not use as frame buffer BLT-only GOPs.
Alexander Motin [Thu, 16 Dec 2021 16:44:34 +0000 (11:44 -0500)]
loader.efi: Do not use as frame buffer BLT-only GOPs.

Kernel needs physical frame buffer address and size, which Block
Transfer-only Graphics Output Protocol instances do not have.

Some recent ASUS boards like PRIME Z690M-PLUS D4 and PRIME H570-Plus
report two GOPs, out of which the second one support ConOut protocol,
that made it preferable, but is BLT-only, that made console unusable.

Discussed with: tsoome (previous version)
MFC after: 1 week

2 years agoipfilter: MSN RPC proxy is not complete
Cy Schubert [Thu, 16 Dec 2021 00:08:11 +0000 (16:08 -0800)]
ipfilter: MSN RPC proxy is not complete

The MSN RPC proxy is incomplete and does not do any address
translation. Remove it.

MFC after: 1 week

2 years agoOpenSSL: Do not remove symbolic links readded in 1.1.1m
Jung-uk Kim [Thu, 16 Dec 2021 14:31:46 +0000 (09:31 -0500)]
OpenSSL: Do not remove symbolic links readded in 1.1.1m

Reported by: Herbert J. Skuhra <herbert@mailbox.org>

2 years agoaesni: Fix an out-of-bounds read in AES_GCM_decrypt()
Mark Johnston [Thu, 16 Dec 2021 14:08:16 +0000 (09:08 -0500)]
aesni: Fix an out-of-bounds read in AES_GCM_decrypt()

This is the same as 4285655adb74 ("aesni: Avoid a potential
out-of-bounds load in AES_GCM_encrypt()") except for the decryption
path.

Reported by: Jenkins (KASAN job)
Reviewed by: cem
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33474

2 years agoudp: Fix a use-after-free in udp_multi_input()
Mark Johnston [Thu, 16 Dec 2021 14:08:47 +0000 (09:08 -0500)]
udp: Fix a use-after-free in udp_multi_input()

"ip" is a pointer into the input mbuf chain, so we shouldn't access it
after the chain is freed.

Fix style at the call site while here.

Reported by: syzbot+7c8258509722af1b6145@syzkaller.appspotmail.com
Reviewed by: tuexen, glebius
Fixes: de2d47842e88 ("SMR protection for inpcbs")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33473

2 years agozfs: merge openzfs/zfs@f291fa658 (master) into main
Martin Matuska [Thu, 16 Dec 2021 13:38:34 +0000 (14:38 +0100)]
zfs: merge openzfs/zfs@f291fa658 (master) into main

Notable upstream pull request merges:
  #11711 Vdev Properties Feature
  #12717 VOP_RENAME fixes for FreeBSD
  #12746 Enable strict hole reporting by default
  #12770 ZFS send/recv with ashift 9->12 leads to data corruption
  #12828 FreeBSD: Add vop_standard_writecount_nomsyn
  #12828 zfs: Fix a deadlock between page busy and the teardown lock
  #12828 FreeBSD: Catch up with more VFS changes

Obtained from: OpenZFS
OpenZFS commit: f291fa658efd146540b03ce386133632bde237bf

2 years agoida: plug set-but-not-used vars
Mateusz Guzik [Thu, 16 Dec 2021 13:23:30 +0000 (13:23 +0000)]
ida: plug set-but-not-used vars

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

2 years agotests: sys.netpfil.pf.pfsync.defer fails in CI
Kristof Provost [Thu, 16 Dec 2021 12:09:59 +0000 (13:09 +0100)]
tests: sys.netpfil.pf.pfsync.defer fails in CI

sys.netpfil.pf.pfsync.defer has been failing for a while in CI now.
Disable it for now.

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

2 years agoloader: lua: test that /boot exists first
Emmanuel Vadot [Mon, 13 Dec 2021 13:18:12 +0000 (14:18 +0100)]
loader: lua: test that /boot exists first

Otherwise on fs like tftp where no directory listing is possible we fail
on the .dir method.

Reviewed by: imp, kevans
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33414

2 years agoloader: bcache: Fix debug printf
Emmanuel Vadot [Mon, 13 Dec 2021 08:23:19 +0000 (09:23 +0100)]
loader: bcache: Fix debug printf

Use %j to it works on 64 and 32 bits system.

Reviewed by: imp, tsoome
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33430

2 years agoloader: tftp: Add preload method
Emmanuel Vadot [Fri, 10 Dec 2021 09:37:01 +0000 (10:37 +0100)]
loader: tftp: Add preload method

The preload method will transfer the whole file in a buffer and cache it
so read/lseek operations are faster.

Reviewed by: imp, tsoome
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33410

2 years agoloader: Add preload operation to fs_ops
Emmanuel Vadot [Fri, 10 Dec 2021 09:33:43 +0000 (10:33 +0100)]
loader: Add preload operation to fs_ops

When we load an ELF file (kernel or module) we do seek(2) a lot to
parse/load the different sections of the ELF file.
Protocol like TFTP suffers a lot from this as there is no resume or
a way to start the tranfer from a specified offset in the file.
fs_preload is added to help those protocol.
Call preload just after opening the ELF file that we need to load so
the underlying method can cache the hole file and then read/lseek operations
are faster.

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33409

2 years agoloader: ip: Do not call getsecs so much
Emmanuel Vadot [Thu, 9 Dec 2021 14:46:39 +0000 (15:46 +0100)]
loader: ip: Do not call getsecs so much

getsecs is very costly, reuse the values we got before.

Fetching a ~30MB kernel with the tftp command use to take ~26 seconds
and now it's ~18 seconds.

Reviewed by: imp, tsoome
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33408

2 years agoloader: tftp: Don't let tftp timeout
Emmanuel Vadot [Mon, 13 Dec 2021 09:35:23 +0000 (10:35 +0100)]
loader: tftp: Don't let tftp timeout

When we load a kernel or module we open/close it a few times.
Since we're using the same port number each time and that we requested
the same file the ACK that we send are valid on the server side and the
server send us the file multiple times.
This makes tftp loading time very inconsistant due to the UDP "flood" that
we have to process.

Reviewed by: imp, tsoome
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33407

2 years agoloader: Add a readtest command
Emmanuel Vadot [Thu, 9 Dec 2021 13:54:58 +0000 (14:54 +0100)]
loader: Add a readtest command

readtest will simply load the file in memory, useful for timing
loading on some filesystems.

Reviewed by: tsoome
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33411

2 years agoloader: tftp: Don't error on tftp error 0
Emmanuel Vadot [Wed, 8 Dec 2021 15:18:49 +0000 (16:18 +0100)]
loader: tftp: Don't error on tftp error 0

tftp-hpa sends NAK with tftp error set to 0 when trying to get
a directory and this is the first thing that loader tries to do
and this make it hangs.

Reviewed by: imp, tsoome
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33406

2 years agoChange VOP_READDIR's cookies argument to a **uint64_t
Alan Somers [Tue, 14 Dec 2021 02:37:27 +0000 (19:37 -0700)]
Change VOP_READDIR's cookies argument to a **uint64_t

The cookies argument is only used by the NFS server.  NFSv2 defines the
cookie as 32 bits on the wire, but NFSv3 increased it to 64 bits.  Our
VOP_READDIR, however, has always defined it as u_long, which is 32 bits
on some architectures.  Change it to 64 bits on all architectures.  This
doesn't matter for any in-tree file systems, but it matters for some
FUSE file systems that use 64-bit directory cookies.

PR:             260375
Reviewed by:    rmacklem
Differential Revision: https://reviews.freebsd.org/D33404

2 years agonfs: don't truncate directory cookies to 32-bits in the NFS server
Alan Somers [Mon, 13 Dec 2021 03:57:14 +0000 (20:57 -0700)]
nfs: don't truncate directory cookies to 32-bits in the NFS server

In NFSv2, the directory cookie was 32-bits.  NFSv3 widened it to
64-bits and SVN r22521 widened the corresponding argument in
VOP_READDIR, but FreeBSD's NFS server continued to treat the cookies as
32-bits, and 0-extended to fill the field on the wire.  Nobody ever
noticed, because every in-tree file system generates cookies that fit
comfortably within 32-bits.

Also, have better type safety for txdr_hyper.  Turn it into an inline
function that type-checks its arguments.  Prevents warnings about
shift-count-overflow.

PR: 260375
MFC after: 2 weeks
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D33404

2 years agostand/module: skip is only used by veriexec
Warner Losh [Thu, 16 Dec 2021 02:52:29 +0000 (19:52 -0700)]
stand/module: skip is only used by veriexec

Sponsored by: Netflix

2 years agostand/userboot: Kill set but unused variables
Warner Losh [Thu, 16 Dec 2021 02:48:40 +0000 (19:48 -0700)]
stand/userboot: Kill set but unused variables

We never use 'dev' after fetching it from the varargs list. Skip the
whole bother of fetching it, or setting up the meachinery to fetch it.

Sponsored by: Netflix