FreeBSD/src 785600dusr.sbin/kldxref elf.c ef.c

kldxref: Properly handle reading strings near the end of an ELF file

If a string is at or near the end of an input file and the amount of
remaining data in the file is smaller than the maximum string size,
the pread(2) system call would return a short read which is treated as
an error.  Instead, add a new helper function for reading a string
which permits short reads so long as the data read from the file
contains a terminated string.

Reported by:    jrtc27
Reviewed by:    jrtc27
Sponsored by:   University of Cambridge, Google, Inc.
Differential Revision:  https://reviews.freebsd.org/D44419
DeltaFile
+18-0usr.sbin/kldxref/elf.c
+1-8usr.sbin/kldxref/ef.c
+1-8usr.sbin/kldxref/ef_obj.c
+4-0usr.sbin/kldxref/ef.h
+24-164 files

FreeBSD/src a8eb3b3stand/forth loader.4th

loader.4th dictthreshold too small

The dictthreshold in stand/forth/loader.4th is too small
resulting in full dictionary.

Reviewed by:    stevek, imp
Sponsored by:   Juniper Networks, Inc.
Differential Revision:  https://reviews.freebsd.org/D44414
DeltaFile
+2-2stand/forth/loader.4th
+2-21 files

FreeBSD/src 01f3abbstand/uboot Makefile

uboot/Makefile move BINDIR

Set BINDIR before we include bsd.init.mk
so we can override it via local.init.mk

Reviewed by:    imp
Sponsored by:   Juniper Networks, Inc.
Differential Revision:  https://reviews.freebsd.org/D44413
DeltaFile
+2-1stand/uboot/Makefile
+2-11 files

FreeBSD/src 8f13abbusr.sbin/nfsd nfsd.8

nfsd.8: Document ways to minimize Copy operation times

For NFSv4.2, a Copy operation can take a long time to complete.
If there is a concurrent ExchangeID or DelegReturn operation
which requires the exclusive lock on all NFSv4 state, this can
result in a stall of the nfsd server.

This patch documents ways to avoid this problem.

This is a content change.

Reviewed by:    karels, wollman, pauamma_gundo.com (manpages)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D44395
DeltaFile
+23-1usr.sbin/nfsd/nfsd.8
+23-11 files

FreeBSD/src d413597usr.bin/calendar/calendars calendar.freebsd

add myself(oh) to the calendar

Reported by: McKusick
Approved by: Manu (mentor)
Differential Revision: https://reviews.freebsd.org/D44408
DeltaFile
+1-0usr.bin/calendar/calendars/calendar.freebsd
+1-01 files

FreeBSD/src 60bc961sys/kern kern_vnodedumper.c, sys/sys param.h kerneldump.h

kerneldump: add livedump_start_vnode(9)

livedump_start_vnode(9) is introduced such that the live minidump on the
system could take a vnode. This interface could be used to extend support
for the existing framework in downstream.

Bump __FreeBSD_version for introducing livedump_start_vnode(9).

Sponsored by:   Juniper Networks, Inc.
Reviewed by:    khng
Differential Revision:  https://reviews.freebsd.org/D43471
DeltaFile
+23-9sys/kern/kern_vnodedumper.c
+1-1sys/sys/param.h
+1-0sys/sys/kerneldump.h
+25-103 files

FreeBSD/src e34ea01sys/netinet tcp_timer.c tcp_subr.c

tcp: clear all TCP timers in tcp_timer_stop() when in callout

When a TCP callout decides to disable self, e.g. tcp_timer_2msl() calling
tcp_close(), we must also clear all other possible timers.  Otherwise,
upon return, the callout would be scheduled again in tcp_timer_enter().

Revert 57e27ff07aff, which was a temporary partial revert of otherwise
correct 62d47d73b7eb, that exposed the problem being fixed now.  Add an
extra assertion in tcp_timer_enter() to check we aren't arming callout for
a closed connection.

Reviewed by:    rscheff
DeltaFile
+4-2sys/netinet/tcp_timer.c
+1-2sys/netinet/tcp_subr.c
+5-42 files

FreeBSD/src 576fbcbusr.bin/calendar/calendars calendar.freebsd

Add myself (rcm) to the calendar.

Reminded by:    mckusick
DeltaFile
+1-0usr.bin/calendar/calendars/calendar.freebsd
+1-01 files

FreeBSD/src f50322cshare/man/man9 random.9

random(9): bump removal to FreeBSD 15.0

