]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 months agoMFV: zlib 1.3.1.
Xin LI [Sun, 18 Feb 2024 06:12:51 +0000 (22:12 -0800)]
MFV: zlib 1.3.1.

MFC after: 1 week

3 months agoreboot: Move extern for environ
Warner Losh [Sun, 18 Feb 2024 04:30:48 +0000 (21:30 -0700)]
reboot: Move extern for environ

envorin isn't defined in any header, and gcc is cranky with this inside
a function, so move it to global scope. Both clang and gcc are now happy
with this.

Sponsored by: Netflix

3 months agoreboot: Remove sys/types.h: it's not needed here...
Warner Losh [Sun, 18 Feb 2024 04:18:37 +0000 (21:18 -0700)]
reboot: Remove sys/types.h: it's not needed here...

3 months agoVendor import of zlib 1.3.1.
Xin LI [Sun, 18 Feb 2024 03:43:52 +0000 (19:43 -0800)]
Vendor import of zlib 1.3.1.

3 months agoMFV: expat 2.6.0.
Xin LI [Sat, 17 Feb 2024 21:56:56 +0000 (13:56 -0800)]
MFV: expat 2.6.0.

MFC after: 3 days

3 months agoVendor import of expat 2.6.0
Xin LI [Sat, 17 Feb 2024 21:54:42 +0000 (13:54 -0800)]
Vendor import of expat 2.6.0

3 months agomsdosfs: fix directory corruption after rename operation
Stefan Eßer [Sat, 17 Feb 2024 21:04:49 +0000 (22:04 +0100)]
msdosfs: fix directory corruption after rename operation

The is a bug in MSDOSFS that can be triggered when the target of a
rename operation exists. It is caused by the lack of inodes in the
FAT file system, which are substituted by the location of the DOS 8.3
directory entry in the file system. This causes the "inode" of a file
to change when its directory entry is moved to a different location.

The rename operation wants to re-use the existing directory entry
position of an existing target file name (POS1). But the code does
instead locate the first position in the directory that provides
sufficient free directory slots (POS2) to hold the target file name
and fills it with the directory data.

The rename operation continues and at the end writes directory data to
the initially retrieved location (POS1) of the old target directory.
This leads to 2 directory entries for the target file, but with
inconsistent data in the directory and in the cached file system
state.

The location that should have been re-used (POS1) is marked as deleted
in the directory, and new directory data has been written to a
different location (POS2). But the VFS cache has the newly written
data stored under the inode number that corresponds to the initially
planned position (POS1).

If then a new file is written, it can allocate the deleted directory
entries (POS1) and when it queries the cache, it retrieves data that
is valid for the target of the prior rename operation, leading to a
corrupt directory entry (at POS1) being written (DOS file name of the
earlier rename target combined with the Windows long file name of the
newly written file).

PR: 268005
Reported by: wbe@psr.com
Approved by: kib, mckusick
Fixes:     2c9cbc2d45b94
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D43951

3 months agoProactively remove /usr/lib/kgdb file that became a directory
Dimitry Andric [Sat, 17 Feb 2024 11:27:33 +0000 (12:27 +0100)]
Proactively remove /usr/lib/kgdb file that became a directory

This was already handled in ObsoleteFiles.inc (see the 20201215 entry),
but some people never run "make delete-old", or want to upgrade directly
from a revision that still had the file to the most recent revision.

They would then encounter a failure during installworld, similar to:

  install: /usr/libexec/kgdb exists but is not a directory

Therefore, clean it up in the distrib-cleanup phase, similar to the
earlier instances of libc++ header files that became a directory.

MFC after: 3 days

3 months agopowerpc psim: Fix infinite recursion in multiple bus methods
John Baldwin [Sat, 17 Feb 2024 07:17:42 +0000 (23:17 -0800)]
powerpc psim: Fix infinite recursion in multiple bus methods

Similar to 68a3ff041129208ea98a3bd5142061176ab4165e, the default case
needs to call bus_generic_* to pass the request up the tree, not bus_*
which will just call this method again.

Fixes: d7c16b333455 powerpc psim: Use bus_generic_rman_*

3 months agopowerpc mpc85xx: Fix infinite recursion in multiple bus methods
John Baldwin [Sat, 17 Feb 2024 07:15:52 +0000 (23:15 -0800)]
powerpc mpc85xx: Fix infinite recursion in multiple bus methods

Similar to 68a3ff041129208ea98a3bd5142061176ab4165e, the default case
needs to call bus_generic_* to pass the request up the tree, not bus_*
which will just call this method again.

Fixes: 5a7e717fb790 powerpc mpc85xx: Use bus_generic_rman_*

3 months agoOptionally create full debuginfo for llvm-related executables
Dimitry Andric [Sun, 11 Feb 2024 19:02:51 +0000 (20:02 +0100)]
Optionally create full debuginfo for llvm-related executables

Commit de6feefdb7cfd limited the amount of debuginfo generated for clang
and other llvm-related executables. This was done to save disk space and
memory during building, but it makes debugging any of these executables
much harder.

Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate
full debuginfo instead. This is off by default, but could for example be
enabled for release builds or snapshots, so llvm executables are easier
to debug.

Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43839

3 months agoirdma(4): Upgrade to 1.2.36-k
Bartosz Sobczak [Fri, 16 Feb 2024 21:55:08 +0000 (13:55 -0800)]
irdma(4): Upgrade to 1.2.36-k

Update Intel irdma driver to version 1.2.36-k.

Notable changes:

- Start using ib_sge directly instead of irdma_sge
- Turn off flush completion generator for libirdma
- Minor formatting changes

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D43567

3 months agopci_host_generic: Fix build without PCI_RES_BUS
John Baldwin [Fri, 16 Feb 2024 20:09:46 +0000 (12:09 -0800)]
pci_host_generic: Fix build without PCI_RES_BUS

Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation

3 months agofclose.3: remove a confusing sentence
Maxim Konovalov [Fri, 16 Feb 2024 18:50:12 +0000 (18:50 +0000)]
fclose.3: remove a confusing sentence

PR: 277037
Reviewed by: oshogbo

3 months agobusdma: fix page miscount for small segment sizes
Mitchell Horne [Tue, 25 May 2021 21:04:56 +0000 (18:04 -0300)]
busdma: fix page miscount for small segment sizes

