Commit Graph
314335 Commits
Author SHA1 Message Date
Wolfram Schneider 029466808f manpages: Fix unusual Xr order 2026-10-26 10:46:28 +00:00
Wolfram Schneider fb4f233466 manpages: Fix unusual Xr order 2026-10-26 10:44:08 +00:00
Wolfram Schneider 2ba2623414 manpages: Fix unusual Xr order 2026-10-26 10:41:28 +00:00
Wolfram Schneider f5b6c8f5c2 manpages: Fix unusual Xr order 2026-10-26 10:35:42 +00:00
Wolfram Schneider 3208a17f96 manpages: Fix unusual Xr order 2026-10-26 10:32:42 +00:00
Wolfram Schneider afe20e82f9 manpages: Fix unusual Xr order 2026-10-26 10:29:10 +00:00
Wolfram Schneider 4560b19ff4 manpages: Fix unusual Xr order 2026-10-26 10:27:43 +00:00
Konstantin Belousov 175595ba6c dl_iterate_phdr(3): do not return garbage for objects not using TLS
For objects without a TLS segment, tlsindex is zero. tls_get_addr_slow()
then reads dtv_slots[-1], which is dtv_size, and returns it as the TLS
address. Set dlpi_tls_data to NULL for such objects instead.

Fixes:	d36d681615 ("rtld dl_iterate_phdr(): dlpi_tls_data is wrong")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-25 19:33:46 +02:00
Konstantin Belousov e2979f4cbb rtld: some cosmetics in donelist_init()
Add a missing word in the comment.
Make each assignment a separate statement.
Fix formatting.

