FreeBSD/src cc92108release Makefile Makefile.vm

release: Use make's `:H` rather than `/..`

In general we want to strip subdir components, rather than appending
`..`s.

Reviewed by:    lwhsu
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54373

(cherry picked from commit 3949c2b8c4691a6dff8be7b38805d56faab91187)
(cherry picked from commit 61f0453b3aa71e640a42085f67ce556ca3283c6c)
DeltaFile
+2-2release/Makefile
+1-1release/Makefile.vm
+3-32 files

FreeBSD/src c3aa964sys/kern uipc_shm.c

shm: Zero struct kinfo_file in sysctl handler

Reported by: Calif.io in collaboration with Claude and Anthropic Research
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55806

(cherry picked from commit 25cc459286a02b646751541ccde5a33319471c73)
(cherry picked from commit 6348a5fd0d4792e752cb714f2a536c3287b8d580)
(cherry picked from commit e61804ae6380c8d1db4b8c43bf7821e5d31ca04e)
DeltaFile
+1-1sys/kern/uipc_shm.c
+1-11 files

FreeBSD/src 815eb5asys/compat/linux linux_misc.c

compat/linux: Avoid waitid() kernel stack disclosure

Reported by:    Adam Crosser, Praetorian
Reviewed by:    philip
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55812

(cherry picked from commit 9a9f93bcf1aa0059d759b2f3ea6faeb2760a11bd)
(cherry picked from commit 9f8db9cc67fb86eeb2b645ce7f8aa748e99241a9)
(cherry picked from commit a347e6e20e75ad6224afefcf650ef738c3de094d)
DeltaFile
+1-0sys/compat/linux/linux_misc.c
+1-01 files

FreeBSD/src 7f4bc45sys/compat/freebsd32 freebsd32_misc.c

compat32: Zero struct to avoid stack disclosure

Reported by:    Adam Crosser, Praetorian
Reviewed by:    philip
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55811

(cherry picked from commit 097cb4e9f0432c543c704cec712ce1cd3302335c)
(cherry picked from commit 4551ea3b3f04650cd5300a9eae8994bdb080db91)
(cherry picked from commit 6a808cd7534802d30010fb0a7f46381ff9f6ef3f)
DeltaFile
+1-1sys/compat/freebsd32/freebsd32_misc.c
+1-11 files

FreeBSD/src c5c5705sys/kern kern_descrip.c

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

(cherry picked from commit e68433e1990d5f1bcc1bdd270d65f1e4792a8e1b)
(cherry picked from commit 0cef1a9ae5ec90b2c4717de9bc33fc7c3b1fd705)
(cherry picked from commit 5e6b16f4555cba4422dde7c63344359019a23722)
DeltaFile
+1-1sys/kern/kern_descrip.c
+1-11 files

FreeBSD/src efba864sys/sys elf_common.h

elf_common.h: Add some AArch32 relocations

Reviewed by:    mmel
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55268

(cherry picked from commit 10ac7413c060b1496ef54e2338f487ea84f66206)
(cherry picked from commit 50a7a38ea79f05b2da38352629802c346aeb55d6)
DeltaFile
+13-0sys/sys/elf_common.h
+13-01 files

FreeBSD/src f62ab5csys/sys elf_common.h

elf_common.h: Add AArch64 Memtag ABI constants

Obtained from the Memtag ABI Extension to ELF for the Arm® 64-bit
Architecture (AArch64) [1]

[1] https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst#dynamic-section

Reviewed by:    andrew
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55486

(cherry picked from commit d971bc5220f7adb8a2bdfadc8e3ca7ffcf9ca843)
(cherry picked from commit 9712b5e4b58bc3ff9402413ce7a149c956774263)
DeltaFile
+8-0sys/sys/elf_common.h
+8-01 files

FreeBSD/src 5e6b16fsys/kern kern_descrip.c

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

(cherry picked from commit e68433e1990d5f1bcc1bdd270d65f1e4792a8e1b)
(cherry picked from commit 0cef1a9ae5ec90b2c4717de9bc33fc7c3b1fd705)
DeltaFile
+1-1sys/kern/kern_descrip.c
+1-11 files

FreeBSD/src 0cef1a9sys/kern kern_descrip.c

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

(cherry picked from commit e68433e1990d5f1bcc1bdd270d65f1e4792a8e1b)
DeltaFile
+1-1sys/kern/kern_descrip.c
+1-11 files

FreeBSD/src f617845share/mk src.opts.mk

src.opts.mk: Comment about CTF & DTRACE relationship

WITH_CTF enables building userland components with CTF, and not the ctf*
tools as one might expect.  The tools are actually included with the
DTRACE knob.  Add a comment where the dependency is handled, as this has
caused confusion.

Reported by:    ivy
Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56977
DeltaFile
+2-0share/mk/src.opts.mk
+2-01 files

