FreeBSD/src e9efa3etools/tools/kgdb tcplog.py

Add a kgdb python script to extract bbl from kernel dumps

A kgdb script allows us to be relatively resilient to kernel structure
changes, with a lower burden for updates when they happen than a C tool.

tuexen@ requested we ship this script in a source distribution. Making
it easier for users to extract useful debugging information from a core.
It requires kgdb and python3 and would ideally be a lldb lua script, but
there is more work needed on lldb lua before we can do that.

Add the script as is. A single script we could run against a core would
be nice, but I don't want to let that block making this tool more
available.

Reviewed by:    teuxen, rrs
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48705
DeltaFile
+267-0tools/tools/kgdb/tcplog.py
+267-01 files

FreeBSD/src 91506dbshare/zoneinfo Makefile

zoneinfo: also install tzdata.zi and version

Build and install the shrunk version of the time zone database required
by libc++ 19 std::chrono::current_zone (etc).  While here, also install
the tzdata 'version' file to align more closely with other vendors.

PR:             282377
Reviewed by:    dim, emaste, imp
Differential Revision:  https://reviews.freebsd.org/D49577
DeltaFile
+16-0share/zoneinfo/Makefile
+16-01 files

FreeBSD/src 426f4e5share/man/man4 run.4, sys/dev/usb usbdevs

if_run: Add sitecom device id

Reviewed by:    thj, adrian
Obtained from:  NetBSD
Differential Revision:  https://reviews.freebsd.org/D49588
DeltaFile
+3-1share/man/man4/run.4
+1-0sys/dev/usb/wlan/if_run.c
+1-0sys/dev/usb/usbdevs
+5-13 files

FreeBSD/src 9f3e7b7share/man/man4 rsu.4, sys/dev/usb usbdevs

if_rsu: Add sitecom device id

Approved by:    thj, adrian
Obtained from:  NetBSD
Differential Revision:  https://reviews.freebsd.org/D49588
DeltaFile
+3-1share/man/man4/rsu.4
+1-0sys/dev/usb/usbdevs
+1-0sys/dev/usb/wlan/if_rsu.c
+5-13 files

FreeBSD/src 7becd87sys/vm vm_page.c

vm_grab: use iterator for grab lookup

When a page lookup fails in a vm_page_grab operation, use the results
of the failed search, stored in an iterator, to begin the search for a
predecessor to use in a call to vm_page_alloc_after(), to avoid doing
that search from the root in vm_page_alloc(), as happens now.

Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D49371
DeltaFile
+89-56sys/vm/vm_page.c
+89-561 files

FreeBSD/src 4b98fe9. ObsoleteFiles.inc, lib/googletest/tests/gmock_main Makefile

Fix GoogleTest 1.14.0 import

- Prune headers and tests no longer installed after the upgrade.
- Remove GoogleTest-related files when MK_GOOGLETEST == no.
- Disable `-Werror` with gcc to unbreak the gcc12 CI run with
  `lib/googletest`. Any issues found by g++ will be filed
  upstream and hopefully resolved in a future version.
- Remove clang -Werror issues which are resolved in version 1.14.0 to
  avoid masking valid issues.

Conflicts:
        ObsoleteFiles.inc
        tools/build/mk/OptionalObsoleteFiles.inc

MFC after:      1 week
MFC with:       28f6c2f292806bf31230a959bc4b19d7081669a7

(cherry picked from commit 0c785f06020f3b02e34c97eb27fecd3af8eb2a7b)
DeltaFile
+79-78tools/build/mk/OptionalObsoleteFiles.inc
+16-0ObsoleteFiles.inc
+0-11share/mk/googletest.test.inc.mk
+1-0lib/googletest/tests/gtest_main/Makefile
+1-0lib/googletest/tests/gtest/Makefile
+1-0lib/googletest/tests/gmock_main/Makefile
+98-896 files

FreeBSD/src b84a505usr.bin/m4/tests regress.gnusofterror.out regress.quotes.out

m4 tests: Update tests after $FreeBSD$ removal

Fixes:  d54a7d337331 ("Remove $FreeBSD$: one-line m4 tag")
(cherry picked from commit d5b5497e10fd11dfea350d229406fa63fd0ea70f)
DeltaFile
+1-1usr.bin/m4/tests/regress.gnusofterror.out
+1-1usr.bin/m4/tests/regress.quotes.out
+2-22 files

