]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
22 months agounbound: Vendor import 1.16.2
Cy Schubert [Sat, 6 Aug 2022 01:44:40 +0000 (18:44 -0700)]
unbound: Vendor import 1.16.2

Security update to unbound.

PR:             265645
Security:       CVE-2022-30698, CVE-2022-30699
Security:       bc43a578-14ec-11ed-856e-d4c9ef517024
MFC after:      3 days

Merge commit '9b76d32f2310b735dbeb896cbf2776cad61f23e8' into main

22 months agobpf: Fix BIOCPROMISC locking
Mark Johnston [Fri, 5 Aug 2022 20:25:05 +0000 (16:25 -0400)]
bpf: Fix BIOCPROMISC locking

BPF might put an interface in promiscuous mode when handling the
BIOCSDLT ioctl.  When this happens, a flag is set in the BPF descriptor
so that the old interface can be restored when the BPF descriptor is
destroyed.

The BIOCPROMISC ioctl can also be used to put a BPF descriptor's
interface into promiscuous mode, but there was nothing synchronizing the
flag.  Fix this by modifying the ioctl handler to acquire the global BPF
mutex, which is used to synchronize ifpromisc() calls elsewhere in BPF.

Reviewed by: kp, melifaro
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36045

22 months agoarm: Clear TTBCR before enabling the MMU
Mark Johnston [Fri, 5 Aug 2022 20:21:09 +0000 (16:21 -0400)]
arm: Clear TTBCR before enabling the MMU

Upon reset, this register is supposed to have a value of zero.  But when
booting certain v7 CPUs in QEMU, we enter the kernel with several bits
set, including the EAE bit, which enables ARM's PAE extension.  I'm not
sure if QEMU is setting it or if it's the uboot loader.  Because FreeBSD
doesn't implement that extension and uses regular 32-bit page tables,
the kernel hangs immediately after enabling the MMU.

Just clear everything in TTBCR before enabling the MMU, to match the
reset value.  FreeBSD doesn't toggle anything in that register.

PR: 251187
Reviewed by: imp
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36041

22 months agounbound: Vendor import 1.16.2
Cy Schubert [Fri, 5 Aug 2022 20:02:55 +0000 (13:02 -0700)]
unbound: Vendor import 1.16.2

Security update to unbound.

PR: 265645
Security: CVE-2022-30698, CVE-2022-30699
Security: bc43a578-14ec-11ed-856e-d4c9ef517024

22 months agoacpi_apei: Add sysctl to mute corrected errors.
Alexander Motin [Fri, 5 Aug 2022 17:45:35 +0000 (13:45 -0400)]
acpi_apei: Add sysctl to mute corrected errors.

Setting hw.acpi.apei.log_corrected to 0 will mute corrected errors logging.

MFC after: 1 week

22 months agomca: Add sysctl to mute corrected errors.
Alexander Motin [Fri, 5 Aug 2022 17:40:57 +0000 (13:40 -0400)]
mca: Add sysctl to mute corrected errors.

Setting hw.mca.log_corrected to 0 will mute corrected errors logging
except ones marked as reaching Yellow threshold by hardware.

MFC after: 1 week

22 months agoRELNOTES: Document ZFS support in makefs
Mark Johnston [Fri, 5 Aug 2022 17:31:14 +0000 (13:31 -0400)]
RELNOTES: Document ZFS support in makefs

Sponsored by: The FreeBSD Foundation

22 months agomakefs: Add ZFS support
Mark Johnston [Fri, 5 Aug 2022 17:07:54 +0000 (13:07 -0400)]
makefs: Add ZFS support

This allows one to take a staged directory tree and create a file
consisting of a ZFS pool with one or more datasets that contain the
contents of the directory tree.  This is useful for creating virtual
machine images without using the kernel to create a pool; "zpool create"
requires root privileges and currently is not permitted in jails.
makefs -t zfs also provides reproducible images by using a fixed seed
for pseudo-random number generation, used for generating GUIDs and hash
salts.  makefs -t zfs requires relatively little by way of machine
resources.

The "zpool_reguid" rc.conf setting can be used to ask a FreeBSD guest to
generate a unique pool GUID upon first boot.

A small number of pool and dataset properties are supported.  The pool
is backed by a single disk vdev.  Data is always checksummed using
Fletcher-4, no redundant copies are made, and no compression is used.
The manual page documents supported pool and filesystem properties.

The implementation uses a few pieces of ZFS support from with the boot
loader, especially definitions for various on-disk structures, but is
otherwise standalone and in particular doesn't depend on OpenZFS.

This feature should be treated as experimental for now, i.e., important
data shouldn't be trusted to a makefs-created pool, and the command-line
interface is subject to change.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35248

22 months agobsdinstall: allow setting the root password via env variables
Brad Davis [Fri, 5 Aug 2022 15:10:21 +0000 (09:10 -0600)]
bsdinstall: allow setting the root password via env variables

Reviewed by: 0mp, allanjude, asiciliano, dteske, pauamma, rpokala, sef
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35588

22 months agonvme: Print CRD, M and DNR status bits on errors.
Alexander Motin [Fri, 5 Aug 2022 14:58:19 +0000 (10:58 -0400)]
nvme: Print CRD, M and DNR status bits on errors.

It may help with some issues debugging.

MFC after: 1 week

22 months agoRemove "All rights reserved" where I can in libc
Andrew Turner [Fri, 5 Aug 2022 14:11:39 +0000 (15:11 +0100)]
Remove "All rights reserved" where I can in libc

These all have my copyright so can be removed. Some also have FreeBSD
Foundation copyright so drop from there as has been done for previous
files.

Sponsored by: The FreeBSD Foundation

