From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8268CC6B12 for ; Tue, 13 Oct 2026 22:40:24 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4j48Rn1wgyz30Vs; Wed, 14 Oct 2026 09:40:21 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2607:f8b0:4864:20::1348" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1791931221; cv=none; b=old6gRjd1fFcM/YIJGpUS8sQLo5LPlR7E/+Aw7EN4uHyz2D1h3n4w6S7En0BLrwqs793ikCE+251ZpFrYLuoMVD01Pu1yH9A7xoLDW2JrZOJcoCXrzKtEGiXywYnua8opuBIKbsnGj+X40A6MebUatzQpnmZUDxj/RZt91NHBDqgB5T7giL6tWoZo3qWFgBlVkVHD2jhDPHvW5us3rvu3IV6CledZlZJiirLTa1Y/G8esegQft32+CmNS6OG7DTt8MtfHPnI3bNq1dskk7jNp14otw8S1LdT6ZTvLzjinJZ47fH22bRu2xVMw0cjg6UFMsyPWriRTOE17Q44mwr2hQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1791931221; c=relaxed/relaxed; bh=6CWZGGdh7JOQ6UqV1gxmMbPkjK0LPv1nbOU26QpmZ10=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=IJ6bJtWBpLQTcxtMom9jPpPN9gjGMb7C+yaxRI61ETmwoWQP7lrZ/9WGMy8I5JLnuivasK2YvMc0JbOxKgEnJTAfoDpnXu3/P56hHxsuABrAo2sUoOLCgDiE7imFCKvVxuQcmHv23gB31OhLD7YAScVpOmI4wRt5XT5R4YKyqIdHMaYnNv9lzmQedT4npNeVvUhlrEBY3OBVJdN4SMu1YlpmfDMz7xws45e0PETg/YS2tfj9m1YlbhXGsWzCFFEIGv8MZaHHqTC1PKdQxz9VJ2cd7JNcrFd6aGjy5KfaNJkiL7PMScyQi/Fd2+Ci7DguEAMZBJPjMwjgAKZvL9Auyw== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=RmFdLYrt; dkim-atps=neutral; spf=pass (client-ip=2607:f8b0:4864:20::1348; helo=mail-dy1-x1348.google.com; envelope-from=3tlpoagckdesv41tr45t11tyr.p1zyv07a22p-qr8yv565.1cyno5.14t@flex--irogers.bounces.google.com; receiver=lists.ozlabs.org) smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=RmFdLYrt; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--irogers.bounces.google.com (client-ip=2607:f8b0:4864:20::1348; helo=mail-dy1-x1348.google.com; envelope-from=3tlpoagckdesv41tr45t11tyr.p1zyv07a22p-qr8yv565.1cyno5.14t@flex--irogers.bounces.google.com; receiver=lists.ozlabs.org) Received: from mail-dy1-x1348.google.com (mail-dy1-x1348.google.com [IPv6:2607:f8b0:4864:20::1348]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4j48Rk1y5Wz30NF for ; Wed, 14 Oct 2026 09:40:17 +1100 (AEDT) Received: by mail-dy1-x1348.google.com with SMTP id 5a478bee46e88-33c35f5ca6cso7840280eec.1 for ; Tue, 13 Oct 2026 15:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1791931213; x=1792536013; darn=lists.ozlabs.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=6CWZGGdh7JOQ6UqV1gxmMbPkjK0LPv1nbOU26QpmZ10=; b=RmFdLYrtN29LtVGQttc4Us4R9rE8c9JYprCZrL24N7lHbs6GuRONFQIe0AmHc4+hfE WPPC2fUp/Wz4G/MIpryIfI8uIqfquOo1Qa5J0Bt3QqDc9b3elM4kDFNrFgT5UMQ7uk3J OXNaiINWkFw6gmHy7MDv3k8Ue8dB/yTxnTuOL9uKwd/UfozEqxIxc6GFyEtvXgyX20Aq ypbv7bqm8bXpI10z/Yq2x6HDq23Icn83aEfmpGmXSHnj1oP6R9koOB0zA7LQ3EUZskdL iFVDN5JSTRWl+Tph3Eb5EiZO/RgVJJnznfSHH7UUwTXZFsKfftSkLgkClvM6laIt8fUX dFzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791931213; x=1792536013; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=6CWZGGdh7JOQ6UqV1gxmMbPkjK0LPv1nbOU26QpmZ10=; b=t4+sl1hb6xiSTniqPZZ6y8+ezURLRFKk0UkzkYL0gj0CE/8BdJ5ks80DYzYPBQQw+x 0qZdtT3doZcApkCI2O6W8Ht5amO8JF0Vsvhj0MX5lbFrE2t3Xcbj7qnLhuYE3K1fYY+S TNJd2arFghg1GVppxHAFiARA2EgtPuFsHqXpA8H7Ql/AagtC1mBKAQpDuXy6klj13IlY bT0bkocFzurd3DiHwe4N1Qz0rUexKBnJgND5huxmloYjIg6dnSJalweo7O4lTTftDZ11 4o3iC50uj8ltHTUXKrl+Jn1erhvA+MQRMkNuuatAZrIMOGMVx1QJ7Wtggd+j6SrBQMGK B4bQ== X-Forwarded-Encrypted: i=1; AKwUvBwxeaVG0Ltd8jdFkW1PNzmfkC8JZnGWYMqefg5jXersDhP3F9j8heyajo1oLEKl6W4PhGHniB3JzwPw0wQ=@lists.ozlabs.org X-Gm-Message-State: AFq9FYKMjEvrwOYbPM94r3uFPgXVQ8LqlU6Tfd23N3OFhgu9BphlHNtQ BYIh6GGRyReg3iBNJoJ7j6a/dyeX6uWw14C60j5OdvsCiPWMidIviGR9bQ9386mGNO2S+AOYRWY Zj8omwlvHBw== X-Received: from dlak14.prod.google.com ([2002:a05:701b:290e:b0:14e:f9ab:6f83]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:701b:2309:b0:153:7a27:b89 with SMTP id a92af1059eb24-16a5ed4008cmr22709999c88.21.1791931212336; Tue, 13 Oct 2026 15:40:12 -0700 (PDT) Date: Tue, 13 Oct 2026 15:39:35 -0700 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list Mime-Version: 1.0 X-Mailer: git-send-email 2.56.0.385.gd3acb90ef8-goog Message-ID: <20261013223946.1836757-1-irogers@google.com> Subject: [PATCH 00/11] kobject: Require explicit initialization of struct kobj_type::release From: Ian Rogers To: Greg Kroah-Hartman , "Rafael J . Wysocki" , Danilo Krummrich , Miguel Ojeda , Kees Cook , Nathan Chancellor Cc: Nick Desaulniers , Bill Wendling , Justin Stitt , Jonathan Corbet , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Nayna Jain , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Viresh Kumar , David Teigland , Alexander Aring , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Richard Weinberger , Zhihao Cheng , Felix Kuehling , Alex Deucher , "=?UTF-8?q?Christian=20K=C3=B6nig?=" , driver-core@lists.linux.dev, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, gfs2@lists.linux.dev, xen-devel@lists.xenproject.org, linux-s390@vger.kernel.org, linux-mtd@lists.infradead.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" Clang supports the 'require_explicit_initialization' attribute on struct fields to enforce that the field is explicitly initialized when an aggregate object is constructed, emitting -Wuninitialized-explicit-init (enabled by default) if the field is omitted. Following discussion at the Linux Plumbers Conference [1], this series introduces __require_explicit_initialization in include/linux/compiler_attributes.h and applies it to struct kobj_type::release. As Documentation/core-api/kobject.rst notes: "One important point cannot be overstated: every kobject must have a release() method, and the kobject must persist (in a consistent state) until that method is called. If these constraints are not met, the code is flawed." Annotating struct kobj_type::release caught 30 struct kobj_type definitions across the tree that omitted .release: - Patches 2-10 fix 10 struct kobj_type definitions where dynamically allocated kobjects, ksets, or enclosing structures were either leaked on kobject_put() or freed prematurely before kobject release (risking a use-after-free when CONFIG_DEBUG_KOBJECT_RELEASE=y). - Patch 11 annotates struct kobj_type::release with __require_explicit_initialization and explicitly sets .release = NULL (with explanatory comments) on the remaining legacy struct kobj_type definitions whose kobjects are static, per-CPU, or embedded in devm- or parent-managed structures. [1] https://lpc.events/event/20/contributions/2392/ Ian Rogers (11): Compiler Attributes: Add __require_explicit_initialization macro powerpc/secvar: Add missing kobject release callback to secvar_ktype sh: sq: Add missing kobject release callback to ktype_percpu_entry cpufreq: Initialize kobj_type release callback in ondemand and conservative governors ACPI: CPPC: Free cpc_desc in kobject release callback dlm: Free dlm_ls in kobject release callback xen/sys-hypervisor: Add release callback to hyp_sysfs_kobj_type s390/sclp_mem: Allocate struct sclp_mem dynamically and add kobject release ubifs: sysfs: Use kset_create_and_add() for ubifs_kset drm/amdkfd: Free queue in procfs_queue_type kobject release callback kobject: Require explicit initialization of struct kobj_type::release Documentation/conf.py | 1 + arch/arm64/kernel/cpuinfo.c | 2 + arch/powerpc/kernel/secvar-sysfs.c | 6 ++ arch/sh/kernel/cpu/sh4/sq.c | 6 ++ drivers/acpi/cppc_acpi.c | 39 +++++----- drivers/acpi/sysfs.c | 2 + drivers/cpufreq/cpufreq_conservative.c | 5 +- drivers/cpufreq/cpufreq_governor.c | 3 +- drivers/cpufreq/cpufreq_governor.h | 1 + drivers/cpufreq/cpufreq_ondemand.c | 5 +- drivers/dma/ioat/sysfs.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 4 + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 10 ++- drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 5 +- drivers/infiniband/hw/hfi1/sysfs.c | 2 + drivers/infiniband/hw/usnic/usnic_ib_sysfs.c | 2 + drivers/parisc/pdc_stable.c | 2 + drivers/power/supply/ab8500_fg.c | 2 + drivers/s390/char/sclp_mem.c | 73 +++++++++---------- drivers/soc/hisilicon/kunpeng_hccs.c | 6 ++ .../fbdev/omap2/omapfb/dss/display-sysfs.c | 2 + .../fbdev/omap2/omapfb/dss/manager-sysfs.c | 2 + .../fbdev/omap2/omapfb/dss/overlay-sysfs.c | 2 + drivers/xen/sys-hypervisor.c | 6 ++ fs/dlm/lockspace.c | 19 +++-- fs/erofs/sysfs.c | 4 + fs/f2fs/sysfs.c | 6 ++ fs/ocfs2/cluster/masklog.c | 2 + fs/ubifs/sysfs.c | 24 ++---- include/linux/compiler_attributes.h | 11 +++ include/linux/kobject.h | 2 +- scripts/checkpatch.pl | 1 + tools/lib/python/kdoc/xforms_lists.py | 1 + 33 files changed, 170 insertions(+), 90 deletions(-) -- 2.56.0.385.gd3acb90ef8-goog