For small segments (< PAGE_SIZE) there is a mismatch between how
required bounce pages are counted in _bus_dmamap_count_pages() and
bounce_bus_dmamap_load_buffer().

This problem has been observed on the RISC-V VisionFive v2 SoC (and
earlier revisions of the hardware) which has memory physically addressed
above 4GB. This requires some bouncing for the dwmmc driver, which has
has a maximum segment size of 2048 bytes. When attempting to load a
page-aligned 4-page buffer that requires bouncing, we can end up
counting 4 bounce pages for an 8-segment transfer. These pages will be
incorrectly configured to cover only the first half of the transfer (4 x
2048 bytes).

Fix the immediate issue by adding the maxsegsz check to
_bus_dmamap_count_pages(); this is what _bus_dmamap_count_phys() does
already. The result is that we will inefficiently allocate a separate
bounce page for each segment (8 pages for the example above), but the
transfer will proceed in its entirety.

The more complete fix is to address the shortcomings in how small
segments are assigned to bounce pages, so that we opportunistically
batch multiple segments to a page whenever they fit (e.g. two 2048 bytes
segments per 4096 page). This will be addressed more holistically in the
future. For now this change will prevent the (silent) incomplete
transfers that have been observed.

PR: 273694
Reported by: Jari Sihvola <jsihv@gmx.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34118

3 months agopowerpc psim: Fix infinite recursion in bus_adjust_resource method
John Baldwin [Fri, 16 Feb 2024 17:42:30 +0000 (09:42 -0800)]
powerpc psim: Fix infinite recursion in bus_adjust_resource method

The default case needs to call bus_generic_adjust_resource to pass the
request up the tree, not bus_adjust_resource which will just call this
method again.

Fixes: d7c16b333455 powerpc psim: Use bus_generic_rman_*

3 months agopowerpc mpc85xx: Fix infinite recursion in bus_adjust_resource method
John Baldwin [Fri, 16 Feb 2024 17:40:34 +0000 (09:40 -0800)]
powerpc mpc85xx: Fix infinite recursion in bus_adjust_resource method

The default case needs to call bus_generic_adjust_resource to pass the
request up the tree, not bus_adjust_resource which will just call this
method again.

Fixes: 5a7e717fb790 powerpc mpc85xx: Use bus_generic_rman_*

3 months agoRevert "heimdal: CVE-2022-41916: Check for overflow in _gsskrb5_get_mech()"
Cy Schubert [Fri, 16 Feb 2024 17:31:13 +0000 (09:31 -0800)]
Revert "heimdal: CVE-2022-41916: Check for overflow in _gsskrb5_get_mech()"

This was already applied by ed549cb0c53f.

Repored by: Gunther Nikl <gnikl@justmail.de>

This reverts commit 9286d46a794f25482880d29864a8901ef6666fae.

3 months agoLinuxKPI: 802.11: lsta txq locking cleanup
Bjoern A. Zeeb [Wed, 14 Feb 2024 21:56:48 +0000 (21:56 +0000)]
LinuxKPI: 802.11: lsta txq locking cleanup

Rename the LSTA lock to LSTA_TXQ lock as that is really what it is and
put down the full set of macros.  Replace the init and destroy with the
macro invocation rather than direct code.

Put locking around the txq_ready unset and check. Move the taskq_enqueue
call under lock to be sure we do not call it anymore after txq_ready
got unset.

Leave a comment related to the node reference which is passed into the
TX path on the recvif mbuf pointer.

Fixes: 0936c648ad0ee
PR: 274382 (possibly)
MFC after: 1 day
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D43909

3 months agopmc: Fix some problems with the makefile
Mark Johnston [Thu, 15 Feb 2024 18:17:37 +0000 (13:17 -0500)]
pmc: Fix some problems with the makefile

- For some reason we don't build it as a PIE, but I don't have any
  problems doing so with either clang or gcc.
- There is no apparent need to override WARNS, so don't.
- Some building with -O0, presumably that's left over from debugging.

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

3 months agox86/xen: fix migration when ACPI suspend is not available
Roger Pau Monné [Tue, 6 Feb 2024 08:16:44 +0000 (09:16 +0100)]
x86/xen: fix migration when ACPI suspend is not available

Xen PVH guests expose a very minimal set of ACPI tables, and due to the lack of
SCI interrupt FreeBSD doesn't allocate the suspend stacks for saving CPU and
FPU contexts.

Lack of allocated stacks would lead to a page-fault in cpususpend_handler() when
CPUs attempted to use the save context area as a result of a Xen suspend
request.  However there's no need to save the CPU or the FPU registers in the
Xen case, as that's all handled by the hypervisor.  Hence avoid saving all this
state if the suspend stacks are not allocated.

Note that this will currently only apply to PVH guests, HVM ones will still get
the stack allocated and the context saved even when not strictly required.  I
find it easier rather that having to provide cpususpend_handler() with extra
information whether the context needs to be saved or not.

Sponsored by: Cloud Software Group
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D43765

3 months agomd5: Clean up input stream rights.
Dag-Erling Smørgrav [Fri, 16 Feb 2024 12:37:08 +0000 (13:37 +0100)]
md5: Clean up input stream rights.

Keep it simple, caph_limit_stdio() and fileargs_fopen() already take
care of everything for us.

MFC after: 1 week
Reviewed by: markj, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D43897

3 months agomd5: Ignore files in string and passthrough mode.
Dag-Erling Smørgrav [Fri, 16 Feb 2024 12:37:04 +0000 (13:37 +0100)]
md5: Ignore files in string and passthrough mode.

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

3 months agomd5: Accept "-" as alias for stdin.
Dag-Erling Smørgrav [Fri, 16 Feb 2024 12:36:58 +0000 (13:36 +0100)]
md5: Accept "-" as alias for stdin.

(based on a patch by jhb)

MFC after: 1 week
PR: 276915
Reported by: Hannes Hauswedell <h2+fbsdports@fsfe.org>
Reviewed by: allanjude, markj, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D43870

3 months agodtrace: allow NULL interface pointer for ifinfo_t translator
Michael Tuexen [Fri, 16 Feb 2024 11:28:48 +0000 (12:28 +0100)]
dtrace: allow NULL interface pointer for ifinfo_t translator

This is similar to other translators and will be used in static
probes where the interface is not known.

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