22 months agoClarify code comments on ASLR default settings
Ed Maste [Fri, 5 Aug 2022 14:01:07 +0000 (10:01 -0400)]
Clarify code comments on ASLR default settings

Sponsored by: The FreeBSD Foundation

22 months agozlib: Fix a bug when getting a gzip header extra field with inflate().
Mark Adler [Sat, 30 Jul 2022 22:51:11 +0000 (15:51 -0700)]
zlib: Fix a bug when getting a gzip header extra field with inflate().

If the extra field was larger than the space the user provided with
inflateGetHeader(), and if multiple calls of inflate() delivered
the extra header data, then there could be a buffer overflow of the
provided space. This commit assures that provided space is not
exceeded.

(cherry picked from zlib commit eff308af425b67093bab25f80f1ae950166bece1)

22 months agopowerpc/fsl_sata: Properly clamp maxio to pessimized size
Justin Hibbits [Fri, 5 Aug 2022 01:28:21 +0000 (21:28 -0400)]
powerpc/fsl_sata: Properly clamp maxio to pessimized size

The CAM 'maxio' is a 'pessimized' size, assuming 4k pages and one page
per segment.  Since there are at most 63 segments in a transaction with
this driver, and one would necessarily be the indirect segment marker,
clamp the maxio to the minimum of maxphys (tunable) or (63 - 1) pages
(248k).

MFC after: 3 days

22 months agorenice: support -- as per POSIX.
Dag-Erling Smørgrav [Thu, 4 Aug 2022 23:50:00 +0000 (01:50 +0200)]
renice: support -- as per POSIX.

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

22 months agoDrop checks with last alternate superblock in fsck_ffs(8).
Kirk McKusick [Thu, 4 Aug 2022 23:06:43 +0000 (16:06 -0700)]
Drop checks with last alternate superblock in fsck_ffs(8).

The fsck_ffs(8) utility made sanity checks of critical superblock
fields by comparing the values of those fields in the standard
superblock againt the values of those fields in the last alternate
superblock. The code for validating a superblock now cover all the
checked fields as well as many more. Further the checks done are
far more comprehensive. So we now drop the alternate superblock
checks as they no longer provide value. Dropping these checks also
eliminates the need to read the alternate superblock.

22 months agolibc: drop "All rights reserved" from Foundation copyrights
Ed Maste [Thu, 4 Aug 2022 20:52:23 +0000 (16:52 -0400)]
libc: drop "All rights reserved" from Foundation copyrights

This has already been done for most files that have the Foundation as
the only listed copyright holder.  Do it now for files that list
multiple copyright holders, but have the Foundation copyright in its own
section.

Sponsored by: The FreeBSD Foundation

22 months ago[libm] Correct comments in s_cbrt[l].c
Steve Kargl [Thu, 4 Aug 2022 17:31:57 +0000 (19:31 +0200)]
[libm] Correct comments in s_cbrt[l].c

Damian McGuckin <damianm at esi dot com dot au> noted that the accuracy
claims in the code for cbrt(3) and cbrtl(3) were incorrect. Fix the
comments to more accurately describe the accuracies.

PR: 265603
MFC after: 3 days

22 months agohier.7: Document /var/db/freebsd-update
Mateusz Piotrowski [Thu, 4 Aug 2022 13:57:18 +0000 (15:57 +0200)]
hier.7: Document /var/db/freebsd-update

MFC after: 3 days
Sponsored by: Klara, Inc.

22 months agobridge tests: Tests using pft_ping.py require scapy
Mark Johnston [Thu, 4 Aug 2022 13:41:52 +0000 (09:41 -0400)]
bridge tests: Tests using pft_ping.py require scapy

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

22 months agofile: Move code to share fdtol structs into kern_descrip.c
Mark Johnston [Thu, 4 Aug 2022 13:39:25 +0000 (09:39 -0400)]
file: Move code to share fdtol structs into kern_descrip.c

This ensures the filedesc-to-leader code is consistently encapsulated in
kern_descrip.c.

No functional change intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35988

22 months agoqat: Move qat_c2xxx firmware files and build glue into separate dirs
Mark Johnston [Thu, 4 Aug 2022 13:37:55 +0000 (09:37 -0400)]
qat: Move qat_c2xxx firmware files and build glue into separate dirs

Reviewed by: Zdziarski, KrzysztofX <krzysztofx.zdziarski@intel.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36032

22 months agoif_ovpn: fix unused functions with NOINET / NOINET6
Kristof Provost [Thu, 4 Aug 2022 08:13:09 +0000 (10:13 +0200)]
if_ovpn: fix unused functions with NOINET / NOINET6

ovpn_find_peer_by_ip() is not used if INET is not defined. Do not
define the function in that case. Same for ovpn_find_peer_by_ip6().

Fix these warnings:

/usr/src/sys/net/if_ovpn.c:1580:1: warning: unused function 'ovpn_find_peer_by_ip' [-Wunused-function]
ovpn_find_peer_by_ip(struct ovpn_softc *sc, const struct in_addr addr)
^
/usr/src/sys/net/if_ovpn.c:1599:1: warning: unused function 'ovpn_find_peer_by_ip6' [-Wunused-function]
ovpn_find_peer_by_ip6(struct ovpn_softc *sc, const struct in6_addr *addr)
^

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

22 months agohda: Add a patch for ASUS ROG GL553VE.
Gleb Popov [Mon, 1 Aug 2022 11:07:04 +0000 (14:07 +0300)]
hda: Add a patch for ASUS ROG GL553VE.

Summary:
This change enables headset detection on the laptop.

PR: 256169

Approved by: mav

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

