Commit graph

289908 commits

Author SHA1 Message Date
Warner Losh ab97d42add 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
2024-02-29 10:58:52 -07:00
Warner Losh 8b9178cd0d 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
2024-02-29 10:58:43 -07:00
Warner Losh 3a3afbec38 firmware: unbreak armv7
Use proper format specifiers (with casts) and don't redefine flags.

Fixes:			c7b1e980ae
Sponsored by:		Netflix
2024-02-29 10:53:05 -07:00
Warner Losh f32a6403d3 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
2024-02-29 10:42:06 -07:00
Baptiste Daroussin 73157ce498 RELNOTES: fix my poor english
Reported by:	Gary Jennejohn <garyj@gmx.de>
2024-02-29 18:35:41 +01:00
Warner Losh 9478c7f5f8 firmware: document new native file loading.
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43611
2024-02-29 09:36:40 -07:00
Warner Losh 479905a1ed 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
2024-02-29 09:36:31 -07:00
Warner Losh c7b1e980ae 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
2024-02-29 09:36:20 -07:00
Warner Losh 23dff4fdba 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
2024-02-29 09:30:37 -07:00
Warner Losh 2425dbdff3 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
2024-02-29 09:14:47 -07:00
Warner Losh 525e6d6c89 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 e54bb0ad80.

Reported by:		Bill Sommerfeld <sommerfeld@hamachi.org>
Fixes:			e54bb0ad80
Sponsored by:		Netflix
2024-02-29 09:12:21 -07:00
Dag-Erling Smørgrav aa80cfadff 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
2024-02-29 14:59:25 +01:00
Dag-Erling Smørgrav aedb37dc49 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
2024-02-29 14:59:21 +01:00
Baptiste Daroussin ddca081d38 libucl: import snapshot 2024-02-06 2024-02-29 13:27:03 +01:00
Baptiste Daroussin 76f58d4432 libucl: import latest snapshot from 2024-02-06 2024-02-29 13:18:07 +01:00
Baptiste Daroussin 5a98d9d028 RELNOTES: document usbconfig(8) changes 2024-02-29 13:06:08 +01:00
Baptiste Daroussin db1d086b73 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.
2024-02-29 13:02:46 +01:00
Baptiste Daroussin 8fe86d923f usbconfig: allow to get usb vendors and products from the usb.ids database
Reviewed by:		emaste, manu
Differential Revision:	https://reviews.freebsd.org/D3392
2024-02-29 13:01:06 +01:00
Andrew Turner 5a02ffc32e Update the Arm Optimized Routine library to v24.01
Sponsored by:	Arm Ltd
2024-02-29 11:39:12 +00:00
Shawn Anastasio b52dceb838 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
2024-02-28 22:01:15 -05:00
Konstantin Belousov 5db5c6c87a 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
2024-02-29 03:49:02 +02:00
Konstantin Belousov 799940154c 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
2024-02-29 02:26:51 +02:00
Gleb Smirnoff 7ee47c3bb7 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.
2024-02-28 15:57:25 -08:00
Brooks Davis 882d9f4507 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
2024-02-28 23:39:55 +00:00
Gleb Smirnoff 253d8a1f8a 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
2024-02-28 14:32:47 -08:00
Gleb Smirnoff 3bc122d270 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
2024-02-28 14:32:46 -08:00
Gleb Smirnoff 1f46c32c1f 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
2024-02-28 14:32:46 -08:00
Gleb Smirnoff d6ef9649dd 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
2024-02-28 14:32:46 -08:00
Gleb Smirnoff 152a6d410e 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
2024-02-28 14:32:46 -08:00
Kristof Provost 706d465dae pf: convert kill/clear state to use netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44090
2024-02-28 23:26:18 +01:00
Kristof Provost dfed87b5ce netlink: add bool type support
Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44089
2024-02-28 23:26:18 +01:00
Kristof Provost 48f33b55b0 netlink: fix casts
Reviewed by:	melifaro
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44088
2024-02-28 23:26:17 +01:00
Stefan Eßer e0dfecadf5 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
2024-02-28 18:49:29 +01:00
Dag-Erling Smørgrav cf4d9bf8b3 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
2024-02-28 16:37:44 +01:00
Dag-Erling Smørgrav 96da41b6db lorder: Add unit tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44134
2024-02-28 16:37:41 +01:00
Dag-Erling Smørgrav 5c7b986c21 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
2024-02-28 16:37:36 +01:00
Warner Losh e8a605e129 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
2024-02-28 08:05:17 -07:00
Warner Losh cb4a83cff0 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
2024-02-28 07:09:43 -07:00
Warner Losh 1d13cc2008 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
2024-02-28 07:09:42 -07:00
Warner Losh a3f164a0c7 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
2024-02-28 07:09:42 -07:00
Warner Losh b4368e8389 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
2024-02-28 07:09:42 -07:00
Warner Losh ae84491a35 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
2024-02-28 07:09:42 -07:00
Warner Losh ddd98f5a62 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
2024-02-28 07:09:42 -07:00
Warner Losh 51c57ca92e 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
2024-02-28 07:09:42 -07:00
Warner Losh 15c8a610a8 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
2024-02-28 07:09:42 -07:00
Warner Losh 07d600649e stand: Remove dangling mips references
Remove mips support files from ficl.

Sponsored by:		Netflix
2024-02-28 07:09:41 -07:00
Stefan Schlosser 865baeaf1a 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
2024-02-28 09:31:28 +01:00
Stefan Schlosser 77f6c0ce92 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
2024-02-28 09:26:20 +01:00
Emmanuel Vadot 72b045386d 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
2024-02-28 08:17:58 +01:00
Mitchell Horne 749e318da3 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
2024-02-27 18:10:14 -04:00