]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 months agosys/mount.h: align values of MNTK_XXX flags
Konstantin Belousov [Sun, 3 Mar 2024 05:14:11 +0000 (07:14 +0200)]
sys/mount.h: align values of MNTK_XXX flags

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 months agogpioevents: Fix build with newer Clang
John F. Carr [Sat, 2 Mar 2024 15:38:04 +0000 (10:38 -0500)]
gpioevents: Fix build with newer Clang

PR: 277422

3 months agogetblkx(9): be more tolerant but also strict with the buffer size checks
Konstantin Belousov [Sat, 2 Mar 2024 04:58:57 +0000 (06:58 +0200)]
getblkx(9): be more tolerant but also strict with the buffer size checks

It is possible that on-disk filesystem format causes allocation of
buffers of size larger than maxbcachebuf.  Currently, getblkx() and
indirectly bufkva_alloc() panic in that situation.

It is more useful to return an error instead, allowing the system to
continue running.

PR: 277414
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 months agoread(2): Add write cross reference
Warner Losh [Sat, 2 Mar 2024 03:36:39 +0000 (20:36 -0700)]
read(2): Add write cross reference

Add a write cross reference in the SEE ALSO section.

Sponsored by: Netflix

3 months agoread.2: Use .Fn markup instead of .Xr for read/write calls
Christopher Davidson [Sat, 2 Mar 2024 03:32:37 +0000 (20:32 -0700)]
read.2: Use .Fn markup instead of .Xr for read/write calls

Udpate both write / read references from .Xr to .Fn to eliminate
self-reference cross reference.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1128

3 months agoAdd an UNDEFINED_VERSION option
Brooks Davis [Fri, 1 Mar 2024 23:21:46 +0000 (23:21 +0000)]
Add an UNDEFINED_VERSION option

When enabled (current default) link with --undefined-version to allow
symbol maps to contain symbols not defined by libraries.  When disabled,
link with --no-undefined-version to disallow these bugs.

WITHOUT_UNDEFINED_VERSION is currently broken.  Once it is fixed it
should be made the default and this option should likely be removed.

Reviewed by: dim, emaste
Differential Revision: https://reviews.freebsd.org/D44169

3 months agonvme: Report only the unknown bits
Warner Losh [Fri, 1 Mar 2024 23:03:19 +0000 (16:03 -0700)]
nvme: Report only the unknown bits

When we get a smart error that's unknown, report only the unknown
(reserved) bits of the Critical Warning Bitfield.

Sponsored by: Netflix

3 months agohier.7: various improvements usr/src and /var
Alexander Ziaee [Wed, 28 Feb 2024 05:16:35 +0000 (00:16 -0500)]
hier.7: various improvements usr/src and /var

Forth batch of word smithing: /usr/src and /var: Improved wording and a
few missing files added.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/831

3 months agohier.7: various improvements usr (no src)
Alexander Ziaee [Wed, 28 Feb 2024 05:16:35 +0000 (00:16 -0500)]
hier.7: various improvements usr (no src)

Third batch of word smithing: /usr but not /usr/src: Improved wording
and a few missing files added.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/831

3 months agohier.7: various improvements m-s
Alexander Ziaee [Wed, 28 Feb 2024 05:16:35 +0000 (00:16 -0500)]
hier.7: various improvements m-s

Second batch of word smithing: /media, /mnt, /nonexistant, /rescue,
/sbin: Improved wording and a few missing files added

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/831

3 months agohier.7: various improvements
Alexander Ziaee [Wed, 28 Feb 2024 05:16:35 +0000 (00:16 -0500)]
hier.7: various improvements

First batch of word smithing: /boot, /dev and /etc. Improved wording and
a few missing files added, though /dev is by no means complete.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/831

3 months agopci_host_generic: Enumerate resource ranges under bootverbose
John Baldwin [Fri, 1 Mar 2024 22:20:10 +0000 (14:20 -0800)]
pci_host_generic: Enumerate resource ranges under bootverbose

Previously ranges were only enumerated for the FDT attachment but not
ACPI.  This commit moves the enumeration to the shared attach routine
so it is done for both.  While here, don't list empty ranges but do
include the resource type for each range.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D44132

3 months agonvme: Firmware revisions in the firmware slot info logpage are ASCII strings
John Baldwin [Fri, 1 Mar 2024 22:18:43 +0000 (14:18 -0800)]
nvme: Firmware revisions in the firmware slot info logpage are ASCII strings