3 months agoRACK, BBR: handle EACCES like EPERM for IP output handling
Michael Tuexen [Fri, 16 Feb 2024 11:19:24 +0000 (12:19 +0100)]
RACK, BBR: handle EACCES like EPERM for IP output handling

The FreeBSD TCP base stack handles them also the same way.
In case of packet filters dropping packets in the output path,
this avoids retranmitting the dropped packet every 10ms or so.

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

3 months agoloader: Bump the limit to 560,000 bytes for BIOS loader
Warner Losh [Fri, 16 Feb 2024 04:12:52 +0000 (21:12 -0700)]
loader: Bump the limit to 560,000 bytes for BIOS loader

Further experience suggests we do not need as much margin. This was
mistakenly bumped to 570,000 in a prior commit, so this undoes that.

Sponsored by: Netflix

3 months agoloader: line line per src file in libi386
Warner Losh [Fri, 16 Feb 2024 04:02:37 +0000 (21:02 -0700)]
loader: line line per src file in libi386

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

3 months agoloader: Simplify build a little
Warner Losh [Fri, 16 Feb 2024 03:55:05 +0000 (20:55 -0700)]
loader: Simplify build a little

Confine -DDISK_DEBUG to biosdisc.c, the only file it affects.
Use modern variable arrays instead of alloca and add a sanity
size minimum for biospnp nodes. These nodes are tiny enough that
we needn't do a malloc/free pair: the stack is fine.

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

3 months agokboot: Add our own lua bindings
Warner Losh [Fri, 16 Feb 2024 03:54:55 +0000 (20:54 -0700)]
kboot: Add our own lua bindings

Create a small wrapper around the new flua hash module so we can use it
here too. There's no 4th bindings, nor will they be created.

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

3 months agoflua: Add hash module
Warner Losh [Fri, 16 Feb 2024 03:54:36 +0000 (20:54 -0700)]
flua: Add hash module

Add lua bindings to hashing functions. sha256 is available. sha256.new
craetes a new object. sha256.update updates the digest. sha256.digest
returns the digest as a binary string and resets the
context. sha256.hexdigest returns the digest as a string of hex digits
and then resets the cotnext.

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

3 months agoloader: Move drawer.lua over to gfx table.
Warner Losh [Fri, 16 Feb 2024 03:54:04 +0000 (20:54 -0700)]
loader: Move drawer.lua over to gfx table.

Drawer.lua is the only bit of lua code in the base that uses any of the
functons moved from the loader table to the gfx table. Move the main
code to using the gfx dispatch. Add compat code for running on old
loaders that creates the newer-style gfx table with the term_* functions
we call in it populated. This will even work on the super old versions
of the loader that don't have them (we'll still skip using them).

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

3 months agoloader: Move gfx functions to gfx.lua.8
Warner Losh [Fri, 16 Feb 2024 03:53:55 +0000 (20:53 -0700)]
loader: Move gfx functions to gfx.lua.8

Now that the fb_* and term_* functions are available in the gfx table,
move the documentation to gfx.lua.8. Add information about backwards
compatibility.

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

3 months agoloader: Move to using linker sets to bring in optional bits
Warner Losh [Fri, 16 Feb 2024 03:53:47 +0000 (20:53 -0700)]
loader: Move to using linker sets to bring in optional bits

The graphics stuff is optional. When it is pulled into the system, we
use a linker set to initialize the lua bindings for it now.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D43906

3 months agoloader: Remove gfx_fb_stub.c, it's no longer needed
Warner Losh [Fri, 16 Feb 2024 03:53:39 +0000 (20:53 -0700)]
loader: Remove gfx_fb_stub.c, it's no longer needed

Now that we draw in the gfx bindings for all our interpreters only when
graphics support is compiled in, we can eliminate this from all the
loaders that don't have graphics support.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D43905

3 months agoloader: Only create gfx 4th bindings when gfx is available
Warner Losh [Fri, 16 Feb 2024 03:53:28 +0000 (20:53 -0700)]
loader: Only create gfx 4th bindings when gfx is available

Only create the gfx bindings for 4th when it's compiled into the
loader. We do this with a linker set that only gets brought in to those
loaders that call gfx_framework_init. This calls gfx_interp_md() will
will drag in gfx_loader.c which will add to the linker set that
registers these bindings.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D43904

3 months agoloader: Add prototype for gfx_interp_md
Warner Losh [Fri, 16 Feb 2024 03:53:19 +0000 (20:53 -0700)]
loader: Add prototype for gfx_interp_md

This function will be used to draw in the graphics bindings when the
loader is compiled with graphics (gfx) support. Provide definitions
for lua and the simple interpreter. 4th support is forthcoming.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D43903

3 months agoloader: Create new gfx table
Warner Losh [Fri, 16 Feb 2024 03:53:07 +0000 (20:53 -0700)]
loader: Create new gfx table

Create a new gfx global table. Put into it all the graphics bindings
that we have in loader today. For now, have compatability binding for
loader. Remove them from loader.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D43902

3 months agoloader: Separate gfx to a new file.
Warner Losh [Fri, 16 Feb 2024 03:52:59 +0000 (20:52 -0700)]
loader: Separate gfx to a new file.

Move gfx lua hook registration to a new file.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D43901

3 months agoloader: Register the gfx stuff separately.
Warner Losh [Fri, 16 Feb 2024 03:52:48 +0000 (20:52 -0700)]
loader: Register the gfx stuff separately.

Move registration of the gfx stuff to separate function. However, no
change in functionality is intended.

Sponsored by: Netflix
Reviewed by: kevans, jhb
Differential Revision: https://reviews.freebsd.org/D43900

3 months agoloader: Simplify the loader.has_command
Warner Losh [Fri, 16 Feb 2024 03:52:41 +0000 (20:52 -0700)]
loader: Simplify the loader.has_command

luaL_checkstring already checks for the right number of
arguments. There's no need to do that by hand here. Now an exception
will be thrown like any other function with the wrong args. Also,
push a boolean instead of an int.

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

3 months agoreboot: Use posix_spawn instead of system
Warner Losh [Fri, 16 Feb 2024 03:52:31 +0000 (20:52 -0700)]
reboot: Use posix_spawn instead of system

Use posix_spawn to avoid having to allocate memory needed for the system
command line.

