]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 months agotests/sigsys: initialize parameter passed to sysctlbyname()
Gleb Smirnoff [Tue, 20 Feb 2024 22:37:45 +0000 (14:37 -0800)]
tests/sigsys: initialize parameter passed to sysctlbyname()

3 months agotests/fdgrowtable: remove always true check
Gleb Smirnoff [Tue, 20 Feb 2024 22:31:06 +0000 (14:31 -0800)]
tests/fdgrowtable: remove always true check

We are always the parent in this code path.

3 months agotests/fdgrowtable: open more files in the threaded case
Gleb Smirnoff [Tue, 20 Feb 2024 22:31:06 +0000 (14:31 -0800)]
tests/fdgrowtable: open more files in the threaded case

This should fix the test failing on some machines/conditions/runs.  This
won't fix failures in standalone run, but should fix kyua(1) runs.
Currently with standalone run it will usually fail because the 40-sized
allocation is skipped (see details below).

This matches what forking test does: open 128 files in the parent and 128
in the child.  There should actually be no difference where and when the
files are open, but let's mimic the forking test, and open more files in
the spawned thread.  Also opening from two different contexts adds a bit
more entropy to the test.

What the test does it checks that fdgrowtable() has been called at least
three tmes for the test process, and the old tables are still on the free
list as long as other execution contexts exist.  Under kyua(1) control the
first call grows the table from 20 to 40, but the original table of 20 is
an embedded one, thus is not put on the free list.  Passing 40 open files
the table grows to 128 and first old table lands on the free list. Passing
128 open file the table grows to 256 and a second old table lands on the
free list.  After that the test would pass.  The threaded test was one
open file off before this fix sometimes.

3 months agomd5: Untabify declarations.
Dag-Erling Smørgrav [Tue, 20 Feb 2024 22:04:45 +0000 (23:04 +0100)]
md5: Untabify declarations.

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

3 months agomd5: Fix GNU check mode.
Dag-Erling Smørgrav [Tue, 20 Feb 2024 22:04:40 +0000 (23:04 +0100)]
md5: Fix GNU check mode.

Fixes: 9b20849bc5f1b500f2de7aeca77f0e6556069bbb
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: imp, allanjude, markj
Differential Revision: https://reviews.freebsd.org/D43990

3 months agomd5: Fix Perl mode long options.
Dag-Erling Smørgrav [Tue, 20 Feb 2024 22:04:36 +0000 (23:04 +0100)]
md5: Fix Perl mode long options.

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

3 months agomd5: Add test case for GNU input modes.
Dag-Erling Smørgrav [Tue, 20 Feb 2024 22:04:32 +0000 (23:04 +0100)]
md5: Add test case for GNU input modes.

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

3 months agotests/arp: test arp -s/-S work
Gleb Smirnoff [Tue, 20 Feb 2024 18:32:03 +0000 (10:32 -0800)]
tests/arp: test arp -s/-S work

Install permanent entry, try to modify it, check that
net.link.ether.inet.log_arp_permanent_modify works.

3 months agotests/arp: when checking 'arp -d' check that entry is removed
Gleb Smirnoff [Tue, 20 Feb 2024 18:32:03 +0000 (10:32 -0800)]
tests/arp: when checking 'arp -d' check that entry is removed

Previous check trusted the "entry was deleted" output of the command.
Improved check does additional request to make sure that entry is not
returned.

3 months agoarp: fix arp -s/-S
Gleb Smirnoff [Tue, 20 Feb 2024 18:31:05 +0000 (10:31 -0800)]
arp: fix arp -s/-S

When setting a permanent ARP entry, the route(4) would use
rtm->rtm_rmx.rmx_expire == 0 as a flag for installing a static entry, but
netlink(4) is looking for explicit NTF_STICKY flag in the request.  The
arp(8) utility was adopted to use netlink(4) by default, but it has lots
of route-era guts internally. Specifically there is global variable 'opts'
that shares configuration for both protocols, and it is still initialized
with route(4) specific RTF_xxx flags.  In set_nl() these flags are
translated to netlink(4) parameters. However, RTF_STATIC is a flag that is
never set by default, so attempt to use it as a proxy flag manifesting
-s/-S results in losing it.  Use zero opts.expire_time as a manifest of
-s/-S operation.  This is a minimal fix.  A better one would be to fully
get rid of route(4) legacy.

The change also corrects the logic to set NUD_PERMANENT flag for
consistency.  This flag is ignored by our kernel (now).