22 months agorouting: remove duplicate error message after 5c23343b8c0c.
Alexander V. Chernikov [Thu, 4 Aug 2022 09:51:38 +0000 (09:51 +0000)]
routing: remove duplicate error message after 5c23343b8c0c.

MFC after: 2 weeks

22 months agovirtio_mmio: correct offset of VIRTIO_MMIO_CONFIG_GENERATION
Bryan Venteicher [Thu, 4 Aug 2022 03:54:36 +0000 (22:54 -0500)]
virtio_mmio: correct offset of VIRTIO_MMIO_CONFIG_GENERATION

22 months agoxinstall: alphabetize: upper case precedes lower.
Dag-Erling Smørgrav [Thu, 4 Aug 2022 00:09:18 +0000 (02:09 +0200)]
xinstall: alphabetize: upper case precedes lower.

Sponsored by: Klara, Inc.

22 months agoroute: fix NOIP builds
Mateusz Guzik [Wed, 3 Aug 2022 21:23:32 +0000 (21:23 +0000)]
route: fix NOIP builds

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

22 months agoxinstall: use dynamic bufsize as in cat(1) / cp(1).
Dag-Erling Smørgrav [Wed, 3 Aug 2022 21:00:14 +0000 (23:00 +0200)]
xinstall: use dynamic bufsize as in cat(1) / cp(1).

Sponsored by: Klara, Inc.

22 months agoxinstall: make md5 and ripemd160 conditional
Dag-Erling Smørgrav [Wed, 3 Aug 2022 19:20:47 +0000 (21:20 +0200)]
xinstall: make md5 and ripemd160 conditional

Sponsored by: Klara, Inc.

22 months agoxinstall: fix dounpriv logic, add tests
Dag-Erling Smørgrav [Wed, 3 Aug 2022 18:59:28 +0000 (20:59 +0200)]
xinstall: fix dounpriv logic, add tests

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

22 months agostand: Reduce number of files that need -I${LDRSRC}
Warner Losh [Wed, 3 Aug 2022 17:16:17 +0000 (11:16 -0600)]
stand: Reduce number of files that need -I${LDRSRC}

geliboot.c and geliboot_crypto.c don't need anything from stand/common,
so remove them from the list of things to add it.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35921

22 months agostand: Remove unneeded include from geli
Warner Losh [Wed, 3 Aug 2022 17:13:34 +0000 (11:13 -0600)]
stand: Remove unneeded include from geli

bootstrap.h isn't needed at all by geil, so remove it.

Sponsored by: Netflix
Reviewed by: tsoome (earlier version)
Differential Revision: https://reviews.freebsd.org/D35920

22 months agostand: use snprintf here
Warner Losh [Wed, 3 Aug 2022 16:50:14 +0000 (10:50 -0600)]
stand: use snprintf here

This code was written prior to snprintf being in the then libstand (now
libsa). Since we have it, use it for extra safety. The code already
tries to be safe, but since we have snprintf as well, the added layer of
protection will suffice. The current code reserves 16 bytes (plus a NUL)
at the end for worst case of inet_ntoa, which is still a little
pessimal, but safe from overflow.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35102

22 months agosctp: tweak panic message
Michael Tuexen [Wed, 3 Aug 2022 15:28:15 +0000 (17:28 +0200)]
sctp: tweak panic message

MFC after: 1 week

22 months agosig_suspend_threads(): remove 'sending' arg
Konstantin Belousov [Wed, 3 Aug 2022 01:04:17 +0000 (04:04 +0300)]
sig_suspend_threads(): remove 'sending' arg

The TDA_AST flag is set on td2 unconditionally (as it was TDF_ASTPENDING
before AST rework), so it is not used practically for some time.

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

22 months agoast_sig(): add missed TDAI()
Konstantin Belousov [Wed, 3 Aug 2022 13:42:49 +0000 (16:42 +0300)]
ast_sig(): add missed TDAI()

Mask checked was completely wrong

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

22 months agopkgbase: split kerberos binaries and libs
Doug Rabson [Fri, 29 Jul 2022 09:14:34 +0000 (10:14 +0100)]
pkgbase: split kerberos binaries and libs

Summary:
This allows installing packages that depend on kerberos libraries
without pulling in all the binaries. It also moves libgssapi to runtime
to allow installing kerbereos libraries without adding a dependancy on
the large utilities package. It makes sense to put libgssapi in runtime
rather than kerberos-lib since this is a plugin layer which is intended
to support any GSS-API mechanisms, not just kerberos.

A good example of a package which uses kerberos libraries without
needing the kerberos utilities is sshd. This uses the kerberos GSS-API
libraries to implement its GSSAPIAuthentication option.

MFC after: 2 weeks

Subscribers: imp

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

22 months agorouting: fix panic for p2p interfaces after 800c68469ba6.
Alexander V. Chernikov [Wed, 3 Aug 2022 08:21:08 +0000 (08:21 +0000)]
routing: fix panic for p2p interfaces after 800c68469ba6.

Reported by: cy
MFC after: 1 month

22 months agoAdd me as ports committer, update mentor/mentee
Felix Palmen [Tue, 2 Aug 2022 16:31:23 +0000 (18:31 +0200)]
Add me as ports committer, update mentor/mentee

This completes step 7 from Committer's Guide.

Approved by: tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D36014

22 months agoctfconvert: Actually use the asprintf() helper
Mark Johnston [Wed, 3 Aug 2022 00:49:50 +0000 (20:49 -0400)]
ctfconvert: Actually use the asprintf() helper

Fixes: 1165fc9a5266 ("ctfconvert: Give bitfield types names distinct from the base type")

22 months agoctfconvert: Give bitfield types names distinct from the base type
Mark Johnston [Wed, 3 Aug 2022 00:32:17 +0000 (20:32 -0400)]
ctfconvert: Give bitfield types names distinct from the base type