Fixes:	1e370f0387 ("rtld: stop using unbound alloca()")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-25 19:33:46 +02:00
Konstantin Belousov 91d8163803 rtld: fix leak in get_program_var_addr() on the error path
Fixes:	1e370f0387 ("rtld: stop using unbound alloca()")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-25 19:33:46 +02:00
Dimitry Andric 28ec7cb871 Merge commit fd4113508a64 from llvm-project (by Minsoo Choo):
[libunwind] Support extended amd64 segment registers (#229176)

  Raise the amd64 DWARF register limit to 59 and add RFLAGS, all six
  segment selectors, FS.base, and GS.base to the register model. Capture
  the extended state and restore it when resuming, using sigreturn() on
  FreeBSD to restore selectors and bases together. Pack the state into the
  existing context buffers without changing their public sizes or the
  Windows XMM offsets.

  Add tests for register access, signal-frame CFI recovery, register
  bounds, and resume behavior.

  Assisted-by: GPT

MFC after:	1 week
2026-10-25 13:11:27 +01:00
Dimitry Andric 6a936d939b Merge commit 4d7292e58078 from llvm-project (by Minsoo Choo):
[libunwind] Unwind through AArch64 FreeBSD signal trampolines (#235065)

  Retried from https://reviews.llvm.org/D155066.

  Recognize signal trampolines using KERN_PROC_SIGTRAMP when unwind
  metadata is unavailable. Restore the interrupted PC, LR, SP, general
  registers, and valid floating-point registers.

  Add coverage for unwinding out of an interrupted leaf function on both
  regular and alternate signal stacks.

  Assisted-by: GPT

MFC after:	1 week
2026-10-25 13:11:27 +01:00
Wolfram Schneider f7114dc7b7 manpages: Fix unusual Xr order 2026-10-25 12:06:08 +00:00
Wolfram Schneider 44a5cf1372 manpages: Fix unusual Xr order 2026-10-25 12:02:00 +00:00
Wolfram Schneider 3f4743d657 manpages: Fix unusual Xr order 2026-10-25 11:57:18 +00:00
Wolfram Schneider 741197267e manpages: Fix unusual Xr order 2026-10-25 11:51:42 +00:00
Wolfram Schneider 14680d205c ps.1: Fix unusual Xr order 2026-10-25 11:36:15 +00:00
Wolfram Schneider 51a531151a df.1: Fix unusual Xr order 2026-10-25 11:32:12 +00:00
Christos Margiolis 8dac0bdb4d snd_hda: Identify AMD Audio Coprocessor
This makes the driver attach, but the device is still not usable.

Reported by:	Lukasz Wencki <[email protected]>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2026-10-25 11:23:36 +01:00
Konstantin Belousov dc1514eda5 x86: make machine/sysarch.h usable from assembler
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-25 05:39:25 +02:00
Enji Cooper a3214d4e9b share/mk/bsd.confs.mk: fix trivial typo in message
The error message noting that the file should not be included said
"bsd.conf.mk" before this change. Now it correctly says "bsd.confs.mk".

MFC after:	3 days
2026-10-24 19:57:19 -07:00
Ed Maste 81f86c9a94 smsc: Allow 10BASE-T1L/-T1S media
These are Single-Pair Ethernet types (SPE) from 802.3cg. smsc sets the
link flag only if mii_media_active is one of a known set of media types.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60745
2026-10-24 14:54:11 -04:00
Maxim Konovalov b9585475ee jail.8: fix a typo, sort Xr
PR:		299990 (typo part)
MFC after:	1 week
2026-10-24 16:32:58 +00:00
Roman Bogorodskiy e809c7d810 bhyve: add command to list config options
For a software built on top of bhyve(8) and/or managing bhyve(8),
it is very convenient to know what specific features the given binary supports.
Currently, bhyve(8) provides some of this information, and it could be
retrieved by parsing `bhyve -h`, `bhyve -s help`, `bhyve -l help`.

Sometimes it is not enough, for example, the recently added
"oemstrings" feature cannot be fully probed using these commands.
Over time, some workarounds were suggested. Specifically:

 - Mapping features to __FreeBSD_version. I see at least two issues with
   that:

     * __FreeBSD_version does not directly map to bhyve(8) features,
       so this is simply not accurate.
     * bhyve(8) might be updated separately from the system, which
       is not so uncommon, especially for development purposes.
       Then such a probing will be inaccurate.

 - Manual pages parsing. I see more disadvantages with that:

     * Manual pages are meant to be read by a human. Extracting
       information from it by a machine is not the most convenient thing.
       Especially understanding side notes like: "Note, feature 'foo'
       is arm64-only!".
     * Manual pages might be inaccurate, they might miss options.
     * bhyve(8) could be used in an environment where manual pages
       are not installed.

This commit attempts to close this gap by introducing the "bhyve -o
help" command which prints all the supported configuration variables.
In my opinion, it is, in combination with the other commands mentioned
above, sufficient to retrieve most of the capabilities of the given
bhyve(8) binary.

The current implementation defines a simple configuration schema for
common and machdep code and prints out a list of supported configuration
variables for the current architecture.

The next step as I see it would be extending set_config*() functions
to validate the user provided values against the schema, so users get
notified early on incorrect or misspelled configuration variables.
It would also be nice to allow users to only validate their
configuration, think of 'nginx configtest / -t'.

Reviewed by:	chuck (previous revision), bnovkov
MFC after:	1 month
MFC to:		stable/15
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D58419
2026-10-24 13:01:53 +02:00
Wolfram Schneider a03b051f23 locate.1: clarify bytes vs. characters
The database stores bytes, not characters. Remove the historical
note about 7-bit storage. Also document that -i ignores case only
for ASCII letters.

Reviewed by: ziaee
MFC after: 3 days
2026-10-24 10:12:05 +00:00
Joy a3d1d4e88a arm64 linux: Allow FUTEX_REQUEUE on arm64 by setting the brand flag
Better change is to provide the dedicated musl brandinfo, as it is done
on amd64/i386, which should be done later.

PR:	299836
MFC after:	1 week
2026-10-24 05:28:42 +03:00
Joy 9a8d5af1ba linux: correct errors from mremap(2)
Linux returns EFAULT when the range to be remapped is not mapped at all,
and ENOMEM only when it is mapped but cannot be grown in place. Callers
depend on that distinction: musl's pthread_getattr_np() measures the
main thread stack by growing a one page mapping and retries while errno
is ENOMEM. Returning ENOMEM for every growth request makes that loop
spin forever.

PR:	299835
MFC after:	1 week
2026-10-24 05:24:19 +03:00
Aymeric Wibo cb77c4e846 amdsmu: Don't rely on s0i3_last_entry_status metric
This metric seems unreliable and I have observed it occasionally report
1 (successful entry to S0i3) when the time_last_in_s0i3 metric was 0 on
Phoenix, which does not make sense.

So just rely on time_last_in_s0i3 instead.

Sponsored by:	The FreeBSD Foundation
2026-10-24 01:00:42 +01:00
Ed Maste 10ceddaa94 smsc: Use read-modify-write to configure LEDs
After reset the driver enables three LED outputs by writing 1s to
the appropriate GPIO/LED configuration bits in the LED & GPIO
configuration register LED_GPIO_CFG.

The LED Select (LED_SEL) bit in LED_GPIO_CFG chooses between two LED
modes:

0: Speed, Link+Activity, Full Duplex
1: Speed, Link, Activity

If an EEPROM is present LED_SEL is initialized from bit 1 in the
EEPROM's configuration flags value.  If no EEPROM is present this bit
defaults to zero.

Previously we wrote to all bits in the register, clearing LED_SEL.  A
device with LED_SEL set by the EEPROM would thus not have correct LEDs.

Now we read the current value of LED_GPIO_CFG and just set the three
LED configuration bits, as Linux does in commit 52a2f0608366 ("net: usb:
smsc95xx: fix changing LED_SEL bit value updated from EEPROM").

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D60828
2026-10-23 18:01:59 -04:00
Ed Maste dc4c75c9a3 smsc: Support external PHY
SMSC_HW_CFG_PSEL indicates that an external PHY is present. Skip the
internal PHY initialization when set and store the ID of the detected
PHY.

Reviewed by:	br
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D60744
2026-10-23 18:00:48 -04:00
Ed Maste 13011cbf7d smsc: Remove phy address check in smsc_miibus_writereg
The driver only allowed writes to the expected phy (i.e., sc->sc_phyno),
and reads were never filtered.  sc_phyno is already passed to
mii_attach() as phyloc, so nothing tries to issue MDIO writes to other
addresses and the check is not required.

Remove the check in advance of supporting external PHYs at arbitrary
addresses.

Tested on Microchip's EVB-LAN9500A-LC LAN9500A evaluation board.

Sponsored by:	The FreeBSD Foundation
Sponsored by:	Microchip (Hardware)
Differential Revision: https://reviews.freebsd.org/D60743
2026-10-23 17:58:51 -04:00
Gleb Smirnoff 91bff7d7ed Revert "inpcb: add single peer local port caching"
This reverts commit 289082428c.

Requested by:	markj
2026-10-23 11:56:06 -07:00
R. Christian McDonald f1726686cb iflib: Do not pull up trailing IPv4 fragments to the L4 header
iflib_parse_header() pulls every IPv4 packet up to the end of the TCP or
UDP header, including fragments at a non-zero offset, which carry no L4
header at all.  A trailing fragment shorter than that header (1-7 bytes
of UDP, 1-19 bytes of TCP) makes m_pullup() fail and the frame is freed
without a trace in the interface counters.

Only parse the L4 header on the first fragment.  TSO never produces
fragments, so assert that.

With a 1500-byte MTU every UDP datagram of 1473-1479 bytes is lost
behind a forwarding host whose ingress NIC sets receive checksum flags,
or on any VLAN with hardware tagging.  SIP over UDP is a common victim.

Reported by:	Alex Roberts
Reviewed by:	gallatin
Fixes:		c224b2ce7d ("iflib: don't pullup UDP payloads to the TCP header size")
See also:	https://redmine.pfsense.org/issues/17196
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-10-23 14:28:29 -04:00
Seth Hoffert 86a925f538 ptnet.4: Fix typo
MFC after:	3 days
Reviewed by:	ziaee
Signed-off-by:	Seth Hoffert <[email protected]>
Closes:		https://github.com/freebsd/freebsd-src/pull/2480
2026-10-23 14:19:42 -04:00
Konstantin Belousov cf63e3f3cd pdfork.2: improve markup
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-10-23 21:17:45 +03:00
Krzysztof Galazka 8e55febde6 ixl(4): Fix NVM update API
Driver provides an interface for tools operating on adapters'
Non-Volatile Memory using SIOC(G|S)DRVSPEC ioctls. It allows
tools to issue Admin Queue commands to the firmware, which
may return an error code encoded as a negative integer.
The driver passed this negative integer as the return value
of the ioctl handler. This was causing issues because the FreeBSD
kernel reserves negative error codes in system calls for special
purposes such as restarting the handler or detecting incorrect
behavior in VFS operations. Simple remapping of negative values
to positive integers caused currently available tools to misbehave
and could break the NVM update process. Introduce a new API version,
which allows new versions of tools to detect the fixed driver.
Temporarily keep the old API, but issue a warning that tools need
to be updated.

Also refactor the code to use centralized cleanup and move the
debug message from the firmware earlier to make sure it is not masked
by an error from copyout.

Signed-off-by: Krzysztof Galazka <[email protected]>

Tested by:      Mateusz Moga <[email protected]>
MFC after:      2 weeks
Assisted by:    Copilot GPT 5.4
Sponsored by:   Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D57942
2026-10-23 19:57:17 +02:00
Gleb Smirnoff 289082428c inpcb: add single peer local port caching
A typical caching proxy problem is port allocation to backends.  We
usually have a few of them, with thousands connections to each.  Upon
creation of a new connection we need to find a new unique local port for
the peer:port.  This is achieved by linear search in in_pcb_lport_dest().
The closer we get to the port exhaustion the more expensive this loop is.
It needs to be executed tens thousands of times to find a port or fail.

Address the problem by adding advisory negative cache that is lazily
allocated upon first conflict.  Once the cache is in action we skip trying
those ports that are already marked in the cache.  During the search we
may encounter a cache allocated by other lookup.  In this case the caches
are merged into one.  The expectation is that under a stable heavy load we
are going to stabilize at a very low number of allocated caches, ideally
one per peer:port. The cache is a bitset of IPPORT_MAX, which makes it 8k.
Unfortunately metadata pushes allocation size to 16k UMA bucket.  However,
the expectation is that we are going to have a very few allocated, thus
current decision is to not create a separate UMA zone.

Differential Revision:	https://reviews.freebsd.org/D58290
2026-10-23 10:33:04 -07:00
Ed Maste bea44a8363 kernel: Use external retpoline thunks
External retpoline thunks for amd64 and i386 were added in commit
74d971fe15 ("x86: Add external retpoline thunk").  Use them when
WITH_KERNEL_RETPOLINE is set.

There should not be any material performance impact -- the call sites
are identical, and this just replaces (on amd64) compiler-generated
__llvm_retpoline_r11 functions in each object with our
__x86_indirect_thunk_r11.

After this change we could implement boot-time patching, replacing
__x86_indirect_thunk_r11 with just jmp %r11 when retpoline is not
required.

Note on i386: An i386 build WITH_KERNEL_RETPOLINE was successful, but
has not been extensively tested.  Clang may use registers other than
just eax on i386 and so in the future additional thunks beyond the one
added in 74d971fe15 could be required for i386.  Patches are welcome
if this is important to you.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
2026-10-23 11:53:05 -04:00
Michal Meloun ffcd78861e fdt: Support SCMI shared memory under reserved-memory nodes
Add a simplebus-based pseudo-bus that matches the "reserved-memory"
node in the device tree.  Update the SCMI shared memory driver so that
it can attach either as a child of mmio_sram or directly under
simplebus (via the new reserved-memory bus). Make the mmio_sram memory
resource shareable so both attachment methods can coexist when required.

MFC after:      1 week
Reviewed by:    manu
2026-10-23 16:08:31 +02:00
Ayrton Munoz 775e421dc3 nvme: Fix default is_storage_device kobj method
makeobjops.awk only accepts an uppercase DEFAULT before a default kobj
method. This commit fixes a typo introduced in 949804c819 so non-PCI
drivers actually use nvme_is_storage_device_default instead of
kobj_error_method. Note that even though kobj_error_method returns
ENXIO (6), it does not get implicitly cast to a bool due to the function
pointer casting in the nvme_if.h generated by makeobjops. Instead the
codegen for the NVME_IS_STORAGE_DEVICE callsite shows that only the
lowest bit is being checked as if it were always a bool. Without this
any nvme driver that doesn't implement is_storage_device is not treated
as a storage device.

Reviewed by:	imp, kevans
Differential Revision:	https://reviews.freebsd.org/D60112
2026-10-22 11:40:50 -05:00
Pouria Mousavizadeh Tehrani 3200a27427 sctp: Allow to ignore iface type when determining address scope
Scope restriction by loopback interface was not specified in
the draft-stewart-tsvwg-sctp-ipv4 draft and having global address
on loopback interface is common.
Therefore, allow to skip loopback interface type check in sctp.

Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D60938
2026-10-22 18:43:42 +03:30
Dag-Erling Smørgrav 8133230d7e auditdistd: Avoid deprecated OpenSSL APIs
SSL_use_RSAPrivateKey_file() was deprecated in OpenSSL 3.0.  Use the
more generic SSL_use_PrivateKey_file() instead.

Sponsored by:	Klara, Inc.
Sponsored by:	Qualys, Inc.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D60899
2026-10-22 17:13:47 +02:00
Kristof Provost c7523e8cfb tcp: fix incorrect assertion
tcp_autosndbuf() asserts that the buffer is locked, but it should assert
this about the send buffer, not the receive buffer.

Fixes:		7146ad04f1 ("tcp: refactor tcp_autosndbuf() and associated sysctls")
Reviewed by:	tuexen
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-10-22 15:40:29 +02:00
Wolfram Schneider ad0f866941 find.1: rewrite the -s flag section for clarity
Restructure the description of -s flag:
1. what the option does
2. why it is useful (deterministic order, streaming output)
3. how its results can differ from `find | sort'

Reviewed by: ziaee
MFC after: 3 days
2026-10-22 08:50:56 +00:00
Gleb Smirnoff 9c67d6ed96 inpcb: inp_next() never returns a freed inpcb 2026-10-21 20:29:46 -07:00
Gleb Smirnoff 49548ea75c udp: in_pcblookup() never returns a freed inpcb 2026-10-21 20:29:41 -07:00
Gleb Smirnoff abb8b02550 icmp6: make icmp6_notify_error() more readable
Remove a level of indentation, improve line breaks, remove single use
variables.  No functional change.
2026-10-21 20:29:37 -07:00
Gleb Smirnoff 331333ba01 ipfw: hold sleepable "upper half lock" for periodic state expiry
The state expiration may lead to freeing rules, which requires this lock.
Since the lock is sleepable, move the expiry routine from callout context
to a taskqueue.  This also should have a positive effect of not running
expensive function as a callout.

Fixes:	e3caa360d5

Reviewed by:		pouria
Differential Revision:	https://reviews.freebsd.org/D60869
2026-10-21 20:28:57 -07:00
Gleb Smirnoff 7146ad04f1 tcp: refactor tcp_autosndbuf() and associated sysctls
Rename tcp_sndbuf_autoscale() to tcp_autosndbuf().  This matches
complementary tcp_autorcvbuf() that was factored out as a separate
function a few months before tcp_sndbuf_autoscale() was.  Move the large
comment to the header of the function.  Use unsigned types for all sizing
sysctls and variables and use bool for the switching sysctl.  Add a
comment above net.inet.tcp.sendbuf_auto_lowat (default to off) providing a
reference to its origins.  Add DTrace probe tcp::send-autoresize,
complementary to the existing tcp::receive-autoresize.

Rack has its own function, just enable the DTrace probe there.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D60732
2026-10-21 20:27:47 -07:00
Gleb Smirnoff 04cd9bca4d tcp: refactor tcp_autorcvbuf() and associated sysctls
Run the entire function under the socket buffer lock.  Make it responsible
to set the new limit or clear SB_AUTOSIZE in case of a failure.  Use
unsigned type for newsize, that matches both the sb_hiwat type and min()
argument types.  Make byte counter in the tcpcb unsigned, too.  Make the
sizing tunables unsigned, and make the switching tunable a boolean.  Don't
execute Dtrace probe in case of a failure.  Simplify the Dtrace probe to
report only relevant information, the previous probe looked more like a
leftover from a debugging session.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D60731
2026-10-21 20:27:36 -07:00