FreeBSD/src 2c65f96sys/compat/linuxkpi/common/src linux_pci.c

LinuxKPI: pci: fix two errors in lkpi_pci_get_device()

On any result we need to acquire a reference. pci_dev_get() deals with
a NULL argument so we can simply pass what we "found" at the end.
This will avoid reference count problems.

If the iteration on the linux list in lkpi_pci_get_device() does
not find a match pdev will still be defined at the end of the
loop but not pointing to a valid pdev.
Store the found entry in a 2nd variable which otherwise will be NULL.
This will avoid random panics, usually in sysfs_remove_dir() when
the reference gets released.

Found during mt76 bringup.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Fixes:          8f61992d7cc11
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D50153
DeltaFile
+7-3sys/compat/linuxkpi/common/src/linux_pci.c
+7-31 files

FreeBSD/src 93b8214sys/compat/linuxkpi/common/include/linux ktime.h

LinuxKPI: add ktime_get_boottime_seconds()

ktime_get_boottime_seconds() is needed by an updated iwlwifi driver.

Sposored by:    The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D50005
DeltaFile
+7-0sys/compat/linuxkpi/common/include/linux/ktime.h
+7-01 files

FreeBSD/src 71576edsys/compat/linuxkpi/common/include/linux devcoredump.h

LinuxKPI: add _devcd_free_sgtable() to devcoredump.h

It may be that once we implement freeing of chained tables
_devcd_free_sgtable() will become our _lkpi_dev_coredumpsg_free()
but further investigations need to happen.  For now make an
updated iwlwifi driver happy which should not need more.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D50006
DeltaFile
+8-1sys/compat/linuxkpi/common/include/linux/devcoredump.h
+8-11 files

FreeBSD/src 96e86aasys/compat/linuxkpi/common/src linux_pci.c

LinuxKPI: pci: deal with kobject_add() being able to fail

lkpifill_pci_dev() uses a sequene of kobject_init/set_name/add.
The problem is that kobject_add could fail.

Move the entire logic to the beginning of the function,
switch to kobject_init_and_add() and check the return code.
Make lkpifill_pci_dev() return the error and deal in the callers
with a possible error accordingly.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D50154
DeltaFile
+22-7sys/compat/linuxkpi/common/src/linux_pci.c
+22-71 files

FreeBSD/src 8414a2eshare/misc committers-src.dot

committers-src: add myself (khorben@) with philip@ as mentor

Approved by:    philip (mentor)
Differential Revision:  https://reviews.freebsd.org/D50255
DeltaFile
+2-0share/misc/committers-src.dot
+2-01 files

FreeBSD/src 5d50c23share/man/man5 src.conf.5, tools/build/options WITH_ZONEINFO_LEAPSECONDS_SUPPORT

src.conf.5: Add WITH_ZONEINFO_LEAPSECONDS_SUPPORT warning

People are turning on the option and then tripping over weird
consequences.  See bugs 248338 and 271170 as examples.

Approved by:    cy, imp, philip
Differential Revision:  https://reviews.freebsd.org/D25902

Co-authored-by: Joseph Mingrone <jrm at FreeBSD.org>
DeltaFile
+6-1share/man/man5/src.conf.5
+5-0tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT
+11-12 files

FreeBSD/src a9b30c9contrib/bsddialog/lib barbox.c bsddialog_progressview.h

bsddialog: Correct type for bsddialog_total_progview

It was an int, but printed with %lli format.  Although it would be
reasonable to use a 32-bit int here (i.e., changing the printf format
instead) this matches what was done in bsddialog upstream (and now in
main).

PR:             286655
Reviewed by:    asiciliano
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50261
DeltaFile
+2-2contrib/bsddialog/lib/barbox.c
+2-2contrib/bsddialog/lib/bsddialog_progressview.h
+4-42 files

FreeBSD/src 7ffedfeusr.sbin/service service.8 service.sh

service(8): Allow for passing no arguments to the service script

Currently, service(8) requires the user to provide a command to the
rc service script. For example,

    service cron

does not even run the cron rc service script but
instead shows the usage message of service(8).

This patch makes it so running the rc service script with no arguments
via service(8) is closer to running the rc service script directly
(e.g., /etc/rc.d/cron).

Long story short, for most of the rc service scripts this change means
that running "service FOO" now shows the usage message of FOO instead of
the usage message of service(8).

PR:             255115

    [4 lines not shown]
DeltaFile
+2-2usr.sbin/service/service.8
+1-1usr.sbin/service/service.sh
+3-32 files

FreeBSD/src de121c5share/examples/jails jng

jail: copy MTU settings to vnet interface