In particular, don't try to byteswap the values as 64-bit integers and
always print a non-empty version as a string.

Reviewed by: chuck, imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44121

3 months agoHTPS has actually three states not two so the macro needs to account for that.
Randall Stewart [Fri, 1 Mar 2024 20:21:15 +0000 (15:21 -0500)]
HTPS has actually three states not two so the macro needs to account for that.

Ok lets fix up the tcp_in_hpts() so that it also says yes if you
are in the race state moving and you are scheduled to be put in.
This also requires changing the MPASS to be the old version non
inline function of tcp_in_hpts().

This change also adds a new inline macro so that a uint64_t timestamp can be
obtained by a transport (aka Rack will use this).

Reviewed by: glebius, tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D44157

3 months agoarm64: Fix typo in pagetable_l0_ttbr0_bootstrap symbol name
Alfredo Mazzinghi [Fri, 1 Mar 2024 18:32:43 +0000 (10:32 -0800)]
arm64: Fix typo in pagetable_l0_ttbr0_bootstrap symbol name

Obtained from: CheriBSD

3 months agomqueuefs: fix statfs report to not signal file system full
Stefan Eßer [Fri, 1 Mar 2024 17:31:15 +0000 (18:31 +0100)]
mqueuefs: fix statfs report to not signal file system full

Synthetic file systems that do not actually allocate file system
blocks or inodes should report that they have space available and
that they provide 0 inodes, in order to prevent capacity monitoring
tools from warning about resource exhaustion.

This has been fixed in all other synthetic file systems in base in
commit 88a795e80c0, but this file was overlooked since its name does
not indicate that it also provides a file system.

MFC after: 1 month

3 months agoCirrus-CI: Add manual Clang 18 jobs
Ed Maste [Fri, 1 Mar 2024 13:21:54 +0000 (08:21 -0500)]
Cirrus-CI: Add manual Clang 18 jobs

Work is in progress to import Clang/LLVM 18 as the base system compiler.
llvm18-lite is not yet in the quarterly package set but but will be
available in the not too distant future, and is available for src forks
that switch to latest packages.  Add manual llvm18 jobs now so that they
can be used for testing.

Sponsored by: The FreeBSD Foundation

3 months agoCODEOWNERS: Add Stephane Rochoy
Warner Losh [Fri, 1 Mar 2024 16:15:46 +0000 (09:15 -0700)]
CODEOWNERS: Add Stephane Rochoy

Stephane Rochoy isn't quite the maintainer of these items, but has an
interest in them. As an experiment, see if this is a viable thing to do.

3 months agoldconfig: remove ignored -v (verbose) option
Stefan Eßer [Fri, 1 Mar 2024 15:29:31 +0000 (16:29 +0100)]
ldconfig: remove ignored -v (verbose) option

The -v option used to print useful information when operating on a.out
format libraries. After the removal of a.out support, it was accepted
but did not have any effect.

Remove the option and update the man-page.

While here mention the set of historic options that are accepted but
ignored: "-elf", "-s", and "-v".

The FILES section contained outdated information and did not mention
the way library directories of optional ports and packages are
included in the library search path recorded in the hints file.

The description of the "-B" option was incorrect (described a planned
change) for big-endian platforms (powerpc64). These do still default
to big-endian hints files, since the current version of the "pkg"
program expects the hints file to be in native byte-order.

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

3 months agopam_xdg: Close the dir after removal
Emmanuel Vadot [Fri, 1 Mar 2024 13:49:16 +0000 (14:49 +0100)]
pam_xdg: Close the dir after removal

CID: 1534878
Sponsored by: Beckhoff Automation GmbH & Co. KG

3 months agopf tests: IPv6 versions of the route-to/reply-to if-bound tests
Kristof Provost [Thu, 29 Feb 2024 14:10:56 +0000 (15:10 +0100)]
pf tests: IPv6 versions of the route-to/reply-to if-bound tests

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

3 months agopf: support if-bound with reply-to
Kristof Provost [Fri, 2 Feb 2024 20:56:55 +0000 (21:56 +0100)]
pf: support if-bound with reply-to

On reply-to we don't know what interface to bind to when we create
the state. Create any reply-to state as floating, but bind to the
appropriate interface once we're handling the reply.

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