CTF integers have an explicit width and so can be used to represent
bitfields.  Bitfield types emitted by ctfconvert(1) share the name of
the base integer type, so a struct field with type "unsigned int : 15"
will have a type named "unsigned int".

To avoid ambiguity when looking up types by name, add a suffix to names
of bitfield types to distinguish them from the base type.  Then, if
ctfmerge happens to order bitfield types before the corresponding base
type in a CTF file, a name lookup will return the base type, which is
always going to be the desired behaviour.

PR: 265403
Reported by: cy
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

22 months agodtrace tests: Rename some test type names to avoid a conflict
Mark Johnston [Wed, 3 Aug 2022 00:32:08 +0000 (20:32 -0400)]
dtrace tests: Rename some test type names to avoid a conflict

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

22 months agodtrace tests: Override RLIMIT_CORE for a test which triggers a core dump
Mark Johnston [Wed, 3 Aug 2022 00:32:04 +0000 (20:32 -0400)]
dtrace tests: Override RLIMIT_CORE for a test which triggers a core dump

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

22 months agodomain: Use designated constants for timeout periods
Mark Johnston [Wed, 3 Aug 2022 00:31:29 +0000 (20:31 -0400)]
domain: Use designated constants for timeout periods

No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

22 months agopowerpcspe: make GEOM_LABEL kernel built-in
Alfredo Dal'Ava Junior [Tue, 2 Aug 2022 21:11:11 +0000 (18:11 -0300)]
powerpcspe: make GEOM_LABEL kernel built-in

Make powerpspe kernel config in sync with other targets making
GEOM_LABEL built-in to allow use of labels when mounting partitions.

MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

22 months agolinuxkpi: more precise need_resched() definition
Konstantin Belousov [Thu, 28 Jul 2022 12:06:30 +0000 (15:06 +0300)]
linuxkpi: more precise need_resched() definition

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

22 months agoktrace: change AST handler to require AST flag set
Konstantin Belousov [Thu, 28 Jul 2022 06:32:47 +0000 (09:32 +0300)]
ktrace: change AST handler to require AST flag set

When it was inline it made sense to depend on the existing nested check
in KTRUSERRET() rather than adding a new td_flags flag.  However, since
we now have a TDA_KTRACE flag anyway, we might as well check it and
avoid the call.

Suggested by: jhb
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35888

22 months agokern/subr_trap.c: cleanup no longer needed headers
Konstantin Belousov [Mon, 25 Jul 2022 13:03:59 +0000 (16:03 +0300)]
kern/subr_trap.c: cleanup no longer needed headers

Also bump Foundation' copyright year

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35888

22 months agoAdjust g_waitidle() visibility and definition
Konstantin Belousov [Fri, 22 Jul 2022 08:00:18 +0000 (11:00 +0300)]
Adjust g_waitidle() visibility and definition

Explicitly pass the struct thread argument.
Move the function prototype from sys/systm.h to geom/geom.h, we do not
need almost each kernel source to see the prototype, it is now used
only by kern/vfs_mountroot.c outside geom/geom_event.c, where the
function is defined.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35888

22 months agosigfastblock_setpend() and fastblock_mask can be static now
Konstantin Belousov [Fri, 22 Jul 2022 06:59:16 +0000 (09:59 +0300)]
sigfastblock_setpend() and fastblock_mask can be static now

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35888

22 months agoAST: rework
Konstantin Belousov [Mon, 18 Jul 2022 16:39:17 +0000 (19:39 +0300)]
AST: rework

Make most AST handlers dynamically registered.  This allows to have
subsystem-specific handler source located in the subsystem files,
instead of making subr_trap.c aware of it.  For instance, signal
delivery code on return to userspace is now moved to kern_sig.c.

Also, it allows to have some handlers designated as the cleanup (kclear)
type, which are called both at AST and on thread/process exit.  For
instance, ast(), exit1(), and NFS server no longer need to be aware
about UFS softdep processing.

The dynamic registration also allows third-party modules to register AST
handlers if needed.  There is one caveat with loadable modules: the
code does not make any effort to ensure that the module is not unloaded
before all threads processed through AST handler in it.  In fact, this
is already present behavior for hwpmc.ko and ufs.ko.  I do not think it
is worth the efforts and the runtime overhead to try to fix it.

Reviewed by: markj
Tested by: emaste (arm64), pho
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35888

22 months agoamd64: expicitly re-init td_frame in copy_thread()
Konstantin Belousov [Thu, 21 Jul 2022 16:26:26 +0000 (19:26 +0300)]
amd64: expicitly re-init td_frame in copy_thread()

Otherwise we are using whatever the value was left from the previous
thread run on kernel entry from usermode. Typically it would be the
desired value as is, but it is not guaranteed.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35888

22 months agorb_tree: resolve name clash
Doug Moore [Tue, 2 Aug 2022 16:47:17 +0000 (11:47 -0500)]
rb_tree: resolve name clash

Rename 'tmp' to 'rb_update_tmp' in a macro to avoid a shadow variable panic.

Reported by: imb@protected-networks.net
Fixes: 35557a0d9169

22 months agorb_tree: update augmentation after element change
Doug Moore [Tue, 2 Aug 2022 16:19:46 +0000 (11:19 -0500)]
rb_tree: update augmentation after element change

For an augmented rb_tree, allow a faster alternative to removing an
element from the tree, tweaking it slightly, and inserting it back
into the tree, knowing that its relative position in the tree is
unchanged. Instead, just change the element and invoke
RB_UPDATE_AUGMENT to fix the augmentation data for all the nodes in
the tree.

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