FreeBSD/src 23005edsys/dev/acpica acpi_spmc.c

acpi_spmc(4): Update copyright

Sponsored by:   The FreeBSD Foundation
DeltaFile
+4-0sys/dev/acpica/acpi_spmc.c
+4-01 files

FreeBSD/src 91d3fb3sys/dev/acpica acpi_spmc.c

acpi_spmc(4): If verbose, print called functions

...as a debugging aid, in order to be able to check that some functions
are effectively called and to identify them quickly if they cause
a hang.

Reviewed by:    obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56883
DeltaFile
+10-2sys/dev/acpica/acpi_spmc.c
+10-21 files

FreeBSD/src 69a303asys/dev/acpica acpi_spmc.c

acpi_spmc(4): Auto-detect DSM revisions by default

Which revisions to use for the Intel and AMD DSMs is unclear.  For the
Intel one, the written specification indicates only 0, but Linux uses
1 (possibly an oversight).  For the AMD one, for which there is no
specification, Linux uses 0, but at least on the Framework 13 AMD 7040
series, the "enumerate functions" function only returns a mask that
covers all the functions we expect when called with revision 2.

Introduce an auto-detection strategy where each revision starting from
0 is tried in turn up to some limit (included; default: 15).  As soon as
a revision implements all expected functions, we stop the loop and use
that one, in effect selecting the minimum revision that implements all
we need, which should avoid potential backwards-compatibility problems.
If no revision implements all expected functions, the highest available
revision in the checked range is selected, but higher revisions that do
not bring new functions are discarded (see the explanatory comment in
acpi_spmc_probe_dsm()).


    [21 lines not shown]
DeltaFile
+176-75sys/dev/acpica/acpi_spmc.c
+176-751 files

FreeBSD/src b82e41dsys/dev/acpica acpi_spmc.c

acpi_spmc(4): Trivial simplification in detach function

Reviewed by:    obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56881
DeltaFile
+1-2sys/dev/acpica/acpi_spmc.c
+1-21 files

FreeBSD/src b092ee5sys/dev/acpica acpi_spmc.c

acpi_spmc(4): softc: Move supported functions into a DSM info structure

This is in preparation to adding the revision as a probed information.

Reviewed by:    obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56880
DeltaFile
+10-5sys/dev/acpica/acpi_spmc.c
+10-51 files

FreeBSD/src 65ecfb4sys/dev/acpica acpi_spmc.c

acpi_spmc(4): Only run DSM functions reported present

Examination of the DSDT in a Framework laptop generally hints at
firmware designers sometimes providing ACPI methods for convenience
(e.g., same firmware for multiple models) but not using them (or not
expecting them to be used) depending on tweaks or the actual hardware
platform.

On an Intel Framework laptop, we specifically observe the presence of
a Microsoft DSM that just reports availability of the SLEEP_ENTRY and
SLEEP_EXIT (7 and 8) functions although the Microsoft specification
requires other functions, whose purpose is similar to corresponding
Intel DSM's ones (such as DISPLAY_OFF).  However, we currently always
call the latter even on the Microsoft DSM.  On that laptop, fortunately,
the way the code is structured in the _DSM method leads to nothing being
executed on this call.

Given the similarity of intent between most functions from the Microsoft
DSM on one side and those of ADM and Intel on the other, it is

    [24 lines not shown]
DeltaFile
+37-52sys/dev/acpica/acpi_spmc.c
+37-521 files

FreeBSD/src ba4f05bsys/dev/acpica acpi_spmc.c

acpi_spmc(4): Factor out testing for present DSMs/functions

Since we are now keeping in the softc the information about which DSM
functions are available (in supported_functions[]), the 'dsms' field
there is somewhat redundant.

Make it completely redundant by keeping the bit representing the
enumeration function itself in each element of supported_functions[],
and then remove the field.

As a result, convert has_dsm() to rely on supports_function().

Adapt acpi_spmc_dsm_check_functions() so that it does not take into
account the enumeration function bit.

While here, use the self-explanatory stance
IDX_TO_BIT(DSM_ENUM_FUNCTIONS) instead of a hardcoded 1.

Reviewed by:    obiwac

    [2 lines not shown]
DeltaFile
+16-8sys/dev/acpica/acpi_spmc.c
+16-81 files

FreeBSD/src d765d20sys/dev/acpica acpi_spmc.c

acpi_spmc(4): acpi_spmc_run_dsm(): Rename, rename parameters, constify

This function actually runs a function of a given DSM.  Remove the
'_dsm' suffix to remove the inaccuracy and make things simpler.

Reviewed by:    obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56877
DeltaFile
+25-21sys/dev/acpica/acpi_spmc.c
+25-211 files

FreeBSD/src 6da01f0sys/dev/acpica acpi_spmc.c

acpi_spmc(4): Be less verbose by default

