Commit Graph

306646 Commits

Author SHA1 Message Date
Pavel Knoblokh abf911af22 pkg: Fix mirror type parsing and service discovery
Signed-off-by: Pavel Knoblokh <info@software-advisory.com.au>
Reviewed by:	emaste, imp, kevans
Fixes:		dc4581589a ("pkg: clean support for repositories")
Closes:		https://github.com/freebsd/freebsd-src/pull/1989
2026-02-04 21:59:21 -06:00
Pat Maddox 2e020c84cb bectl: Add -E flag to create an empty boot environment
Signed-off-by: Pat Maddox <pat@patmaddox.com>
Reviewed by:	kevans
MFC after:	1 week
Closes:		https://github.com/freebsd/freebsd-src/pull/1975
2026-02-04 21:54:45 -06:00
Xin LI 4f7336a93c etcupdate: Do not ignore empty files.
PR:		bin/292773
Reviewed by:	markj
MFC after:	1 week

Differential Revision: https://reviews.freebsd.org/D54935
2026-02-04 19:44:26 -08:00
Justin Hibbits c1a339b4a3 powerpc64/pmap: No need to use r0 anymore in tlbie
The only use of `tlbie %rN, 0` is now explicit and covered in the block
above.  Since there's no need for an explicit `tlbie %rN, 0` now, drop
this convoluted piece and let the compiler decide.

While here, a trivial optimization of the old-style tlbie block, by
clearing tlbie_lock and returning, instead of going to the end which
checks again if the lock is needed.  Since it's already known to be
needed, there's no need to check again.
2026-02-04 22:42:23 -05:00
Alexander Ziaee e54a1ef4eb builtin.1: Command list maintenance
+ link to return(1) like the other exclusive builtins
+ fix alphabetical sorting of list in rendered manual

MFC after:	3 days
2026-02-04 22:40:39 -05:00
Kyle Evans 38a4995eb5 tpm20: fix suspend/resume and entropy harvesting
There were a few problem here:
  - TPM2_Shutdown results in a response that we need to either process
    or ignore, otherwise any tpm20_write or tpm20_harvest call will
    trivially hang on an `sc->pending_data_length != 0`
  - We should have a matching TPM2_Startup upon resume to restore any
    state that should have persisted
  - We must drain the harvest task before we suspend to avoid problems
    there

This commit is sufficient to avoid breaking suspend/resume.

PR:		291067
Fixes:	a2d5ed9442 ("Introduce driver for TPM 2.0 in CRB and [...]")
Fixes:	4ee7d3b011 ("Allow using TPM as entropy source.")
Co-authored-by:	markj (D53835)
Tested by:	garga
Differential Revision:	https://reviews.freebsd.org/D55074
2026-02-04 21:35:10 -06:00
Artem Bunichev 5c9d988d86 OptionalObsoleteFiles: Add etc/zfs/compatibility.d
If the world is built and installed with WITHOUT_ZFS, then make
-DBATCH_DELETE_OLD_FILES delete-old-dirs will give the error:

> rmdir: /etc/zfs: Directory not empty

because /etc/zfs/compatibility.d is still there.  While we're here,
clean out /usr/share/zfs as well.

Co-authored-by:	kevans
Differential Revision:	https://reviews.freebsd.org/D54758
2026-02-04 21:35:01 -06:00
Enji Cooper 9c666de5b3 Make message added for Darwin OSI quirk more terse
The verbose message was way too verbose. Make it terse.

MFC after:	1 week
MFC with:	052a791b00 ("acpi: add Darwin OSI quirk for Apple Mac hardware")
Requested by:	kib
2026-02-04 18:57:22 -08:00
Jaeyoon Choi 0f515c0a97 ufshci: Remove UIC error during initialization
This patch removes the UIC error caused by QEMU not supporting certain
UIC command. Additionally, it removes the unused unipro_version.

Reviewed by:		imp (mentor)
Sponsored by:           Samsung Electronics
Differential Revision:	https://reviews.freebsd.org/D54513
2026-02-05 00:05:14 +00:00
Gleb Smirnoff 5937e1cdc9 bpf: don't clear pointer from descriptor to the tap on descriptor close
During packet processing the descriptor is looked up using epoch(9) and it
can be accessed after bpf_detachd().  In scenario of descriptor close the
tap point is alive (it actually produces packets) and thus the pointer can
be legitimately dereferenced.  This fixes a race on a bpf(4) device close
that would otherwise result in panic.