Reviewed by: melifaro, tuexen, emaste
PR: 277063
Fixes: 6ad73dbf65048b0950a1ba6ff25607f6708c8954
Differential Revision: https://reviews.freebsd.org/D43983

3 months agoiwm.4: add iwlwifi cross-reference
Ed Maste [Tue, 20 Feb 2024 16:43:00 +0000 (11:43 -0500)]
iwm.4: add iwlwifi cross-reference

iwlwifi(4) supports a superset of the devices supported by iwm(4).  The
latter may be retired in the future (if there is no reason to prefer it
for the set of devices supported by both).

Sponsored by: The FreeBSD Foundation

3 months agomsdosfs: fix potential inode collision on FAT12 and FAT16
Stefan Eßer [Tue, 20 Feb 2024 12:02:24 +0000 (13:02 +0100)]
msdosfs: fix potential inode collision on FAT12 and FAT16

FAT file systems do not use inodes, instead all file meta-information
is stored in directory entries.

FAT12 and FAT16 use a fixed size area for root directories, with
typically 512 entries of 32 bytes each (for a total of 16 KB) on hard
disk formats. The file system data is stored in clusters of typically
512 to 4096 bytes, depending on the size of the file system.

The current code uses the offset of a DOS 8.3 style directory entry as
a pseudo-inode, which leads to inode values of 0 to 16368 for typical
root directories with 512 entries.

Sub-directories use 2 cluster length plus the byte offset of the
directory entry in the data area for the pseudo-inode, which may be
as low as 1024 in case of 512 byte clusters. A sub-directory in
cluster 2 and with 512 byte clusters will therefore lead to a
re-use of inode 1024 when there are at least 32 DOS 8.3 style
filenames in the root directory (or 11 14-character Windows
long file names, each of which takes up 3 directory entries).

FAT32 file systems are not affected by this issue and FAT12/FAT16
file systems with larger cluster sizes are unlikely to have as
many directory entries in the root directory as are required to
cause the collision.

This commit leads to inode numbers that are guaranteed to not collide
for all valid FAT12 and FAT16 file system parameters. It does also
provide a small speed-up due to more efficient use of the vnode cache.

Approved by: mckusick
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D43978

3 months agotools/net80211/wlanwatch: Remove obsolete code.
Joseph Koshy [Mon, 19 Feb 2024 16:46:45 +0000 (16:46 +0000)]
tools/net80211/wlanwatch: Remove obsolete code.

The symbol NI_WITHSCOPEID has not been defined by <netdb.h> since
May 2005 (since SVN r146690).

3 months agonextboot: fix nextboot -k on ZFS
Gleb Smirnoff [Tue, 20 Feb 2024 03:51:22 +0000 (19:51 -0800)]
nextboot: fix nextboot -k on ZFS

zfsbootcfg(1) expects pool name to operate on, not currently mounted
filesystem name.

Fixes: fd6d47375a78fbf0737012b7cc11180291781e8b

3 months agonextboot: fix typo that merged two args into one
Gleb Smirnoff [Tue, 20 Feb 2024 03:51:22 +0000 (19:51 -0800)]
nextboot: fix typo that merged two args into one

Fixes: fd6d47375a78fbf0737012b7cc11180291781e8b

3 months agoEliminate unnecessary UFS1 integrity checks.
Kirk McKusick [Tue, 20 Feb 2024 00:16:07 +0000 (16:16 -0800)]
Eliminate unnecessary UFS1 integrity checks.

The UFS1 integrity checks added in FreeBSD 14 were too aggressive
for UFS1 filesystems created in FreeBSD 4 and 9 systems. This patch
removes those tests which can be done safely since they are not
relevant to the current implementation of UFS1.

This is a follow-on report to bug report 264450 (comments 21-28).

Reported by: slb@sonnet.com
Tested by:   slb@sonnet.com
PR:          264450
MFC after:   1 week

3 months agozlib: use more memory for a small deflate speedup.
Xin LI [Mon, 19 Feb 2024 23:01:04 +0000 (15:01 -0800)]
zlib: use more memory for a small deflate speedup.

The LIT_MEM option uses slightly more memory (for base gzip(1),
about 16kiB; according to the author, about 6% for default deflate
settings) for a small speedup.

The performance gain is more noticeable for input data with higher
entropy and less significant for data that is highly compressible,
such as source code and logs.

MFC after: 1 month