Do not print by default details of failures that are unlikely to help
a normal user and to have a crucial influence on whether suspension
works correctly.  Do so only on a verbose boot or if requested
explicitly by the user via 'debug.acpi.spmc.verbose'.

In particular:
- On an Intel Framework laptop, the Microsoft DSM only reports the
  SLEEP_ENTRY and SLEEP_EXIT functions.  That makes some sense since,
  according to its specification, all functions of a Microsoft DSM
  except these two are in fact redundant with Intel DSM's ones (also,
  that of AMD DSM's ones).  Those functions being missing are only
  a potential problem if there is no other DSM than Microsoft's (yet to
  be observed in the field).
- The details of malformed/unapplicable constraints or ones with a newer
  format the driver does not know about are not readily actionable
  pieces of information, but rather debug/developer-oriented ones.  When
  verbosity is not requested, only print the details of the first such

    [10 lines not shown]
DeltaFile
+14-7sys/dev/acpica/acpi_spmc.c
+14-71 files

FreeBSD/src 37c59fdsys/dev/acpica acpi_spmc.c

acpi_spmc(4): Add a sysctl knob to request verbosity

The driver will be more verbose on this knob being non-zero or
'bootverbose' being set.  The corresponding variable is typed as an
integer to leave room for expansion.  To be used in subsequent commits.

Reviewed by:    obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56875
DeltaFile
+6-0sys/dev/acpica/acpi_spmc.c
+6-01 files

FreeBSD/src f56201csys/dev/acpica acpi_spmc.c

acpi_spmc(4): acpi_spmc_probe_dsm(): Remove passing superfluous handle

The handle is already held by the softc, which is also passed.

No functional change (intended).

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56818
DeltaFile
+5-5sys/dev/acpica/acpi_spmc.c
+5-51 files

FreeBSD/src 310cbb8sys/dev/acpica acpi_spmc.c

acpi_spmc(4): Enable multiple instances

Support the (so far hypothetical) case of a machine with multiple
instances of the PNP0D80 device (e.g., if multiple DSMs are not
implemented on the same device), by allowing multiple instances of the
device to co-exist.

This is achieved by moving 'supported_functions' from 'struct dsm' into
the softc, so each instance has its own view of which functions are
supported.

Consequently, the check on the instance unit on probe can be removed.

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56817
DeltaFile
+20-20sys/dev/acpica/acpi_spmc.c
+20-201 files

FreeBSD/src ee13d62sys/dev/acpica acpi_spmc.c

acpi_spmc(4): Constraint parsing: Clearer error messages

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56815
DeltaFile
+6-4sys/dev/acpica/acpi_spmc.c
+6-41 files

FreeBSD/src 5ba100asys/dev/acpica acpi_spmc.c

acpi_spmc(4): Global message on constraints parsing failure

...in order to indicate to users that power state constraints will not
be checked at all.

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56816
DeltaFile
+7-1sys/dev/acpica/acpi_spmc.c
+7-11 files

FreeBSD/src ebad66asys/dev/acpica acpi_spmc.c

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
DeltaFile
+8-4sys/dev/acpica/acpi_spmc.c
+8-41 files

FreeBSD/src 921a6d6sys/dev/acpica acpi_spmc.c

acpi_spmc(4): Gracefully support a standalone Microsoft DSM

In acpi_spmc_get_constraints(), stop assuming that if there is no AMD
DSM, then the Intel one is present.  Although this is likely to be the
overwhelming majority of cases on amd64, there is no technical reason
nor constraint in our code that really needs assuming that.  On (so far
hypothetical) machines with only the Microsoft DSM, this assumption
would cause a cryptic and irrelevant error message (and, prior to the
previous commit, a panic on INVARIANTS).

Warn the user if both the Intel and AMD DSMs are present, and use the
constraints reported by the Intel one (see the comment for why).

Reviewed by:    imp (older version), obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56813
DeltaFile
+32-18sys/dev/acpica/acpi_spmc.c
+32-181 files

FreeBSD/src 0813dc0sys/dev/acpica acpi_spmc.c

acpi_spmc(4): In-kernel strdup() cannot fail, remove dead code

No functional change (intended).

Reviewed by:    imp, obiwac
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56814
DeltaFile
+0-8sys/dev/acpica/acpi_spmc.c
+0-81 files

FreeBSD/src e5615cdsys/dev/acpica acpi_spmc.c

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
DeltaFile
+9-10sys/dev/acpica/acpi_spmc.c
+9-101 files

FreeBSD/src 6bd543fsys/dev/acpica acpi_spmc.c

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

    [6 lines not shown]
DeltaFile
+28-30sys/dev/acpica/acpi_spmc.c
+28-301 files

FreeBSD/src 0cef5efsys/dev/acpica acpi_spmc.c

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
DeltaFile
+20-7sys/dev/acpica/acpi_spmc.c
+20-71 files