Commit Graph

309266 Commits

Author SHA1 Message Date
Olivier Certner e5615cd809 acpi_spmc(4): INVARIANTS: Do not panic on getting constraints failure
Just continue without constraints checking in this case.

To this end, remove the 'constraints_populated' field from 'struct
acpi_spmc_softc' and any reference to it.

However, we introduce another boolean, 'sc->get_constraints_succeeded',
in order to check (under INVARIANTS) that acpi_spmc_get_constraints() is
called only once on success.  Calling that function another time after
a success would leak memory.  It would be easy to change that function
to support multiple calls (e.g., by adding a call to
acpi_spmc_free_constraints() near its start), however trying to retrieve
the constraints again simply looks like wasted time as the same results
are expected to be returned on each call.

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56812
2026-05-13 14:38:22 +02:00
Olivier Certner ebad66abbc acpi_spmc(4): Print supported functions after DSMs
This makes things more top-down, as expected when probing devices.

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56811
2026-05-13 14:38:22 +02:00
Olivier Certner 6bd543f7a8 acpi_spmc(4): Check DSMs only on attach, do not return 0 on probe
Once we have recognized a device by PNP ID, declare support
unconditionally on probe, and only check for DSMs in attach.

We do this for these reasons:
1. PNP0D80 is de-facto a device supposed to hold DSMs related to
   suspend-to-idle, so we assume it cannot be used for other purposes.
   And if that changes, we need another architecture anyway (e.g., have
   a new driver claiming those devices and behaving like a bus, to which
   this driver would be a sub-driver).
2. If there are no DSMs that we support on such a device, then a new DSM
   was added that the driver does not know about and which "replaces"
   (in terms of functionality) the known ones, or the firmware is buggy.
   In both cases, failing the attach instead of the probe is reasonable,
   as that leads to printing some error which we (and probably users
   too) would like to know about.
3. This is a step to enable multiple instances of this driver (just to
   be a good citizen, and also to be future proof against weird
   firmwares that would, e.g., implement the Microsoft DSM on another
   device than the Intel one).

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56810
2026-05-13 14:38:21 +02:00
Olivier Certner 0cef5efbbf acpi_spmc(4): Stop pretending that all constraints are verified
We do not check these constraints (yet), so stop printing that they are
verified.

While here, make the (not compiled in at the moment) "constraint
violated" message more terse, and move the warning it contains to
outside of the loop (no need to print it repeatedly if multiple
constraints are violated).

While here, bail out early if there are no constraints to avoid printing
(in the future) that constraints are respected even when there are none.

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56809
2026-05-13 14:38:21 +02:00
Olivier Certner a78c9a2a47 acpi_spmc(4): Constraints: Clearer message on handle retrieve error
Currently, the "failed to get handle for ..." log messages on attach are
a bit alarming and no context is provided.  Print out that these are
retrieved when trying to match constraints and that such failures are
ignored, which should make administrators worry less.

While here, remove duplicated handle retrieving code in
acpi_spmc_check_constraints() because:
1. As is, it is dead code: We 'continue' if the handle is NULL, i.e.,
   not already resolved, before trying to resolve it again.
2. This code is called after device suspension, which might make some
   objects disappear from the ACPI namespace.  In any case, it seems
   unlikely that, suddenly, new objects would appear.

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56808
2026-05-13 14:38:21 +02:00
Olivier Certner 98ad729f3e acpi_spmc(4): Constraints: Simplify some assertions
While here, capitalize their messages.

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56807
2026-05-13 14:38:21 +02:00
Olivier Certner ee00031940 acpi_spmc(4): Rename functions parsing constraints
Rename acpi_spmc_get_constraints_intel() and
acpi_spmc_get_constraints_amd() ("get" => "parse") to reflect that they
are actually just parsing the constraints passed by
acpi_spmc_get_constraints().

