]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 months agolibucl: import snapshot 2024-02-06
Baptiste Daroussin [Thu, 29 Feb 2024 12:27:03 +0000 (13:27 +0100)]
libucl: import snapshot 2024-02-06

3 months agolibucl: import latest snapshot from 2024-02-06
Baptiste Daroussin [Thu, 29 Feb 2024 12:18:07 +0000 (13:18 +0100)]
libucl: import latest snapshot from 2024-02-06

3 months agoRELNOTES: document usbconfig(8) changes
Baptiste Daroussin [Thu, 29 Feb 2024 12:06:08 +0000 (13:06 +0100)]
RELNOTES: document usbconfig(8) changes

3 months agousb_vendors: add new usb_vendors
Baptiste Daroussin [Thu, 29 Feb 2024 12:02:46 +0000 (13:02 +0100)]
usb_vendors: add new usb_vendors

usb_vendors is a local copy of usb.ids (similar to pci_vendors)
It is now used by usbconfig(1) when listing the devices.

3 months agousbconfig: allow to get usb vendors and products from the usb.ids database
Baptiste Daroussin [Tue, 27 Feb 2024 17:12:38 +0000 (18:12 +0100)]
usbconfig: allow to get usb vendors and products from the usb.ids database

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

3 months agoUpdate the Arm Optimized Routine library to v24.01
Andrew Turner [Thu, 29 Feb 2024 11:39:12 +0000 (11:39 +0000)]
Update the Arm Optimized Routine library to v24.01

Sponsored by: Arm Ltd

3 months agopowerpc: Bump maximum number of FDT reserved mem entries
Shawn Anastasio [Tue, 27 Feb 2024 19:40:50 +0000 (14:40 -0500)]
powerpc: Bump maximum number of FDT reserved mem entries

Newer firmware on POWER systems, including v2.10 of the Talos II and
Blackbird firmware can end up reserving more than 32 memory regions in
the device tree, which exceeded an assumption made by ofw_machdep.c's
excise_fdt_reserved(). Bump the maximum number of FDT reservations to
the next power of 2 in order to fix booting on newer firmware.

PR: 277097
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D44015

3 months agortld: use generated map file to check for some leaks from libc into rtld
Konstantin Belousov [Wed, 28 Feb 2024 23:40:41 +0000 (01:40 +0200)]
rtld: use generated map file to check for some leaks from libc into rtld

