[libc] Implement timegm (#243668)
This function is mktime but always in UTC. It's a BSD extension, but
it's also supported on linux. This PR adds the function as well as a
bunch of tests.
Assisted-by: Automated tooling, human reviewed.
linuxkpi: Release the "from" device in pci_get_class() and pci_get_base_class()
On Linux the pci_get_*() iterators drop the reference of the device passed
as "from" once the next one has been looked up, so a loop like
while ((pch = pci_get_class(class, pch)))
does not leak anything. LinuxKPI allocates a new pci_dev for every device
it returns but never released "from", so each device but the last one was
leaked together with its kobject, its name and its path name. i915 does
exactly this in intel_detect_pch() and leaked a device at every load.
Drop the reference, but only for the devices created by lkpinew_pci_dev();
the pci_dev of a device attached to a driver belongs to the bus.
Differential Revision: https://reviews.freebsd.org/D61222
lindebugfs: Free the kcov symlink when the module is unloaded
lindebugfs_init() creates the "kcov" symlink with debugfs_create_symlink(),
which allocates a node and a copy of the destination, but passed no destroy
callback to pfs_create_link(). pseudofs therefore never released them and
the "debugfsint" malloc type was reported as leaking memory each time the
module was unloaded.
Use debugfs_destroy(), as done for the other nodes.
Differential Revision: https://reviews.freebsd.org/D61221
linuxkpi: Release devres when the probe of a PCI driver fails
When the probe method of a driver fails, linux_pci_attach_device() only
dropped its reference on the device. Like on detach (see the previous
change), the devres actions are then not run if one of them holds a
reference on the device, which is what devm_drm_dev_alloc() does through the
drm_device. The device is never released, the drm_device is leaked with its
minor, its managed memory and its debugfs entries: unloading the driver
after a failed load (e.g. a missing firmware) printed
"WARNING !xa_empty(&drm_minors_xa)" and leaked memory.
Linux releases the devres resources of a device whose probe failed, so do the
same.
Differential Reivision: https://reviews.freebsd.org/D61223
[Clang][CFI] Check same-layout classes against their base in checked loads (#241644)
Without `-fsanitize=cfi-cast-strict`, CFI allows deleting a `Base`
object
through `Derived *` when `Derived` adds nothing to `Base`
(`struct Derived : Base {};`), and the regular `cfi-vcall` check uses
`Base` for such calls. The `llvm.type.checked.load` path, used by
trapping CFI with `-fwhole-program-vtables` and by VFE, used `Derived`,
so these deletes trapped only with `-fwhole-program-vtables`. That path
also applied the ignorelist and the hidden LTO visibility check to
`Derived` instead of `Base`.
Only virtual destructor calls are affected: a same-layout `Derived`
declares no other virtual functions, so other calls already check the
class that declares the function.
Pick the checked class the same way on both paths:
```text
[30 lines not shown]
pam_xdg: Add linger option
The pam_xdg module deletes a user's XDG_RUNTIME_DIR when the last
interactive session logs out. If the user leaves background processes
running on the system, like a terminal multiplexer, that puts state or
domain sockets in XDG_RUNTIME_DIR, then that state gets destroyed and
the processes become effectively orphaned.
On Linux, systemd-logind not only unlinks XDG_RUNTIME_DIR but also kills
all user processes on logout. To allow long-lived background processes,
it implements a per-user "linger" mode to disable the unlink and kill.
Because FreeBSD's pam_xdg does not implement process killing, this
"linger" option implementation skips only XDG_RUNTIME_DIR unlinking
when the user still has running processes after the last session logs
out.
Differential Revision: https://reviews.freebsd.org/D61332
sysutils/rpi-firmware: Use firmware DTB placement on Raspberry Pi 5
Set device_tree_address to an empty value for Pi 5, overriding the
inherited 0x4000 address and allowing firmware to place the DTB.
Keep DTB selection automatic for the D0 overlay. Preserve other models'
settings and bump PORTREVISION.
Companion src driver and release changes are required for Pi 5 support.
[DAG] isGuaranteedNotToBeUndefOrPoison - load(constant_pool) add DemandedElts handling (#243498)
If we're loading a Constant that is exactly the same vector dimensions
as the ISD::LOAD's ValueType, then attempt to perform a per-element
isGuaranteedNotToBeUndefOrPoison check to make use of the DemandedElts
mask
Fixes #243491
[CodeGen] Lower FREEZE of a defined value to COPY
A FREEZE is only needed when its operand may be undefined. FinalizeISel
now turns every other FREEZE into a COPY, right after instruction
selection.
Assisted-By: Claude Opus 5.5 <noreply at anthropic.com>
[CodeGen] Add FREEZE target opcode (#240469)
Machine IR equivalent of `freeze` instruction. Unlike COPY,
ProcessImplicitDefs does not turn a `FREEZE` of an `IMPLICIT_DEF` into
an `IMPLICIT_DEF` and the register coalescer does not join it.
After register allocation, a `FREEZE` of a defined value is lowered to a
COPY. A `FREEZE` of an undefined value is kept until code emission, so
that no later pass sees the register as undefined. It emits a comment in
verbose asm (like `IMPLICIT_DEF`).
This PR doesn't select `freeze` -> `FREEZE` yet because there's some
work to do to avoid regressions.
Assisted-By: Claude Opus 5.5 <noreply at anthropic.com>
[RISCV][GlobalISel] FP Info implementation for RISC-V. (#243299)
Enable extended LLTs for RISC-V.
This patch was written almost entirely by AI.
One of the obvious regressions is extra fmv.x.w / fmv.w.x pairs in tests
like half-convert.ll. I'll see about fixing it, but probably in a
separate PR.
Assisted-by: Claude