No functional change (intended).

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56806
2026-05-13 14:38:20 +02:00
Olivier Certner cc628a66b4 acpi_spmc(4): Human-readably print supported DSMs and their functions
To this end, revamp how DSMs and their functions are represented.
Replace enumerations, which only bring minimal advantages, with plain
macros, allowing to get rid of 'union dsm_index' and in passing the associated bug
that an underlying type smaller than 'int' is aliased to an 'int', which
assumes little-endian architectures.  Associate to each function
a printable name, in the form of a per-DSM array that maps a function
index into a string.  Make sure that every used array and their number
of items are sized at compile-time and are declared constant, and that
as little code as possible depends on the particular set of present DSMs
and associated functions.

Since the set of DSMs and sets of per-DSM functions are represented as
bitsets, introduce print_bit_field() to print such sets.  This new
function is akin to printf("%b", ...) but with more flexibility.  It
takes a function associating a name to some bit index and an opaque
pointer, allowing to leverage existing structures containing names
instead of imposing the use of a separate string containing all names to
be printed.  It also provides a default name to bits without an explicit
name, composed of a common prefix and the bit index as a suffix.

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56756
2026-05-13 14:38:20 +02:00
Olivier Certner 3c2d2bcc6f acpi_spmc(4): Factor out printing DSM call error, delineate function
Introduce failed_to_call_dsm(), which prepends "function" before the
function index for better clarity.  For now, it prints the function
number, as before, but will soon print a human-readable name.

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56805
2026-05-13 14:38:20 +02:00
Olivier Certner 868f50f649 acpi_spmc(4): softc: Remove unused 'obj'
No functional change (intended).

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56804
2026-05-13 14:38:20 +02:00
Olivier Certner f77731ee95 acpi_spmc(4): Introduce supports_function()
For better readability and because this stance will be used in many
more places in a subsequent commit.

No functional change (intended).

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56803
2026-05-13 14:38:19 +02:00
Olivier Certner 27d99ff079 acpi_spmc(4): Clear confusion between DSMs and their functions
Stick to the ACPI specification's terminology where DSM means "device
specific method", but is in fact a set of multiple functions (actually,
there is one set of functions per DSM revision, with the set for some
revision in theory including those of the previous revisions), by
renaming some of the fields of 'struct acpi_spmc_softc' and local
variables accordingly.

To this end, rename appropriate structures, fields, parameters and
variables, mechanically.

No functional change (intended).

Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56802
2026-05-13 14:38:19 +02:00
Olivier Certner a648c45c9d acpi_spmc(4): Factor out code to test for a DSM's presence
...through a new function has_dsm(), which slightly simplifies reading.

No functional change (intended).

Reviewed by:    obiwac, imp
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56801
2026-05-13 14:38:19 +02:00
Olivier Certner 704b96509d acpi_spmc(4): Constraints: Rename the Intel-format parser
...from acpi_spmc_get_constraints_spec() to
acpi_spmc_get_constraints_intel(), as really there is no ACPI
specification proper and parsing the constraints is done according to
some *Intel* specification (even if it is true that, by contrast, AMD
has none).

No functional change (intended).

Reviewed by:    obiwac, imp
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56800
2026-05-13 14:38:19 +02:00
Olivier Certner beca41dfb5 acpi_spmc(4): Remove XXX from a comment about retrieving constraints
There is really nothing we can do about a DSM function that works on
first call but fails on subsequent calls, except calling it only once,
which we already do.

While here, soften the comment message, as failure was observed with
some specific machines only.

No functional change.

Reviewed by:    emaste, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56799
2026-05-13 14:38:18 +02:00
Olivier Certner a652d97630 acpi_spmc(4): Fix comments on constraints storage
The fields themselves are not unused, we actually fill them, but once
filled we indeed do not use their values (yet).  See the '#ifdef notyet'
section in acpi_spmc_check_constraints().

No functional change.

Reviewed by:    emaste, obiwac, imp
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56798
2026-05-13 14:38:13 +02:00
Aymeric Wibo d649825e83 power: Power device and ioctl for state transitions
Create new /dev/power node with super simple ioctl for initiating sleep
state transitions.

This is meant as a generic interface to replace the ACPI- and
APM-specific interfaces. This allows for non-ACPI states to be entered,
such as suspend-to-idle when setting kern.power.suspend=suspend_to_idle.