Reviewed by: brooks, emaste (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44136

3 months agortld: unconditionally generate map file during build
Konstantin Belousov [Wed, 28 Feb 2024 00:04:37 +0000 (02:04 +0200)]
rtld: unconditionally generate map file during build

It is needed at least to ensure that undesirable code is not linked into
rtld from libsys/libc, and adding the map file option each time is not
productive.

Reviewed by: brooks, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44136

3 months agosockets: in solisten_proto() don't call sbdestroy() on a PR_SOCKBUF
Gleb Smirnoff [Wed, 28 Feb 2024 23:57:04 +0000 (15:57 -0800)]
sockets: in solisten_proto() don't call sbdestroy() on a PR_SOCKBUF

A socket marked with PR_SOCKBUF has protocol specific socket buffers
and will take care of the in its pr_listen method.  Right now we don't
have any sockets that can listen and are PR_SOCKBUF, but that will
change soon.

3 months agolib{c,sys}: expose cap_sandboxed from libc/gen
Brooks Davis [Wed, 28 Feb 2024 23:23:33 +0000 (23:23 +0000)]
lib{c,sys}: expose cap_sandboxed from libc/gen

It's a thin wrapper on cap_getmode() implemented in libc, not a system
call so the symbol should have been exposed by libc/gen/Symbol.map
alongside the implementation.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44110

3 months agotests/unix_seqpacket: test that implied connect doesn't work
Gleb Smirnoff [Wed, 28 Feb 2024 22:32:47 +0000 (14:32 -0800)]
tests/unix_seqpacket: test that implied connect doesn't work

Applies both to SOCK_STREAM and SOCK_SEQPACKET.  Put the test in this file
as it is most advanced one.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D43854

3 months agotests/unix_seqpacket: test that data can be sent before accept(2)
Gleb Smirnoff [Wed, 28 Feb 2024 22:32:46 +0000 (14:32 -0800)]
tests/unix_seqpacket: test that data can be sent before accept(2)

This is undocumented feature of PF_UNIX/SOCK_STREAM and thus of
PF_UNIX/SOCK_SEQPACKET, too.  Put the test into this file, since this file
is most advanced and has all primitives to write this test in minimum
number of lines.

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

3 months agotests/unix_seqpacket: provide function that returns bound & listening sock
Gleb Smirnoff [Wed, 28 Feb 2024 22:32:46 +0000 (14:32 -0800)]
tests/unix_seqpacket: provide function that returns bound & listening sock

Use the function in mk_pair_of_sockets(), and in four existing tests -
'listen_bound', 'connect', 'shutdown_send' and 'shutdown_send_sigpipe'.
While here make mk_pair_of_sockets() return pointer to sockaddr_un instead
of path.  This also fixes bug of returning pointer to stack memory of
returning function.  However, the only caller that cares about this return
is temporarily ifdefed out.  No functional change intended.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D43852

3 months agotests/unix_seqpacket: remove EMSGSIZE tests
Gleb Smirnoff [Wed, 28 Feb 2024 22:32:46 +0000 (14:32 -0800)]
tests/unix_seqpacket: remove EMSGSIZE tests

These tests were not testing conformance to the specification, rather than
the limitation of our implementation.  The specification doesn't say that
a SOCK_SEQPACKET shall ever return EMSGSIZE.  It says:

  The SOCK_SEQPACKET socket type is similar to the SOCK_STREAM type,
  and is also connection-oriented. The only difference between these
  types is that record boundaries are maintained using the
  SOCK_SEQPACKET type. A record can be sent using one or more output
  operations and received using one or more input operations, but a
  single operation never transfers parts of more than one record.
  Record boundaries are visible to the receiver via the MSG_EOR flag
  in the received message flags returned by the recvmsg() function. It
  is protocol-specific whether a maximum record size is imposed.

The EMSGSIZE is specified as 'message is too large to be sent all at once,
as the socket requires'.  Indeed existing implementation that has
unix/seqpacket marked as PR_ATOMIC has such a limitation.  But future
implementation won't have, thus remove the tests.

Reviewed by: tuexen, asomers
Differential Revision: https://reviews.freebsd.org/D43756

3 months agosocket tests: remove MSG_TRUNC test for unix/seqpacket
Gleb Smirnoff [Wed, 28 Feb 2024 22:32:46 +0000 (14:32 -0800)]
socket tests: remove MSG_TRUNC test for unix/seqpacket

The PF_UNIX/SOCK_SEQPACKET was marked as PR_ATOMIC and that made
soreceive_generic() to treat it pretty much as a datagram socket.
However, POSIX says:

  The SOCK_SEQPACKET socket type is similar to the SOCK_STREAM type,
  and is also connection-oriented. The only difference between these
  types is that record boundaries are maintained using the
  SOCK_SEQPACKET type. A record can be sent using one or more output
  operations and received using one or more input operations, but a
  single operation never transfers parts of more than one record.
  Record boundaries are visible to the receiver via the MSG_EOR flag
  in the received message flags returned by the recvmsg() function. It
  is protocol-specific whether a maximum record size is imposed.

What the test was doing is checking if MSG_TRUNC would report the space
required to return up the end of next mbuf record in the socket buffer.
Apparently the test assumed that this boundary is defined by the write(2)
size on the peer socket.  This was true in test conditions, but I'm not
sure it would always be true - sbcompress() may merge mbufs. Anyway, the
mbuf boundaries are internal socket buffer implementation, they are not
SOCK_SEQPACKET records.  The records need to be explicitly marked with
MSG_EOR by sender, and the test definitely wasn't doing that.

Reviewed by: tuexen, markj
Differential Revision: https://reviews.freebsd.org/D43707

3 months agopf: convert kill/clear state to use netlink
Kristof Provost [Mon, 26 Feb 2024 10:20:29 +0000 (11:20 +0100)]
pf: convert kill/clear state to use netlink

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

3 months agonetlink: add bool type support
Kristof Provost [Mon, 26 Feb 2024 10:19:28 +0000 (11:19 +0100)]
netlink: add bool type support

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

3 months agonetlink: fix casts
Kristof Provost [Mon, 26 Feb 2024 10:18:30 +0000 (11:18 +0100)]
netlink: fix casts

Reviewed by: melifaro
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D44088

3 months agoldconfig: support hints files of either byte-order
Stefan Eßer [Wed, 28 Feb 2024 17:49:29 +0000 (18:49 +0100)]
ldconfig: support hints files of either byte-order

Make the ldconfig program accept hints files in little-endian and
big-endian format on all architectures.

The default format is the native byte-order of the respective host.
This is expected to change when a version of the pkg command is
available that implements support for either byte-order in its
internal ldconfig function. (Already committed in the development
tree of the pkg utility, a release is expected at the end of Q1/2024).

This update adds the -B option to the ldconfig program. It enforces
the creation of a big-endian hints file on a little-endian host.
The main purpose to is support of tests with non-native byte-order
files on little-endian hosts. It will be removed when all supported
FreeBSD releases use little-endian hints files by default.

When little-endian hints files are generally used, support of
either byte-order in libexec/rtld can also be removed.

When support for big-endian hints files is no longer required,
the COND_SWAP macro in ldconfig and rtld shall be replaced by
le32toh(), which just return their argument on little-endian
architectures.

Approved by: kib
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D44093

3 months agolorder: Undeprecate.
Dag-Erling Smørgrav [Wed, 28 Feb 2024 15:37:44 +0000 (16:37 +0100)]
lorder: Undeprecate.

While lorder is not required by our current toolchain (or any toolchain
we've used in the past decade or two), it still occasionally shows up
in build systems of third party software, including The Open Group's
UNIX conformance test suite, and the maintenance cost is negligible.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: imp, allanjude, emaste
Differential Revision: https://reviews.freebsd.org/D44135

3 months agolorder: Add unit tests.
Dag-Erling Smørgrav [Wed, 28 Feb 2024 15:37:41 +0000 (16:37 +0100)]
lorder: Add unit tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44134

3 months agolorder: Clean up and improve robustness.
Dag-Erling Smørgrav [Wed, 28 Feb 2024 15:37:36 +0000 (16:37 +0100)]
lorder: Clean up and improve robustness.

* Properly parse (no) command-line options.

* Ensure that errors go to stderr and result in a non-zero exit.

* Drop the special-case code for a single argument, as it will produce
  the wrong outcome if the file does not exist or is corrupted.

* Don't print anything until after we've collected all the data.

* Always create all temporary files before setting the trap.  This
  ensures that the trap can safely fire at any moment, regardless of any
  previous definition of `T`.

* Use a temporary file rather than a pipe between `nm` and `sed` to
  ensure proper termination if `nm` fails due to a missing or invalid
  input.

* The check for self-referential entries was conditional on testing our
  argument list against a regex looking for archives.  This was a
  needless and unreliable optimization; make the check unconditional.

* Document that lorder will not work properly if any of its inputs have
  spaces in their name.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44133

3 months agogicv3: If the LPI is already allocated, remember it
Warner Losh [Wed, 28 Feb 2024 14:09:17 +0000 (07:09 -0700)]
gicv3: If the LPI is already allocated, remember it

If the LPI Configuration Tabel has been pre-allocated by the boot
loader, then we have to remember PROPBASER and use it rather than
allocating memory for it ourselves. Linux provides us with a reserved
table that contains all the gicv3 allocations, so make sure what we read
from PROPBASER matches something in that table. Normally, bare metal
boot loaders leave the gic in a reset state. However, Linux brings it up
fully so it can do I/O to boot the next kernel via kexec. Since the
gicv3 PENDBASER can't be reset while running due to undefined behavior,
we must reuse what's there for both PENDBASER and PROPBASER.

With this commit, the workaround is complete. Details are at
https://lkml.iu.edu/hypermail/linux/kernel/1809.2/06246.html
and pointers in the thread.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44038

3 months agogicv3: In its_init_cpu_lpi record each cpu's PENDBASER
Warner Losh [Wed, 28 Feb 2024 14:09:10 +0000 (07:09 -0700)]
gicv3: In its_init_cpu_lpi record each cpu's PENDBASER

When we're using the preallocated memory for gicv3, record each cpu's
PENDBASER where we'd normally allocate memory for it. Make sure that
memory is in the excluded list and map the PA to VA and store that, to
mimic what we do with the allocation case.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44037

3 months agogicv3: Define PA masks for the PENDBASR and PROPBASER registers
Warner Losh [Wed, 28 Feb 2024 14:09:02 +0000 (07:09 -0700)]
gicv3: Define PA masks for the PENDBASR and PROPBASER registers

Define masks for these registers to find the PA of where these are
pointing.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44096

3 months agogicv3: Report PENDBASE when bootverbose
Warner Losh [Wed, 28 Feb 2024 14:08:55 +0000 (07:08 -0700)]
gicv3: Report PENDBASE when bootverbose

Report some stats about PENDBASE when we're running under
bootverbose. We don't do this by default because experience has been
excess output in this routine hangs the system.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44036

3 months agogicv3: Only set the redistributor base if we're not prealloced
Warner Losh [Wed, 28 Feb 2024 14:08:39 +0000 (07:08 -0700)]
gicv3: Only set the redistributor base if we're not prealloced

Only set the redistributor base if we're not reallocated.  If we are
preallocated, leave it all alone.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44035

3 months agogicv3: Don't allocate pend_base if we're already started
Warner Losh [Wed, 28 Feb 2024 14:08:32 +0000 (07:08 -0700)]
gicv3: Don't allocate pend_base if we're already started

If the gicv3 is already started, then don't allocate memory for the
pend_base tables.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44034

3 months agogicv3: Panic if the gicv3 already running
Warner Losh [Wed, 28 Feb 2024 14:08:24 +0000 (07:08 -0700)]
gicv3: Panic if the gicv3 already running

Due to undefined behavior, it's impossible to re-program a gicv3 ITS
table once it's programmed once. Memory corruption happens otherwise.
Panic if we detect the LPI is already enabled.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44033

3 months agogicv3: Change how we initialize its children.
Warner Losh [Wed, 28 Feb 2024 14:08:15 +0000 (07:08 -0700)]
gicv3: Change how we initialize its children.

The current code is written such that all the attach routines can do so
in parallel. However, newbus serializes children today, and is likely to
do so in the future. Only allocate memory for the first time. Add an
assertion that this memory is allocated for larger units.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44032

3 months agostand: Remove dangling mips references
Warner Losh [Tue, 27 Feb 2024 22:59:30 +0000 (15:59 -0700)]
stand: Remove dangling mips references

Remove mips support files from ficl.

Sponsored by: Netflix

3 months agomd5.1: Fix an example
Stefan Schlosser [Wed, 28 Feb 2024 08:31:28 +0000 (09:31 +0100)]
md5.1: Fix an example

The last example in the manpage md5(1) wants to demonstrate
GNU mode (md5sum), but uses BSD mode (md5) instead:

In GNU mode, the -c option does not compare against a hash string
passed as parameter. Instead, it expects a  digest file,
as created under the name digest for /boot/loader.conf in
the example above.

PR: 276560
Reviewed by: mhorne
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D44098

3 months agonvmecontrol.8: Fix the SYNOPSIS section
Stefan Schlosser [Wed, 28 Feb 2024 08:26:20 +0000 (09:26 +0100)]
nvmecontrol.8: Fix the SYNOPSIS section

The manpage of nvmecontrol(8) has the following SYNOPSIS:

nvmecontrol format [-f fmt] [-m mset] [-o pi] [-l pil] [-E]
[-C] <device-id | namespace-id>

The correct switch for the pi option is -p according
to sbin/nvmecontrol/format.c:

OPT("pi", 'p', arg_uint32, opt, pi, "Protective information")

So correct the SYNOPSIS section accordingly.

PR: 276554
Reviewed by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D44099

3 months agorc: Set var_run_enable to enable by default
Emmanuel Vadot [Tue, 27 Feb 2024 17:33:52 +0000 (18:33 +0100)]
rc: Set var_run_enable to enable by default

This will load/save the /var/run directories at boot/shutdown if
and only if /var/run/ is a tmpfs mount so it is a win for tmpfs
users and a no-op for everyone else.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D44097
Sponsored by: Beckhoff Automation GmbH & Co. KG

3 months agoriscv: add starfive kernelconf template
Mitchell Horne [Tue, 27 Feb 2024 22:00:44 +0000 (18:00 -0400)]
riscv: add starfive kernelconf template

Enable the Synopsis UART driver. Other drivers will be added in the
future.

Reviewed by: jrtc27
Sponsored by: The FreeBSD Foundatino
Differential Revision: https://reviews.freebsd.org/D44105

3 months agoriscv: add dwc, dwmmc to NOTES
Mitchell Horne [Tue, 27 Feb 2024 22:03:18 +0000 (18:03 -0400)]
riscv: add dwc, dwmmc to NOTES

In the future these drivers will be enabled in GENERIC. For now, ensure
they build with LINT.

Sponsored by: The FreeBSD Foundation

3 months agoconf: deduplicate dwmmc config logic
Mitchell Horne [Tue, 27 Feb 2024 22:00:24 +0000 (18:00 -0400)]
conf: deduplicate dwmmc config logic

The core of this driver is supported by multiple architectures. Move the
config entries to the MI conf/files.

This hardware is found on several available/emerging RISC-V SoCs, so we
will soon need it on this architecture.

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

3 months agoconf: deduplicate dwc config logic
Mitchell Horne [Tue, 27 Feb 2024 21:59:53 +0000 (17:59 -0400)]
conf: deduplicate dwc config logic

Move the core dwc(4) file entries to the MI conf/files.
Platform-specific versions e.g. rk_dwc are retained in their current
position. On arm64 this necessitates adding an additional 'device dwc'
option.

This hardware is found on several available/emerging RISC-V SoCs, so we
will soon need it on this architecture.

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

3 months agodwc: fix DEBUG macro name
Mitchell Horne [Tue, 27 Feb 2024 21:59:24 +0000 (17:59 -0400)]
dwc: fix DEBUG macro name

It conflicts with the general "DEBUG" macro defined as an option in LINT
builds. Since this is actually unused, just rename it to GMAC_DEBUG.

Reviewed by: manu
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44102

3 months agoAdd share/mk/local.dirdeps-targets.mk
Simon J. Gerraty [Tue, 27 Feb 2024 21:36:20 +0000 (13:36 -0800)]
Add share/mk/local.dirdeps-targets.mk

To include site.dirdeps-targets.mk

3 months agonetlink: restore original buffer if nlmsgs_to_linux() fails
Gleb Smirnoff [Tue, 27 Feb 2024 20:45:54 +0000 (12:45 -0800)]
netlink: restore original buffer if nlmsgs_to_linux() fails

Caller is responsible to free it or reuse.

Fixes: 17083b94a91563aba15ba03d1c74796a35bb1c26

3 months agonetlink: Don't use a zero-length array
John Baldwin [Tue, 27 Feb 2024 19:59:52 +0000 (11:59 -0800)]
netlink: Don't use a zero-length array

Define SNL_DECLARE_FIELD_PARSER* macros to create a parser that has
no output attributes only input fields and use this to define the
snl_donemsg_parser.

This removes the need for the zero-length nla_p_donemsg[] variable.
Zero length arrays are not valid in ISO C.

Reviewed by: jrtc27, melifaro
Differential Revision: https://reviews.freebsd.org/D43918

3 months agomkimg.1: add new PARTITION SPECIFICATION section
Eugene Grosbein [Tue, 27 Feb 2024 19:53:31 +0000 (02:53 +0700)]
mkimg.1: add new PARTITION SPECIFICATION section

The specification follows a commentary to the function parse_part()
in the source code and the code itself.

MFC after: 3 days

3 months agobhnd_chipc: Make use of bus_generic_rman_* to simplify some code
John Baldwin [Tue, 27 Feb 2024 19:44:22 +0000 (11:44 -0800)]
bhnd_chipc: Make use of bus_generic_rman_* to simplify some code

This uses bus_generic_rman_alloc/release_resource to reduce some code
duplication.  However, I've left the custom activate/deactivate
methods as-is.

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

3 months agobhnd_usb: Use bus_generic_rman_*
John Baldwin [Tue, 27 Feb 2024 19:44:03 +0000 (11:44 -0800)]
bhnd_usb: Use bus_generic_rman_*

For SYS_RES_MEMORY, use bus_generic_rman_* for
activate/deactivate_resource methods as well as custom
map/unmap_resource methods that request submappings of the sc_mem
resource allocated from the parent bus.

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

3 months agodpaa2: Use bus_generic_rman_*
John Baldwin [Tue, 27 Feb 2024 19:43:50 +0000 (11:43 -0800)]
dpaa2: Use bus_generic_rman_*

Reviewed by: dsl
Differential Revision: https://reviews.freebsd.org/D43937

3 months agorman: Remove rman_set_start/end
John Baldwin [Tue, 27 Feb 2024 19:43:34 +0000 (11:43 -0800)]
rman: Remove rman_set_start/end

These functions are not safe as the rman implementation assumes that
all regions (including allocated resources) are sorted by address in
the internal linked-list.

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

3 months agoCTL: Drop Format Device and Rigid Disk Geometry mode pages
Alexander Motin [Tue, 27 Feb 2024 18:28:44 +0000 (13:28 -0500)]
CTL: Drop Format Device and Rigid Disk Geometry mode pages

Those mode pages are obsolete since SBC-2 specification almost 20
years ago.  First I was trying to understand possible relations
between physical block and physical sector terms in different specs.
Then was thinking about possible relations to device CHS geometry
and compatibility issues.  Finally I just decided that none of it
worth the efforts and should rest in piece.

PR: 276524

3 months agocarp(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 27 Feb 2024 16:39:57 +0000 (17:39 +0100)]
carp(4): Fix a typo in a source code comment

- s/successfull/successful/

MFC after: 3 days

3 months agobxe(4): Fix two typos in a kernel messages
Gordon Bergling [Tue, 27 Feb 2024 16:38:53 +0000 (17:38 +0100)]
bxe(4): Fix two typos in a kernel messages

- s/successfull/successful/

MFC after: 3 days

3 months agopf: fix packet-to-big for route-to as well
Kristof Provost [Tue, 27 Feb 2024 13:24:25 +0000 (14:24 +0100)]
pf: fix packet-to-big for route-to as well

When we handle a packet via route-to (i.e. pf_route6()) we still need to
verify the MTU. However, we only run that check in the forwarding case.

Set the PFIL_FWD tag when running the pf_test6(PF_OUT) check from
pf_route6(). We are in fact forwarding, so should call the test function
as such. This will cause us to run the MTU check, and generate an ICMP6
packet-too-big error when required.

See also: 54c62e3e5d8cd90c5571a1d4c8c5f062d580480e
See also: f1c0030bb05cfa01bdd500e50befbb425fecc4c4
See also: https://redmine.pfsense.org/issues/14290
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 months agopci_vendors: update to 2024.02.02
Baptiste Daroussin [Tue, 27 Feb 2024 13:01:11 +0000 (14:01 +0100)]
pci_vendors: update to 2024.02.02

3 months agodumprestore.h: Fix typos in source code comments
Gordon Bergling [Tue, 27 Feb 2024 12:49:21 +0000 (13:49 +0100)]
dumprestore.h: Fix typos in source code comments

- s/dumpped/dumped/

MFC after: 3 days

3 months agovge(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 27 Feb 2024 12:42:10 +0000 (13:42 +0100)]
vge(4): Fix a typo in a source code comment

- s/opration/operation/

MFC after: 3 days

3 months agostress2: Added a few regression tests
Peter Holm [Tue, 27 Feb 2024 10:05:26 +0000 (11:05 +0100)]
stress2: Added a few regression tests

3 months agosched: Simplify sched_lend_user_prio_cond()
Olivier Certner [Fri, 9 Feb 2024 18:03:22 +0000 (19:03 +0100)]
sched: Simplify sched_lend_user_prio_cond()

If 'td_lend_user_pri' has the expected value, there is no need to check
the fields that sched_lend_user_prio() modifies, they either are already
good or soon will be ('td->td_lend_user_pri' has just been changed by
a concurrent update).

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44050

3 months agoPP mutexes: lock: Reduce 'umtx_lock' holding before taking the user lock
Olivier Certner [Thu, 22 Feb 2024 09:13:38 +0000 (10:13 +0100)]
PP mutexes: lock: Reduce 'umtx_lock' holding before taking the user lock

There is no need to have it for the priority check (that the thread
doesn't have a higher priority than the mutex's ceiling), and there's
also no need to take it if the thread doesn't have privileges to set its
priority to the mutex's ceiling.

While here, turn 'su' into a 'bool' and compute the internal priority
corresponding to the mutex's ceiling once and for all, putting it in new
'new_pri'.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44045

3 months agoPP mutexes: lock: Check if priority is too high against base one
Olivier Certner [Thu, 22 Feb 2024 08:53:51 +0000 (09:53 +0100)]
PP mutexes: lock: Check if priority is too high against base one

Doing this instead of using the current (user) priority, which includes
current lendings, prevents gratuitous failures for threads involved in
multiple locking groups, where each group is defined as the threads that
can lock a particular PP or PI mutex.  No deadlock can occur in this
case.  Indeed, if a thread holds such a lock A giving it a higher
priority than the ceiling of some other lock B that is PP, and B is
acquired by another thread, effectively the latter may not be able to
run but this situation can only last until the first thread releases A,
which it will do eventually.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44044

3 months agoPP mutexes: unlock: Reset inherited prio regardless of privileges
Olivier Certner [Tue, 20 Feb 2024 13:52:40 +0000 (14:52 +0100)]
PP mutexes: unlock: Reset inherited prio regardless of privileges

'uq_inherited_pri' contains the current priority inherited from Priority
Protection mutexes.  If -1 is passed through 'm_ceilings[1]', meaning
that there are no such mutexes held anymore, this must be reflected into
it by setting it to PRI_MAX, regardless of whether the thread has
privilege to set realtime priorities (PRI_MAX is also obviously not
a realtime priority level).  By contrast, it shall not be updated and
the computed 'new_inherited_pri' shall stay unused if the thread doesn't
have the ability to set a realtime priority, possibly keeping an older
such priority acquired previously.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43984

3 months agopam_xdg: Reset rv to 0
Emmanuel Vadot [Tue, 27 Feb 2024 07:05:00 +0000 (08:05 +0100)]
pam_xdg: Reset rv to 0

Otherwise on success it ontain the return value of asprintf.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Fixes: 2d2950c88933 ("pam_xdg: Check asprintf return value")

3 months agopam_xdg: Check asprintf return value
Emmanuel Vadot [Tue, 27 Feb 2024 06:41:59 +0000 (07:41 +0100)]
pam_xdg: Check asprintf return value

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Fixes: 6e69612d5df1 ("pam: Add pam_xdg module")
3 months agopam_xdg: Remove leftover debug printf
Emmanuel Vadot [Tue, 27 Feb 2024 06:39:13 +0000 (07:39 +0100)]
pam_xdg: Remove leftover debug printf

Sponsored by: Beckhoff Automation GmbH & Co. KG
Fixes: 6e69612d5df1 ("pam: Add pam_xdg module")

3 months agoloader: Add loader.exit
Warner Losh [Tue, 27 Feb 2024 03:19:58 +0000 (20:19 -0700)]
loader: Add loader.exit

Add loader.exit(status). While one can get alomst this behavior with
loader.perform("quit"), quit doesn't allow a value to be returned to the
firmware. The interpretation of 'status' is firmware specific. This can
be used when autobooting doesn't work in scripts, for example, to allow
the firmware to try something else...

Sponsored by: Netflix

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44094

3 months agopcm.4: Fix lint warnings
Christos Margiolis [Mon, 26 Feb 2024 23:28:53 +0000 (00:28 +0100)]
pcm.4: Fix lint warnings

Ignore the "manual not found" warnings for snd_ai2s(4) and
snd_davbus(4).

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

3 months agosnd_uaudio(4): Fix sample rate selection after 42fdcd9fd917.
Florian Walpen [Mon, 26 Feb 2024 23:27:47 +0000 (00:27 +0100)]
snd_uaudio(4): Fix sample rate selection after 42fdcd9fd917.

The sample rate selection of snd_uaudio(4) at runtime was implicitly
relying on a specific order in the device config list. In case a default
was set through the hw.usb.uaudio.default_rate sysctl tunable, commit
42fdcd9fd917 removed a duplicate sample rate entry from that list, which
inadvertently broke sample rate selection at runtime. Implement sample
rate selection in a way that works for any order in the device config
list.

Reported by: Lexi Winter <lexi@le-fay.org>
MFC after: 1 week
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D44051

3 months agoofwdump: Convert ints that are booleans to bool.
Warner Losh [Mon, 26 Feb 2024 23:14:53 +0000 (16:14 -0700)]
ofwdump: Convert ints that are booleans to bool.

No functional changes...

Sponsored by: Netflix

3 months agortld-elf: support either byte-order of hints file
Stefan Eßer [Mon, 26 Feb 2024 22:18:12 +0000 (23:18 +0100)]
rtld-elf: support either byte-order of hints file

Accept either little-endian or big-endian representation of the ELF
hints magic number in the header of a hints file and convert the
parameters to the native byte-order of the repsective system.

This is a pre-requisite for a planned change to always write the byte
order in little-endian format on all architectures. The only relvant
architecture that uses big-endian data is powerpc64, and it is not
likely that new architectures will choose that representation of data
in memory.

When all supported architectures use little-endian data in the hints
file, the byte swap logic can be enabled for big-endian CPUs at
compile time. Up to that point, there is a very small run-time penalty
that is paid on all systems to check the byte-order of the hints file
and to provide the option to byte-swap the parameters read from the
hints file header.

This commit contains the changes from review D44080 (which had been
split off from this patch for easier review),

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D44053

3 months agokern: fix panic with disabled ttys
Ed Maste [Mon, 26 Feb 2024 15:38:45 +0000 (10:38 -0500)]
kern: fix panic with disabled ttys

PR: 277240, 277329
Reviewed by: kib (earlier version)
Fixes: f1d0a0cbecf2 ("jail: Fix information leak.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44086

3 months agodiff: Bump manual page date.
Dag-Erling Smørgrav [Mon, 26 Feb 2024 18:21:40 +0000 (19:21 +0100)]
diff: Bump manual page date.

Sponsored by: Klara, Inc.

3 months agodiff: Fix --expand-tabs and --side-by-side.
Dag-Erling Smørgrav [Mon, 26 Feb 2024 18:08:06 +0000 (19:08 +0100)]
diff: Fix --expand-tabs and --side-by-side.

* Overhaul column width and padding calculation.
* Rewrite print_space() so it is now a) correct and b) understandable.
* Rewrite tab expansion in fetch() for the same reason.

This brings us in line with GNU diff for all cases I could think of.

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

3 months agopam: Always use pam_xdg for session and xdm
Emmanuel Vadot [Thu, 22 Feb 2024 05:46:08 +0000 (06:46 +0100)]
pam: Always use pam_xdg for session and xdm

This ensure that the XDG_RUNTIME_DIR is always created and the environment
variable is present which is a must for any wayland user (at least).
The only "cost" of it is a directory is created and unused.

Reviewed by: des
Differential Revision: https://reviews.freebsd.org/D44012
Sponsored by: Beckhoff Automation GmbH & Co. KG

3 months agopam: Add pam_xdg module
Emmanuel Vadot [Wed, 21 Feb 2024 14:51:05 +0000 (15:51 +0100)]
pam: Add pam_xdg module

This is a module to setup the XDG directories and environment variables.
For now the only usage is to have a XDG_RUNTIME_DIR environment setup at
user login.
All other environment variable have a default fallback so no need to export
them in this module.
The directory is created according to the XDG Base directory specification.

The default base directory is /var/run/xdg/<username> but can be configured
using the runtime_dir=<dir> module option.

According to the spec the directory *must* not survive a reboot so adding
var_run_enable="YES" to rc.conf is highly recommanded.

Reviewed by: des, pauamma (manpages)
Differential Revision: https://reviews.freebsd.org/D44011
Sponsored by: Beckhoff Automation GmbH & Co. KG

3 months agoipsec esp: avoid dereferencing freed secasindex
Konstantin Belousov [Sun, 25 Feb 2024 10:30:48 +0000 (12:30 +0200)]
ipsec esp: avoid dereferencing freed secasindex

It is possible that SA was removed while processing packed, in which
case it is changed to the DEAD state and it index is removed from the
tree. Dereferencing sav->sah then touches freed memory.

Reviewed by: ae
Sponsored by: NVIDIA networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44079

3 months agoloader: we can only env_discard() existing variable
Toomas Soome [Sun, 25 Feb 2024 22:34:00 +0000 (00:34 +0200)]
loader: we can only env_discard() existing variable

While dropping nvpair from nvstore, we also remove the corresponding
environment variable. By doing so, we should be careful not to try
to unset non-existing variable.

Reviewed by: imp
MFC after:      2 week
Differential revision:  https://reviews.freebsd.org/D44083

3 months agoMFV: xz 5.6.0.
Xin LI [Sun, 25 Feb 2024 23:46:22 +0000 (15:46 -0800)]
MFV: xz 5.6.0.

MFC after: 2 weeks

3 months agosnd_hdspe(4): Optional unified pcm device.
Florian Walpen [Sun, 25 Feb 2024 21:39:36 +0000 (21:39 +0000)]
snd_hdspe(4): Optional unified pcm device.

Add a sysctl tunable to unify all physical ports of an HDSPe sound card
into one pcm device, with up to 14 (AIO) or 36 (RayDAT) channels. This
makes all ports available in multi-channel audio software.

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

3 months agolibc/sys: add errno test
Konstantin Belousov [Sat, 24 Feb 2024 23:39:02 +0000 (01:39 +0200)]
libc/sys: add errno test

Despite looking trivial, it requires proper split of exports from libsys
and libc, proper filtering work in rtld, and operational libsys.

Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44075

3 months agoVendor import of xz 5.6.0 (trimmed)
Xin LI [Sun, 25 Feb 2024 19:07:13 +0000 (11:07 -0800)]
Vendor import of xz 5.6.0 (trimmed)

3 months agotcp: need default in switch statement for enum.
Richard Scheffenegger [Sun, 25 Feb 2024 07:23:07 +0000 (08:23 +0100)]
tcp: need default in switch statement for enum.
fix clang error after c9b6241e250a4f1156e2150ccdbad0d3029dcef6

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D44081

3 months agotcp: address enum-int-mismatch
Richard Scheffenegger [Sun, 25 Feb 2024 03:45:05 +0000 (04:45 +0100)]
tcp: address enum-int-mismatch
fix gcc13 error after f74352fbcf15341accaf5a92240871f98323215d

3 months agotcp_rack.4: Fix a link in the SEE ALSO section
Gordon Bergling [Sun, 25 Feb 2024 09:16:25 +0000 (10:16 +0100)]
tcp_rack.4: Fix a link in the SEE ALSO section

The URL of the paper at arxiv.org has changed so link the
PDF-file directly.

MFC after: 3 days

3 months agosigsys test: correct count of delivered signals
Konstantin Belousov [Sun, 25 Feb 2024 01:36:27 +0000 (03:36 +0200)]
sigsys test: correct count of delivered signals

When knob is zero, intent is that no SIGSYS signals are delivered.
Comparing zero to zero does not test much, we should compare the count
of delivered SIGSYSs to zero.

Reviewed by: dchagin, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44077

3 months agoloader/efi: Only include interpreter's linker script
Warner Losh [Sun, 25 Feb 2024 00:57:29 +0000 (17:57 -0700)]
loader/efi: Only include interpreter's linker script

For safety, only include the interpreter's linker script. Note that the
simple loader doesn't have one, but it's not an error to copy a ELF
section that does not exist. No functional change, however.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44064

3 months agoloader/ficl: Rename the ficl compile set to X4th_compile_set
Warner Losh [Sun, 25 Feb 2024 00:57:21 +0000 (17:57 -0700)]
loader/ficl: Rename the ficl compile set to X4th_compile_set

And upcoming change will need this set to be named this. Since it's only
used in the efi Makefile, and inside if ficl itself, the change should
be a nop.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44063

3 months agoloader/efi: Use unique linker set for lua
Warner Losh [Sun, 25 Feb 2024 00:57:13 +0000 (17:57 -0700)]
loader/efi: Use unique linker set for lua

After the linker set cleanup in ldscripts, there's now only one place we
need to know the linkerset name, so go ahead and change the lua
interpreter augmentation linker set to be uniquely named.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44062

3 months agoloader/efi: Linker sets not needed.
Warner Losh [Sun, 25 Feb 2024 00:57:04 +0000 (17:57 -0700)]
loader/efi: Linker sets not needed.

We don't need linker sets listed as sections. They are explicitly
included in the objcopy we use to create the .efi file. This practice
was added in 2002 by peter@ in a6d81d83a280 to make ia64 builds
self-hosted. However, it was added back to the objcopy in 2010 by rpaulo
in 8df7a05edd36 for i386 EFI support, though the ldscript file then
retained them needlessly. The gcc/binutils bug having been fixed in the
interim. We've not needed them since then, but the redundancy didn't
matter.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44061

3 months agoloader/kboot: simplify linker set inclusion a little
Warner Losh [Sun, 25 Feb 2024 00:56:56 +0000 (17:56 -0700)]
loader/kboot: simplify linker set inclusion a little

Linker set sections are included by default. No need to do so
explicitly.  These were bogusly copied from the efi ldscripts. They were
there due to a workaround introduced in 2002 by peter@ for a gcc
upgrade, but whatever bugs necessitated it were filed by 2010 when
rpaulo@ imported the i386 support (though they were copied even though
the objcopy retained them correctly, the gcc bug having been
fixed). They've never been needed.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44060

3 months agoloader/uboot: Move to foo.ldconfig
Warner Losh [Sun, 25 Feb 2024 00:56:48 +0000 (17:56 -0700)]
loader/uboot: Move to foo.ldconfig

Move to the foo.ldconfig convention to match the rest of the boot
loader. No functional change intended.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44059

3 months agoloader/powerpc: Share ldscript
Warner Losh [Sun, 25 Feb 2024 00:56:31 +0000 (17:56 -0700)]
loader/powerpc: Share ldscript

Share ldscript between the different ppc versions. There's two different
scripts since we build 32-bit binaries for all types of powerpc, but
have little endian and big endian variations that are different by only
two lines. Set the output format and include the rest.

Move to foo.ldscript as well.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44058

3 months agokboot: Centralize ldscript addition
Warner Losh [Sun, 25 Feb 2024 00:56:23 +0000 (17:56 -0700)]
kboot: Centralize ldscript addition

Make the pattern for ldscripts always be
arch/$MACHINE_ARCH/$MACHINE_ARCH.ldscript so we can add it from a
central Makefile. This also moves from ldscript.arch to arch.ldscript to
match the loader's new convention.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D44057

3 months agoloader: Move ldscripts to match more standard practices
Warner Losh [Sun, 25 Feb 2024 00:56:14 +0000 (17:56 -0700)]
loader: Move ldscripts to match more standard practices

In the larger open source community, ld scripts are foo.ldscrpt rather
than ldscript.arch like we use here. This moves the EFI ldscripts.

Sponsored by: Netflix
Reviewed by: tsoome, kevans, emaste
Differential Revision: https://reviews.freebsd.org/D44056

3 months agotcp: retain some CC signals outside of kernel scope
Richard Scheffenegger [Sat, 24 Feb 2024 20:01:54 +0000 (21:01 +0100)]
tcp: retain some CC signals outside of kernel scope

Summary: fix build error after f74352fbcf15341accaf5a92240871f98323215d

Reviewers: #transport!

Subscribers: imp, melifaro, glebius

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

3 months agosctp: improve sending of packets containing an INIT ACK chunk
Michael Tuexen [Sat, 24 Feb 2024 18:16:36 +0000 (19:16 +0100)]
sctp: improve sending of packets containing an INIT ACK chunk

If the peer announced support of zero checksums, do so when sending
packets containing an INIT ACK chunk.

MFC after: 1 week

3 months agotcp: cubic - restart epoch after RTO
Richard Scheffenegger [Sat, 24 Feb 2024 16:07:25 +0000 (17:07 +0100)]
tcp: cubic - restart epoch after RTO

This is a migitation to avoid sudden extreme jumps in
cwnd, as t_epoch can be very out of date after an RTO.
Per RFC9438, sec 4.8, t_epoch is to be reset whenever
cwnd grows beyond ssthresh (CC phase transitions from
slow start to congestion avoidance), to be fixed with
the upcoming cc_cubic changes.

MFC after: 3 days
Reviewed By: cc, #transport
Sponsored by: NetApp, Inc
Differential Revision: https://reviews.freebsd.org/D44023

3 months agotcp: provide correct snd_fack on post_recovery
Richard Scheffenegger [Sat, 24 Feb 2024 15:53:32 +0000 (16:53 +0100)]
tcp: provide correct snd_fack on post_recovery

Ensure that snd_fack holds a valid value when doing
the post_recovery CC processing, for preparation of
the cc_cubic update, so that local pipe calculations
can correctly refer to snd_fack during and after CC events.

Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43957

3 months agotcp: use enum for all congestion control signals
Richard Scheffenegger [Sat, 24 Feb 2024 15:41:31 +0000 (16:41 +0100)]
tcp: use enum for all congestion control signals

Facilitate easier troubleshooting by enumerating
all congestion control signals. Typecast the
enum to int, when a congestion control module uses
private signals.

No external change.

Reviewed By: glebius, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43838

3 months agotcp: prevent div by zero in cc_htcp
Richard Scheffenegger [Sat, 24 Feb 2024 15:35:23 +0000 (16:35 +0100)]
tcp: prevent div by zero in cc_htcp

Make sure the divident is at least one. While cwnd should
never be smaller than t_maxseg, this can happen during
Path MTU Discovery, or when TCP options are considered
in other parts of the stack.

PR: 276674
MFC after: 3 days
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43797

3 months agoif_hn: Fix two typos in source code comments
Gordon Bergling [Sat, 24 Feb 2024 09:13:44 +0000 (10:13 +0100)]
if_hn: Fix two typos in source code comments

- s/managment/management/
- s/transacion/transaction/

Obtained from: NetBSD
MFC after: 3 days

3 months agostress2: Add a helper tool
Peter Holm [Sat, 24 Feb 2024 06:26:16 +0000 (07:26 +0100)]
stress2: Add a helper tool