3 months agolib{c,thr}: add DT_RUNPATH for gcc -m32
Brooks Davis [Mon, 19 Feb 2024 22:44:08 +0000 (22:44 +0000)]
lib{c,thr}: add DT_RUNPATH for gcc -m32

To allow gcc -m32 to work, link libc and libthr with --rpath-/usr/lib32.
When called with -m32, gcc is currently unable to communicate to
the bfd linker that it should look in /usr/lib32 to resolve needed (as
opposed to explicitly linked) libraries so we need to provide a hint.

See also: https://sourceware.org/bugzilla/show_bug.cgi?id=31395

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

3 months agolib{c,sys}: move auxargs more firmly into libsys
Brooks Davis [Mon, 19 Feb 2024 22:44:08 +0000 (22:44 +0000)]
lib{c,sys}: move auxargs more firmly into libsys

Continue to filter the public interface (elf_aux_info()), but entierly
relocate the private interfaces (_elf_aux_info(),
__init_elf_aux_vector(), and __elf_aux_vector) to libsys.

This ensures that rtld updates the correct (only) copy of
__elf_aux_vector.  After 968a18975adc9c2a619bb52aa2f009de99fc9e24
updates were confused and __getosreldate was failing, causing
the system to fall back to compat compat12 syscalls in some cases.

Return to explicitly linking libc to libsys and link libthr with libc
and libsys (in that order).

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

3 months agols: Fix -v and associated test
Warner Losh [Mon, 19 Feb 2024 16:48:05 +0000 (09:48 -0700)]
ls: Fix -v and associated test

The cleanup of d854370fa86b7 had a cut and paste error (so f_verssort
was set to 1 and then to 0 rather thame f_timesort being set to 0).

Fixes: d854370fa86b7
Sponsored by: Netflix

3 months agoumtxvar.h: Add missing include
Olivier Certner [Thu, 8 Feb 2024 20:11:17 +0000 (21:11 +0100)]
umtxvar.h: Add missing include

Necessary to have the definition of 'struct timespec'.

No functional change.

Approved by:        markj (mentor)
MFC after:          3 days
Sponsored by:       The FreeBSD Foundation

3 months agosched: sched_switch(): Factorize sleepqueue flags
Olivier Certner [Tue, 16 Jan 2024 09:42:11 +0000 (10:42 +0100)]
sched: sched_switch(): Factorize sleepqueue flags

Avoid duplicating common flags for the preempted and non-preempted
cases, making it clear that they are the same without resorting to
formatting.

No functional change.

Approved by:        markj (mentor)
MFC after:          3 days
Sponsored by:       The FreeBSD Foundation

3 months agocommitters-src: Add bnovkov@ with markj@ and jhb@ as mentors
Bojan Novković [Mon, 19 Feb 2024 15:55:31 +0000 (16:55 +0100)]
committers-src: Add bnovkov@ with markj@ and jhb@ as mentors

Add mentorship information for bnovkov@.

Approved by:  markj (mentor)
Differential Revision: https://reviews.freebsd.org/D43963

3 months agonet80211: Fix two typos in kernel messages
Gordon Bergling [Mon, 19 Feb 2024 11:08:07 +0000 (12:08 +0100)]
net80211: Fix two typos in kernel messages

- s/defered/deferred/

MFC after: 5 days

3 months agoiov.h: Fix a typo in a source code comment
Gordon Bergling [Mon, 19 Feb 2024 11:02:57 +0000 (12:02 +0100)]
iov.h: Fix a typo in a source code comment

- s/subystem/subsystem/

MFC after: 3 days

3 months agougen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver
Andriy Gapon [Mon, 19 Feb 2024 10:44:00 +0000 (12:44 +0200)]
ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver

Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached.  That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

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

3 months agoscsi_da: add 4K quirks for Samsung SSD 860 and 870
Andriy Gapon [Mon, 19 Feb 2024 10:16:47 +0000 (12:16 +0200)]
scsi_da: add 4K quirks for Samsung SSD 860 and 870

Although the actual flash page size is either 8K or 16K for those
devices (according to different sources of various reliability), they
seem to be optimized for the "industry-standard" emulated 4K block size.

To do: consolidate very similar Samsung SSD entries for 830 - 870
models.

MFC after: 2 weeks

3 months agoata_da: add quirk to disable NCQ TRIM for Samsung 860/870 SSDs
Andriy Gapon [Mon, 19 Feb 2024 10:08:12 +0000 (12:08 +0200)]
ata_da: add quirk to disable NCQ TRIM for Samsung 860/870 SSDs