Differential Revision:	https://reviews.freebsd.org/D55064
2026-02-04 14:07:11 -08:00
Cy Schubert e40817302e ipfilter: Fix possible overrun
The destination buffer is FR_GROUPLEN (16 bytes) in length. When
gname is created, the userspace utilities correctly use FR_GROUPLEN
as the buffer length. The kernel should also limit its copy operation to
FR_GROUPLEN bytes to avoid any user written code from exploiting this
vulnerability.

Reported by:	Ilja Van Sprundel <ivansprundel@ioactive.com>
MFC after:	1 week
2026-02-04 12:46:20 -08:00
Warner Losh fe8105de14 stand: Minor style tweaks
re-wrap the function calls in a couple of ifs in get_zfs_root so they
are more readable. They really didn't need to be wrapped like this in
the first place.

Sponsored by:		Netflix
2026-02-04 10:29:11 -07:00
Pouria Mousavizadeh Tehrani c2ba906fa6 ifconfig: fix gre(4) status
Set `ifr->ifr_name` to display gre options
for the interface.

Reviewed by: glebius, zlei
Approved by: glebius (mentor)
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D55099
2026-02-04 20:50:21 +03:30
Bojan Novković a3ff85e119 pmc: Import Intel Granite Rapids events
Reviewed by:	mhorne
Sponsored by:	Klara, Inc.
Obtained from:	Intel perfmon (JSON event definitions)
Differential Revision:	https://reviews.freebsd.org/D55081
MFC after:	2 days
2026-02-04 16:38:30 +01:00
Mark Johnston 6e32e8d7d1 sdt: Enable on 32-bit powerpc and powerpc64le
Reviewed by:	jhibbits, adrian
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D54814
2026-02-04 14:48:34 +00:00
Enji Cooper b78806b156 Remove additional libtpool and libuutil-related files
This change removes additional library files and tests orphaned in the
commit referenced below.

MFC with:	8b78d412a
Fixes: 8b78d412a ("zfs: world changes after 89f729dcc merge")
2026-02-03 23:33:04 -08:00
Brad Smith 3f3cc6fd69 if_rge: sync with up to date OpenBSD code
e574c2d36cbcacf2556088879be336775e80154b
Add support for RTL8125D revision 0x6890000

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D54922
MFC after: 2 weeks
2026-02-03 22:29:10 -08:00
Kristof Provost fe9e4eb6f3 pf: fix use of uninitialised variable
In pf_match_rule() we attempt to append matching rules to the end of
'match_rules'. We want to preserve the order to make the multiple
pflog entries easier to understand. So we keep track of the last added
rule item in 'rt'. However, that assumed that 'match_rules' was only
ever added to in that one call to pf_match_rules(). This isn't always
the case, for example if we have match rules in different anchors.
In that case we'd end up using the uninitialised 'rt' variable in the
SLIST_INSERT_AFTER call.

Instead track the match rules and the last matching rule (to enable
easy appending) in the struct pf_test_ctx.
This also allows us to reduce the number of arguments for some
functions, because we passed a ctx to most functions that needed
'match_rules'.

While here also make pf_match_rules() static, because it's only ever
used in pf.c

Add a test case to exercise the relevant code path.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2026-02-03 23:51:28 +01:00
Olivier Certner 895e1c6567 sysctl(9): Booleans: Fix old value length discovery
When calling sysctl(3) with a null 'oldp', i.e., length discovery mode,
'oldix' can be equal to 'oldlen', and we should not fail.

More generally, let SYSCTL_OUT() and SYSCTL_IN() handle corner cases,
simply removing the comparisons between 'oldidx' and 'oldlen' and
'newidx' and 'newlen' done by hand as the test just after is an equality
that does not require to know if 'idx' is smaller than 'len'.

PR:             292917
Reported by:    cy
Fixes:          406da392ef ("sysctl(9): Booleans: Accept integers to ease knob conversion")
Sponsored by:   The FreeBSD Foundation
2026-02-03 23:43:49 +01:00
Bjoern A. Zeeb 8df7af9c9e LinuxKPI: string_choices.h: use ternary operator
Switch from using if () else to a direct return (?:) code.
No functional changes.