Sponsored by: Netflix
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D43860

3 months agoipfw: Skip to the start of the loop when following a keep-state rule
Karim Fodil-Lemelin [Fri, 16 Feb 2024 01:57:51 +0000 (17:57 -0800)]
ipfw: Skip to the start of the loop when following a keep-state rule

When a packet matches an existing dynamic rule for a keep-state rule,
the matching engine advances the "instruction pointer" to the action
portion of the rule skipping over the match conditions.  However, the
code was merely breaking out of the switch statement rather than doing
a continue, so the remainder of the loop body after the switch was
still executed.  If the first action opcode contains an F_NOT but not
an F_OR (such as an "untag" action), then match is toggled to 0, and
the code exits the inner loop via a break which aborts processing of
the actions.

To fix, just use a continue instead of a break.

PR: 276732
Reviewed by: jhb, ae
MFC after: 2 weeks

3 months agopci_host_generic: Properly handle bus_release_resource of IRQ resources
John Baldwin [Fri, 16 Feb 2024 01:56:01 +0000 (17:56 -0800)]
pci_host_generic: Properly handle bus_release_resource of IRQ resources

Unlike other bus methods updated to use bus_generic_rman_* in commit
d79b6b8ec267, the bus_release_resource method was using
bus_generic_rman_release_resource for all types other than
PCI_RES_BUS.  Instead, bus_generic_rman_* should only be used for
memory and I/O port resources for this driver.

Tested by: cperciva
Reviewed by: cperciva
Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
Differential Revision: https://reviews.freebsd.org/D43925

3 months agopci_host_generic: Set a valid error if allocating a range resource fails
John Baldwin [Fri, 16 Feb 2024 00:05:09 +0000 (16:05 -0800)]
pci_host_generic: Set a valid error if allocating a range resource fails

Previously pci_host_generic_attach was returning 0 (success)
incorrectly if allocating a range failed.  The error value was 0 from
the previously successful call to bus_set_resource in this case.

Fixes: d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation

3 months agosimplebus: Implement bus_delete_resource
John Baldwin [Fri, 16 Feb 2024 00:05:00 +0000 (16:05 -0800)]
simplebus: Implement bus_delete_resource

3 months agosimplebus: Map SYS_RES_IOPORT to SYS_RES_MEMORY later in alloc_resource
John Baldwin [Fri, 16 Feb 2024 00:04:50 +0000 (16:04 -0800)]
simplebus: Map SYS_RES_IOPORT to SYS_RES_MEMORY later in alloc_resource

Specifically, the set/get_resource methods do not currently remap
resource types, so remap the type in alloc_resource only after
looking for a matching resource list entry.

Fixes: 3cf553288b96 simplebus: Consistently map SYS_RES_IOPORT to SYS_RES_MEMORY

3 months agoreboot: initialize howto
Warner Losh [Thu, 15 Feb 2024 21:28:54 +0000 (14:28 -0700)]
reboot: initialize howto

Make static analyzers happy by initialzing howto to 0. Coverity is
cranky that it could be used unused. But it's analysis is incomplete
because the args to getopt when it wasn't initialized preclude it from
being used.

3 months agoheimdal: Fix NULL deref
Cy Schubert [Thu, 15 Feb 2024 15:41:07 +0000 (07:41 -0800)]
heimdal: Fix NULL deref

A flawed logical condition allows a malicious actor to remotely
trigger a NULL pointer dereference using a crafted negTokenInit
token.

Upstream notes:

    Reported to Heimdal by Michał Kępień <michal@isc.org>.

    From the report:

    Acknowledgement
    ---------------

    This flaw was found while working on addressing ZDI-CAN-12302: ISC BIND
    TKEY Query Heap-based Buffer Overflow Remote Code Execution
    Vulnerability, which was reported to ISC by Trend Micro's Zero Day

Security: CVE-2022-3116
Obtained from: upstream 7a19658c1
MFC after: 1 week

3 months agoheimdal: always confirm PA-PKINIT-KX for anon PKINIT
Cy Schubert [Thu, 15 Feb 2024 01:58:06 +0000 (17:58 -0800)]
heimdal: always confirm PA-PKINIT-KX for anon PKINIT

Import upstream 38c797e1a.

Upstream notes:

    RFC8062 Section 7 requires verification of the PA-PKINIT-KX key
    excahnge when anonymous PKINIT is used.  Failure to do so can
    permit an active attacker to become a man-in-the-middle.

Reported by: emaste
Obtained from: upstream 38c797e1a
Security: CVE-2019-12098
MFC after: 1 week

3 months agoheimdal: CVE-2022-41916: Check for overflow in _gsskrb5_get_mech()
Cy Schubert [Thu, 15 Feb 2024 00:54:46 +0000 (16:54 -0800)]
heimdal: CVE-2022-41916: Check for overflow in _gsskrb5_get_mech()

Apply upstream 22749e918 to fix a buffer overflow.

Upstream notes:

    If len_len is equal to total_len - 1 (i.e. the input consists only of a
    0x60 byte and a length), the expression 'total_len - 1 - len_len - 1',
    used as the 'len' parameter to der_get_length(), will overflow to
    SIZE_MAX. Then der_get_length() will proceed to read, unconstrained,
    whatever data follows in memory. Add a check to ensure that doesn't
    happen

This is similar to samba CVE-2022-3437.

Reported by: emaste
Security: CVE-2022-41916
Obtained from: upstream 22749e918
MFC after: 1 week

3 months agoHeimdal: CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum
Cy Schubert [Wed, 14 Feb 2024 20:04:30 +0000 (12:04 -0800)]
Heimdal: CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum

Upstream's explanation of the problem:

    S4U2Self is an extension to Kerberos used in Active Directory to allow
    a service to request a kerberos ticket to itself from the Kerberos Key
    Distribution Center (KDC) for a non-Kerberos authenticated user
    (principal in Kerboros parlance). This is useful to allow internal
    code paths to be standardized around Kerberos.

    S4U2Proxy (constrained-delegation) is an extension of this mechanism
    allowing this impersonation to a second service over the network. It
    allows a privileged server that obtained a S4U2Self ticket to itself
    to then assert the identity of that principal to a second service and
    present itself as that principal to get services from the second
    service.

    There is a flaw in Samba's AD DC in the Heimdal KDC. When the Heimdal
    KDC checks the checksum that is placed on the S4U2Self packet by the
    server to protect the requested principal against modification, it
    does not confirm that the checksum algorithm that protects the user
    name (principal) in the request is keyed.  This allows a
    man-in-the-middle attacker who can intercept the request to the KDC to
    modify the packet by replacing the user name (principal) in the
    request with any desired user name (principal) that exists in the KDC
    and replace the checksum protecting that name with a CRC32 checksum
    (which requires no prior knowledge to compute).

    This would allow a S4U2Self ticket requested on behalf of user name
    (principal) user@EXAMPLE.COM to any service to be changed to a
    S4U2Self ticket with a user name (principal) of
    Administrator@EXAMPLE.COM. This ticket would then contain the PAC of
    the modified user name (principal).

Reported by: emaste
Security: CVE-2018-16860
Obtained from: Upstream c6257cc2c
MFC after: 1 week

3 months agoHeimdal: Fix transit path validation CVE-2017-6594
Cy Schubert [Wed, 14 Feb 2024 19:56:18 +0000 (11:56 -0800)]
Heimdal: Fix transit path validation CVE-2017-6594

Apply upstream b1e699103. This fixes a bug introduced by upstream
f469fc6 which may in some cases enable bypass of capath policy.

Upstream writes in their commit log:

    Note, this may break sites that rely on the bug.  With the bug some
    incomplete [capaths] worked, that should not have.  These may now break
    authentication in some cross-realm configurations.

Reported by: emaste
Security: CVE-2017-6594
Obtained from: upstream b1e699103
MFC after: 1 week

3 months agopci_pci: Remove obsolete comment
John Baldwin [Thu, 15 Feb 2024 02:04:34 +0000 (18:04 -0800)]
pci_pci: Remove obsolete comment

This comment referred to the layering violation fixed in commit
b377ff8110e3489eb6e6b920b51a2384dfc4eb0b.

3 months agovmd: Use bus_generic_rman_* for PCI bus and memory resources
John Baldwin [Thu, 15 Feb 2024 20:26:40 +0000 (12:26 -0800)]
vmd: Use bus_generic_rman_* for PCI bus and memory resources

While here, add custom bus_map/unmap_resource methods to request
mappings via the window memory resources allocated from the parent
bus.

Tested by: emaste
Differential Revision: https://reviews.freebsd.org/D43886

3 months agovmd: Use bus_read/write_* instead of bus_space_read/write_*
John Baldwin [Thu, 15 Feb 2024 20:26:19 +0000 (12:26 -0800)]
vmd: Use bus_read/write_* instead of bus_space_read/write_*

Using an explicit bus space tag and handle is deprecated.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D43885

3 months agoriscv: Add missing includes for DDB
John Baldwin [Thu, 15 Feb 2024 20:20:30 +0000 (12:20 -0800)]
riscv: Add missing includes for DDB

The #ifdef DDB code in parse_metadata was dead code without opt_ddb.h.
While here, update the call to db_fetch_ksymtab for changes in commit
02bc014a200a.

Reviewed by: mhorne
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D43919

3 months agopsci: Add FDT node status check
Stephen J. Kiernan [Thu, 15 Feb 2024 16:57:32 +0000 (11:57 -0500)]
psci: Add FDT node status check

Consider the PSCI missing if the FDT node status says it is not okay.

Reviewed by: andrew
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D43920

3 months agosocket tests: add listener_wakeup
Gleb Smirnoff [Thu, 15 Feb 2024 18:48:44 +0000 (10:48 -0800)]
socket tests: add listener_wakeup

This test runs several scenarios when sleep(9) on a listen(2)ing socket is
interrupted by shutdown(2) or by close(2).  What should happen in that
case is not specified, neither is documented.  However, there is certain
behavior that we have and this test makes sure it is preserved.  There is
software that relies on it, see bug 227259.  This test is based on
submission with this bug, bugzilla attachment 192260.

The test checks TCP and unix(4) stream socket behavior and SCTP can be
added easily if needed.

The test passes on FreeBSD 11 to 15.  It won't pass on FreeBSD 10,
although the wakeup behavior of shutdown(2) is the same, but it doesn't
return error.

PR: 227259

3 months agosockets: repair wakeup of accept(2) by shutdown(2)
Gleb Smirnoff [Thu, 15 Feb 2024 18:48:44 +0000 (10:48 -0800)]
sockets: repair wakeup of accept(2) by shutdown(2)

That was lost in transition from one-for-all soshutdown() to protocol
specific methods.  Only protocols that listen(2) were affected.  This is
not a documented or specified feature, but some software relies on it.  At
least the FreeSWITCH telephony software uses this behavior on
PF_INET/SOCK_STREAM.

Fixes: 5bba2728079ed4da33f727dbc2b6ae1de02ba897
3 months agorights.4: Remove sentence implying that rights are a mask
Ed Maste [Thu, 15 Feb 2024 14:55:39 +0000 (09:55 -0500)]
rights.4: Remove sentence implying that rights are a mask

Capability rights passed to cap_rights_* are (now) not simple bitmaks
and cannot be ORed together in general (although it will work for
certain subsets of rights).

Remove sentence that implied rights are masks.  We already have the
sentence "The complete list of capability rights is provided below" so
listing the rights without an introductory sentence seems fine.

PR: 277057

3 months agopath_test: fix cap_rights_init usage
Ed Maste [Thu, 15 Feb 2024 00:45:42 +0000 (19:45 -0500)]
path_test: fix cap_rights_init usage

Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR: 277057
Fixes: e5e1d9c7b781 ("path_test: Add a test case for...")
Sponsored by: The FreeBSD Foundation

3 months agobsdinstall: remove two dead mirrors
Philip Paeps [Thu, 15 Feb 2024 13:49:33 +0000 (21:49 +0800)]
bsdinstall: remove two dead mirrors

3 months agobsdinstall: prefer HTTP
Philip Paeps [Thu, 15 Feb 2024 13:49:33 +0000 (21:49 +0800)]
bsdinstall: prefer HTTP

In 2024, users are more likely to have working HTTP than working FTP.
Present http://ftp.FreeBSD.org as the first option in the installer.
Keep ftp://ftp.FreeBSD.org as the second option.

MFC after: 3 weeks