Reviewed by:	markj, olce
Approved by:	markj, olce
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D55508
2026-05-13 12:55:48 +01:00
Pouria Mousavizadeh Tehrani 4329663a86 rtnetlink: Align RTA_MULTIPATH length validation in nlattr_get
Fix length validation of RTA_MULTIPATH attributes in
nlattr_get_multipath() by making sure the user request is align.

PR:		295102
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	markj
Fixes:		7e5bf68495 ("netlink: add netlink support")
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D56963
2026-05-13 13:14:28 +03:30
Pouria Mousavizadeh Tehrani 188631e43a rtnetlink: Check for allocation failure in nlattr_get_multipath()
Check for alloction failure on `npt_alloc()` for RTA_MULTIPATH
attributes in `nlattr_get_multipath()`.
Also, add tests for maximum number of rtnexthop in rtnetlink.

Reported by:	Joshua Rogers of AISLE Research Team
Reviewed by:	markj
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D56954
2026-05-13 13:14:19 +03:30
Simon J. Gerraty 1729d2f741 Merge bmake-20260508
Merge commit 'ef402bba84260816d3e8d6e2439b0bc7eddc9446'
2026-05-12 21:26:44 -07:00
Simon J. Gerraty ef402bba84 Import bmake-20260508
Intersting/relevant changes since bmake-20260313

ChangeLog since bmake-20260313

2026-05-08  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20260508
	Merge with NetBSD make, pick up
	o make.1: fix description of '-' handling in jobs-mod
	by intenting it correctly.

2026-04-13  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20260406
	Merge with NetBSD make, pick up
	o cleanup unnecessary parens

	* configure.in: add --with-save-dollars to control default for
	.MAKE.SAVE.DOLLARS - address FreeBSD PR 294436

mk/ChangeLog since bmake-20260313

2026-05-09  Simon J Gerraty  <sjg@beast.crufty.net>

	* gendirdeps.mk: also apply ':S,/$,,' and ':C,/(\.[^.]*)$,\1,'
	when setting DIRDEPS prior to saving.

	* dirdeps.mk: when debugging it is handy to be able to skip
	recursing so if DEBUG_DIRDEPS contains 'norecurse' we will only
	process the immediate DIRDEPS.
	Also if DEBUG_DIRDEPS contains '-V' we process sections normally
	skipped when doing 'make -V'.
	o ensure we do not get duplicate build dirs due to someone
	adding a trailing '/' or '/.${TARGET_SPEC}' to a DIRDEPS entry.
	Add ':S,/$,,' when setting '__depdirs' and
	add ':C,/(\.[^.]*)$,\1,' when setting '__qual_depdirs'.

2026-04-24  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20260424

	* Use MK_META_AUTODEP to control use of meta.autodep.mk
	so it can be used independently of MK_DIRDEPS_BUILD for
	bootstrapping.

	* sys.vars.mk (M_type): use :sh rather than :sh1 to avoid
	surprises in a .for loop.
2026-05-12 21:20:50 -07:00
Philip Paeps 9cc9b8b372 contrib/expat: import expat 2.8.1
Changes: https://github.com/libexpat/libexpat/blob/R_2_8_1/expat/Changes

Security:	CVE-2026-45186
MFC after:	1 week
2026-05-13 11:26:56 +08:00
Philip Paeps e3c0f2f399 Vendor import of expat 2.8.1 2026-05-13 11:13:20 +08:00
Ed Maste eacf4f50bf u3g: Add Telit LM960A18 LTE modem
The patch in the PR failed to apply, so I manually applied the same
changes.

PR:		295231
Submitted by:	Mike Tancsa <mike@sentex.net>
Reviewed by:	emaste
2026-05-12 20:36:39 -04:00
Ed Maste e6475c8f35 Cirrus-CI: Bump toolchain to LLVM 21
Cirrus-CI is shutting down at the end of the month, but we can still
finish with an up-to-date working build with an LLVM version matching
the in-tree toolchain.

Sponsored by:	The FreeBSD Foundation
2026-05-12 20:29:30 -04:00
Ed Maste b76b05c04c pam_ssh: Fix build - chase OpenSSH function signature change
Reported by: dch
Fixes: 644b4646c7 ("OpenSSH: Update to 10.1p1")
Sponsored by: The FreeBSD Foundation
2026-05-12 18:51:00 -04:00
Ed Maste e68aa5ab80 OpenSSH: Update to 10.2p1
Full release notes are available at
https://www.openssh.com/txt/release-10.2