Suggested by:	kib (D55029)
Sponosred by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste (before removing more () as suggested by him)
Differential Revision: https://reviews.freebsd.org/D55088
2026-02-03 20:00:12 +00:00
Mark Johnston 2d0564b9da vmm: Remove an unneeded NULL pointer check
sc->vm is unconditionally dereferenced earlier in this function.  No
functional change intended.

Reviewed by:	bnovkov
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55069
2026-02-03 19:09:44 +00:00
Mark Johnston 8cfa6ddcee vmm: Fix a resource leak in an error path
vmmdev_create() increments the VM count as its last step and calls
vmmdev_destroy() if it fails.  However, vmmdev_destroy() unconditionally
decrements the count.

Correct this bug by reordering operations.

Fixes:		1092ec8b33 ("kern: Introduce RLIMIT_VMM")
Reviewed by:	bnovkov
Differential Revision:	https://reviews.freebsd.org/D55068
2026-02-03 19:09:28 +00:00
Bjoern A. Zeeb 6ea242cc30 LinuxKPI: add str_read_write()
Needed by a wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	kib, emaste
Differential Revision: https://reviews.freebsd.org/D55029
2026-02-03 18:39:30 +00:00
Warner Losh cbb7441245 nvmecontrol: Pass 1 to uint8_t arg
The rae arg is uint8_t (which we then shift over to the right bit. Pass
'1' instead of 'true' here to match the interface. While true is
promoted to (uint8_t)1, we don't use it as a bool in read_logpage().

Fixes:			5322eec86ae4 ("nvmecontrol: Always set the RAE bit on telemetry-log requests")
Sponsored by:		Netflix
Reviewed by:		chs
Differential Revision:	https://reviews.freebsd.org/D55060
2026-02-03 10:34:36 -07:00
Andrew Turner a4f0e93c51 arm64/vmm: Set and use the fine-grained traps
Set the Fine-grained trap registers to trap any features we don't
support. These are expected to be more useful when we support nested
virtualisation, so for now just the base features and GICv3 are not
trapped.

As nested virtualisation will require VHE we only set the fine-grained
trap registers when VHE is used.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54687
2026-02-03 17:14:44 +00:00
Andrew Turner 095a7871f4 arm64/vmm: Add HYP_FEAT_FGT{,2}
Add the macros and detection for Fine-grained traps (FEAT_FGT and
FEAT_FGT2).

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54686
2026-02-03 17:14:26 +00:00
Andrew Turner 4f82ce5191 arm64: Add the Fine-Grained Trap registers
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54685
2026-02-03 17:14:03 +00:00
Andrew Turner 2f3f5055e7 virtio_p9fs: Use VIRTIO_SIMPLE_PNPINFO
This allows us to also use the common VIRTIO_SIMPLE_PROBE and to have
devmatch load the driver when detected.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54684
2026-02-03 17:13:35 +00:00
Andrew Turner 32d1f18865 libc/aarch64: Add memset for a 64 byte dc zva
On arm64 we can use the "dc zva" instruction to zero memory. The CPU
tells software if the instruction is implemented, and if so the size
and alignment it will use.

When the size is 64-bytes the Arm Optimized Routines implementation of
memset can use dc zva to zero memory, and has a build flag to skip
checking.

Use this flag to build a version of memset that will be used when this
assumption is true.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54776
2026-02-03 17:11:51 +00:00
Andrew Turner f0516ed465 libc/aarch64: Split out the MOPS functions
This allows static binaries to only include the functions they
reference.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54775
2026-02-03 17:11:50 +00:00
Andrew Turner 00f6839213 libc/aarch64: Add a Makefile.inc dependency
If we update Makefile.inc it may be to change the contents of these
files.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54774
2026-02-03 17:11:50 +00:00
Olivier Certner e401e6d3fc acpi: 'hw.acpi.s4bios' sysctl: Change type to bool, expand description
Another boolean, indicating hardware support, will be introduced in next commit.

Thanks to the previous commit modifying sysctl_handle_bool(), this
change is backwards-compatible with old programs using an integer in and
out of sysctl(3).

Reviewed by:    obiwac
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54626
2026-02-03 18:19:08 +01:00
Olivier Certner 7f031c9f6b acpi: Move sysctl tree set up at end of initialization
Setting up the sysctl tree later:
1. Fixes not de-registering sysctl knobs on failure to attach.
2. Avoids having inconsistent knob values exposed during a brief moment.

Reviewed by:    imp, obiwac
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54926
2026-02-03 18:19:08 +01:00
Olivier Certner 406da392ef sysctl(9): Booleans: Accept integers to ease knob conversion
In sysctl_handle_bool(), if the output buffer (for the old value) has
room for exactly 4 bytes (sizeof(int)), then output the current boolean
value as an integer rather than a 'uint8_t'.  Conversely, if 4 bytes
exactly remain in the input buffer (for the new value), treat them as an
integer and derive the new boolean value from it.

Doing so allows to convert existing integer syscstl knobs that are
interpreted as a boolean into true boolean ones while staying
backwards-compatible.

That brings no drawback as no code currently uses sysctl_handle_bool()
as part of a series of calls to sysctl_handle_*() functions for
(de)serialization of some compound structure.  If that case ever
materializes, it can be easily solved, e.g., by creating
a sysctl_handle_bool_strict() variant.

In the future, we might want to go further and generally be more liberal
in the external type of integers we accept and output, by tolerating any
kind of supported integers (8-bit to 64-bit), enabling integer type
changes of knob's internal representations without breaking the ABI for
consumers hardcoding the passed integers (instead of relying on sysctl
knob type information).

Reviewed by:    jhb
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54925
2026-02-03 18:19:07 +01:00
Olivier Certner 53bb02015f amd64: parse_memmap(): Move comment about size at proper place
While here, declare 'size' only in the relevant block.

No functional change (intended).

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
2026-02-03 18:19:00 +01:00
Gleb Smirnoff 64f7e3c9c1 sockets: let protocols be responsible for socket buffer mutexes
Sockets that implement their own socket buffers (marked with PR_SOCKBUF)
are now also responsible for initialization of socket buffer mutexes in
pr_attach and for destruction in pr_detach (or pr_close).

This removes a big bunch of reported LORs, as now WITNESS is able to see
that tcp(4) socket buffer mutex and netlink(4) socket buffer mutex are two
different things.  Distinct names also improve diagnostics for blocked
threads.

This also removes a hack from unix(4), where we used to mtx_destroy().
Also removes an innocent bug from unix(4) where for accept(2)-ed socket
soreserve() was called twice.  This one was innocent since first call to
soreserve() was asking for 0 bytes of space.

This slightly increased amount of pasted code in TCP's syncache_socket().
The problem is that while for sockets created with socket(2) it is
pr_attach responsible for call to soreserve() (including !PR_SOCKBUF
protocols), but for the sockets created with accept(2) it was
solisten_clone() doing soreserve(), combined with the fact that for
accept(2) TCP completely bypasses pr_attach. This all should improve once
TCP has its own socket buffers.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D54984
2026-02-03 09:09:49 -08:00
John Baldwin dbe9fa0be1 Makefile.inc1: Don't mark GCC broken for riscv64
Reviewed by:	mhorne
Differential Revision:	https://reviews.freebsd.org/D54969
2026-02-03 11:56:44 -05:00
Artem Bunichev 9555d80066 sh.1: Fix rendering error due to redundant .El
Due to this all the rest of the items in the Built-in Commands section
were not rendered at all.

Fixes: 2711852bd9 ("sh.1: Provide detailed job control documentation")
MFC after:		3 days
Reviewed by:		emaste, ziaee
Differential Revision:	https://reviews.freebsd.org/D55080
2026-02-03 11:20:26 -05:00
Ali Mashtizadeh c215eef345 libpmc: Fix the L3 counters for AMD Zen 1-4
On AMD processors libpmc was using the topic field (based on filename) to
determine the counter's subclass.  Unfortunately, the JSON definitions for
AMD Zen 1-4 have the L3 counters in files shared with other counters.

This change has libpmc to use the pmu field (which is derived from the Unit
field in JSON) to determine the correct counter subclass.

Reviewed by:	mhorne
MFC after:	2 weeks
Sponsored by:	Netflix
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1984
2026-02-03 11:21:50 -04:00
Justin Hibbits 9345091308 powerpc/pmap: Use a constant for HPT superpage shift
There are no plans to allow multiple sizes of HPT superpages, so just use a
constant for it.

MFC after:	3 weeks
Fixes:		1bc75d77e9 ("powerpc/pmap/oea64: Make PV_LOCK superpage sized")
2026-02-03 10:15:24 -05:00
Aymeric Wibo 9d4bad45e2 EVENTHANDLER.9: EVENTHANDLER_REGISTER never fails
Since ecdf4409f9 ("Rework the eventhandler locking [...]"),
EVENTHANDLER_REGISTER() can never return NULL.

Suggested by:	olce
Reviewed by:	olce, ziaee, zlei
Approved by:	olce, zlei
Fixes:	ecdf4409f9 ("Rework the eventhandler locking [...]")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55014
2026-02-03 15:56:40 +01:00
Jean-Sébastien Pédron 465ba08bb5 vm_phys: Check RB_FIND() return value in case it is NULL
When trying to unregister a fictitious range in
`vm_phys_fictitious_unreg_range()`, the function checks the properties
of the looked up segment, but it does not check if a segment was found
in the first place.

This can happen with the amdgpu DRM driver which could call
`vm_phys_fictitious_unreg_range()` without a fictitious range registered
if the initialisation of the driver failed (for example because
firmwares are unavailable).

The code in the DRM driver was improved to avoid that, but
`vm_phys_fictitious_unreg_range()` should still check the return value
of `RB_FIND()` before trying to dereference the segment pointer and
panic with a page fault.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55076
2026-02-03 15:44:55 +01:00
Dag-Erling Smørgrav d70b9eb74f libc/tests: Clean up *dir() tests
Mainly, avoid reusing the name of one of the functions we should be
testing (but aren't) for local variables.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55054
2026-02-03 15:39:32 +01:00
Olivier Certner 9ae367d11d hwpstate_amd(4): Rename CPPC register macros
To be closer to AMD's official terminology, except for the "Lowest
Non-Linear Performance" field which we label as 'EFFICIENT_PERF' closer
to Intel's ("Most Efficient Performance"), and to clear possible
confusion.

No functional change (intended).

Reviewed by:    aokblast
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54998
2026-02-03 15:03:02 +01:00
Olivier Certner 4b0e09a918 hwpstate_amd(4): Fix BITS_WITH_VALUE()/SET_BITS_VALUE() to obey the mask
While here, rename an argument of BITS_VALUE() to be consistent with the
other macros.

Reviewed by:    aokblast
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54997
2026-02-03 15:03:02 +01:00
Olivier Certner e5f8cbb86d x86: x86_msr_op(): MSR_OP_LOCAL: Disable interrupts on atomic ops
On MSR_OP_LOCAL and non-naturally-atomic operations (MSR_OP_ANDNOT and
MSR_OP_OR), there is no guarantee that we are not interrupted between
reading and writing the MSR, and that interruption could actually
perform some operation on that MSR, which would be lost.

Prevent that problem by temporarily disabling interrupts around MSR
manipulation.

Reviewed by:    kib
Discussed with: markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54996
2026-02-03 15:03:01 +01:00
Olivier Certner a1a8bcdfde x86: x86_msr_op(): Simplify assertions
Simplify them by moving them into more natural places, i.e., default
cases of 'switch' statements.

No functional change (intended).

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54996
2026-02-03 15:03:01 +01:00
Olivier Certner 7acd7ac638 x86: x86_msr_op(): Move setting mode up, delineate logical blocks
No functional changes (intended).

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D54996
2026-02-03 15:02:55 +01:00
Konstantin Belousov cd8d44173a unmount(2): do not allow MNT_DEFERRED or MNT_RECURSE flags from userspace
Repprted and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-02-03 12:25:47 +02:00
Enji Cooper e1f36b9db9 usr.bin/tftp: remove tests when MK_TFTP=no
These tests require the tftp client, which is not installed when
`MK_TFTP=no`. Remove them when that's not true.

MFC after:	1 week
2026-02-02 21:44:47 -08:00