It has not yet been removed, and still has some in-tree consumers.

PR:             277655
Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-2share/man/man9/random.9
+2-21 files

FreeBSD/src d9108adtools/build depend-cleanup.sh

lib{c,sys}: really fix incremental builds

Reported by:    andrew
Fixes:          a650ec0e55a9 lib{c,sys}: fix incremental builds
DeltaFile
+2-2tools/build/depend-cleanup.sh
+2-21 files

FreeBSD/src e29be07share/man/man4 tcp_rack.4

tcp_rack.4: Update the SEE ALSO section

Correct the surname of one of authors of RFC 8985 and add RFC 5681 and
RFC 6937 (PRR: Proportional Rate Reduction for TCP).

Reviewed by:    tuexen
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D44399
DeltaFile
+18-2share/man/man4/tcp_rack.4
+18-21 files

FreeBSD/src c85d75ausr.bin/calendar/calendars calendar.freebsd

Add myself (harti) to the calendar.

Reminded by:    mckusick
DeltaFile
+1-0usr.bin/calendar/calendars/calendar.freebsd
+1-01 files

FreeBSD/src 0a5f791sys/arm64/arm64 gdb_machdep.c

arm64: Return all registers to gdb when able

When the kdb thread is the current thread we read the registers from
the trap frame. As this contains all general purpose registers we can
use it to read these in the gdb stub. This allows us to include the
non-callee saved registers, e.g. function arguments.

Reviewed by:    imp
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D44360
DeltaFile
+4-0sys/arm64/arm64/gdb_machdep.c
+4-01 files

FreeBSD/src a931b85sys/dev/uart uart_cpu_acpi.c uart_cpu_acpi.h

uart: Add uart_cpu_acpi_setup to setup the uart

In preperation for adding debug port support add a generic function
to setup the uart from ACPI tables.

Reviewed by:    imp
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D44358
DeltaFile
+11-5sys/dev/uart/uart_cpu_acpi.c
+2-2sys/dev/uart/uart_cpu_acpi.h
+1-1sys/dev/uart/uart_cpu_arm64.c
+1-1sys/dev/uart/uart_cpu_x86.c
+15-94 files

FreeBSD/src 473c0b4sys/dev/uart uart_cpu_acpi.c

uart: Split out initilisation of the acpi devinfo

Split out the common parts of building the uart devinfo from ACPI
tables from the SPCR parser. This will be used when we support the DBG2
table to find the debug uart to be used by the kernel gdb stub.

Reviewed by:    imp
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D44357
DeltaFile
+72-60sys/dev/uart/uart_cpu_acpi.c
+72-601 files

FreeBSD/src 801160fsys/arm64/arm64 locore.S

arm64: Rename drop_to_el1 to enter_kernel_el

In the future we may not drop to EL1, e.g. when we support FEAT_VHE
where the kernel runs in EL2.

Reviewed by:    emaste, imp
Sponsored by:   Arm Ltd
Differential Revision:  https://reviews.freebsd.org/D43976
DeltaFile
+6-6sys/arm64/arm64/locore.S
+6-61 files

FreeBSD/src e5c1ba9sys/netlink/route route.h

netlink: fix route protocol constant values to match Linux

Although these particular constants aren't supported, the incorrect
values break bird 2.15 operation.

PR:             277618
Reported by:    Ondrej Zajicek <santiago at crfreenet.org>

(cherry picked from commit 16f8d8829472dfdf6b3b2bb21d652f0bafefccbc)
DeltaFile
+2-2sys/netlink/route/route.h
+2-21 files

FreeBSD/src d45714asys/netlink/route route.h

netlink: fix route protocol constant values to match Linux

Although these particular constants aren't supported, the incorrect
values break bird 2.15 operation.

PR:             277618
Reported by:    Ondrej Zajicek <santiago at crfreenet.org>

(cherry picked from commit 16f8d8829472dfdf6b3b2bb21d652f0bafefccbc)
DeltaFile
+2-2sys/netlink/route/route.h
+2-21 files

FreeBSD/src dd7b86esys/netinet tcp_usrreq.c tcp_output.c, sys/netinet/tcp_stacks rack.c bbr.c

tcp: remove IS_FASTOPEN() macro

The macro is more obfuscating than helping as it just checks a single flag
of t_flags.  All other t_flags bits are checked without a macro.

A bigger problem was that declaration of the macro in tcp_var.h depended
on a kernel option.  It is a bad practice to create such definitions in
installable headers.

