Kernel series forces kobject release callbacks, plugs UAFs
A Clang-backed __must_init attribute will make missing kobj_type release methods a build-time error, after fixes across filesystems, GPU, cpufreq, and more.
Ian Rogers has posted a nine-patch series that adds a new __must_init compiler attribute and uses it to require every kobj_type to declare a release callback, closing a long-standing class of use-after-free and leak bugs in the Linux kernel's kobject layer.
Kernel documentation has long insisted that every kobject must carry a release method and must stay valid until that method runs. In practice many subsystems defined kobj_type structures without one. Dynamically allocated objects were then leaked on kobject_put(), freed too early, or left dangling when CONFIG_DEBUG_KOBJECT_RELEASE delayed cleanup past module unload or parent teardown.
The series first exposes Clang's require_explicit_initialization attribute (Clang 21 and later) as __must_init, a shorter name Greg Kroah-Hartman preferred after Linux Plumbers Conference discussion and an earlier seq_file prototype from Kees Cook. Annotating kobj_type::release then turns any omitted field into a default compiler diagnostic.
Fixes land for SuperH store-queue sysfs entries, cpufreq ondemand and conservative governors, the DLM lockspace, Xen's hypervisor sysfs node, UBIFS (switching a static kset to a dynamically allocated one), and AMD KFD queue procfs objects, among others. Remaining legacy types whose objects are static, per-CPU, firmware-backed, or parent-managed get an explicit .release = NULL and a comment. A few known-unsafe teardown paths (ioat, kunpeng_hccs, omapfb display) are only documented for now.
Rafael J. Wysocki advised routing the series through driver core as a unit so Clang builds do not break when individual subsystem fixes land out of order, and offered an ack for the cpufreq pieces. Review tags have also arrived from Felix Kuehling (amdkfd) and Zhongqiu Han (cpufreq).