3 months agoCirrus-CI: bump Clang versions to 16 and 17
Ed Maste [Thu, 29 Feb 2024 22:00:39 +0000 (17:00 -0500)]
Cirrus-CI: bump Clang versions to 16 and 17

Clang/LLVM 17 is currently the in-tree default compiler, so use it as
the default Cirrus-CI toolchain.  Clang/LLVM 18 is coming soon and needs
to be added here, but I ran into trouble with llvm18-lite package
availability so will look at that later.

Reviewed by: dim (earlier), Jose Luis Duran
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44162

3 months agolib{c,sys}: expose _getlogin consistently
Brooks Davis [Thu, 29 Feb 2024 19:46:33 +0000 (19:46 +0000)]
lib{c,sys}: expose _getlogin consistently

Historically we exposed _getlogin as a private symbol on a per-arch basis
(except on aarch64 and riscv) for no obvious reason.  We now need to
expose it for libc's use so remove the special case from
makesyscalls.lua and expose it in the generated syscalls.map.

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

3 months agolibsys: make PSEUDO take a bare syscall name
Brooks Davis [Thu, 29 Feb 2024 19:19:01 +0000 (19:19 +0000)]
libsys: make PSEUDO take a bare syscall name

Rather than having PSEUDO be a list of object files when all consumers
want syscall names or source files, make it a list of bare syscall
names like INTERPOSED (which is built on PSEUDO).

Improve document of variables developers can set.

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

3 months agolibsys: consolidate PSEUDO definitions
Brooks Davis [Thu, 29 Feb 2024 19:19:01 +0000 (19:19 +0000)]
libsys: consolidate PSEUDO definitions

Consolidate in preparation for further cleanup.

Also relocate the sole NOASM entry.

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

3 months agolibsys: reduce makefile declaration duplication
Brooks Davis [Thu, 29 Feb 2024 19:19:01 +0000 (19:19 +0000)]
libsys: reduce makefile declaration duplication

Every PSEUDO entry (_foo.o) has a corresponding NOASM entry (foo.o) to
suppress its addition to ASM.  Check PSEUDO instead when adding entries
to ASM.  No functional change.

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

3 months agoloader/lua: Remove workaround for command_error
Warner Losh [Thu, 29 Feb 2024 17:58:59 +0000 (10:58 -0700)]
loader/lua: Remove workaround for command_error

loader.command_error was available prior to stable/12 branching. No need
to check if it is available or not.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44144

3 months agoloader/lua: Remove compat shim for loader.lua_path
Warner Losh [Thu, 29 Feb 2024 17:58:52 +0000 (10:58 -0700)]
loader/lua: Remove compat shim for loader.lua_path

loader.lua_path was committed before stable/13 was branched, and merged
in to for 12.2. Remove workaround for it not being present.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44143

3 months agoloader/lua: Remove pager shim
Warner Losh [Thu, 29 Feb 2024 17:58:43 +0000 (10:58 -0700)]
loader/lua: Remove pager shim

Just after 12.2 and before the stable/13 branch, kevans added lpager.c
to provide a pager interface for commands written in lua.  It was merged
into 12.3. Now that 12.2 is long since EOL, we can remove the pager shim
here. Nobody needs that old loader + new lua scripts.  Plus only one
command is affected.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44142

3 months agofirmware: unbreak armv7
Warner Losh [Thu, 29 Feb 2024 17:53:05 +0000 (10:53 -0700)]
firmware: unbreak armv7

Use proper format specifiers (with casts) and don't redefine flags.

Fixes: c7b1e980ae16
Sponsored by: Netflix

3 months agoMerge one true awk from 2024-01-22 for the Awk Second Edition support
Warner Losh [Wed, 28 Feb 2024 15:16:16 +0000 (08:16 -0700)]
Merge one true awk from 2024-01-22 for the Awk Second Edition support

This brings in Unicode support, CSV support and a number of bug fixes.
They are described in _The AWK Programming Language_, Second Edition, by
Al Aho, Brian Kernighan, and Peter Weinberger (Addison-Wesley, 2024,
ISBN-13 978-0138269722, ISBN-10 0138269726).

Sponsored by: Netflix

3 months agoRELNOTES: fix my poor english
Baptiste Daroussin [Thu, 29 Feb 2024 17:35:07 +0000 (18:35 +0100)]
RELNOTES: fix my poor english

Reported by: Gary Jennejohn <garyj@gmx.de>