Reported by:    Arne Steinkamm <arne at steinkamm.com>
Reviewed by:    bapt, thj
Differential Revision:  https://reviews.freebsd.org/D48334
DeltaFile
+3-0share/examples/jails/jng
+3-01 files

FreeBSD/src bcd85e0sys/amd64/sgx sgx.c, sys/arm/nvidia/drm2 tegra_bo.c

vm_page: make iter_insert() public

In places where vm_page_insert() is used after lookups, or for
consecutive pages, use vm_page_iter_insert instead, to exploit
locality.

Reviewed by:    kib, markj
Differential Revision:  https://reviews.freebsd.org/D50248
DeltaFile
+30-32sys/amd64/sgx/sgx.c
+8-3sys/compat/linuxkpi/common/src/linux_page.c
+6-3sys/dev/drm2/ttm/ttm_bo_vm.c
+3-1sys/arm/nvidia/drm2/tegra_bo.c
+1-1sys/vm/vm_page.c
+2-0sys/vm/vm_page.h
+50-406 files

FreeBSD/src 8703b57sys/kern subr_pctrie.c, sys/sys pctrie.h

vm_page_grab_pages: fetch page ranges

Define an iterator based function for reading a range of consecutive,
non-NULL leaves from a pctrie. Adapt it to vm pages.  Use it in
vm_page_grab_pages to fetch more than one page at a time.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D50253
DeltaFile
+24-7sys/kern/subr_pctrie.c
+15-1sys/sys/pctrie.h
+10-4sys/vm/vm_page.c
+11-0sys/vm/vm_radix.h
+60-124 files

FreeBSD/src 2fa185fshare/man/man9 crypto_request.9, sys/opencrypto crypto.c cryptodev.c

crypto: Remove uses of CRYPTO_F_DONE

Previously OCF set CRYPTO_F_DONE prior to invoking the completion
callback, even if the request failed. This isn't particularly useful
and leads to bugs when consumers retry a failed request, since OCF also
asserts that CRYPTO_F_DONE is clear in crypto_dispatch(). (Really, OCF
should retry requests that fail with EAGAIN, but that's a larger
change.)

For now, just stop setting CRYPTO_F_DONE to simplify consumers (and fix
those which fail to clear the flag before retrying a request).

PR:             286321
Reviewed by:    jhb
Differential Revision:  https://reviews.freebsd.org/D50104
DeltaFile
+1-12share/man/man9/crypto_request.9
+0-6sys/opencrypto/crypto.c
+0-2sys/opencrypto/cryptodev.c
+1-1sys/opencrypto/cryptodev.h
+0-2sys/opencrypto/ktls_ocf.c
+1-1sys/sys/param.h
+3-242 files not shown
+3-268 files

FreeBSD/src 04421fdsys/kgssapi/krb5 kcrypto_aes.c

krb5: Fix handling of transient crypto request failures

- Instead of using CRYPTO_F_DONE to decide whether a request has
  completed, use a custom protocol of setting crp_opaque = NULL in the
  callback and checking that instead.  CRYPTO_F_DONE is set independent
  of whether an error occurred, but for transient errors signaled by
  EAGAIN, we want to simply retry the request.
- Clear CRYPTO_F_DONE before retrying the request.
- Panic if the request truly failed, as we currently have no way to
  pass hard errors back up.

Reviewed by:    jhb
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D50238
DeltaFile
+19-11sys/kgssapi/krb5/kcrypto_aes.c
+19-111 files

FreeBSD/src 0e80651sys/conf newvers.sh

14.3: Update to BETA2

Approved by:    re (implicit)
Sponsored by:   Amazon
DeltaFile
+1-1sys/conf/newvers.sh
+1-11 files

FreeBSD/src 33759fclibexec/rtld-elf rtld.c

rtld: remove stray tabs

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+2-2libexec/rtld-elf/rtld.c
+2-21 files

FreeBSD/src 8d6b758sys/net80211 ieee80211_ioctl.c

net80211: fix a race between ieee80211_sta_join and scan entries

We were seeing panics during ieee80211_sta_join() which seemed that
the ni->ni_chan was not valid anymore, which was true.
We also saw errors indicating data put into ni_ies became inalid.

The problem was that the ieee80211_scan_entry passed into
ieee80211_sta_join() (in the observed case from setmlme_assoc_sta())
became invalid during ieee80211_alloc_node().
As a result for the ni_chan case the the rateset and len in rates[1]
became invalid.  Similarly for the IEs.

Make a (deep)copy of the scan entry in setmlme_assoc_sta() and return
the copy as once we leave ieee80211_scan_iterate() we can no longer
rely on the scan entry to be valid.

Sponsored by:   The FreeBSD Foundation
Reported by:    rm, ziaee, bz
Tested by:      rm, ziaee, bz

    [7 lines not shown]