FreeBSD/src 39775a2tests/sys/netlink test_rtnl_route.py

tests/netlink: mark a test that requires tun(4)

(cherry picked from commit effa0f6c0aad54a07917af6986d71cd0a57223b8)
DeltaFile
+2-0tests/sys/netlink/test_rtnl_route.py
+2-01 files

FreeBSD/src bcd9c0clib/libc/tests/gen getentropy_test.c

getentropy tests: Update after commit 473681a1a506da

- Use GETENTROPY_MAX instead of hard-coding the value.
- Check for EINVAL instead of EIO

Fixes:  473681a1a506 ("libc: Fix getentropy POSIX 2024 conformance issues")
(cherry picked from commit c5056a3931b41a803a24b89400d38d5c5f843612)
DeltaFile
+6-5lib/libc/tests/gen/getentropy_test.c
+6-51 files

FreeBSD/src ebd127cusr.bin/file/tests file_test.sh Makefile

file: Support testing multiple magic files.

This is based on upstream b74150490be904801378b2712fe0d532e1700124
but adapted to ATF.

Reviewed by: jlduran at gmail.com, markj, vangyzen
Differential Revision: https://reviews.freebsd.org/D42129

(cherry picked from commit 8f75390c66bdcde95e1b383aecaa27b4adf88279)
DeltaFile
+17-5usr.bin/file/tests/file_test.sh
+1-1usr.bin/file/tests/Makefile
+18-62 files

FreeBSD/src 18c4022contrib/netbsd-tests/usr.bin/grep t_grep.sh

netbsd-tests: Update a test case to chase grep symlink handling changes

This test case verifies that grep detects symlink loops when traversing
a directory hierarchy.

Fixes:          fc12c191c087 ("grep: Default to -p instead of -S.")
Reviewed by:    ngie, jhb
Reported by:    Jenkins
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D46544

(cherry picked from commit a700bef1e4ee3e6f4e1a86a374bf9b4044f69a70)
DeltaFile
+1-1contrib/netbsd-tests/usr.bin/grep/t_grep.sh
+1-11 files

FreeBSD/src 8d95e94contrib/netbsd-tests/usr.bin/grep t_grep.sh

netbsd-tests: Update a test case to chase grep symlink handling changes

This test case verifies that grep detects symlink loops when traversing
a directory hierarchy.

Fixes:          fc12c191c087 ("grep: Default to -p instead of -S.")
Reviewed by:    ngie, jhb
Reported by:    Jenkins
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D46544

(cherry picked from commit a700bef1e4ee3e6f4e1a86a374bf9b4044f69a70)
DeltaFile
+1-1contrib/netbsd-tests/usr.bin/grep/t_grep.sh
+1-11 files

FreeBSD/src 680d348sys/dev/pci pci.c

Revert "pci: Only re-route IRQs based on firmware on x86"

This reverts commit 0e33c2e6df7a5de65db40c7cc0fc97f66da28ccd.
DeltaFile
+0-2sys/dev/pci/pci.c
+0-21 files

FreeBSD/src f0adc90sys/dev/mlx5/mlx5_en mlx5_en_main.c mlx5_en_rx.c

mlx5en: sync channel close with the rq completion processing

Without the wait, mlx5e_destroy_rq() might free mbuf that is passed up
to the network stack on receive in mlx5e_poll_rx_cq().

Sponsored by:   NVidia networking
MFC after:      1 week
DeltaFile
+11-0sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+5-0sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+1-0sys/dev/mlx5/mlx5_en/en.h
+17-03 files

FreeBSD/src 910535asys/vm uma_core.c

uma: Avoid excessive per-CPU draining

After commit 389a3fa693ef, uma_reclaim_domain(UMA_RECLAIM_DRAIN_CPU)
calls uma_zone_reclaim_domain(UMA_RECLAIM_DRAIN_CPU) twice on each zone
in addition to globally draining per-CPU caches. This was unintended
and is unnecessarily slow; in particular, draining per-CPU caches
requires binding to each CPU.

Stop draining per-CPU caches when visiting each zone, just do it once in
pcpu_cache_drain_safe() to minimize the amount of expensive sched_bind()
calls.

Fixes:          389a3fa693ef ("uma: Add UMA_ZONE_UNMANAGED")
MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    gallatin, kib
Differential Revision:  https://reviews.freebsd.org/D49349