23 months agotcp.4: Add missing sysctls, other fixes
Mike Karels [Sun, 31 Jul 2022 18:57:03 +0000 (13:57 -0500)]
tcp.4: Add missing sysctls, other fixes

Add some of the missing sysctls to tcp.4, using references to other
man pages where they exist.  Added sysctls include recvbuf and sendbuf
controls for automatic buffer sizing.  Updated recvspace and sendspace.

Add sysctl.8 to "see also" and intro to variable section.  Rename
"MIB Variables" section to "MIB (sysctl) Variables", as most people
will associate with sysctl.

Reviewed by: manpages(pauamma), tuexen
Differential Revision: https://reviews.freebsd.org/D36004

23 months agoinet.4 icmp.4 udp.4: Add missing sysctls, other fixes
Mike Karels [Thu, 21 Jul 2022 13:17:03 +0000 (08:17 -0500)]
inet.4 icmp.4 udp.4: Add missing sysctls, other fixes

Add missing sysctls to inet.4 and icmp.4, using references to ip.4
for variables and groups documented there.  Add sysctl.8 to "see also"
and intro to variable section.  Rename "MIB Variables" section to
"MIB (sysctl) Variables", as most people will associate with sysctl.
Revise history: the ICMP implementation was in 4.2BSD.

Reviewed by: manpages(pauamma)
Differential Revision: https://reviews.freebsd.org/D36003

23 months agoIPv6: fix problem with duplicate port assignment with v4-mapped addrs
Mike Karels [Fri, 29 Jul 2022 14:23:23 +0000 (09:23 -0500)]
IPv6: fix problem with duplicate port assignment with v4-mapped addrs

In in_pcb_lport_dest(), if an IPv6 socket does not match any other IPv6
socket using in6_pcblookup_local(), and if the socket can also connect
to IPv4 (the INP_IPV4 vflag is set), check for IPv4 matches as well.
Otherwise, we can allocate a port that is used by an IPv4 socket
(possibly one created from IPv6 via the same procedure), and then
connect() can fail with EADDRINUSE, when it could have succeeded if
the bound port was not in use.

PR: 265064
Submitted by: firk at cantconnect.ru (with modifications)
Reviewed by: bz, melifaro
Differential Revision: https://reviews.freebsd.org/D36012

23 months agodiff3: Use ranges for new and old diffedits in ed scripts
Tom Jones [Tue, 2 Aug 2022 13:33:17 +0000 (14:33 +0100)]
diff3: Use ranges for new and old diffedits in ed scripts

This should make the output logic easier to read. No functional change
intended.

Sponsored by: Klara, Inc.

23 months agodiff3: Use ranges for the old and new diffedits in A scripts
Tom Jones [Tue, 2 Aug 2022 13:29:38 +0000 (14:29 +0100)]
diff3: Use ranges for the old and new diffedits in A scripts

This makes the output logic easier to read. No functional change
intended.

Sponsored by: Klara, Inc.

23 months agodiff3: Simplify startmark calculation in Ascript
Tom Jones [Tue, 2 Aug 2022 13:23:10 +0000 (14:23 +0100)]
diff3: Simplify startmark calculation in Ascript

Remove redundant calculation for startmark.

Sponsored by: Klara, Inc.

23 months agorecv: bump manpage date after be1f485d7d6bebc53b05.
Alexander V. Chernikov [Tue, 2 Aug 2022 13:23:27 +0000 (13:23 +0000)]
recv: bump manpage date after be1f485d7d6bebc53b05.

MFC after: 1 month

23 months agotcp rack: simplify computation of rsm start and end
Michael Tuexen [Tue, 2 Aug 2022 10:45:56 +0000 (12:45 +0200)]
tcp rack: simplify computation of rsm start and end

While there, also fix the setting of the SYN related flag.

Reviewed by: rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D35862

23 months agofind.1: Correct the markup
Gordon Bergling [Tue, 2 Aug 2022 06:33:20 +0000 (08:33 +0200)]
find.1: Correct the markup

- ASCII is an acronym and there is no ascii(8) manual page
- Reference ascii(7) in the SEE ALSO section

Reported by: karels
X-MFC with: 321dc6ee7e81

23 months agowtap: cleanup module Makefile
Bjoern A. Zeeb [Mon, 1 Aug 2022 19:43:55 +0000 (19:43 +0000)]
wtap: cleanup module Makefile

Remove comments and change whitespace.
Cleanup the opt_* and -nclude opt_global.h bits to avoid various warnings.

23 months agowtap(4): Fix bug in wtap_node_write() and wtap_vap_create()
En-Wei Wu [Mon, 1 Aug 2022 19:40:13 +0000 (19:40 +0000)]
wtap(4): Fix bug in wtap_node_write() and wtap_vap_create()

Originally, wtap_node_write() gets the wrong softc by iterating V_inet and
gets the ifp by string comparison, then gets softc by ifp->if_softc.
However, ifp->if_softc will not point to the correct softc owned by
ieee80211com, and thus causes a kernel panic.
Fix it by assigning softc to cdev's si_drv1 in wtap_vap_create()
and get the softc directly via dev->si_drv1 in wtap_node_write().

The cdev created by wtap_vap_create() use the name of ieee80211com
rather than the vap's name. It will cause the second vap based on
the same ieee80211com as first vap fail to create a device node
because the device node is already exists. Fix it by assigning
vap->iv_ifp->if_xname to cdev's name.

Sponsored by: Google, Inc. (GSoC 2022)
Reviewed by: adrian, cy, bz
Differential Revision: https://reviews.freebsd.org/D35752

23 months agodiff3: Use variables for old and new in A scripts
Tom Jones [Mon, 1 Aug 2022 13:48:35 +0000 (14:48 +0100)]
diff3: Use variables for old and new in A scripts