NCQ TRIM for Samsung 860/870 SSDs results in data corruption on systems
with some SATA controllers.

This can be easily reproduced using ZFS which uses TRIM and is able to
detect block content changes.

Linux bug report for this issue:
 https://bugzilla.kernel.org/show_bug.cgi?id=201693

Since at present we can not limit a quirk based on the contorller / SIM,
apply the quirk in all cases.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43961

3 months agondp(8): increase buffer size in rtsock mode
Boris Lytochkin [Mon, 19 Feb 2024 07:44:52 +0000 (10:44 +0300)]
ndp(8): increase buffer size in rtsock mode

On a router with many connected devices (~10k+) `ndp -an` can fail
with ENOMEM because of some additional NDP records were added
between sysctl() buffer size estimate and data fetch calls.

Allocate more space based on size estimate: 1/64 (~2%) of additional
space, but not less that 4 m_rtmsg structures.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D43956

3 months agoada: Another NCQ Trim instability drive
Warner Losh [Mon, 19 Feb 2024 05:10:55 +0000 (22:10 -0700)]
ada: Another NCQ Trim instability drive

The Seagate IronWolf 110 SATA SSD drive has been reported to be unstable
with NCQ trim enabled.

PR: 264139
Sponsored by: Netflix

3 months agocrontab/crontab.1: Fix crontab path in man
Muhammad Moinur Rahman [Sun, 18 Feb 2024 23:56:16 +0000 (00:56 +0100)]
crontab/crontab.1: Fix crontab path in man

In FreeBSD the crontabs are stored in /var/cron/tabs directory and not
in /var directory.

Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D43181

3 months agorelease/tools: Add support for building armv7 vm
Muhammad Moinur Rahman [Sun, 18 Feb 2024 23:49:52 +0000 (00:49 +0100)]
release/tools: Add support for building armv7 vm

Currently there is no support for generating armv7 vm images in the
release artifacts. In fact in terms of release artifacts and
architecture there is no good reason to have a vm release artifact for
armv7 as those are mostly used in SOCs or embedded boards. However
considering that developers actually do need an easy way to test armv7
with a vm running this is really important. As part of pre-commit ci for
developers this can be really helpful for the end developers.

Approved by: cperciva, imp, re
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43952

3 months agowc: Fix SIGINFO race with casper init.
Bryan Drewery [Sun, 18 Feb 2024 18:55:11 +0000 (10:55 -0800)]
wc: Fix SIGINFO race with casper init.

If a file is specified then fileargs_init(3) may return [EINTR]. With
the SIGINFO handler not being SA_RESTART this causes an early exit
if a SIGINFO comes in. Rather than checking for [EINTR] or changing the
handler just move it later which resolves the problem.

3 months agonet80211: increase number of spares in struct ieee80211_vap
Bjoern A. Zeeb [Sun, 18 Feb 2024 17:47:22 +0000 (17:47 +0000)]
net80211: increase number of spares in struct ieee80211_vap

Turns out MFCing 713db49d06deee90dd358b2e4b9ca05368a5eaf6 does not
leave us with enough spares.  Given wireless will likely see more
changes in the near future add more spares.
This is especially necessary given 'struct ieee80211_vap' gets
allocated by drivers.
Bumps size of struct ieee80211_vap to (7 * 512) on 64bit.

3 months agosdiff: Fix binary case.
Dag-Erling Smørgrav [Sun, 18 Feb 2024 17:39:31 +0000 (18:39 +0100)]
sdiff: Fix binary case.

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

3 months agosdiff: Fix --expand-tabs and --tabsize.
Dag-Erling Smørgrav [Sun, 18 Feb 2024 17:39:28 +0000 (18:39 +0100)]
sdiff: Fix --expand-tabs and --tabsize.

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

3 months agosdiff: Misc cleanup.
Dag-Erling Smørgrav [Sun, 18 Feb 2024 17:39:23 +0000 (18:39 +0100)]
sdiff: Misc cleanup.

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

3 months agosnd_hda: Add patches for the Lenovo Ideapad 330-15 and ThinkPad X230
Dmitry Lukhtionov [Sun, 18 Feb 2024 17:07:39 +0000 (19:07 +0200)]
snd_hda: Add patches for the Lenovo Ideapad 330-15 and ThinkPad X230