3 months agofirmware: document new native file loading.
Warner Losh [Thu, 29 Feb 2024 16:36:40 +0000 (09:36 -0700)]
firmware: document new native file loading.

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

3 months agofirmware: Allow binary files to be loaded by /boot/loader
Warner Losh [Thu, 29 Feb 2024 16:36:31 +0000 (09:36 -0700)]
firmware: Allow binary files to be loaded by /boot/loader

Files loaded "-t firmware" (or module_type="firmware").  They are
registered with the firmware system using the full path to the file.
There's only one firmware per file, and it is the entire file. We do an
extra firmware_get() on any firmware we find here to prevent them from
ever being unloaded (we can't handle that case sanely).

Sponsored by: Netflix
Reviewed by: tsoome, jhb
Differential Revision: https://reviews.freebsd.org/D43522

3 months agofirmware: load binary firmware files
Warner Losh [Thu, 29 Feb 2024 16:36:20 +0000 (09:36 -0700)]
firmware: load binary firmware files

When we can't find a .ko module to satisfy the firmware request, try
harder by looking for a file to read in directly. We compose this file's
name by appending the imagename parameter to the firmware path
(currently hard-wired to be /boot/firmware, future plans are for a
path). Allow this file to be unloaded when firmware_put() releases the
last reference, but we don't need to do the indirection and dance we
need to do when unloading the .ko that will unregister the firmware.

Sponsored by: Netflix
Reviewed by: manu, jhb
Differential Revision: https://reviews.freebsd.org/D43555

3 months agokernel: Sync ldscript files wrt gnu.attributes and .note.GNU-stack
Warner Losh [Thu, 29 Feb 2024 16:30:37 +0000 (09:30 -0700)]
kernel: Sync ldscript files wrt gnu.attributes and .note.GNU-stack

Bring the keeping of .gnu.attributes to all architectures. Also discard
.note.GNU-stack on all archtiectures. Plus delete obsolete comment that
was removed from i386 in 2010.

Sponsored by: Netflix
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44069

3 months agoloader/efi: Small diff reduction
Warner Losh [Thu, 29 Feb 2024 16:14:41 +0000 (09:14 -0700)]
loader/efi: Small diff reduction

Make doing the boot once protocol more similar to copies of this code.

Sponsored by: Netflix
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D44007

3 months agoloader/zfs: Fix to actually return the last error
Warner Losh [Tue, 27 Feb 2024 05:47:38 +0000 (22:47 -0700)]
loader/zfs: Fix to actually return the last error

The last fix, to try to return the last error, really returns the first
return code after the last error, which could be zero. Instead, return
the last error. Also, change rc to err to make it visually distinct from
rv, which is the cause of my error in e54bb0ad8058.

Reported by: Bill Sommerfeld <sommerfeld@hamachi.org>
Fixes: e54bb0ad8058
Sponsored by: Netflix

3 months agolorder: Tweak invalid file test.
Dag-Erling Smørgrav [Thu, 29 Feb 2024 13:59:25 +0000 (14:59 +0100)]
lorder: Tweak invalid file test.

Different implementations of `nm` have different ways of telling you
that your file is not a valid object or library, but they all seem to
have “not recognized” as a common substring.

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

3 months agolorder: Don't rely on legacy syntax.
Dag-Erling Smørgrav [Thu, 29 Feb 2024 13:59:21 +0000 (14:59 +0100)]
lorder: Don't rely on legacy syntax.

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

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

4 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

4 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

4 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

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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 months agoota: Import One True Awk from 20240122 (6a07a6d3bb63)
Warner Losh [Wed, 28 Feb 2024 15:05:17 +0000 (08:05 -0700)]
ota: Import One True Awk from 20240122 (6a07a6d3bb63)

Jan 22, 2024:
        Restore the ability to compile with g++. Thanks to
        Arnold Robbins.

Dec 24, 2023:
        Matchop dereference after free problem fix when the first
        argument is a function call. Thanks to Oguz Ismail Uysal.
        Fix inconsistent handling of --csv and FS set in the
        command line. Thanks to Wilbert van der Poel.
        Casting changes to int for is* functions.

Nov 27, 2023:
        Fix exit status of system on MacOS. Update to REGRESS.
        Thanks to Arnold Robbins.
        Fix inconsistent handling of -F and --csv, and loss of csv
        mode when FS is set.

Sponsored by: Netflix

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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

4 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")

4 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

4 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

4 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

4 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

4 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

4 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