This makes the code easier to follow, no functional changes intended

Sponsored by: Klara, Inc.

23 months agodiff3: Replace literal marker with variable
Tom Jones [Mon, 1 Aug 2022 13:46:09 +0000 (14:46 +0100)]
diff3: Replace literal marker with variable

Sponsored by: Klara, Inc.

23 months agodiff3: Fix indentation
Tom Jones [Mon, 1 Aug 2022 13:14:25 +0000 (14:14 +0100)]
diff3: Fix indentation

Sponsored by: Klara, Inc.

23 months agouftdi(4): Add new USB ID.
Hans Petter Selasky [Mon, 1 Aug 2022 11:25:49 +0000 (13:25 +0200)]
uftdi(4): Add new USB ID.

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

23 months agorouting: refactor private KPI
Alexander V. Chernikov [Mon, 1 Aug 2022 10:02:12 +0000 (10:02 +0000)]
routing: refactor private KPI
* Make nhgrp_get_nhops() return const struct weightened_nhop to
 indicate that the list is immutable
* Make nhgrp_get_group() return the actual group, instead of
 group+weight.

MFC after: 2 weeks

23 months agotests: fix unix_passfd_dgram:rights_creds_payload after be1f485d7d6b
Alexander V. Chernikov [Mon, 1 Aug 2022 09:20:45 +0000 (09:20 +0000)]
tests: fix unix_passfd_dgram:rights_creds_payload after be1f485d7d6b

The test was failing due to the assert on lack of MSG_TRUNC flag in the
 output flags of recvmsg().
The code passed MSG_TRUNC, along with sufficient-size buffer to hold the
 message to-be-received to the recvmsg(), and expected MSG_TRUNC to be
 returned as well.

This is not exactly correct as a) MSG_TRUNC was not even a supported
 recvmsg() flag before be1f485d7d6b and b) it violates POSIX, as
 POSIX states it should be set only "If a message is too long to fit in
 the supplied buffers,".
The test was working before as the kernel copied input flags to the
 output flags. be1f485d7d6b changed that behaviour to clear MSG_TRUNC
 if it was present on the input.

Fix the test by checking POSIX-defined behaviour.

Discussed with: glebius

23 months agorouting: convert remnants of DPRINTF to FIB_CTL_LOG().
Alexander V. Chernikov [Fri, 29 Jul 2022 17:41:16 +0000 (17:41 +0000)]
routing: convert remnants of DPRINTF to FIB_CTL_LOG().

Convert the last remaining pieces of old-style debug messages
 to the new debugging framework.

Differential Revision: https://reviews.freebsd.org/D35994
MFC after: 2 weeks

23 months agorouting: add nhop(9) kpi.
Alexander V. Chernikov [Fri, 29 Jul 2022 12:32:27 +0000 (12:32 +0000)]
routing: add nhop(9) kpi.

Differential Revision: https://reviews.freebsd.org/D35985
MFC after: 1 month

23 months agorouting: remove info argument from add/change_route_nhop().
Alexander V. Chernikov [Thu, 28 Jul 2022 13:41:11 +0000 (13:41 +0000)]
routing: remove info argument from add/change_route_nhop().

Currently, rt_addrinfo(info) serves as a main "transport" moving
 state between various functions inside the routing subsystem.
As all of the fields are filled in directly by the customers, it
 is problematic to maintain consistency, resulting in repeated checks
 inside many functions. Additionally, there are multiple ways of
 specifying the same value (RTAX_IFP vs rti_ifp / rti_ifa) and so on.
With the upcoming nhop(9) kpi it is possible to store all of the
 required state in the nexthops in the consistent fashion, reducing the
 need to use "info" in the KPI calls.
Finally, rt_addrinfo structure format was derived from the rtsock wire
 format, which is different from other kernel routing users or netlink.

This cleanup simplifies upcoming nhop(9) kpi and netlink introduction.

Reviewed by: zlei.huang@gmail.com
Differential Revision: https://reviews.freebsd.org/D35972
MFC after: 2 weeks

23 months agonet: constantify radix.c functions
Alexander V. Chernikov [Thu, 28 Jul 2022 13:04:43 +0000 (13:04 +0000)]
net: constantify radix.c functions

Mark dst/mask public API functions fields as const to clearly
 indicate that these parameters are not modified or stored in
 the datastructure.

Differential Revision: https://reviews.freebsd.org/D35971
MFC after: 2 weeks

23 months agorouting: move route expiration time to its nexthop
Alexander V. Chernikov [Thu, 28 Jul 2022 12:18:19 +0000 (12:18 +0000)]
routing: move route expiration time to its nexthop

Expiration time is actually a path property, not a route property.
Move its storage to nexthop to simplify upcoming nhop(9) KPI changes
 and netlink introduction.

Differential Revision: https://reviews.freebsd.org/D35970
MFC after: 2 weeks

23 months agoIdentify each UFS/FFS superblock integrity check as a warning or fatal error.
Kirk McKusick [Mon, 1 Aug 2022 05:07:20 +0000 (22:07 -0700)]
Identify each UFS/FFS superblock integrity check as a warning or fatal error.

Identify each of the superblock validation checks as either a
warning or a fatal error. Any integrity check that can cause a
system hang or crash is marked as fatal. Those that may simply
lead to poor file layoutor other less good operating conditions
are marked as warning.

Normally both fatal and warning are treated as errors and prevent
the superblock from being loaded. A new flag, UFS_NOWARNFAIL, is
added. When passed to ffs_sbget() it will note warnings that it
finds, but will still proceed with loading the superblock. Note
that when UFS_NOWARNFAIL is used, it also includes UFS_NOHASHFAIL.