PR: 259640
MFC after: 2 weeks
Reviewed by: delphij, markj
Differential Revision: https://reviews.freebsd.org/D43804

3 months agork8xx_poweroff: add parentheses missed in 8b408fc6f2
Andriy Gapon [Sun, 18 Feb 2024 16:26:20 +0000 (18:26 +0200)]
rk8xx_poweroff: add parentheses missed in 8b408fc6f2

Fixes: 8b408fc6f2
MFC after: 2 weeks

3 months agounionfs: work around underlying FS failing to respect cn_namelen
Jason A. Harmening [Sun, 24 Dec 2023 04:48:19 +0000 (22:48 -0600)]
unionfs: work around underlying FS failing to respect cn_namelen

unionfs_mkshadowdir() may be invoked on a non-leaf pathname component
during lookup, in which case the NUL terminator of the pathname buffer
will be well beyond the end of the current component.  cn_namelen in
this case will still (correctly) indicate the length of only the
current component, but ZFS in particular does not currently respect
cn_namelen, leading to the creation on inacessible files with slashes
in their names.  Work around this behavior by temporarily NUL-
terminating the current pathname component for the call to VOP_MKDIR().

https://github.com/openzfs/zfs/issues/15705 has been filed to track
a proper upstream fix for the issue at hand.

PR: 275871
Reported by: Karlo Miličević <karlo98.m@gmail.com>
Tested by: Karlo Miličević <karlo98.m@gmail.com>
Reviewed by: kib, olce
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43818

3 months agounionfs: upgrade the vnode lock during fsync() if necessary
Jason A. Harmening [Sun, 24 Dec 2023 04:42:28 +0000 (22:42 -0600)]
unionfs: upgrade the vnode lock during fsync() if necessary

If the underlying upper FS supports shared locking for write ops,
as is the case with ZFS, VOP_FSYNC() may only be called with the vnode
lock held shared.  In this case, temporarily upgrade the lock for
those unionfs maintenance operations which require exclusive locking.

While here, make unionfs inherit the upper FS' support for shared
write locking.  Since the upper FS is the target of VOP_GETWRITEMOUNT()
this is what will dictate the locking behavior of any unionfs caller
that uses vn_start_write() + vn_lktype_write(), so unionfs must be
prepared for the caller to only hold a shared vnode lock in these
cases.

Found in local testing of unionfs atop ZFS with DEBUG_VFS_LOCKS.

MFC after: 2 weeks
Reviewed by: kib, olce
Differential Revision: https://reviews.freebsd.org/D43817

3 months agoVFS: update VOP_FSYNC() debug check to reflect actual locking policy
Jason A. Harmening [Tue, 26 Dec 2023 02:02:25 +0000 (20:02 -0600)]
VFS: update VOP_FSYNC() debug check to reflect actual locking policy

Shared vs. exclusive locking is determined not by MNT_EXTENDED_SHARED
but by MNT_SHARED_WRITES (although there are several places that
ignore this and simply always use an exclusive lock).  Also add a
comment on the possible difference between VOP_GETWRITEMOUNT(vp)
and vp->v_mount on this path.

Found by local testing of unionfs atop ZFS with DEBUG_VFS_LOCKS.

MFC after: 2 weeks
Reviewed by: kib, olce
Differential Revision: https://reviews.freebsd.org/D43816

3 months agounionfs: cache upper/lower mount objects
Jason A. Harmening [Fri, 22 Dec 2023 20:13:35 +0000 (14:13 -0600)]
unionfs: cache upper/lower mount objects

Store the upper/lower FS mount objects in unionfs per-mount data and
use these instead of the v_mount field of the upper/lower root
vnodes.  As described in the referenced PR, it is unsafe to access this
field on the unionfs unmount path as ZFS rollback may have obliterated
the v_mount field of the upper or lower root vnode.  Use these stored
objects to slightly simplify other code that needs access to the
upper/lower mount objects as well.

PR: 275870
Reported by: Karlo Miličević <karlo98.m@gmail.com>
Tested by: Karlo Miličević <karlo98.m@gmail.com>
Reviewed by: kib (prior version), olce
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43815

3 months agosyscon_power: do reboot after shutdown_panic is executed
Andriy Gapon [Fri, 9 Jul 2021 15:00:21 +0000 (18:00 +0300)]
syscon_power: do reboot after shutdown_panic is executed

A syscon_power instance can handle either poweroff or reboot, but not
both.  If the instance handles reboot then set its priority to be after
shutdown_panic.