3 months agopfsync: Fix offset calculation
Kajetan Staszkiewicz [Tue, 13 Feb 2024 19:41:14 +0000 (20:41 +0100)]
pfsync: Fix offset calculation

Even though message version is automatically recognized and the top of
the struct is identical for different versions, when iterating over
multiple messages proper message length must be used. That's the length
of an union member for given version, not of the union itself.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D43862

3 months agozfs: merge openzfs/zfs@e0bd8118d
Martin Matuska [Thu, 15 Feb 2024 09:21:13 +0000 (10:21 +0100)]
zfs: merge openzfs/zfs@e0bd8118d

Notable upstream pull request merges:
 #15469 cbe882298 Add slow disk diagnosis to ZED
 #15857 d0d273320 Update zfs-snapshot.8
 #15864 a5a725440 zfs list: add '-t fs' and '-t vol' options
 #15874 6cc93ccde BRT: Fix slop space calculation with block cloning
 #15882 a0635ae73 zdb: Fix false leak report for BRT objects

Obtained from: OpenZFS
OpenZFS commit: e0bd8118d04b55b7adf3d9ba256ad4bb53e66512

3 months agolibcasper: fix cap_rights_init usage
Ed Maste [Thu, 15 Feb 2024 00:42:48 +0000 (19:42 -0500)]
libcasper: fix cap_rights_init usage

Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR: 277057
Fixes: faaf43b2a750 ("fileargs: add tests")
Sponsored by: The FreeBSD Foundation

3 months agonet: bandaid for plugging a fw_com leak in fwip_detach()
Tai-hwa Liang [Thu, 15 Feb 2024 01:00:49 +0000 (01:00 +0000)]
net: bandaid for plugging a fw_com leak in fwip_detach()

Adding a temporary workaround for plugging a fw_com upon if_fwip unloading.

Steps to reproduce(needs two hosts connected with firewire):

  while true; do
    ifconfig fwip0 10.0.0.5 up
    fwcontrol -r
    ping -c 10.0.0.3
    kldunload if_fwip
  done

There's a chance that the unloading of if_fwip.ko triggers following warning:

Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked).

commit d79b6b8ec267e7eef6e07cf4245159705e24acd5 (origin/main, origin/HEAD)

3 months agocat: fix cap_rights_init usage
Ed Maste [Thu, 15 Feb 2024 00:03:40 +0000 (19:03 -0500)]
cat: fix cap_rights_init usage

Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR: 277057
Reported by: asomers, markj

3 months agopci_host_generic: Don't rewrite resource start address for translation
John Baldwin [Wed, 14 Feb 2024 22:07:33 +0000 (14:07 -0800)]
pci_host_generic: Don't rewrite resource start address for translation

Allocate resources from the parent device for decoded physical address
ranges.  When child resources suballocated from rman's are mapped,
translate those mapping requests into a mapping request of the
associated physical address range in a bus_map_resource method.

While here, convert generic_pcie_rman to a bus_get_rman method and use
bus_generic_rman_* for operations on child resources.

Factor out a generic_pcie_containing_range to share logic between
bus_translate_resource and bus_*map_resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43894

3 months agophysmem ram: Don't reserve excluded regions
John Baldwin [Wed, 14 Feb 2024 22:07:33 +0000 (14:07 -0800)]
physmem ram: Don't reserve excluded regions

These regions can conflict with I/O resources and prevent allocation
of those regions by other drivers.  It may make sense to reserve them
after the boot-time probe of devices has concluded (or after an
initial pass to reserve firmware-assigned resources before "wildcard"
resources are allocated), but that would require additional changes.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43893

3 months agoacpi: Allow child drivers to use bus_set_resource for more resources
John Baldwin [Wed, 14 Feb 2024 22:07:32 +0000 (14:07 -0800)]
acpi: Allow child drivers to use bus_set_resource for more resources

acpi_set_resource excludes certain types of resources for certain
devices.  The intention of this is to avoid adding resource entries
for bogus resources enumerated via _CRS.  However, this also prevents
drivers from adding those resources explicitly if needed.  To fix
this, move the logic to exclude these resources into an ignore hook
used when parsing _CRS to create the initial set of resources for each
device.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43892

3 months agoacpi: Don't assume a resource is reserved in acpi_delete_resource
John Baldwin [Wed, 14 Feb 2024 22:07:32 +0000 (14:07 -0800)]
acpi: Don't assume a resource is reserved in acpi_delete_resource

This fixes a panic if a driver uses bus_set_resource to add a resource
that fails to reserve and then deletes the resource via
bus_delete_resource.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43891

3 months agopci_host_generic: Include the bridge's device name in rman descriptions
John Baldwin [Wed, 14 Feb 2024 22:07:32 +0000 (14:07 -0800)]
pci_host_generic: Include the bridge's device name in rman descriptions

The rman description strings now match those used in the PCI-PCI
bridge driver.  Using more specific names removes ambiguity in devinfo -u
output on systems with multiple host to PCI bridges.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43890

3 months agopci_host_generic: Remove unused res1 field from softc
John Baldwin [Wed, 14 Feb 2024 22:07:32 +0000 (14:07 -0800)]
pci_host_generic: Remove unused res1 field from softc

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43889

3 months agopci_host_generic_fdt: Remove duplicate DEVMETHOD entries
John Baldwin [Wed, 14 Feb 2024 22:07:32 +0000 (14:07 -0800)]
pci_host_generic_fdt: Remove duplicate DEVMETHOD entries

These are already inherited from generic_pcie_core_driver.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43888

3 months agogpiobus: Use bus_generic_rman_*
John Baldwin [Wed, 14 Feb 2024 22:07:32 +0000 (14:07 -0800)]
gpiobus: Use bus_generic_rman_*

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43887

3 months agoLinuxKPI: sort dev_<loglevel>() functions
Bjoern A. Zeeb [Thu, 1 Feb 2024 23:56:45 +0000 (23:56 +0000)]
LinuxKPI: sort dev_<loglevel>() functions

Sort the dev_<loglevel> functions by loglevel order, add the dev_alert()
version and an indentation change.

No functional changes.

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D43719

3 months agoctfmerge: demote "No ctf sections found" to a warning
Ed Maste [Wed, 14 Feb 2024 14:48:42 +0000 (09:48 -0500)]
ctfmerge: demote "No ctf sections found" to a warning