No legitimate superblocks should fail as a result of these changes.

23 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Mon, 1 Aug 2022 03:28:04 +0000 (20:28 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Further updates based on analysis of the way the fields are used
in the various filesystem macros defined in fs.h.

Eliminate several checks for non-negative values where the fields
are checked for specific values. Since these specific values are
non-negative, if the value is a verified positive value then it
cannot be negative and such a check is redundant and unnecessary.

No legitimate superblocks should fail as a result of these changes.

23 months agoDeprecate minigzip(1) in preparation of removing it from base system.
Xin LI [Sun, 31 Jul 2022 22:16:22 +0000 (15:16 -0700)]
Deprecate minigzip(1) in preparation of removing it from base system.

Reviewed by: emaste, pauamma
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36000

23 months agoFix for 548045b a too aggressive UFS superblock integrity check.
Kirk McKusick [Sun, 31 Jul 2022 14:48:59 +0000 (07:48 -0700)]
Fix for 548045b a too aggressive UFS superblock integrity check.

Reported by: Jenkins

23 months agofind.1: Fix mandoc warnings and mention a useful manpage
Gordon Bergling [Sun, 31 Jul 2022 14:38:10 +0000 (16:38 +0200)]
find.1: Fix mandoc warnings and mention a useful manpage

- new sentence, new line
- unknown AT&T UNIX version: At v7
- no blank before trailing delimiter
- reference the ASCII(8) manual page

MFC after: 5 days

23 months agosh.1: Fix a mandoc warning
Gordon Bergling [Sun, 31 Jul 2022 14:23:27 +0000 (16:23 +0200)]
sh.1: Fix a mandoc warning

- new sentence, new line

MFC after: 3 days

23 months agouhsoctl.1: Fix the man page date
Gordon Bergling [Sun, 31 Jul 2022 10:27:10 +0000 (12:27 +0200)]
uhsoctl.1: Fix the man page date

- STYLE: normalizing date format to: August 12, 2009

MFC after: 3 days

23 months agouefi(8): Fix a typo in a source code comment
Gordon Bergling [Sun, 31 Jul 2022 10:14:54 +0000 (12:14 +0200)]
uefi(8): Fix a typo in a source code comment

- s/intrrupt/interrupt/

MFC after: 3 days

23 months agobluetooth(3): Fix a typo in a source code comment
Gordon Bergling [Sun, 31 Jul 2022 10:13:13 +0000 (12:13 +0200)]
bluetooth(3): Fix a typo in a source code comment

- s/intrrupt/interrupt/

MFC after: 3 days

23 months agoqlnxe(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 31 Jul 2022 09:35:07 +0000 (11:35 +0200)]
qlnxe(4): Fix a typo in a source code comment

- s/pedning/pending/

MFC after: 3 days

23 months agorouting: add debug printing helpers for rtentry and RTM* cmds.
Alexander V. Chernikov [Sun, 31 Jul 2022 09:00:42 +0000 (09:00 +0000)]
routing: add debug printing helpers for rtentry and RTM* cmds.

MFC after: 2 weeks

23 months agomlx5en(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 31 Jul 2022 08:28:20 +0000 (10:28 +0200)]
mlx5en(4): Fix a typo in a source code comment

- s/functino/function/

MFC after: 3 days

23 months agocxgb(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 31 Jul 2022 07:59:03 +0000 (09:59 +0200)]
cxgb(4): Fix a typo in a source code comment

- s/collissions/collisions/

Obtained from: NetBSD
MFC after: 3 days

23 months agoAdd a flags parameter to the ffs_sbget() function that reads UFS superblocks.
Kirk McKusick [Sun, 31 Jul 2022 05:44:01 +0000 (22:44 -0700)]
Add a flags parameter to the ffs_sbget() function that reads UFS superblocks.

Rather than trying to shoehorn flags into the requested superblock
address, create a separate flags parameter to the ffs_sbget()
function in sys/ufs/ffs/ffs_subr.c. The ffs_sbget() function is
used both in the kernel and in user-level utilities through export
to the sbget() function in the libufs(3) library (see sbget(3)
for details). The kernel uses ffs_sbget() when mounting UFS
filesystems, in the glabel(8) and gjournal(8) GEOM utilities,
and in the standalone library used when booting the system
from a UFS root filesystem.

The ffs_sbget() function reads the superblock located at the byte
offset specified by its sblockloc parameter. The value UFS_STDSB
may be specified for sblockloc to request that the standard
location for the superblock be read.

The two existing options are now flags:

UFS_NOHASHFAIL will note if the check hash is wrong but will still
   return the superblock. This is used by the bootstrap code to
   give the system a chance to come up so that fsck can be run to
   correct the problem.

UFS_NOMSG indicates that superblock inconsistency error messages
   should not be printed. It is used by programs like fsck that
   want to print their own error message and programs like glabel(8)
   that just want to know if a UFS filesystem exists on a partition.

One additional flag is added:

UFS_NOCSUM causes only the superblock itself to be returned, but does
   not read in any auxiliary data structures like the cylinder group
   summary information. It is used by clients like glabel(8) that
   just want to check for possible filesystem types. Using UFS_NOCSUM
   skips the superblock checks for csum data which allows superblocks
   that have corrupted csum data to be read and used.

The validate_sblock() function checks that the superblock has not
been corrupted in a way that can crash or hang the system. Unless
the UFS_NOMSG flag is specified, it will print out any errors that
it finds. Prior to this commit, validate_sblock() returned as soon
as it found an inconsistency so would print at most one message.
It now does all its checks so when UFS_NOMSG has not been specified
will print out everything that it finds inconsistent.

Sponsored by: The FreeBSD Foundation

23 months agocalendar: clarify comment syntax in man page
Stefan Eßer [Sun, 31 Jul 2022 05:37:05 +0000 (07:37 +0200)]
calendar: clarify comment syntax in man page

The single line comment indicator '//' is only detected at the
beginning of a line or when following white space to allow URLs
in calendar entries.

MFC after: 3 days

23 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Sat, 30 Jul 2022 01:01:46 +0000 (18:01 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Reorder a few checks to ensure fields have been checked before
using them to check other fields.

Add eight new checks mostly checking for non-negative values.

No legitimate superblocks should fail as a result of these changes.

23 months agoiwlwifi firmware: update to -73 / newer builds for 9xxx
Bjoern A. Zeeb [Sun, 31 Jul 2022 00:36:23 +0000 (00:36 +0000)]
iwlwifi firmware:  update to -73 / newer builds for 9xxx

Update iwlwifi 22000 firmware to -73 and rebuilds for 9000/9260.
Update the driver to accept the newer version.

Firmware was obtained from linux-firmware at
150864a4d73e8c448eb1e2c68e65f07635fe1a66.

Sponsored by: The FreeBSD Foundation
MFC after: 23 days

23 months agotools/uma/smrstress: fix kthread exit
Konstantin Belousov [Sat, 30 Jul 2022 18:54:34 +0000 (21:54 +0300)]
tools/uma/smrstress: fix kthread exit

By convention, kernel threads must call kthread_exit() instead of
blindly returning from the thread function.  We have some safety measure
in fork_exit(), which checks for the P_KPROC p_flag and does
kthread_exit() for kernel thread that forgot to do it itself.

But this workaround only works for kernel threads belonging to the
kernel process.  If a kernel thread is attached to the normal process
with live userspace, and does not call kthread_exit(), then the
workaround is not activated, and for amd64 at least, the return from the
thread function/fork_exit() results in the return to userspace with the
copy of frame from the thread that did kthread_add().

Practically for smrstress, this destroys the user stack of the still
active frame in the other thread, which was the caller of kthread_add().

Fix it by adding kthread_exit() to the thread function.

Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35999

23 months agoiommu_gas: Eliminate redundant parameters and push down lock acquisition
Alan Cox [Fri, 29 Jul 2022 06:14:46 +0000 (01:14 -0500)]
iommu_gas: Eliminate redundant parameters and push down lock acquisition

Since IOMMU map entries store a reference to the domain in which they
reside, there is no need to pass the domain to iommu_gas_free_entry(),
iommu_gas_free_space(), and iommu_gas_free_region().

Push down the acquisition and release of the IOMMU domain lock into
iommu_gas_free_space() and iommu_gas_free_region().

Both of these changes allow for simplifications in the callers of the
functions without really complicating the functions themselves.
Moreover, the latter change eliminates the direct use of the IOMMU
domain lock from the x86-specific DMAR code.

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

23 months agosockets: add MSG_TRUNC flag handling for recvfrom()/recvmsg().
Alexander V. Chernikov [Mon, 25 Jul 2022 19:46:40 +0000 (19:46 +0000)]
sockets: add MSG_TRUNC flag handling for recvfrom()/recvmsg().

Implement Linux-variant of MSG_TRUNC input flag used in recv(), recvfrom() and recvmsg().
Posix defines MSG_TRUNC as an output flag, indicating packet/datagram truncation.
Linux extended it a while (~15+ years) ago to act as input flag,
resulting in returning the full packet size regarless of the input
buffer size.
It's a (relatively) popular pattern to do recvmsg( MSG_PEEK | MSG_TRUNC) to get the
packet size, allocate the buffer and issue another call to fetch the packet.
In particular, it's popular in userland netlink code, which is the primary driving factor of this change.

This commit implements the MSG_TRUNC support for SOCK_DGRAM sockets (udp, unix and all soreceive_generic() users).

PR: kern/176322
Reviewed by: pauamma(doc)
Differential Revision: https://reviews.freebsd.org/D35909
MFC after: 1 month

23 months agoLinuxKPI: 802.11: add missing linuxkpi_cfg80211_bss_flush()
Bjoern A. Zeeb [Sat, 30 Jul 2022 14:23:14 +0000 (14:23 +0000)]
LinuxKPI: 802.11: add missing linuxkpi_cfg80211_bss_flush()

Add the missing implementation of linuxkpi_cfg80211_bss_flush().
without this we get unresolved symbols and drivers won't load.

Reported by: eduardo, Berislav Purgar (bpurgar gmail.com)
MFC after: 3 days
X-MFC-Squash: b0f73768220e945deebebefc4a2d63ae6a3bfe19

23 months agostand: Add a helper 'universe' target
Warner Losh [Sat, 30 Jul 2022 11:01:47 +0000 (05:01 -0600)]
stand: Add a helper 'universe' target

Add a shortcut for invokging ${SRCTOP}/tools/boot/universe.sh by
creating a 'universe' target in src/stand. This will make it easier to
test out all the different combinations of boot loaders that we build.

Sponsored by: Netflix

23 months agostand: Move quit command to common commands
Warner Losh [Sat, 30 Jul 2022 10:43:21 +0000 (04:43 -0600)]
stand: Move quit command to common commands

Since both EFI and the future kboot will benefit from a 'quit' command,
move it from efi/loader/main.c to common/commands.c. In EFI this command
exits back to the boot loader (which will cause the next BootXXXX in the
BootOrder list to be attempted). In kboot, this will exit back to
whatever called loader.kboot. In uboot this will cause a reset (which
will restart uboot, not quite a simple exit, but will look similar)
and in OFW it will execute OF_exit which should return to the
openfirmware prompt.

Sponsored by: Netflix