(cherry picked from commit f506d5af50fccc37f5aa9fe090e9a0d5f05506c8)
DeltaFile
+7-0sys/vm/uma_core.c
+7-01 files

FreeBSD/src 227c127usr.bin/top top.c

top: Make locale issues non-fatal.

If the `setlocale()` call fails, emit a warning and sleep briefly so the
user has a chance to see the warning before we redraw the screen.  Note
that we have no way of knowing exactly what is wrong, but at least we
can suggest that they check their environment.

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

(cherry picked from commit 180065eb09e699820a1e1c45d3d00156e0effe29)
DeltaFile
+2-2usr.bin/top/top.c
+2-21 files

FreeBSD/src 02324aesys/vm uma_core.c

uma: Avoid excessive per-CPU draining

After commit 389a3fa693ef, uma_reclaim_domain(UMA_RECLAIM_DRAIN_CPU)
calls uma_zone_reclaim_domain(UMA_RECLAIM_DRAIN_CPU) twice on each zone
in addition to globally draining per-CPU caches. This was unintended
and is unnecessarily slow; in particular, draining per-CPU caches
requires binding to each CPU.

Stop draining per-CPU caches when visiting each zone, just do it once in
pcpu_cache_drain_safe() to minimize the amount of expensive sched_bind()
calls.

Fixes:          389a3fa693ef ("uma: Add UMA_ZONE_UNMANAGED")
MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    gallatin, kib
Differential Revision:  https://reviews.freebsd.org/D49349

(cherry picked from commit f506d5af50fccc37f5aa9fe090e9a0d5f05506c8)
DeltaFile
+7-0sys/vm/uma_core.c
+7-01 files

FreeBSD/src a4251e9usr.bin/top top.c

top: Make locale issues non-fatal.

If the `setlocale()` call fails, emit a warning and sleep briefly so the
user has a chance to see the warning before we redraw the screen.  Note
that we have no way of knowing exactly what is wrong, but at least we
can suggest that they check their environment.

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

(cherry picked from commit 180065eb09e699820a1e1c45d3d00156e0effe29)
DeltaFile
+2-2usr.bin/top/top.c
+2-21 files

FreeBSD/src 9e7af40sys/compat/linux linux_socket.c

linux: Handle IP_RECVTOS cmsg type

This unbreaks apps using GameNetworkingSockets from Valve.

(cherry picked from commit 186dc094cf1ce14b26c6dfa329a445357121238a)
DeltaFile
+2-1sys/compat/linux/linux_socket.c
+2-11 files

FreeBSD/src a5918bfsys/compat/linux linux_socket.c

linux: Fix a typo in linux_recvmsg_common

We are supposed to check the result of bsd_to_linux_sockopt_level here
rather than its input.

(cherry picked from commit 9f55630b8d72602f6ec86b15b607f5fc5fde911e)
DeltaFile
+1-1sys/compat/linux/linux_socket.c
+1-11 files

FreeBSD/src eca3c05sys/compat/linprocfs linprocfs.c

linprocfs: Correct sysfs /proc/<pid>/mountinfo entry

Technically mount source could be an arbitrary string (since it's
effectively ignored), but it's common to repeat fs type there.

(cherry picked from commit b9752d5d1cea30a39e89c83ea3aeb539581418cb)
DeltaFile
+1-5sys/compat/linprocfs/linprocfs.c
+1-51 files

FreeBSD/src f2a4943sys/netlink/route rt.c

netlink/route: fix fib number validation in old Linux compat mode

The value passed via old field also needs to be validated.

PR:                     283848
Fixes:                  f34aca55adef1e28cd68b2e6705a0cac03f0238e
(cherry picked from commit 031fbf8dc962ca8d458b217ba2b4a9e637b7e932)
DeltaFile
+3-3sys/netlink/route/rt.c
+3-31 files

FreeBSD/src 96e6fc5sys/netlink/route rt.c

netlink/route: validate family attribute

PR:                     283818
(cherry picked from commit cdacb12065e4d85416655743da5bc6b17a9d9119)
DeltaFile
+3-3sys/netlink/route/rt.c
+3-31 files

FreeBSD/src 1bda3falib/libc/sys close.2, sys/netinet tcp_usrreq.c

tcp: don't ever return ECONNRESET on close(2)

The SUS doesn't mention this error code as a possible one [1]. The FreeBSD
manual page specifies a possible ECONNRESET for close(2):