If there are no CTF sections then ctfmerge just has nothing to do; it
should not be an error.

Note that ctfmerge has an option to require CTF:
     -t      Make sure that all object files have a CTF section.

Before this change, this option explicitly exited without error if none
of the object files have CTF sections, with the comment:

    If we're verifying that C files have CTF, it's safe to
    assume that in this case, we're building only from assembly
    inputs.

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

3 months agoLinuxKPI: 802.11: update the ni/lsta reference cycle
Bjoern A. Zeeb [Mon, 5 Feb 2024 14:51:08 +0000 (14:51 +0000)]
LinuxKPI: 802.11: update the ni/lsta reference cycle

Update the ni/lsta reference cycle, add extra checks and assertions.
This is to accomodate problems we were seeing based on net80211
behaviour (join1() and (*iv_update_bss)() as well as state changes for
new iv_bss nodes during an active session).
This should hopefully help to stabilise behaviour until the underlying
problems gets properly addressed (for this and all other device drivers).

PR: 272607, 273985, 274003
MFC after: 3 days
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43753

3 months agoLinuxKPI: 802.11: band-aid for invalid state changes after (*iv_update_bss)
Bjoern A. Zeeb [Sat, 3 Feb 2024 16:33:56 +0000 (16:33 +0000)]
LinuxKPI: 802.11: band-aid for invalid state changes after (*iv_update_bss)

With firmware based solutions we cannot just jump from an active session
to a new iv_bss node without tearing down state for the old and bringing
up the new node.  This likely used to work on softmac based cards/drivers
where one could essentially set the state and fire at will.

We track (*iv_update_bss) calls from net80211 and set a local flag that
we are out of synch and do not allow any further operations up the state
machine until we hit INIT or SCAN.  That means someone will take the state
down, clean up firmware state and then we can join again and build up
state.

Apparently this problem has been "known" for a while as native iwm(4) and
others have similar workarounds (though less strict) and can be equally
pestered into bad states.  For LinuxKPI all the KASSERTs just massively
brought this problem out.  The solution will be some rewrites in net80211.
Until then, try to keep us more stable at least and not die on second
join1() calls triggered by service netif start wlan0 and similar.

PR: 271979, 271988, 275255, 263613, 274003
Sponsored by: The FreeBSD Foundation (2023, partial)
MFC after: 3 days
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43725

3 months agonet80211: deal with lost state transitions
Bjoern A. Zeeb [Wed, 10 Jan 2024 10:14:16 +0000 (10:14 +0000)]
net80211: deal with lost state transitions

Since 5efea30f039c4 we can possibly lose a state transition which can
cause trouble further down the road.
The reproducer from 643d6dce6c1e can trigger these for example.
Drivers for firmware based wireless cards have worked around some of
this (and other) problems in the past.

Add an array of tasks rather than a single one as we would simply
get npending > 1 and lose order with other tasks.  Try to keep state
changes updated as queued in case we end up with more than one at a
time.  While this is not ideal either (call it a hack) it will sort
the problem for now.
We will queue in ieee80211_new_state_locked() and do checks there
and dequeue in ieee80211_newstate_cb().
If we still overrun the (currently) 8 slots we will drop the state
change rather than overwrite the last one.
When dequeing we will update iv_nstate and keep it around for historic
reasons for the moment.

The longer term we should make the callers of
ieee80211_new_state[_locked]() actually use the returned errors
and act appropriately but that will touch a lot more places and
drivers (possibly incl. changed behaviour for ioctls).

rtwn(4) and rum(4) should probably be revisted and net80211 internals
removed (for rum(4) at least the current logic still seems prone to
races).

PR: 271979, 271988, 275255, 263613, 274003
Sponsored by: The FreeBSD Foundation (in 2023)
MFC after: 3 days
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43389

3 months agoiwlwifi: improve error message
Bjoern A. Zeeb [Mon, 12 Feb 2024 16:09:12 +0000 (16:09 +0000)]
iwlwifi: improve error message

In case we cannot identify the firmware monitor buf_location,
print the type (usually 0 = invalid) so we have an idea at least
of what was set (or not).

MFC after: 3 days

3 months agoLinuxKPI: 802.11: correct HT protection fields
Bjoern A. Zeeb [Mon, 29 Jan 2024 22:35:08 +0000 (22:35 +0000)]
LinuxKPI: 802.11: correct HT protection fields

It seems during the initial buildup of the file, the defines were
either mixed or not flagged as "FIXME".
Define the values through to the net80211 definitions and also
annotate them by at least some standards reference.

MFC after: 3 days
Fixes: 6b4cac814e32f
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43658

3 months agonet80211: fix checks for (*iv_preamble_update)/(*iv_ht_protmode_update)
Bjoern A. Zeeb [Mon, 29 Jan 2024 20:59:05 +0000 (20:59 +0000)]
net80211: fix checks for (*iv_preamble_update)/(*iv_ht_protmode_update)

Both vap_update_preamble() and vap_update_ht_protmode() also check for
(*iv_erp_protmode_update)() rather than (*iv_preamble_update)()
or (*iv_ht_protmode_update)() before calling the later.
Use the appropriate NULL-function-pointer checks before calling it.

All seem unused currently so no functional changes expected.

MFC after: 3 days
Fixes: f1481c8d3b58e
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43655

3 months agoloader: Make vidc_biosputchar static
Warner Losh [Wed, 14 Feb 2024 18:07:10 +0000 (11:07 -0700)]
loader: Make vidc_biosputchar static

It's currently unused outside of vidconsole.c. Gerald Hicks' fix to the
beep code from de37e4a6d2333/1998 introduced the funciton as
static. Maxim Sobolev (sobomax) made it non-static since his spinconsole
called it in c4c3b35172d67/2009. When sobomax dropped the direct call
after making spinconsole console independent in b35172d67/2017,
vidc_biosputchar remained a harmless unreferenced global. Make it static
once again.

Fixes: c7e10205ae0d
Sponsored by: Netflix

3 months agoloader: export the CMD_ constants in loader table
Warner Losh [Wed, 14 Feb 2024 17:51:58 +0000 (10:51 -0700)]
loader: export the CMD_ constants in loader table

Export the CMD_OK, etc constants in the loader table. They are the
return values of loader.perform, etc.

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