DeltaFile
+21-5sys/net80211/ieee80211_ioctl.c
+21-51 files

FreeBSD/src 873c0easys/compat/linuxkpi/common/include/linux ieee80211.h, sys/compat/linuxkpi/common/include/net cfg80211.h mac80211.h

LinuxKPI: 802.11: header updates for mt76

Add more structs, fields, flags, defines.

Sponsored by:   The FreeBSD Foundation
Approved by:    re (cperciva)

(cherry picked from commit 675e6b1c68ba71af1853952f7df4d84399340009)
(cherry picked from commit 6a0dbc0a1246c9825f0892bb6dd957f5d081057a)
DeltaFile
+67-29sys/compat/linuxkpi/common/include/net/cfg80211.h
+27-9sys/compat/linuxkpi/common/include/net/mac80211.h
+6-0sys/compat/linuxkpi/common/include/linux/ieee80211.h
+100-383 files

FreeBSD/src 7194631sys/compat/linuxkpi/common/include/net cfg80211.h

LinuxKPI: 802.11: fix wiphy_info[_once]

The dev field in wiphy is a pointer already; no need for &.

Sponsored by:   The FreeBSD Foundation
Fixes:          ac1d519c01ca8
Approved by:    re (cperciva)

(cherry picked from commit 845b81cf908002b14ac08ce8c42246720a5b30d9)
(cherry picked from commit a21addc7a0137c5938414df322dbf5f929729834)
DeltaFile
+2-2sys/compat/linuxkpi/common/include/net/cfg80211.h
+2-21 files

FreeBSD/src 7866169stand/i386/loader Makefile

loader: i386: use -z nostart-stop-gc for bfd as well

binutils 2.37 seems to have added the knob, so let's just use that
version here (it's not clear if GC'ing start/stop symbols was actually
made the default at the time, and it didn't seem worth it to dig much
further).  This fixes misbehavior when built with more recent binutils,
as we do rely on linker sets for loader commands that we use.

Reported by:    sjg
Reviewed by:    dim, sjg
Differential Revision:  https://reviews.freebsd.org/D50252
DeltaFile
+2-1stand/i386/loader/Makefile
+2-11 files

FreeBSD/src 4a38527sys/dev/acpica acpi_resource.c

pci: Ignore PCRx devices resources

Some systems provide two PCI root complex devices in the ACPI tables.
Allow us to skip known pci-like devices even if they aren't detected
as a PCI root complex.

Reviewed by:    cognet, jhb
Co-authored-by: cognet
Differential Revision:  https://reviews.freebsd.org/D49709
DeltaFile
+15-0sys/dev/acpica/acpi_resource.c
+15-01 files

FreeBSD/src 95528b6sys/kern vfs_cache.c

VFS cache: Fix initial sizing for non-default 'ncsizefactor'

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

(cherry picked from commit 811f6a0ae0230fb09b666276cbe93a8be4fe7c73)
DeltaFile
+1-1sys/kern/vfs_cache.c
+1-11 files

FreeBSD/src e5baab9sys/kern vfs_cache.c

Revert "VFS cache: Fix initial sizing for non-default 'ncsizefactor'"

Because it unadvertently was committed without the proper tags.  Will be recommitted with them.

This reverts commit 455203ec8885 (VFS cache: Fix initial sizing for non-default 'ncsizefactor', 2025-05-01).
DeltaFile
+1-1sys/kern/vfs_cache.c
+1-11 files

FreeBSD/src d285265lib/libusb libusb10_hotplug.c libusb10_io.c

libusb: Emit event after deregistering hotplug handler

The original implementation did not emit an event when a hotplug handler
was deregistered. This omission causes issues for programs that follow
the best practices recommended by libusb—particularly those that use
`libusb_hotplug_register_callback()` or similar functions in a loop
while managing hotplug handlers dynamically.

Without emitting an event after deregistration, these programs can
become stuck waiting indefinitely for an event that will never come,
as the condition to break out of the wait loop is never satisfied.

See: https://github.com/libusb/libusb/blob/6c0ae1ab456da49e7805115e77ce0428ace4ea41/libusb/hotplug.c#L459

Reviewed by:    bapt
Sponsored By:   FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50170
DeltaFile
+1-0lib/libusb/libusb10_hotplug.c
+1-0lib/libusb/libusb10_io.c
+2-02 files

FreeBSD/src 08f613elib/libc/gen fts.c

fts: Fix misindented line.

Fixes:          da2025a0e894
Sponsored by:   Klara, Inc.
DeltaFile
+2-2lib/libc/gen/fts.c
+2-21 files

FreeBSD/src eca0ce8share/man/man3 Makefile

queue(3): Install *_SPLIT_AFTER() links to the main manual page