Selected highlights from the release notes:

Bugfixes
--------

 * ssh(1): fix mishandling of terminal connections when
   ControlPersist was active that rendered the session unusable.
   bz3872

Sponsored by:	The FreeBSD Foundation
2026-05-12 21:12:09 +00:00
Ed Maste 644b4646c7 OpenSSH: Update to 10.1p1
Full release notes are available at
https://www.openssh.com/txt/release-10.1

Selected highlights from the release notes:

Potentially-incompatible changes

 * ssh(1): add a warning when the connection negotiates a non-post
   quantum key agreement algorithm.

 * ssh(1), sshd(8): major changes to handling of DSCP marking/IPQoS

 * ssh(1), sshd(8): deprecate support for IPv4 type-of-service (ToS)
   keywords in the IPQoS configuration directive.

 * ssh-add(1): when adding certificates to an agent, set the expiry
   to the certificate expiry time plus a short (5 min) grace period.

 * ssh-agent(1), sshd(8): move agent listener sockets from /tmp to
   under ~/.ssh/agent for both ssh-agent(1) and forwarded sockets
   in sshd(8).

Security

 * ssh(1): disallow control characters in usernames passed via the
   commandline or expanded using %-sequences from the configuration
   file, and disallow \0 characters in ssh:// URIs.

New features

 * ssh(1), sshd(8): add SIGINFO handlers to log active channel and
   session information.

Sponsored by:	The FreeBSD Foundation
2026-05-12 20:24:10 +00:00
Mark Johnston beab4a237a igmp: Avoid leaving dangling pointers in the state-change queue
When igmp_v3_merge_state_changes() is iterating over state-change
packets, there is a case where it'll free a queued packet but will fail
to remove it from the queue.  Fix that.

Reported by:	Yuxiang Yang, Yizhou Zhao, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM5.1 from Z.ai
Reviewed by:	pouria, glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56947
2026-05-12 20:05:19 +00:00
Mark Johnston a6c4fe2d1a if_vxlan: Update *m0 after a pullup
vxlan_input()'s caller is supposed to free *m0 if it is non-NULL after
the function returns.  vxlan_input() failed to update *m0 after the
pullup however, so if it hits an error case after the pullup, we'll free
the mbuf twice.  Currently this can happen only if the interface is
brought down or due to a packet loop.

Reported by:	Yuxiang Yang, Yizhou Zhao, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM5.1 from Z.ai
Reviewed by:	pouria, zlei
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56944
2026-05-12 20:05:19 +00:00
Mark Johnston 8b4b995eff cpuset: Move userspace declarations out of _cpuset.h
The _*.h headers are for structure definitions and should avoid
dependencies on other headers.  This convention is violated by using
__BEGIN_DECLS/__END_DECLS.

Move the declarations to cpuset.h, I see no reason they can't be there.

Reviewed by:	olce, brooks, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56856
2026-05-12 20:05:19 +00:00
Mark Johnston 271d25a066 libufs: Avoid using param.h constants in libufs.h
MAXBSIZE is defined in param.h, which defines many other things.  To
avoid forcing all consumers of libufs.h to include param.h, let's
instead redefine it and verify the definition in inode.c.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56859
2026-05-12 20:05:19 +00:00
Mark Johnston 3cd3900b69 fsck_ffs: Avoid relying on param.h pollution from libufs.h
- gjournal.c needs param.h to get a definition of isclr().
- fsck.h needs signal.h for sig_atomic_t.

Sort includes while here.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56858
2026-05-12 20:05:19 +00:00
Mark Johnston 237900f17f libutil: Include param.h in quotafile.c
Required for MAXPATHLEN.

MFC after:	1 week
2026-05-12 20:05:19 +00:00
Mark Johnston 9461071d5c reboot: Include limits.h for PATH_MAX
MFC after:	1 week
2026-05-12 20:05:19 +00:00
Mark Johnston ee2d1a1a5a edquota: Include param.h
Required for MAXPATHLEN and MAXLOGNAME.