3 months agoloader: Fetch initial script from loader_lua env
Warner Losh [Wed, 14 Feb 2024 17:51:38 +0000 (10:51 -0700)]
loader: Fetch initial script from loader_lua env

Sometimes it is nice to override the initial script that we run. Make it
possible by fetching loader_lua from the env and using that instead of
the default if prsent.

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

3 months agoriscv: Introduce support for APLIC interrupt controller
Himanshu Chauhan [Wed, 14 Feb 2024 15:31:26 +0000 (11:31 -0400)]
riscv: Introduce support for APLIC interrupt controller

This patch introduces support for the RISC-V APLIC interrupt controller
[1]. Currently, it is only supports direct mode, i.e. without an IMSIC
and functionally replacing the legacy RISC-V PLIC. Work on IMSIC support
is in progress.

[1] https://github.com/riscv/riscv-aia/releases/tag/1.0

Reviewed by: mhorne
Discussed with: jrtc27
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D43293

3 months agoriscv: add firmware partitions to GENERICSD.conf
Mitchell Horne [Wed, 14 Feb 2024 15:12:57 +0000 (11:12 -0400)]
riscv: add firmware partitions to GENERICSD.conf

Create two partitions in the existing space at the beginning of the
image (8MB). These are intended to hold u-boot SPL and u-boot proper.

The partition types selected are compatible with SiFive boards, e.g. the
HiFive Unmatched. They can easily be overridden for a platform that uses
the same scheme but different partition types, e.g. the StarFive
VisionFive v2. Firmware is not actually installed, this too is left for
the user.

It is not as simple to create the firmware partitions after the fact,
e.g. with partition indices 3 and 4. It is a shortcoming of current day
u-boot that the SPL loader looks for a specific partition index, rather
than the partition type, meaning that we will fail to boot if partition
2 doesn't contain u-boot.

Thus, our GENERICSD images become more generically usable with current
RISC-V hardware/firmware platforms.

Reviewed by: manu, karels, imp
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43849

3 months agorelease: make SD card partition layout more flexible
Mitchell Horne [Wed, 14 Feb 2024 15:12:29 +0000 (11:12 -0400)]
release: make SD card partition layout more flexible

Currently the partition layout is hardcoded to create an EFI/FAT
partition and a UFS root partition, with some logic to handle GPT/MBR
differences.

On RISC-V platforms we are seeing the emerging pattern that firmware
should be placed in a partition of a known type, rather than just a
known sector of the disk. Thus, some functionality is needed to
customize the layout for SD card images.

Add a hook, arm_create_partitions(), which can be overridden to insert
additional platform-specific partitions, possibly preceding the standard
EFI and UFS ones. A couple of new variables are added to track the
indices, e.g. ROOTFSPART_SUFFIX=p2.

In a couple places this de-duplicates the GPT/MBR logic.

Reviewed by: manu, karels, imp
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43848

3 months agorelease: de-duplicate arm.subr fstab logic
Mitchell Horne [Wed, 14 Feb 2024 15:11:41 +0000 (11:11 -0400)]
release: de-duplicate arm.subr fstab logic

These days, the entries are the identical for GPT and MBR.

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

3 months agobuild: Do not run ctfconvert on VDSO files
Mark Johnston [Tue, 13 Feb 2024 23:06:58 +0000 (18:06 -0500)]
build: Do not run ctfconvert on VDSO files

Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43877

3 months agosched_setscheduler(2): Change realtime privilege check
Florian Walpen [Wed, 14 Feb 2024 13:50:44 +0000 (14:50 +0100)]
sched_setscheduler(2): Change realtime privilege check

Check for privilege PRIV_SCHED_SETPOLICY instead of PRIV_SCHED_SET, to
at least make it coherent with what is done at thread creation when
a realtime policy is requested, and have users authorized by
mac_priority(4) pass it.

This change is good enough in practice since it only allows 'root' (as
before) and mac_priority(4)'s authorized users in (the point of this
change), without other side effects.  More changes in this area, to
generally ensure that all privilege checks are consistent, are going to
come as olce's priority revamp project lands.

(olce: Expanded the explanations.)

PR:                     276962
Reported by:            jbeich
Reviewed by:            olce
Approved by:            emaste (mentor)
MFC after:              3 days
Differential Revision:  https://reviews.freebsd.org/D43835

3 months agowlan(4) - remove an(4) reference
Christopher Davidson [Wed, 14 Feb 2024 04:27:13 +0000 (23:27 -0500)]
wlan(4) - remove an(4) reference

Fixes: 663b174b5b53 ("an: Remove driver")
Pull request: https://github.com/freebsd/freebsd-src/pull/1120

3 months agotcp: fix RTO ssthresh for non-6675 pipe calculation
Richard Scheffenegger [Wed, 14 Feb 2024 13:51:39 +0000 (14:51 +0100)]
tcp: fix RTO ssthresh for non-6675 pipe calculation

Follow up on D43768 to properly deal with the non-default
pipe calculation. When CC_RTO is processed, the timeout
will have already pulled back snd_nxt. Further, snd_fack
is not pulled along with snd_una.

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

3 months agounbound: Vendor import 1.19.1
Cy Schubert [Mon, 13 Nov 2023 19:44:16 +0000 (11:44 -0800)]
unbound: Vendor import 1.19.1

Release notes at
    https://www.nlnetlabs.nl/news/2024/Feb/13/unbound-1.19.1-released/

Security: CVE-2023-50387, CVE-2023-50868
MFC after: 3 days

3 months agounbound: Vendor import 1.19.1
Cy Schubert [Mon, 13 Nov 2023 19:44:16 +0000 (11:44 -0800)]
unbound: Vendor import 1.19.1

Release notes at
    https://www.nlnetlabs.nl/news/2024/Feb/13/unbound-1.19.1-released/

3 months agobuild: Default to DWARF4 in the kernel
Mark Johnston [Sun, 11 Feb 2024 18:03:23 +0000 (13:03 -0500)]
build: Default to DWARF4 in the kernel

gcc 12 defaults to emitting DWARF 5, but this is not yet supported by
our libdwarf and thus by ctfconvert.

Reviewed by: emaste, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43837

3 months agoUpdate tzcode to 2024a.
Dag-Erling Smørgrav [Tue, 13 Feb 2024 20:20:44 +0000 (21:20 +0100)]
Update tzcode to 2024a.

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