Completes commit "queue(3): New *_SPLIT_AFTER(), *_ASSERT_EMPTY(),
*_ASSERT_NONEMPTY()" (c02880233949b01f).

MFC after:      1 day
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit c071616b06aa0f51ac4314f989c472d0268c2ddb)
DeltaFile
+4-0share/man/man3/Makefile
+4-01 files

FreeBSD/src efce9f8sys/contrib/openzfs/module/os/freebsd/zfs zfs_znode_os.c, sys/fs/devfs devfs_devs.c

sysctl(9): Ease exporting struct sizes; Discourage doing that

Introduce two helpers, the more general SYSCTL_SIZEOF() and
a struct-specific one SYSCTL_SIZEOF_STRUCT() which prepends 'struct' in
the description and in the use of sizeof() but uses the raw structure
name as the knob's name.  The size of the object/structure is exported
under 'debug.sizeof'.

Existing knobs under 'debug.sizeof' were all converted to use the
helpers.

Add a note before the helpers discouraging the introduction of new
leaves for ad-hoc reasons.  List alternative means for developers to
obtain the size of arbitrary kernel structures easily (thanks to markj@
for providing these).

No functional change (intended).

Reviewed by:    kib, markj

    [5 lines not shown]
DeltaFile
+21-0sys/sys/sysctl.h
+6-12sys/kern/kern_mib.c
+5-10sys/geom/geom_kern.c
+2-5sys/fs/devfs/devfs_devs.c
+4-0sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode_os.c
+1-2sys/kern/subr_devstat.c
+39-291 files not shown
+40-317 files

FreeBSD/src 5af1870tools/test/stress2/misc exlock2.sh

stress2: exlock2.sh: Preserve behavior after ps(1)'s '-U' change

Remove '-Uroot', as now '-U' selects processes based on their real user
IDs, and since the program using them was launched as 'root', the
equivalent now is just to remove it, as now ps(1) by default selects
processes based on its effective UID (root) and their effective UIDs.

It seems that matching on effective or real UID does not really matter
in this test, but at least this change simplifies the command-line.

MFC after:      1 day
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D50200

(cherry picked from commit 1265d3b07eaa418e9c60800db93f3482ddbb6ae2)
DeltaFile
+1-1tools/test/stress2/misc/exlock2.sh
+1-11 files

FreeBSD/src a69fe62libexec/rc/tests rc_subr_test.sh

rc/tests: Fix process flags checks using ps(1)

These checks use ps(1) with both the '-p' and '-a' flags, which worked
so far as ps(1)'s '-a' option was buggy.  Since the fix in commit
"ps(1): Make '-a' and '-A' always show all processes"
(93a94ce731a89b56), such a command-line always selects all processes,
making the specified '-p' useless and the test wrong.  Remove the
useless '-a'.

While here, remove the redundant '-x', as '-p' implies '-x' by default.

MFC after:      1 day
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D50201

(cherry picked from commit 646375408742dd5ed9abb174a621a3f8f65a56ef)
DeltaFile
+2-2libexec/rc/tests/rc_subr_test.sh
+2-21 files

FreeBSD/src 1586fd8bin/ps ps.1

ps.1: Remove ambiguity in description of option '-J'

As stated in the previous commit, option '-J' was introduced by commit
"Add -J to filter by matching jail IDs and names."
(13767130c7147ae7182a, r265229), which unfortunately talked about '-J'
being a filter while actually implementing it as a regular selection
option which adds to the processes to display.

The manual page's formulation hinted more at '-J' being a filter, which
it is not, or could be just considered ambiguous, because of the
presence of the "only" word.  Consequently, remove it and reformulate.

Reviewed by:    ziaee, dch
MFC after:      1 day
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D50194

(cherry picked from commit cbda1aea6532697247bcca6e59d45775857c35e2)
DeltaFile
+2-2bin/ps/ps.1
+2-21 files

FreeBSD/src f18a49a. RELNOTES

RELNOTES: ps(1): Document change in behavior for '-a'/'-A'

Document the practical consequence of change "ps(1): Make '-a' and '-A'
always show all processes" (93a94ce731a8) that specifying '-a'/'-A'
leads to printing all processes regardless of the presence of other
process selection options (except for '-x'/'-X', which command
a filter).

While here, mention a possible practical issue with '-J', as reported by
dch@.  This option was introduced by commit "Add -J to filter by
matching jail IDs and names." (13767130c7147ae7182a, r265229), which
unfortunately talked about '-J' being a filter while actually
implementing it as a regular selection option which adds to the
processes to display.

Reviewed by:    dch
MFC after:      1 day
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D50193

    [4 lines not shown]
DeltaFile
+17-0RELNOTES
+17-01 files