Reviewed by:            rscheff, tuexen, kib
Differential Revision:  https://reviews.freebsd.org/D44362
DeltaFile
+18-17sys/netinet/tcp_stacks/rack.c
+13-13sys/netinet/tcp_stacks/bbr.c
+7-8sys/netinet/tcp_usrreq.c
+7-7sys/netinet/tcp_output.c
+7-7sys/netinet/tcp_input.c
+0-8sys/netinet/tcp_var.h
+52-602 files not shown
+54-628 files

FreeBSD/src 97bfe58usr.sbin/crunch/crunchgen crunchgen.c

crunchgen: slap a dependency on the generated makefile for .lo

crunchgen generates a foo.lo for each binary it will end up crunching
into the final product.  While they have a dependency on the libs that
are used to link them, nothing will force relinking if the set of libs
needed to link them is changed.  Because of this, incremental builds may
not be possible if one builds a version of, e.g., rescue/ with a broken
set of libs specified for a project -- a subsequent fix won't be rolled
in cleanly, it will require purging the rescue/ objdir.

This is a bit crude, but the foo.mk we generate doesn't actually get
regenerated all that often in practice, so a spurious relink for the
vast majority of crunched objects won't actually happen all that often.

Reviewed by:    bapt, emaste, imp

(cherry picked from commit 6e2cfb24ee87fec0f538d04cd69d76a8d58c324f)
DeltaFile
+2-2usr.sbin/crunch/crunchgen/crunchgen.c
+2-21 files

FreeBSD/src efb74e1lib/libsysdecode sysdecode_mask.3 flags.c

libsysdecode: add a decoder for pollfd events

We'll use this in another change to read pollfd arrays coming from a
successful poll(2) operation.

Reviewed by:    bapt, jhb

(cherry picked from commit bd23e71f91ceec5dfdffc28bbd0020849fdd20b4)
DeltaFile
+11-1lib/libsysdecode/sysdecode_mask.3
+8-0lib/libsysdecode/flags.c
+1-0lib/libsysdecode/mktables
+1-0lib/libsysdecode/sysdecode.h
+1-0lib/libsysdecode/Makefile
+22-15 files

FreeBSD/src 160788csys/kern sys_generic.c uipc_syscalls.c, sys/netinet sctp_syscalls.c

ktrace: log genio events on failed write

Visibility into the contents of the buffer when a write(2) has failed
can be immensely useful in debugging IPC issues -- pushing this to
discuss the idea, or maybe an alternative where we can set a flag like
KTRFAC_ERRIO to enable it.

When a genio event is potentially raised after an error, currently we'll
just free the uio and return.  However, such data can be useful when
debugging communication between processes to, e.g., understand what the
remote side should have grabbed before closing a pipe.  Tap out the
entire buffer on failure rather than simply discarding it.

Reviewed by:    kib, markj

(cherry picked from commit 47ad4f2d45e406c6316909bc12bc760b2fdd6afb)
DeltaFile
+4-2sys/netinet/sctp_syscalls.c
+2-1sys/kern/sys_generic.c
+2-1sys/kern/uipc_syscalls.c
+1-1sys/kern/kern_ktrace.c
+9-54 files

FreeBSD/src b983d4fusr.bin/kdump kdump.c

kdump: decode pollfd struct arrays coming from poll(2)

We'll handle these just as we do kevents, one per line with subsequent
lines indented sufficiently to distinguish them from the upcoming
return value.

Sample, with indentation stripped and revents changed to '...' in the
first one to keep the line length down:

CALL  poll(0x820610560,0x3,0)
STRU  struct pollfd[] = { { fd=0, events=0x1<POLLIN>, revents=0x11<...>
 { fd=1, events=0x4<POLLOUT>, revents=0x4<POLLOUT>}
 { fd=-1, events=0x4<POLLOUT>, revents=0} }
RET   poll 2

Reviewed by:    bapt, jhb

(cherry picked from commit 02c57f7b48772c5ec4e3a0a3405273b387b9bb08)
DeltaFile
+20-0usr.bin/kdump/kdump.c
+20-01 files

FreeBSD/src 416547bsys/kern sys_generic.c

kern: poll: tap out the pollfd array on successful return

We do this in kern_poll() to include freebsd32 but exclude the linux
compat layer.  The ABI should be the same, but the POLL constants are
probably different or should be assumed so.

Reviewed by:    bapt, jhb

(cherry picked from commit b5d2165b9046572c9361a8e8b09323a6001ac586)
DeltaFile
+5-0sys/kern/sys_generic.c
+5-01 files

FreeBSD/src a7b9045libexec/rtld-elf/tests dlopen_test.c Makefile

rtld: add some dlopen tests

dlopen_basic just tests that libthr.so can be dlopen()ed, which will
just serve as a sanity check that "libthr.so" is a thing that can be
dlopened in case we get a weird failure in dlopen_recursing.

dlopen_recursing tests a regression reported after the libsys split,
where some dlopen() may cause infinite recursion and a resulting crash.
This case is inspired by bdrewery's description of what seemed to be
causing his issue.

The corresponding fix landed in commit
968a18975ad ("rtld: ignore load_filtees() calls if we already [...]")

Reviewed by:    kib

(cherry picked from commit c5796f1572c82b88e8b6a2810c92f30e5ac3e118)
DeltaFile
+52-0libexec/rtld-elf/tests/dlopen_test.c
+2-0libexec/rtld-elf/tests/Makefile
+54-02 files

FreeBSD/src d62c460sys/kern uipc_socket.c, sys/netinet in_pcb.c tcp_offload.h

sockets: remove unused KPIs to manipulate sockets

These KPIs were added in dd0e6c383a9f0 and through 15 years had zero use.
They slightly remind what IfAPI does for struct ifnet.  But IfAPI does
that for the sake of large collection of NIC drivers not being aware of
struct ifnet.  For the sockets it is unclear what could be a large
collection of externally written kernel modules that need extensively use
sockets and not be aware of their internals at the same time. This
isolation of a structure knowledge requires a lot of work, and just
throwing in a few KPIs isn't helpful.

Reviewed by:            kib, olce, markj
Differential Revision:  https://reviews.freebsd.org/D44311
DeltaFile
+0-101sys/kern/uipc_socket.c
+0-23sys/sys/socket.h
+0-7sys/netinet/in_pcb.c
+2-0sys/netinet/tcp_offload.h
+1-0sys/netinet/tcp_fastopen.h
+3-1315 files

FreeBSD/src 027fda8sys/netinet in_pcb.c in_pcb.h

inpcb: remove unused KPIs to manipulate inpcbs

These KPIs were added in 9d29c635daa69 and through 15 years had zero use.
They slightly remind what IfAPI does for struct ifnet.  But IfAPI does
that for the sake of large collection of NIC drivers not being aware of
struct ifnet.  For the inpcb it is unclear what could be a large
collection of externally written kernel modules that need extensively use
inpcb and not be aware of its internals at the same time. This isolation
of a structure knowledge requires a lot of work, and just throwing in a
few KPIs isn't helpful.

Reviewed by:            kib, bz, markj
Differential Revision:  https://reviews.freebsd.org/D44310
DeltaFile
+0-22sys/netinet/in_pcb.c
+0-4sys/netinet/in_pcb.h
+1-0sys/netinet/toecore.h
+1-263 files

FreeBSD/src 104328esys/kern sys_timerfd.c

timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME

This is a common use case when using timerfd_create to actually use
it with CLOCK_BOOTTIME on linux which is CLOCK_UPTIME for us.

Note that currently on freebsd CLOCK_BOOTTIME is CLOCK_UPTIME, but the
semantic is supposed to be different, this has to be fixed later.

Tested with the fnott notification software

Reviewed by:    des, imp
Differential Revision:  https://reviews.freebsd.org/D44253

(cherry picked from commit cf742faa39a58a9b43b671c66097e6880459d4ae)
(cherry picked from commit 0ecf0b26a750582b804e238e6446db55188d7fdc)
DeltaFile
+13-1sys/kern/sys_timerfd.c
+13-11 files

FreeBSD/src 122f46bshare/misc pci_vendors

pci_vendors: update to 2024.02.02

(cherry picked from commit cce3a70a77a94751ce2d65890e539e24ff6081a3)
DeltaFile
+615-108share/misc/pci_vendors
+615-1081 files

FreeBSD/src 20062c3usr.sbin/kbdmap kbdmap.c

kbdmap: fix typo preventing kbdmap to work under vt

(cherry picked from commit 0f4e8037332fa5e64b3bb291c9b1ba7f8d8b4d4e)
DeltaFile
+1-1usr.sbin/kbdmap/kbdmap.c
+1-11 files