[ECONNRESET]    The underlying object was a stream socket that was
                shut down by the peer before all pending data was
                delivered.

In the past it had been EINVAL (see 21367f630d72), and this EINVAL was
added as a safety measure in 623dce13c64ef.  After conversion to
ECONNRESET it had been documented in the manual page in 78e3a7fdd51e6, but
I bet wasn't ever tested to actually be ever returned, cause the
tcp-testsuite[2] didn't exist back then.  So documentation is incorrect
since 2006, if my bet wins.  Anyway, in the modern FreeBSD the condition
described above doesn't end up with ECONNRESET error code from close(2).
The error condition is reported via SO_ERROR socket option, though.  This
can be checked using the tcp-testsuite, temporarily disabling the
getsockopt(SO_ERROR) lines using sed command [3].  Most of these

    [35 lines not shown]
DeltaFile
+1-4lib/libc/sys/close.2
+0-5sys/netinet/tcp_usrreq.c
+1-92 files

FreeBSD/src e215460sys/netlink/route rt.c

netlink/route: fix nlattr_get_multipath() to check length

of supplied nexthop sub-attributes.  While here, use unsigned types for
length calculations and improve style(9).

PR:                     283860
(cherry picked from commit 49a6e213416b5c0c9eccdff0af1c6b01f34c3693)
DeltaFile
+22-10sys/netlink/route/rt.c
+22-101 files

FreeBSD/src 886fcbdsys/dev/acpi_support acpi_ibm.c, sys/modules/acpi/acpi_ibm Makefile

acpi_ibm: pass brightness events to evdev(4)

unless the dev.acpi_ibm.0.handlerevents sysctl is set to process
them internally.  The default for the latter is to ignore them,
so passing to evdev(4) is enabled by default.

Reviewed by:            wulf, imp
Tested on:              Lenovo Thinpad X11 Carbon 7Th Gen
Differential Revision:  https://reviews.freebsd.org/D48174

(cherry picked from commit c21f5751ef0932796676e55953461e0679020e28)
DeltaFile
+43-0sys/dev/acpi_support/acpi_ibm.c
+1-1sys/modules/acpi/acpi_ibm/Makefile
+44-12 files

FreeBSD/src c541138usr.bin/top top.1 top.c

top: Sync usage and synopsis

Switching between io and cpu sorting uses a great example in the usage.
[-m io | cpu]. Use that everywhere.

MFC after:              3 days
Reviewed by:            mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D49515

(cherry picked from commit 187d954eab94fdcb33609d91966dbd727acfd720)
DeltaFile
+2-2usr.bin/top/top.1
+1-1usr.bin/top/top.c
+3-32 files

FreeBSD/src 1fdca2ausr.bin/top top.1 commands.c

top: Polish key bindings in usage and manual

Organize key bindings by ascii(7) for consistency and maintainability,
mark them as Interactive Commands, wordsmith them, and sync their
organization between the manual and help screen.

MFC after:              3 days
PR:                     282734
Fixes:                  c8aa5e526 (move command mapping to commands.c)
Reviewed by:            imp, mhorne, Jim Brown <jpb at jimby.name>
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D49462

(cherry picked from commit 0a85254d5a33800600477ce57fbaab64591aa6ea)
DeltaFile
+92-91usr.bin/top/top.1
+13-13usr.bin/top/commands.c
+105-1042 files

FreeBSD/src bb9c4deshare/man/man7 hier.7

hier.7: Storage partitions are not filesystems

I recommended the incorrect text to the submitter.

MFC after:              3 days
Fixes:                  f47cbb29e1c2 (Add /dev/gpt)
Reported by:            Mark Millard <marklmi at yahoo.com>
Reviewed by:            imp, mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D49523

(cherry picked from commit 50296dccddf1a7734be2aef606cd8e0408ee8780)
DeltaFile
+1-1share/man/man7/hier.7
+1-11 files

FreeBSD/src 18b3e37share/man/man7 hier.7

hier.7: Add /dev/gpt

While here, fix a typo.

MFC after:      3 days
Reviewed by:    mhorne, emaste, ziaee
Approved by:    mhorne (mentor)
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1608

(cherry picked from commit f47cbb29e1c2bcb5b5ad838d2d5342a47b0c4692)
DeltaFile
+3-1share/man/man7/hier.7
+3-11 files