MFC after:	1 week
2026-05-12 20:05:19 +00:00
Mark Johnston fae5815a1d hastd: Include param.h instead of relying on pollution in hooks.c
This is needed at least for MAX() and PATH_MAX.

MFC after:	1 week
2026-05-12 20:05:18 +00:00
Mark Johnston 5615db1007 find: Include signal.h to get a definition for sig_atomic_t
MFC after:	1 week
2026-05-12 20:05:18 +00:00
Mark Johnston fab4acbb7d vmem: Include param.h in the userspace port as well
It is required at least for NBBY.

MFC after:	1 week
2026-05-12 20:05:18 +00:00
Mark Johnston 35a36d4a54 mdo: Avoid relying on header pollution
The uses of PAGE_SIZE and roundup2() require param.h.

MFC after:	1 week
2026-05-12 20:05:18 +00:00
Mark Johnston 3b16e96b00 tests/ip_mroute: Remove test timeouts
The configured timeout of 30s is a bit too low for a couple of tests
which create 4+ VNET jails when running tests in parallel and with
kernel sanitizers enabled.  There's no reason to have custom timeouts,
just use the default.

MFC after:	1 week
2026-05-12 20:05:18 +00:00
Mark Johnston 26bffe5695 tests/tcp_hpts_test: Fix more resource leaks
Address leaks that I missed in commit f7bf9fd619
("tests/tcp_hpts_test: Fix resource leaks").

Reviewed by:	Nick Banks <nickbanks@netflix.com>, tuexen
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D56943
2026-05-12 20:05:18 +00:00
Nick Banks d1aee9f153 sys/time.h: add bintime2us() helper
Add a microsecond conversion helper to complement the existing
bintime2ns(). The body mirrors bintime2ns().
This will be used by an upcoming eventlog(9) framework as well as
the TCP code in upcoming changes.

Approved by:		gallatin, tuexen
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D56972
2026-05-12 21:26:24 +02:00
Mateusz Piotrowski 03bc95b060 dtrace_dtmalloc.4: Document the DTrace dtmalloc provider
MFC after:	1 week
Discussed with:	christos, markj, ziaee
Differential Revision:	https://reviews.freebsd.org/D51396
2026-05-12 20:03:11 +02:00
Ed Maste e68433e199 sys: Fix heap disclosure in compat7 kern.proc.filedesc sysctl
Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56976
2026-05-12 13:59:51 -04:00
Sarah Walker a6add87b5e arm64: Load SOCDEV_PA as a literal rather than an immediate
When EARLY_PRINTK is used in a realm environment, the UART physical
address must be in the unprotected address space. The resulting
physical address will not generally fit in an immediate, so use a
literal instead.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D56600
2026-05-12 17:54:41 +01:00
Sarah Walker 56abdbc5f7 arm64: VM/PMAP changes for CCA guest support
When in a realm:

- Mappings with mode VM_MEMATTR_DEVICE and VM_MEMATTR_DEVICE_NP are
  unprotected
- Imported busdma buffers in protected memory are always bounced
- If EARLY_PRINTK is in use, the UART physical address must be in the
  unprotected address space

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D56599
2026-05-12 17:54:41 +01:00
Sarah Walker 76a2904c35 arm64: Add RSI detection for CCA
Detect the presence of the Realm Services Interface (RSI). This detection is
performed early in bootup; PSCI initialisation has been moved to initarm() to
faciliate this.

Reviewed by:	andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D56598
2026-05-12 17:54:40 +01:00
Sarah Walker f9ba99eaa2 physmem: Add a way to read all memory
In Arm CCA we need to find all memory to protect it. This needs to find
all memory, ignoring any excluded memory to protect it from the host.

Add physmem_all that reads all physical memory regions.

Co-developed-by: Andrew Turner <andrew@> (writing tests & commit message)
Sponsored by:	Arm Ltd
2026-05-12 17:54:40 +01:00
Sarah Walker cd2512eaab vm: Add flags for unprotected allocations
Unprotected allocations are intended to be accessible outside of the current
VM on systems such as Arm CCA.

Reviewed by:	markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D56518
2026-05-12 17:54:40 +01:00