This is to provide uniform experience with other platforms.

MFC after: 3 weeks

3 months agopsci: split off psci_reboot from psci_shutdown
Andriy Gapon [Fri, 9 Jul 2021 15:01:57 +0000 (18:01 +0300)]
psci: split off psci_reboot from psci_shutdown

Priority of psci_reboot set so that it is run after shutdown_panic is
executed.  This is to provide uniform experience with other platforms.

MFC after: 3 weeks

3 months agork8xx_poweroff: enable power-cycling on support hardware
Andriy Gapon [Sun, 18 Feb 2024 13:57:34 +0000 (15:57 +0200)]
rk8xx_poweroff: enable power-cycling on support hardware

Previously, the function would return early if RB_POWERCYCLE was
specified without RB_POWEROFF.  Those flags are exclusive at the moment,
that is, they are never set together.

Søren Schmidt (sos) uses a similar but extended patch locally.

MFC after: 2 weeks

3 months agoaw_gpio: temporarily switch to input function if read in eint mode
Andriy Gapon [Sun, 18 Feb 2024 13:55:20 +0000 (15:55 +0200)]
aw_gpio: temporarily switch to input function if read in eint mode

This is needed for gpiokeys driver that needs to read input state after
receiving an interrupt for either edge.

PR: 248138
MFC after: 1 month

3 months agosctp(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 18 Feb 2024 12:01:04 +0000 (13:01 +0100)]
sctp(4): Fix a typo in a source code comment

- s/anthing/anything/

MFC after: 3 days

3 months agotzcode: Fix overflow handling in TZ parser.
Dag-Erling Smørgrav [Sun, 18 Feb 2024 09:48:08 +0000 (10:48 +0100)]
tzcode: Fix overflow handling in TZ parser.

Obtained from: upstream 9fc11a27
MFC after: 1 week
PR: 276281

3 months agoboot/universe.sh: Add tests to keep MK_LOADER_BIOS_TEXTONLY working
Warner Losh [Sun, 18 Feb 2024 06:28:33 +0000 (23:28 -0700)]
boot/universe.sh: Add tests to keep MK_LOADER_BIOS_TEXTONLY working

Sponsored by: Netflix

3 months agoloader: Make MK_LOADER_BIOS_TEXTONLY work
Warner Losh [Sun, 18 Feb 2024 06:15:01 +0000 (23:15 -0700)]
loader: Make MK_LOADER_BIOS_TEXTONLY work

Select between text-only and graphical frame buffer consoles for the
BIOS boot loader. Pull one or the other in with #ifdef in conf.c. Add
gfx_bios.c for the few routines that are needed for the BIOS support of
gfx. These are stubbed out for text-only mode. Move bi_load_vbe_data
here since it's only used for the graphical frame buffer.

Note: This setup also allows us to build multiple BIOS loaders if we
have to, some with text-only and some graphical. We don't do this today.
We may be forced to turn this on in the future if ZFS keeps growing.

The size savings is 41k, which helps a lot with some of our users that
want to enable more options in the BIOS boot loader than are normally
safe to do, and they don't need graphics.

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

3 months agoloader: Add textvidc to build
Warner Losh [Sun, 18 Feb 2024 06:14:56 +0000 (23:14 -0700)]
loader: Add textvidc to build

Add textvidc to the build. And use -DTERM_EMU to build it.

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

3 months agoloader: Add new option WITH_LOADER_BIOS_TEXTONLY
Warner Losh [Sun, 18 Feb 2024 06:14:50 +0000 (23:14 -0700)]
loader: Add new option WITH_LOADER_BIOS_TEXTONLY

This option will omit all the graphics support, the teken terminal
library, video mode support, etc and support a simple, basic, text-only
video console for the x86 BIOS boot loader. It uses the FreeBSD 12
version of vidconsole.c. It defaults to NO.

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

3 months agoloader: bring back old text-only video console
Warner Losh [Sun, 18 Feb 2024 06:14:44 +0000 (23:14 -0700)]
loader: bring back old text-only video console

Bring back vidconsole.c as textvidc.c from 2a0e2c88db20. This console
does no graphics stuff at all, supports no fancy logos, has known bugs
in the terminal emulation, etc. However, it is small. It will be a
build-time option to select between the two. The BIOS loader is running
out of space when too many options are selected, so this allows people
to select the smaller one to spend the space elsewhere. This is only the
verbatim copy of the old vidconsole.c. It's not yet connected to the
build.

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

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