| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/09/15 04:07 | flow | patch-triage |
3mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch series introduces a compile-time static storage duration check (ASSERT_STATIC_STORAGE) for DEFINE_* and DECLARE_* macros to prevent misuse on the stack. The changes in include/linux/* add purely compile-time assertions and keep equivalent expansions for on-stack macro variants, introducing no runtime executable code or runtime assertions. The changes under tools/ affect only user-space tests. The modification in drivers/macintosh/ams/ams-pmu.c is exclusive to PowerPC architecture (CONFIG_PPC_PMAC) and unreachable on amd64. Finally, the WireGuard changes in drivers/net/wireguard/selftest/allowedips.c adjust mutex declarations in __init boot-time self-tests where mutex_init() was already called immediately afterwards, causing no functional change in executable kernel logic. None of the changes warrant fuzzing.",
"WorthFuzzing": false
} |
| 1/1 | 2026/09/15 04:07 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit c54f1c46bcb41eb75a627ff924faff421c83a9e0\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Tue Sep 15 04:07:19 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/macintosh/ams/ams-pmu.c b/drivers/macintosh/ams/ams-pmu.c\nindex 1c3ce39e9a590..046a7d5dc5b25 100644\n--- a/drivers/macintosh/ams/ams-pmu.c\n+++ b/drivers/macintosh/ams/ams-pmu.c\n@@ -48,7 +48,7 @@ static void ams_pmu_req_complete(struct adb_request *req)\n static void ams_pmu_set_register(u8 reg, u8 value)\n {\n \tstatic struct adb_request req;\n-\tDECLARE_COMPLETION(req_complete);\n+\tDECLARE_COMPLETION_ONSTACK(req_complete);\n \n \treq.arg = \u0026req_complete;\n \tif (pmu_request(\u0026req, ams_pmu_req_complete, 4, ams_pmu_cmd, 0x00, reg, value))\n@@ -61,7 +61,7 @@ static void ams_pmu_set_register(u8 reg, u8 value)\n static u8 ams_pmu_get_register(u8 reg)\n {\n \tstatic struct adb_request req;\n-\tDECLARE_COMPLETION(req_complete);\n+\tDECLARE_COMPLETION_ONSTACK(req_complete);\n \n \treq.arg = \u0026req_complete;\n \tif (pmu_request(\u0026req, ams_pmu_req_complete, 3, ams_pmu_cmd, 0x01, reg))\ndiff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c\nindex 3e857e6fb627b..ecb2908228e7a 100644\n--- a/drivers/net/wireguard/selftest/allowedips.c\n+++ b/drivers/net/wireguard/selftest/allowedips.c\n@@ -257,7 +257,7 @@ static __init bool randomized_test(void)\n \tu8 ip[16], mutate_mask[16], mutated[16];\n \tstruct wg_peer **peers, *peer;\n \tstruct horrible_allowedips h;\n-\tDEFINE_MUTEX(mutex);\n+\tstruct mutex mutex;\n \tstruct allowedips t;\n \tbool ret = false;\n \n@@ -499,7 +499,7 @@ bool __init wg_allowedips_selftest(void)\n \tstruct allowedips_node *iter_node;\n \tbool success = false;\n \tstruct allowedips t;\n-\tDEFINE_MUTEX(mutex);\n+\tstruct mutex mutex;\n \tstruct in6_addr ip;\n \tsize_t i = 0, count = 0;\n \t__be64 part;\ndiff --git a/include/linux/completion.h b/include/linux/completion.h\nindex fb29156765743..b514b55557223 100644\n--- a/include/linux/completion.h\n+++ b/include/linux/completion.h\n@@ -9,6 +9,7 @@\n * See kernel/sched/completion.c for details.\n */\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/swait.h\u003e\n \n /*\n@@ -50,7 +51,8 @@ static inline void complete_release(struct completion *x) {}\n * variables.\n */\n #define DECLARE_COMPLETION(work) \\\n-\tstruct completion work = COMPLETION_INITIALIZER(work)\n+\tstruct completion work = COMPLETION_INITIALIZER(work);\t\\\n+\tASSERT_STATIC_STORAGE(work)\n \n /*\n * Lockdep needs to run a non-constant initializer for on-stack\n@@ -70,8 +72,10 @@ static inline void complete_release(struct completion *x) {}\n # define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \\\n \tstruct completion work = COMPLETION_INITIALIZER_ONSTACK_MAP(work, map)\n #else\n-# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)\n-# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) DECLARE_COMPLETION(work)\n+# define DECLARE_COMPLETION_ONSTACK(work) \\\n+\tstruct completion work = COMPLETION_INITIALIZER(work)\n+# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \\\n+\tDECLARE_COMPLETION_ONSTACK(work)\n #endif\n \n /**\ndiff --git a/include/linux/idr.h b/include/linux/idr.h\nindex 789e23e674441..b3fff99a4c961 100644\n--- a/include/linux/idr.h\n+++ b/include/linux/idr.h\n@@ -54,7 +54,9 @@ struct idr {\n * An IDR defined using this macro is ready for use with no additional\n * initialisation required. It contains no IDs.\n */\n-#define DEFINE_IDR(name)\tstruct idr name = IDR_INIT(name)\n+#define DEFINE_IDR(name) \\\n+\tstruct idr name = IDR_INIT(name);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n /**\n * idr_get_cursor - Return the current position of the cyclic allocator\ndiff --git a/include/linux/klist.h b/include/linux/klist.h\nindex b0f238f20dbb2..5848363242b61 100644\n--- a/include/linux/klist.h\n+++ b/include/linux/klist.h\n@@ -10,6 +10,7 @@\n #ifndef _LINUX_KLIST_H\n #define _LINUX_KLIST_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/spinlock.h\u003e\n #include \u003clinux/kref.h\u003e\n #include \u003clinux/list.h\u003e\n@@ -29,7 +30,8 @@ struct klist {\n \t .put\t\t= _put, }\n \n #define DEFINE_KLIST(_name, _get, _put)\t\t\t\t\t\\\n-\tstruct klist _name = KLIST_INIT(_name, _get, _put)\n+\tstruct klist _name = KLIST_INIT(_name, _get, _put);\t\t\\\n+\tASSERT_STATIC_STORAGE(_name)\n \n extern void klist_init(struct klist *k, void (*get)(struct klist_node *),\n \t\t void (*put)(struct klist_node *));\ndiff --git a/include/linux/kthread.h b/include/linux/kthread.h\nindex a01a474719a72..faa9dfb2f6cf5 100644\n--- a/include/linux/kthread.h\n+++ b/include/linux/kthread.h\n@@ -2,6 +2,7 @@\n #ifndef _LINUX_KTHREAD_H\n #define _LINUX_KTHREAD_H\n /* Simple interface for creating and stopping kernel threads without mess. */\n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/err.h\u003e\n #include \u003clinux/sched.h\u003e\n \n@@ -179,7 +180,8 @@ struct kthread_delayed_work {\n \n #define DEFINE_KTHREAD_DELAYED_WORK(dwork, fn)\t\t\t\t\\\n \tstruct kthread_delayed_work dwork =\t\t\t\t\\\n-\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn)\n+\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn);\t\t\t\\\n+\tASSERT_STATIC_STORAGE(dwork)\n \n extern void __kthread_init_worker(struct kthread_worker *worker,\n \t\t\tconst char *name, struct lock_class_key *key);\ndiff --git a/include/linux/mutex.h b/include/linux/mutex.h\nindex 734048c02f4f5..2f2d95f3097c4 100644\n--- a/include/linux/mutex.h\n+++ b/include/linux/mutex.h\n@@ -11,6 +11,7 @@\n #ifndef __LINUX_MUTEX_H\n #define __LINUX_MUTEX_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003casm/current.h\u003e\n #include \u003clinux/list.h\u003e\n #include \u003clinux/spinlock_types.h\u003e\n@@ -84,7 +85,8 @@ do {\t\t\t\t\t\t\t\t\t\\\n \t\t__DEP_MAP_MUTEX_INITIALIZER(lockname) }\n \n #define DEFINE_MUTEX(mutexname) \\\n-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname)\n+\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\n+\tASSERT_STATIC_STORAGE(mutexname)\n \n #ifdef CONFIG_DEBUG_LOCK_ALLOC\n void mutex_init_lockdep(struct mutex *lock, const char *name, struct lock_class_key *key);\n@@ -124,7 +126,8 @@ extern bool mutex_is_locked(struct mutex *lock);\n }\n \n #define DEFINE_MUTEX(mutexname)\t\t\t\t\t\t\\\n-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname)\n+\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\n+\tASSERT_STATIC_STORAGE(mutexname)\n \n #define mutex_is_locked(l)\trt_mutex_base_is_locked(\u0026(l)-\u003ertmutex)\n \ndiff --git a/include/linux/notifier.h b/include/linux/notifier.h\nindex 01b6c9d9956f9..4f6330360df2c 100644\n--- a/include/linux/notifier.h\n+++ b/include/linux/notifier.h\n@@ -10,6 +10,7 @@\n \n #ifndef _LINUX_NOTIFIER_H\n #define _LINUX_NOTIFIER_H\n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/errno.h\u003e\n #include \u003clinux/mutex.h\u003e\n #include \u003clinux/rwsem.h\u003e\n@@ -114,10 +115,12 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n \n #define ATOMIC_NOTIFIER_HEAD(name)\t\t\t\t\\\n \tstruct atomic_notifier_head name =\t\t\t\\\n-\t\tATOMIC_NOTIFIER_INIT(name)\n+\t\tATOMIC_NOTIFIER_INIT(name);\t\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n #define BLOCKING_NOTIFIER_HEAD(name)\t\t\t\t\\\n \tstruct blocking_notifier_head name =\t\t\t\\\n-\t\tBLOCKING_NOTIFIER_INIT(name)\n+\t\tBLOCKING_NOTIFIER_INIT(name);\t\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n #define RAW_NOTIFIER_HEAD(name)\t\t\t\t\t\\\n \tstruct raw_notifier_head name =\t\t\t\t\\\n \t\tRAW_NOTIFIER_INIT(name)\n@@ -126,12 +129,14 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n #define _SRCU_NOTIFIER_HEAD(name, mod)\t\t\t\t\\\n \tstatic DEFINE_PER_CPU(struct srcu_data, name##_head_srcu_data); \\\n \tmod struct srcu_notifier_head name =\t\t\t\\\n-\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data)\n+\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n #else\n #define _SRCU_NOTIFIER_HEAD(name, mod)\t\t\t\t\\\n \tmod struct srcu_notifier_head name =\t\t\t\\\n-\t\t\tSRCU_NOTIFIER_INIT(name, name)\n+\t\t\tSRCU_NOTIFIER_INIT(name, name);\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n #endif\n \ndiff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h\nindex 39d5bf8e65625..680c3efc14c83 100644\n--- a/include/linux/percpu-rwsem.h\n+++ b/include/linux/percpu-rwsem.h\n@@ -2,6 +2,7 @@\n #ifndef _LINUX_PERCPU_RWSEM_H\n #define _LINUX_PERCPU_RWSEM_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/atomic.h\u003e\n #include \u003clinux/percpu.h\u003e\n #include \u003clinux/rcuwait.h\u003e\n@@ -36,7 +37,8 @@ is_static struct percpu_rw_semaphore name = {\t\t\t\t\\\n \t.waiters = __WAIT_QUEUE_HEAD_INITIALIZER(name.waiters),\t\t\\\n \t.block = ATOMIC_INIT(0),\t\t\t\t\t\\\n \t__PERCPU_RWSEM_DEP_MAP_INIT(name)\t\t\t\t\\\n-}\n+};\t\t\t\t\t\t\t\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n #define DEFINE_PERCPU_RWSEM(name)\t\t\\\n \t__DEFINE_PERCPU_RWSEM(name, /* not static */)\ndiff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h\nindex 057edc4cbb6ef..dc3795f4cb1f6 100644\n--- a/include/linux/radix-tree.h\n+++ b/include/linux/radix-tree.h\n@@ -8,6 +8,7 @@\n #ifndef _LINUX_RADIX_TREE_H\n #define _LINUX_RADIX_TREE_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/bitops.h\u003e\n #include \u003clinux/gfp_types.h\u003e\n #include \u003clinux/list.h\u003e\n@@ -79,7 +80,8 @@ static inline bool radix_tree_is_internal_node(void *ptr)\n #define RADIX_TREE_INIT(name, mask)\tXARRAY_INIT(name, mask)\n \n #define RADIX_TREE(name, mask) \\\n-\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask)\n+\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n #define INIT_RADIX_TREE(root, mask) xa_init_flags(root, mask)\n \ndiff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h\nindex b19c4354540ab..977fdfff59263 100644\n--- a/include/linux/ratelimit_types.h\n+++ b/include/linux/ratelimit_types.h\n@@ -2,6 +2,7 @@\n #ifndef _LINUX_RATELIMIT_TYPES_H\n #define _LINUX_RATELIMIT_TYPES_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/bits.h\u003e\n #include \u003clinux/param.h\u003e\n #include \u003clinux/spinlock_types_raw.h\u003e\n@@ -40,7 +41,8 @@ struct ratelimit_state {\n #define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)\t\t\\\n \t\t\t\t\t\t\t\t\t\\\n \tstruct ratelimit_state name =\t\t\t\t\t\\\n-\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init)\t\\\n+\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n extern int ___ratelimit(struct ratelimit_state *rs, const char *func);\n #define __ratelimit(state) ___ratelimit(state, __func__)\ndiff --git a/include/linux/rcu_sync.h b/include/linux/rcu_sync.h\nindex 3860dbb9107a2..c10b6d30561ad 100644\n--- a/include/linux/rcu_sync.h\n+++ b/include/linux/rcu_sync.h\n@@ -10,6 +10,7 @@\n #ifndef _LINUX_RCU_SYNC_H_\n #define _LINUX_RCU_SYNC_H_\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/wait.h\u003e\n #include \u003clinux/rcupdate.h\u003e\n \n@@ -48,6 +49,7 @@ extern void rcu_sync_dtor(struct rcu_sync *);\n \t}\n \n #define\tDEFINE_RCU_SYNC(name)\t\\\n-\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name)\n+\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n #endif /* _LINUX_RCU_SYNC_H_ */\ndiff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h\nindex 9e1f012f89db8..495509d82c883 100644\n--- a/include/linux/rtmutex.h\n+++ b/include/linux/rtmutex.h\n@@ -105,7 +105,8 @@ do { \\\n }\n \n #define DEFINE_RT_MUTEX(mutexname) \\\n-\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)\n+\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname);\t\\\n+\tASSERT_STATIC_STORAGE(mutexname)\n \n extern void __rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_class_key *key);\n \ndiff --git a/include/linux/rwsem.h b/include/linux/rwsem.h\nindex 6a1a7bae5f811..faf52c0c8dd3d 100644\n--- a/include/linux/rwsem.h\n+++ b/include/linux/rwsem.h\n@@ -8,6 +8,7 @@\n #ifndef _LINUX_RWSEM_H\n #define _LINUX_RWSEM_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/linkage.h\u003e\n \n #include \u003clinux/types.h\u003e\n@@ -111,7 +112,8 @@ static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *\n \t __RWSEM_DEP_MAP_INIT(name) }\n \n #define DECLARE_RWSEM(name) \\\n-\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name)\n+\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n extern void __init_rwsem(struct rw_semaphore *sem, const char *name,\n \t\t\t struct lock_class_key *key);\n@@ -164,7 +166,8 @@ context_lock_struct(rw_semaphore) {\n \t}\n \n #define DECLARE_RWSEM(lockname) \\\n-\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname)\n+\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname);\t\\\n+\tASSERT_STATIC_STORAGE(lockname)\n \n extern void __init_rwsem(struct rw_semaphore *rwsem, const char *name,\n \t\t\t struct lock_class_key *key);\ndiff --git a/include/linux/semaphore.h b/include/linux/semaphore.h\nindex a4c8651ef0217..c0657a6aeb12b 100644\n--- a/include/linux/semaphore.h\n+++ b/include/linux/semaphore.h\n@@ -8,6 +8,7 @@\n #ifndef __LINUX_SEMAPHORE_H\n #define __LINUX_SEMAPHORE_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/list.h\u003e\n #include \u003clinux/spinlock.h\u003e\n \n@@ -44,7 +45,8 @@ struct semaphore {\n * context.\n */\n #define DEFINE_SEMAPHORE(_name, _n)\t\\\n-\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n)\n+\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n);\t\\\n+\tASSERT_STATIC_STORAGE(_name)\n \n static inline void sema_init(struct semaphore *sem, int val)\n {\ndiff --git a/include/linux/seqlock.h b/include/linux/seqlock.h\nindex f865491c4f2c2..2aa793a452139 100644\n--- a/include/linux/seqlock.h\n+++ b/include/linux/seqlock.h\n@@ -824,7 +824,8 @@ static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)\n * @sl: Name of the seqlock_t instance\n */\n #define DEFINE_SEQLOCK(sl) \\\n-\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl)\n+\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl);\t\\\n+\tASSERT_STATIC_STORAGE(sl)\n \n /**\n * read_seqbegin() - start a seqlock_t read side critical section\ndiff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h\nindex fbcf13bc12d15..40b592b4e2d8b 100644\n--- a/include/linux/srcutiny.h\n+++ b/include/linux/srcutiny.h\n@@ -11,6 +11,7 @@\n #ifndef _LINUX_SRCU_TINY_H\n #define _LINUX_SRCU_TINY_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/irq_work_types.h\u003e\n #include \u003clinux/swait.h\u003e\n \n@@ -48,7 +49,8 @@ void srcu_tiny_irq_work(struct irq_work *irq_work);\n * Tree SRCU, which needs some per-CPU data.\n */\n #define DEFINE_SRCU(name) \\\n-\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name)\n+\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n #define DEFINE_STATIC_SRCU(name) \\\n \tstatic struct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name)\n #define DEFINE_SRCU_FAST(name) DEFINE_SRCU(name)\ndiff --git a/include/linux/srcutree.h b/include/linux/srcutree.h\nindex 75e54e4f963fa..8bea8044230a5 100644\n--- a/include/linux/srcutree.h\n+++ b/include/linux/srcutree.h\n@@ -11,6 +11,7 @@\n #ifndef _LINUX_SRCU_TREE_H\n #define _LINUX_SRCU_TREE_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/rcu_node_tree.h\u003e\n #include \u003clinux/completion.h\u003e\n \n@@ -217,13 +218,15 @@ struct srcu_struct {\n \t\t\t\t\t\t\t\t fast);\t\t\t\\\n \textern struct srcu_struct * const __srcu_struct_##name;\t\t\t\t\t\\\n \tstruct srcu_struct * const __srcu_struct_##name\t\t\t\t\t\t\\\n-\t\t__section(\"___srcu_struct_ptrs\") = \u0026name\n+\t\t__section(\"___srcu_struct_ptrs\") = \u0026name;\t\t\t\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n #else\n # define __DEFINE_SRCU(name, fast, is_static)\t\t\t\t\t\t\t\\\n \tstatic DEFINE_PER_CPU(struct srcu_data, name##_srcu_data);\t\t\t\t\\\n \tstatic struct srcu_usage name##_srcu_usage = __SRCU_USAGE_INIT(name##_srcu_usage);\t\\\n \tis_static struct srcu_struct name =\t\t\t\t\t\t\t\\\n-\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast)\n+\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast);\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n #endif\n #define DEFINE_SRCU(name)\t\t__DEFINE_SRCU(name, 0, /* not static */)\n #define DEFINE_STATIC_SRCU(name)\t__DEFINE_SRCU(name, 0, static)\ndiff --git a/include/linux/swait.h b/include/linux/swait.h\nindex d324419482a0f..caa3028d1dd03 100644\n--- a/include/linux/swait.h\n+++ b/include/linux/swait.h\n@@ -2,6 +2,7 @@\n #ifndef _LINUX_SWAIT_H\n #define _LINUX_SWAIT_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/list.h\u003e\n #include \u003clinux/stddef.h\u003e\n #include \u003clinux/spinlock.h\u003e\n@@ -64,7 +65,8 @@ struct swait_queue {\n }\n \n #define DECLARE_SWAIT_QUEUE_HEAD(name)\t\t\t\t\t\\\n-\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name)\n+\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name,\n \t\t\t\t struct lock_class_key *key);\n@@ -82,7 +84,7 @@ extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name\n \tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name)\n #else\n # define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name)\t\t\t\\\n-\tDECLARE_SWAIT_QUEUE_HEAD(name)\n+\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name)\n #endif\n \n /**\ndiff --git a/include/linux/sysctl.h b/include/linux/sysctl.h\nindex e5d7226ab6f5a..be79359346afa 100644\n--- a/include/linux/sysctl.h\n+++ b/include/linux/sysctl.h\n@@ -22,6 +22,7 @@\n #ifndef _LINUX_SYSCTL_H\n #define _LINUX_SYSCTL_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/list.h\u003e\n #include \u003clinux/rcupdate.h\u003e\n #include \u003clinux/wait.h\u003e\n@@ -216,7 +217,8 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)\n \t.wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) }\n \n #define DEFINE_CTL_TABLE_POLL(name)\t\t\t\t\t\\\n-\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name)\n+\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n /* A sysctl table is an array of struct ctl_table: */\n struct ctl_table {\ndiff --git a/include/linux/timer.h b/include/linux/timer.h\nindex 62e1cea711257..4205093298833 100644\n--- a/include/linux/timer.h\n+++ b/include/linux/timer.h\n@@ -2,6 +2,7 @@\n #ifndef _LINUX_TIMER_H\n #define _LINUX_TIMER_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/list.h\u003e\n #include \u003clinux/ktime.h\u003e\n #include \u003clinux/stddef.h\u003e\n@@ -62,7 +63,8 @@\n \n #define DEFINE_TIMER(_name, _function)\t\t\t\t\\\n \tstruct timer_list _name =\t\t\t\t\\\n-\t\t__TIMER_INITIALIZER(_function, 0)\n+\t\t__TIMER_INITIALIZER(_function, 0);\t\t\\\n+\tASSERT_STATIC_STORAGE(_name)\n \n /*\n * LOCKDEP and DEBUG timer interfaces.\ndiff --git a/include/linux/wait.h b/include/linux/wait.h\nindex 7e215330199cf..5c7d491873961 100644\n--- a/include/linux/wait.h\n+++ b/include/linux/wait.h\n@@ -4,6 +4,7 @@\n /*\n * Linux wait queue related types and methods\n */\n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/list.h\u003e\n #include \u003clinux/stddef.h\u003e\n #include \u003clinux/spinlock.h\u003e\n@@ -57,7 +58,8 @@ struct task_struct;\n \t.head\t\t= LIST_HEAD_INIT(name.head) }\n \n #define DECLARE_WAIT_QUEUE_HEAD(name) \\\n-\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name)\n+\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n extern void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *);\n \n@@ -74,7 +76,8 @@ extern void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *n\n # define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \\\n \tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name)\n #else\n-# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) DECLARE_WAIT_QUEUE_HEAD(name)\n+# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \\\n+\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name)\n #endif\n \n static inline void init_waitqueue_entry(struct wait_queue_entry *wq_entry, struct task_struct *p)\ndiff --git a/include/linux/workqueue.h b/include/linux/workqueue.h\nindex c8a36423cb346..433c9801d9c56 100644\n--- a/include/linux/workqueue.h\n+++ b/include/linux/workqueue.h\n@@ -6,6 +6,7 @@\n #ifndef _LINUX_WORKQUEUE_H\n #define _LINUX_WORKQUEUE_H\n \n+#include \u003clinux/compiler.h\u003e\n #include \u003clinux/alloc_tag.h\u003e\n #include \u003clinux/timer.h\u003e\n #include \u003clinux/linkage.h\u003e\n@@ -250,13 +251,16 @@ struct execute_work {\n \t}\n \n #define DECLARE_WORK(n, f)\t\t\t\t\t\t\\\n-\tstruct work_struct n = __WORK_INITIALIZER(n, f)\n+\tstruct work_struct n = __WORK_INITIALIZER(n, f);\t\t\\\n+\tASSERT_STATIC_STORAGE(n)\n \n #define DECLARE_DELAYED_WORK(n, f)\t\t\t\t\t\\\n-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)\n+\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0);\t\\\n+\tASSERT_STATIC_STORAGE(n)\n \n #define DECLARE_DEFERRABLE_WORK(n, f)\t\t\t\t\t\\\n-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)\n+\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE);\t\\\n+\tASSERT_STATIC_STORAGE(n)\n \n #ifdef CONFIG_DEBUG_OBJECTS_WORK\n extern void __init_work(struct work_struct *work, int onstack);\ndiff --git a/include/linux/xarray.h b/include/linux/xarray.h\nindex be850174e802e..9b9a5eea006d3 100644\n--- a/include/linux/xarray.h\n+++ b/include/linux/xarray.h\n@@ -321,7 +321,8 @@ struct xarray {\n * initialisation at compiletime instead of runtime.\n */\n #define DEFINE_XARRAY_FLAGS(name, flags)\t\t\t\t\\\n-\tstruct xarray name = XARRAY_INIT(name, flags)\n+\tstruct xarray name = XARRAY_INIT(name, flags);\t\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n /**\n * DEFINE_XARRAY() - Define an XArray.\ndiff --git a/tools/testing/memblock/linux/mutex.h b/tools/testing/memblock/linux/mutex.h\nindex ae3f497165d6a..d1a52d6dae80d 100644\n--- a/tools/testing/memblock/linux/mutex.h\n+++ b/tools/testing/memblock/linux/mutex.h\n@@ -2,7 +2,11 @@\n #ifndef _MUTEX_H\n #define _MUTEX_H\n \n-#define DEFINE_MUTEX(name) int name\n+#include \u003clinux/compiler.h\u003e\n+\n+#define DEFINE_MUTEX(name) \\\n+\tint name;\t\t\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n static inline void dummy_mutex_guard(int *name)\n {\n@@ -11,4 +15,4 @@ static inline void dummy_mutex_guard(int *name)\n #define guard(mutex)\t\\\n \tdummy_##mutex##_guard\n \n-#endif /* _MUTEX_H */\n\\ No newline at end of file\n+#endif /* _MUTEX_H */\ndiff --git a/tools/testing/radix-tree/benchmark.c b/tools/testing/radix-tree/benchmark.c\nindex 523c79f22ed37..57ab92e6cd771 100644\n--- a/tools/testing/radix-tree/benchmark.c\n+++ b/tools/testing/radix-tree/benchmark.c\n@@ -114,9 +114,11 @@ static void benchmark_delete(struct radix_tree_root *root,\n \n static void benchmark_size(unsigned long size, unsigned long step)\n {\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n \tlong long normal, tagged;\n \n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n+\n \tbenchmark_insert(\u0026tree, size, step);\n \tbenchmark_tagging(\u0026tree, size, step);\n \ndiff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c\nindex 945144e985072..742ee7ea03152 100644\n--- a/tools/testing/radix-tree/idr-test.c\n+++ b/tools/testing/radix-tree/idr-test.c\n@@ -33,7 +33,9 @@ void item_idr_remove(struct idr *idr, int id)\n void idr_alloc_test(void)\n {\n \tunsigned long i;\n-\tDEFINE_IDR(idr);\n+\tstruct idr idr;\n+\n+\tidr_init(\u0026idr);\n \n \tassert(idr_alloc_cyclic(\u0026idr, DUMMY_PTR, 0, 0x4000, GFP_KERNEL) == 0);\n \tassert(idr_alloc_cyclic(\u0026idr, DUMMY_PTR, 0x3ffd, 0x4000, GFP_KERNEL) == 0x3ffd);\n@@ -79,7 +81,9 @@ void idr_alloc2_test(void)\n \n void idr_replace_test(void)\n {\n-\tDEFINE_IDR(idr);\n+\tstruct idr idr;\n+\n+\tidr_init(\u0026idr);\n \n \tidr_alloc(\u0026idr, (void *)-1, 10, 11, GFP_KERNEL);\n \tidr_replace(\u0026idr, \u0026idr, 10);\n@@ -96,7 +100,9 @@ void idr_replace_test(void)\n void idr_null_test(void)\n {\n \tint i;\n-\tDEFINE_IDR(idr);\n+\tstruct idr idr;\n+\n+\tidr_init(\u0026idr);\n \n \tassert(idr_is_empty(\u0026idr));\n \n@@ -150,7 +156,9 @@ void idr_null_test(void)\n void idr_nowait_test(void)\n {\n \tunsigned int i;\n-\tDEFINE_IDR(idr);\n+\tstruct idr idr;\n+\n+\tidr_init(\u0026idr);\n \n \tidr_preload(GFP_KERNEL);\n \n@@ -169,11 +177,11 @@ void idr_get_next_test(int base)\n {\n \tunsigned long i;\n \tint nextid;\n-\tDEFINE_IDR(idr);\n-\tidr_init_base(\u0026idr, base);\n-\n+\tstruct idr idr;\n \tint indices[] = {4, 7, 9, 15, 65, 128, 1000, 99999, 0};\n \n+\tidr_init_base(\u0026idr, base);\n+\n \tfor(i = 0; indices[i]; i++) {\n \t\tstruct item *item = item_create(indices[i], 0);\n \t\tassert(idr_alloc(\u0026idr, item, indices[i], indices[i+1],\n@@ -229,7 +237,8 @@ void idr_u32_test1(struct idr *idr, u32 handle)\n \n void idr_u32_test(int base)\n {\n-\tDEFINE_IDR(idr);\n+\tstruct idr idr;\n+\n \tidr_init_base(\u0026idr, base);\n \tidr_u32_test1(\u0026idr, 10);\n \tidr_u32_test1(\u0026idr, 0x7fffffff);\n@@ -360,7 +369,9 @@ void idr_find_test(void)\n void idr_checks(void)\n {\n \tunsigned long i;\n-\tDEFINE_IDR(idr);\n+\tstruct idr idr;\n+\n+\tidr_init(\u0026idr);\n \n \tfor (i = 0; i \u003c 10000; i++) {\n \t\tstruct item *item = item_create(i, 0);\ndiff --git a/tools/testing/radix-tree/iteration_check_2.c b/tools/testing/radix-tree/iteration_check_2.c\nindex aac5c50a3674c..f798603a6f28d 100644\n--- a/tools/testing/radix-tree/iteration_check_2.c\n+++ b/tools/testing/radix-tree/iteration_check_2.c\n@@ -54,9 +54,11 @@ static void *throbber(void *arg)\n void iteration_test2(unsigned test_duration)\n {\n \tpthread_t threads[2];\n-\tDEFINE_XARRAY(array);\n+\tstruct xarray array;\n \tint i;\n \n+\txa_init(\u0026array);\n+\n \tprintv(1, \"Running iteration test 2 for %d seconds\\n\", test_duration);\n \n \ttest_complete = false;\ndiff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c\nindex f2cbc8e5b97c8..6f0f8eaa044d3 100644\n--- a/tools/testing/radix-tree/main.c\n+++ b/tools/testing/radix-tree/main.c\n@@ -15,7 +15,9 @@\n void __gang_check(unsigned long middle, long down, long up, int chunk, int hop)\n {\n \tlong idx;\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \n \tmiddle = 1 \u003c\u003c 30;\n \n@@ -78,7 +80,9 @@ void big_gang_check(bool long_run)\n \n void add_and_check(void)\n {\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \n \titem_insert(\u0026tree, 44);\n \titem_check_present(\u0026tree, 44);\n@@ -89,7 +93,9 @@ void add_and_check(void)\n void dynamic_height_check(void)\n {\n \tint i;\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \ttree_verify_min_height(\u0026tree, 0);\n \n \titem_insert(\u0026tree, 42);\n@@ -155,11 +161,13 @@ void check_copied_tags(struct radix_tree_root *tree, unsigned long start, unsign\n \n void copy_tag_check(void)\n {\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n \tunsigned long idx[ITEMS];\n \tunsigned long start, end, count = 0, tagged, cur, tmp;\n \tint i;\n \n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n+\n //\tprintf(\"generating radix tree indices...\\n\");\n \tstart = rand();\n \tend = rand();\ndiff --git a/tools/testing/radix-tree/regression3.c b/tools/testing/radix-tree/regression3.c\nindex 9f9a3b280f56d..dc235bff00633 100644\n--- a/tools/testing/radix-tree/regression3.c\n+++ b/tools/testing/radix-tree/regression3.c\n@@ -28,13 +28,15 @@\n \n void regression3_test(void)\n {\n-\tRADIX_TREE(root, GFP_KERNEL);\n+\tstruct radix_tree_root root;\n \tvoid *ptr0 = (void *)4ul;\n \tvoid *ptr = (void *)8ul;\n \tstruct radix_tree_iter iter;\n \tvoid **slot;\n \tbool first;\n \n+\tINIT_RADIX_TREE(\u0026root, GFP_KERNEL);\n+\n \tprintv(1, \"running regression test 3 (should take milliseconds)\\n\");\n \n \tradix_tree_insert(\u0026root, 0, ptr0);\ndiff --git a/tools/testing/radix-tree/tag_check.c b/tools/testing/radix-tree/tag_check.c\nindex f898957b1a19c..51c0f0d6152c4 100644\n--- a/tools/testing/radix-tree/tag_check.c\n+++ b/tools/testing/radix-tree/tag_check.c\n@@ -42,7 +42,9 @@ __simple_checks(struct radix_tree_root *tree, unsigned long index, int tag)\n void simple_checks(void)\n {\n \tunsigned long index;\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \n \tfor (index = 0; index \u003c 10000; index++) {\n \t\t__simple_checks(\u0026tree, index, 0);\n@@ -61,7 +63,9 @@ void simple_checks(void)\n */\n static void extend_checks(void)\n {\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \n \titem_insert(\u0026tree, 43);\n \tassert(item_tag_get(\u0026tree, 43, 0) == 0);\n@@ -90,7 +94,9 @@ static void contract_checks(void)\n {\n \tstruct item *item;\n \tint tmp;\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \n \ttmp = 1\u003c\u003cRADIX_TREE_MAP_SHIFT;\n \titem_insert(\u0026tree, tmp);\n@@ -271,9 +277,11 @@ static void do_thrash(struct radix_tree_root *tree, char *thrash_state, int tag)\n \n static void thrash_tags(void)\n {\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n \tchar *thrash_state;\n \n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n+\n \tthrash_state = malloc(THRASH_SIZE);\n \tmemset(thrash_state, 0, THRASH_SIZE);\n \n@@ -286,7 +294,9 @@ static void thrash_tags(void)\n \n static void leak_check(void)\n {\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \n \titem_insert(\u0026tree, 1000000);\n \titem_delete(\u0026tree, 1000000);\n@@ -295,7 +305,9 @@ static void leak_check(void)\n \n static void __leak_check(void)\n {\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n+\n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n \n \tprintv(2, \"%d: nr_allocated=%d\\n\", __LINE__, nr_allocated);\n \titem_insert(\u0026tree, 1000000);\n@@ -309,10 +321,12 @@ static void __leak_check(void)\n static void single_check(void)\n {\n \tstruct item *items[BATCH];\n-\tRADIX_TREE(tree, GFP_KERNEL);\n+\tstruct radix_tree_root tree;\n \tint ret;\n \tunsigned long first = 0;\n \n+\tINIT_RADIX_TREE(\u0026tree, GFP_KERNEL);\n+\n \titem_insert(\u0026tree, 0);\n \titem_tag_set(\u0026tree, 0, 0);\n \tret = radix_tree_gang_lookup_tag(\u0026tree, (void **)items, 0, BATCH, 0);\ndiff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h\nindex 4c58487b764e9..f2cdb9185ef9f 100644\n--- a/tools/testing/vma/include/dup.h\n+++ b/tools/testing/vma/include/dup.h\n@@ -2,6 +2,8 @@\n \n #pragma once\n \n+#include \u003clinux/compiler.h\u003e\n+\n /* Forward declarations to avoid header cycle. */\n struct vm_area_struct;\n static inline void vma_start_write(struct vm_area_struct *vma);\n@@ -435,7 +437,8 @@ struct vma_iterator {\n \t}\n \n #define DEFINE_MUTEX(mutexname) \\\n-\tstruct mutex mutexname = {}\n+\tstruct mutex mutexname = {};\t\t\\\n+\tASSERT_STATIC_STORAGE(mutexname)\n \n #define DECLARE_BITMAP(name, bits) \\\n \tunsigned long name[BITS_TO_LONGS(bits)]\ndiff --git a/tools/virtio/linux/compiler.h b/tools/virtio/linux/compiler.h\nindex 0f25db473f55c..3c1eca4a43808 100644\n--- a/tools/virtio/linux/compiler.h\n+++ b/tools/virtio/linux/compiler.h\n@@ -15,6 +15,15 @@\n \n #define __aligned(x) __attribute((__aligned__(x)))\n \n+#ifndef __always_unused\n+#define __always_unused __attribute__((__unused__))\n+#endif\n+\n+/* Enforce static storage duration. */\n+#define ASSERT_STATIC_STORAGE(name) \\\n+\tstatic typeof(name) * const __always_unused \\\n+\t\tname##_storage_check = \u0026(name)\n+\n /**\n * data_race - mark an expression as containing intentional data races\n *\ndiff --git a/tools/virtio/linux/ratelimit.h b/tools/virtio/linux/ratelimit.h\nindex dcce1725f90d0..c15c82a5ca217 100644\n--- a/tools/virtio/linux/ratelimit.h\n+++ b/tools/virtio/linux/ratelimit.h\n@@ -1,4 +1,8 @@\n-#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)\tint name = 0\n+#include \u003clinux/compiler.h\u003e\n+\n+#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \\\n+\tint name = 0;\t\t\t\t\t\t\\\n+\tASSERT_STATIC_STORAGE(name)\n \n #define __ratelimit(x) (*(x))\n \n"
} |
| 2/1 | 2026/09/15 04:07 | agent | patch-evaluator |
3mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series introduces a compile-time static storage duration check (ASSERT_STATIC_STORAGE) for DEFINE_* and DECLARE_* macros to prevent misuse on the stack. The changes in include/linux/* add purely compile-time assertions and keep equivalent expansions for on-stack macro variants, introducing no runtime executable code or runtime assertions. The changes under tools/ affect only user-space tests. The modification in drivers/macintosh/ams/ams-pmu.c is exclusive to PowerPC architecture (CONFIG_PPC_PMAC) and unreachable on amd64. Finally, the WireGuard changes in drivers/net/wireguard/selftest/allowedips.c adjust mutex declarations in __init boot-time self-tests where mutex_init() was already called immediately afterwards, causing no functional change in executable kernel logic. None of the changes warrant fuzzing.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit c54f1c46bcb41eb75a627ff924faff421c83a9e0
Author: syz-cluster <triage@syzkaller.com>
Date: Tue Sep 15 04:07:19 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/macintosh/ams/ams-pmu.c b/drivers/macintosh/ams/ams-pmu.c
index 1c3ce39e9a590..046a7d5dc5b25 100644
--- a/drivers/macintosh/ams/ams-pmu.c
+++ b/drivers/macintosh/ams/ams-pmu.c
@@ -48,7 +48,7 @@ static void ams_pmu_req_complete(struct adb_request *req)
static void ams_pmu_set_register(u8 reg, u8 value)
{
static struct adb_request req;
- DECLARE_COMPLETION(req_complete);
+ DECLARE_COMPLETION_ONSTACK(req_complete);
req.arg = &req_complete;
if (pmu_request(&req, ams_pmu_req_complete, 4, ams_pmu_cmd, 0x00, reg, value))
@@ -61,7 +61,7 @@ static void ams_pmu_set_register(u8 reg, u8 value)
static u8 ams_pmu_get_register(u8 reg)
{
static struct adb_request req;
- DECLARE_COMPLETION(req_complete);
+ DECLARE_COMPLETION_ONSTACK(req_complete);
req.arg = &req_complete;
if (pmu_request(&req, ams_pmu_req_complete, 3, ams_pmu_cmd, 0x01, reg))
diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c
index 3e857e6fb627b..ecb2908228e7a 100644
--- a/drivers/net/wireguard/selftest/allowedips.c
+++ b/drivers/net/wireguard/selftest/allowedips.c
@@ -257,7 +257,7 @@ static __init bool randomized_test(void)
u8 ip[16], mutate_mask[16], mutated[16];
struct wg_peer **peers, *peer;
struct horrible_allowedips h;
- DEFINE_MUTEX(mutex);
+ struct mutex mutex;
struct allowedips t;
bool ret = false;
@@ -499,7 +499,7 @@ bool __init wg_allowedips_selftest(void)
struct allowedips_node *iter_node;
bool success = false;
struct allowedips t;
- DEFINE_MUTEX(mutex);
+ struct mutex mutex;
struct in6_addr ip;
size_t i = 0, count = 0;
__be64 part;
diff --git a/include/linux/completion.h b/include/linux/completion.h
index fb29156765743..b514b55557223 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -9,6 +9,7 @@
* See kernel/sched/completion.c for details.
*/
+#include <linux/compiler.h>
#include <linux/swait.h>
/*
@@ -50,7 +51,8 @@ static inline void complete_release(struct completion *x) {}
* variables.
*/
#define DECLARE_COMPLETION(work) \
- struct completion work = COMPLETION_INITIALIZER(work)
+ struct completion work = COMPLETION_INITIALIZER(work); \
+ ASSERT_STATIC_STORAGE(work)
/*
* Lockdep needs to run a non-constant initializer for on-stack
@@ -70,8 +72,10 @@ static inline void complete_release(struct completion *x) {}
# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \
struct completion work = COMPLETION_INITIALIZER_ONSTACK_MAP(work, map)
#else
-# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
-# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) DECLARE_COMPLETION(work)
+# define DECLARE_COMPLETION_ONSTACK(work) \
+ struct completion work = COMPLETION_INITIALIZER(work)
+# define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \
+ DECLARE_COMPLETION_ONSTACK(work)
#endif
/**
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 789e23e674441..b3fff99a4c961 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -54,7 +54,9 @@ struct idr {
* An IDR defined using this macro is ready for use with no additional
* initialisation required. It contains no IDs.
*/
-#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
+#define DEFINE_IDR(name) \
+ struct idr name = IDR_INIT(name); \
+ ASSERT_STATIC_STORAGE(name)
/**
* idr_get_cursor - Return the current position of the cyclic allocator
diff --git a/include/linux/klist.h b/include/linux/klist.h
index b0f238f20dbb2..5848363242b61 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -10,6 +10,7 @@
#ifndef _LINUX_KLIST_H
#define _LINUX_KLIST_H
+#include <linux/compiler.h>
#include <linux/spinlock.h>
#include <linux/kref.h>
#include <linux/list.h>
@@ -29,7 +30,8 @@ struct klist {
.put = _put, }
#define DEFINE_KLIST(_name, _get, _put) \
- struct klist _name = KLIST_INIT(_name, _get, _put)
+ struct klist _name = KLIST_INIT(_name, _get, _put); \
+ ASSERT_STATIC_STORAGE(_name)
extern void klist_init(struct klist *k, void (*get)(struct klist_node *),
void (*put)(struct klist_node *));
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index a01a474719a72..faa9dfb2f6cf5 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_KTHREAD_H
#define _LINUX_KTHREAD_H
/* Simple interface for creating and stopping kernel threads without mess. */
+#include <linux/compiler.h>
#include <linux/err.h>
#include <linux/sched.h>
@@ -179,7 +180,8 @@ struct kthread_delayed_work {
#define DEFINE_KTHREAD_DELAYED_WORK(dwork, fn) \
struct kthread_delayed_work dwork = \
- KTHREAD_DELAYED_WORK_INIT(dwork, fn)
+ KTHREAD_DELAYED_WORK_INIT(dwork, fn); \
+ ASSERT_STATIC_STORAGE(dwork)
extern void __kthread_init_worker(struct kthread_worker *worker,
const char *name, struct lock_class_key *key);
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 734048c02f4f5..2f2d95f3097c4 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -11,6 +11,7 @@
#ifndef __LINUX_MUTEX_H
#define __LINUX_MUTEX_H
+#include <linux/compiler.h>
#include <asm/current.h>
#include <linux/list.h>
#include <linux/spinlock_types.h>
@@ -84,7 +85,8 @@ do { \
__DEP_MAP_MUTEX_INITIALIZER(lockname) }
#define DEFINE_MUTEX(mutexname) \
- struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
+ struct mutex mutexname = __MUTEX_INITIALIZER(mutexname); \
+ ASSERT_STATIC_STORAGE(mutexname)
#ifdef CONFIG_DEBUG_LOCK_ALLOC
void mutex_init_lockdep(struct mutex *lock, const char *name, struct lock_class_key *key);
@@ -124,7 +126,8 @@ extern bool mutex_is_locked(struct mutex *lock);
}
#define DEFINE_MUTEX(mutexname) \
- struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
+ struct mutex mutexname = __MUTEX_INITIALIZER(mutexname); \
+ ASSERT_STATIC_STORAGE(mutexname)
#define mutex_is_locked(l) rt_mutex_base_is_locked(&(l)->rtmutex)
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 01b6c9d9956f9..4f6330360df2c 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -10,6 +10,7 @@
#ifndef _LINUX_NOTIFIER_H
#define _LINUX_NOTIFIER_H
+#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
@@ -114,10 +115,12 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);
#define ATOMIC_NOTIFIER_HEAD(name) \
struct atomic_notifier_head name = \
- ATOMIC_NOTIFIER_INIT(name)
+ ATOMIC_NOTIFIER_INIT(name); \
+ ASSERT_STATIC_STORAGE(name)
#define BLOCKING_NOTIFIER_HEAD(name) \
struct blocking_notifier_head name = \
- BLOCKING_NOTIFIER_INIT(name)
+ BLOCKING_NOTIFIER_INIT(name); \
+ ASSERT_STATIC_STORAGE(name)
#define RAW_NOTIFIER_HEAD(name) \
struct raw_notifier_head name = \
RAW_NOTIFIER_INIT(name)
@@ -126,12 +129,14 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);
#define _SRCU_NOTIFIER_HEAD(name, mod) \
static DEFINE_PER_CPU(struct srcu_data, name##_head_srcu_data); \
mod struct srcu_notifier_head name = \
- SRCU_NOTIFIER_INIT(name, name##_head_srcu_data)
+ SRCU_NOTIFIER_INIT(name, name##_head_srcu_data); \
+ ASSERT_STATIC_STORAGE(name)
#else
#define _SRCU_NOTIFIER_HEAD(name, mod) \
mod struct srcu_notifier_head name = \
- SRCU_NOTIFIER_INIT(name, name)
+ SRCU_NOTIFIER_INIT(name, name); \
+ ASSERT_STATIC_STORAGE(name)
#endif
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
index 39d5bf8e65625..680c3efc14c83 100644
--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_PERCPU_RWSEM_H
#define _LINUX_PERCPU_RWSEM_H
+#include <linux/compiler.h>
#include <linux/atomic.h>
#include <linux/percpu.h>
#include <linux/rcuwait.h>
@@ -36,7 +37,8 @@ is_static struct percpu_rw_semaphore name = { \
.waiters = __WAIT_QUEUE_HEAD_INITIALIZER(name.waiters), \
.block = ATOMIC_INIT(0), \
__PERCPU_RWSEM_DEP_MAP_INIT(name) \
-}
+}; \
+ ASSERT_STATIC_STORAGE(name)
#define DEFINE_PERCPU_RWSEM(name) \
__DEFINE_PERCPU_RWSEM(name, /* not static */)
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 057edc4cbb6ef..dc3795f4cb1f6 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -8,6 +8,7 @@
#ifndef _LINUX_RADIX_TREE_H
#define _LINUX_RADIX_TREE_H
+#include <linux/compiler.h>
#include <linux/bitops.h>
#include <linux/gfp_types.h>
#include <linux/list.h>
@@ -79,7 +80,8 @@ static inline bool radix_tree_is_internal_node(void *ptr)
#define RADIX_TREE_INIT(name, mask) XARRAY_INIT(name, mask)
#define RADIX_TREE(name, mask) \
- struct radix_tree_root name = RADIX_TREE_INIT(name, mask)
+ struct radix_tree_root name = RADIX_TREE_INIT(name, mask); \
+ ASSERT_STATIC_STORAGE(name)
#define INIT_RADIX_TREE(root, mask) xa_init_flags(root, mask)
diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h
index b19c4354540ab..977fdfff59263 100644
--- a/include/linux/ratelimit_types.h
+++ b/include/linux/ratelimit_types.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_RATELIMIT_TYPES_H
#define _LINUX_RATELIMIT_TYPES_H
+#include <linux/compiler.h>
#include <linux/bits.h>
#include <linux/param.h>
#include <linux/spinlock_types_raw.h>
@@ -40,7 +41,8 @@ struct ratelimit_state {
#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \
\
struct ratelimit_state name = \
- RATELIMIT_STATE_INIT(name, interval_init, burst_init) \
+ RATELIMIT_STATE_INIT(name, interval_init, burst_init); \
+ ASSERT_STATIC_STORAGE(name)
extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#define __ratelimit(state) ___ratelimit(state, __func__)
diff --git a/include/linux/rcu_sync.h b/include/linux/rcu_sync.h
index 3860dbb9107a2..c10b6d30561ad 100644
--- a/include/linux/rcu_sync.h
+++ b/include/linux/rcu_sync.h
@@ -10,6 +10,7 @@
#ifndef _LINUX_RCU_SYNC_H_
#define _LINUX_RCU_SYNC_H_
+#include <linux/compiler.h>
#include <linux/wait.h>
#include <linux/rcupdate.h>
@@ -48,6 +49,7 @@ extern void rcu_sync_dtor(struct rcu_sync *);
}
#define DEFINE_RCU_SYNC(name) \
- struct rcu_sync name = __RCU_SYNC_INITIALIZER(name)
+ struct rcu_sync name = __RCU_SYNC_INITIALIZER(name); \
+ ASSERT_STATIC_STORAGE(name)
#endif /* _LINUX_RCU_SYNC_H_ */
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 9e1f012f89db8..495509d82c883 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -105,7 +105,8 @@ do { \
}
#define DEFINE_RT_MUTEX(mutexname) \
- struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
+ struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname); \
+ ASSERT_STATIC_STORAGE(mutexname)
extern void __rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_class_key *key);
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 6a1a7bae5f811..faf52c0c8dd3d 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -8,6 +8,7 @@
#ifndef _LINUX_RWSEM_H
#define _LINUX_RWSEM_H
+#include <linux/compiler.h>
#include <linux/linkage.h>
#include <linux/types.h>
@@ -111,7 +112,8 @@ static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *
__RWSEM_DEP_MAP_INIT(name) }
#define DECLARE_RWSEM(name) \
- struct rw_semaphore name = __RWSEM_INITIALIZER(name)
+ struct rw_semaphore name = __RWSEM_INITIALIZER(name); \
+ ASSERT_STATIC_STORAGE(name)
extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
struct lock_class_key *key);
@@ -164,7 +166,8 @@ context_lock_struct(rw_semaphore) {
}
#define DECLARE_RWSEM(lockname) \
- struct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname)
+ struct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname); \
+ ASSERT_STATIC_STORAGE(lockname)
extern void __init_rwsem(struct rw_semaphore *rwsem, const char *name,
struct lock_class_key *key);
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
index a4c8651ef0217..c0657a6aeb12b 100644
--- a/include/linux/semaphore.h
+++ b/include/linux/semaphore.h
@@ -8,6 +8,7 @@
#ifndef __LINUX_SEMAPHORE_H
#define __LINUX_SEMAPHORE_H
+#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/spinlock.h>
@@ -44,7 +45,8 @@ struct semaphore {
* context.
*/
#define DEFINE_SEMAPHORE(_name, _n) \
- struct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n)
+ struct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n); \
+ ASSERT_STATIC_STORAGE(_name)
static inline void sema_init(struct semaphore *sem, int val)
{
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index f865491c4f2c2..2aa793a452139 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -824,7 +824,8 @@ static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)
* @sl: Name of the seqlock_t instance
*/
#define DEFINE_SEQLOCK(sl) \
- seqlock_t sl = __SEQLOCK_UNLOCKED(sl)
+ seqlock_t sl = __SEQLOCK_UNLOCKED(sl); \
+ ASSERT_STATIC_STORAGE(sl)
/**
* read_seqbegin() - start a seqlock_t read side critical section
diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h
index fbcf13bc12d15..40b592b4e2d8b 100644
--- a/include/linux/srcutiny.h
+++ b/include/linux/srcutiny.h
@@ -11,6 +11,7 @@
#ifndef _LINUX_SRCU_TINY_H
#define _LINUX_SRCU_TINY_H
+#include <linux/compiler.h>
#include <linux/irq_work_types.h>
#include <linux/swait.h>
@@ -48,7 +49,8 @@ void srcu_tiny_irq_work(struct irq_work *irq_work);
* Tree SRCU, which needs some per-CPU data.
*/
#define DEFINE_SRCU(name) \
- struct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name)
+ struct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name); \
+ ASSERT_STATIC_STORAGE(name)
#define DEFINE_STATIC_SRCU(name) \
static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name)
#define DEFINE_SRCU_FAST(name) DEFINE_SRCU(name)
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
index 75e54e4f963fa..8bea8044230a5 100644
--- a/include/linux/srcutree.h
+++ b/include/linux/srcutree.h
@@ -11,6 +11,7 @@
#ifndef _LINUX_SRCU_TREE_H
#define _LINUX_SRCU_TREE_H
+#include <linux/compiler.h>
#include <linux/rcu_node_tree.h>
#include <linux/completion.h>
@@ -217,13 +218,15 @@ struct srcu_struct {
fast); \
extern struct srcu_struct * const __srcu_struct_##name; \
struct srcu_struct * const __srcu_struct_##name \
- __section("___srcu_struct_ptrs") = &name
+ __section("___srcu_struct_ptrs") = &name; \
+ ASSERT_STATIC_STORAGE(name)
#else
# define __DEFINE_SRCU(name, fast, is_static) \
static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data); \
static struct srcu_usage name##_srcu_usage = __SRCU_USAGE_INIT(name##_srcu_usage); \
is_static struct srcu_struct name = \
- __SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast)
+ __SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast); \
+ ASSERT_STATIC_STORAGE(name)
#endif
#define DEFINE_SRCU(name) __DEFINE_SRCU(name, 0, /* not static */)
#define DEFINE_STATIC_SRCU(name) __DEFINE_SRCU(name, 0, static)
diff --git a/include/linux/swait.h b/include/linux/swait.h
index d324419482a0f..caa3028d1dd03 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_SWAIT_H
#define _LINUX_SWAIT_H
+#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/stddef.h>
#include <linux/spinlock.h>
@@ -64,7 +65,8 @@ struct swait_queue {
}
#define DECLARE_SWAIT_QUEUE_HEAD(name) \
- struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name)
+ struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name); \
+ ASSERT_STATIC_STORAGE(name)
extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name,
struct lock_class_key *key);
@@ -82,7 +84,7 @@ extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name
struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name)
#else
# define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name) \
- DECLARE_SWAIT_QUEUE_HEAD(name)
+ struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name)
#endif
/**
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e5d7226ab6f5a..be79359346afa 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -22,6 +22,7 @@
#ifndef _LINUX_SYSCTL_H
#define _LINUX_SYSCTL_H
+#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/rcupdate.h>
#include <linux/wait.h>
@@ -216,7 +217,8 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)
.wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) }
#define DEFINE_CTL_TABLE_POLL(name) \
- struct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name)
+ struct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name); \
+ ASSERT_STATIC_STORAGE(name)
/* A sysctl table is an array of struct ctl_table: */
struct ctl_table {
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 62e1cea711257..4205093298833 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_TIMER_H
#define _LINUX_TIMER_H
+#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/ktime.h>
#include <linux/stddef.h>
@@ -62,7 +63,8 @@
#define DEFINE_TIMER(_name, _function) \
struct timer_list _name = \
- __TIMER_INITIALIZER(_function, 0)
+ __TIMER_INITIALIZER(_function, 0); \
+ ASSERT_STATIC_STORAGE(_name)
/*
* LOCKDEP and DEBUG timer interfaces.
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 7e215330199cf..5c7d491873961 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -4,6 +4,7 @@
/*
* Linux wait queue related types and methods
*/
+#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/stddef.h>
#include <linux/spinlock.h>
@@ -57,7 +58,8 @@ struct task_struct;
.head = LIST_HEAD_INIT(name.head) }
#define DECLARE_WAIT_QUEUE_HEAD(name) \
- struct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name)
+ struct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name); \
+ ASSERT_STATIC_STORAGE(name)
extern void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *);
@@ -74,7 +76,8 @@ extern void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *n
# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \
struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name)
#else
-# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) DECLARE_WAIT_QUEUE_HEAD(name)
+# define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \
+ struct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name)
#endif
static inline void init_waitqueue_entry(struct wait_queue_entry *wq_entry, struct task_struct *p)
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index c8a36423cb346..433c9801d9c56 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -6,6 +6,7 @@
#ifndef _LINUX_WORKQUEUE_H
#define _LINUX_WORKQUEUE_H
+#include <linux/compiler.h>
#include <linux/alloc_tag.h>
#include <linux/timer.h>
#include <linux/linkage.h>
@@ -250,13 +251,16 @@ struct execute_work {
}
#define DECLARE_WORK(n, f) \
- struct work_struct n = __WORK_INITIALIZER(n, f)
+ struct work_struct n = __WORK_INITIALIZER(n, f); \
+ ASSERT_STATIC_STORAGE(n)
#define DECLARE_DELAYED_WORK(n, f) \
- struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)
+ struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0); \
+ ASSERT_STATIC_STORAGE(n)
#define DECLARE_DEFERRABLE_WORK(n, f) \
- struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
+ struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE); \
+ ASSERT_STATIC_STORAGE(n)
#ifdef CONFIG_DEBUG_OBJECTS_WORK
extern void __init_work(struct work_struct *work, int onstack);
diff --git a/include/linux/xarray.h b/include/linux/xarray.h
index be850174e802e..9b9a5eea006d3 100644
--- a/include/linux/xarray.h
+++ b/include/linux/xarray.h
@@ -321,7 +321,8 @@ struct xarray {
* initialisation at compiletime instead of runtime.
*/
#define DEFINE_XARRAY_FLAGS(name, flags) \
- struct xarray name = XARRAY_INIT(name, flags)
+ struct xarray name = XARRAY_INIT(name, flags); \
+ ASSERT_STATIC_STORAGE(name)
/**
* DEFINE_XARRAY() - Define an XArray.
diff --git a/tools/testing/memblock/linux/mutex.h b/tools/testing/memblock/linux/mutex.h
index ae3f497165d6a..d1a52d6dae80d 100644
--- a/tools/testing/memblock/linux/mutex.h
+++ b/tools/testing/memblock/linux/mutex.h
@@ -2,7 +2,11 @@
#ifndef _MUTEX_H
#define _MUTEX_H
-#define DEFINE_MUTEX(name) int name
+#include <linux/compiler.h>
+
+#define DEFINE_MUTEX(name) \
+ int name; \
+ ASSERT_STATIC_STORAGE(name)
static inline void dummy_mutex_guard(int *name)
{
@@ -11,4 +15,4 @@ static inline void dummy_mutex_guard(int *name)
#define guard(mutex) \
dummy_##mutex##_guard
-#endif /* _MUTEX_H */
\ No newline at end of file
+#endif /* _MUTEX_H */
diff --git a/tools/testing/radix-tree/benchmark.c b/tools/testing/radix-tree/benchmark.c
index 523c79f22ed37..57ab92e6cd771 100644
--- a/tools/testing/radix-tree/benchmark.c
+++ b/tools/testing/radix-tree/benchmark.c
@@ -114,9 +114,11 @@ static void benchmark_delete(struct radix_tree_root *root,
static void benchmark_size(unsigned long size, unsigned long step)
{
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
long long normal, tagged;
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
+
benchmark_insert(&tree, size, step);
benchmark_tagging(&tree, size, step);
diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c
index 945144e985072..742ee7ea03152 100644
--- a/tools/testing/radix-tree/idr-test.c
+++ b/tools/testing/radix-tree/idr-test.c
@@ -33,7 +33,9 @@ void item_idr_remove(struct idr *idr, int id)
void idr_alloc_test(void)
{
unsigned long i;
- DEFINE_IDR(idr);
+ struct idr idr;
+
+ idr_init(&idr);
assert(idr_alloc_cyclic(&idr, DUMMY_PTR, 0, 0x4000, GFP_KERNEL) == 0);
assert(idr_alloc_cyclic(&idr, DUMMY_PTR, 0x3ffd, 0x4000, GFP_KERNEL) == 0x3ffd);
@@ -79,7 +81,9 @@ void idr_alloc2_test(void)
void idr_replace_test(void)
{
- DEFINE_IDR(idr);
+ struct idr idr;
+
+ idr_init(&idr);
idr_alloc(&idr, (void *)-1, 10, 11, GFP_KERNEL);
idr_replace(&idr, &idr, 10);
@@ -96,7 +100,9 @@ void idr_replace_test(void)
void idr_null_test(void)
{
int i;
- DEFINE_IDR(idr);
+ struct idr idr;
+
+ idr_init(&idr);
assert(idr_is_empty(&idr));
@@ -150,7 +156,9 @@ void idr_null_test(void)
void idr_nowait_test(void)
{
unsigned int i;
- DEFINE_IDR(idr);
+ struct idr idr;
+
+ idr_init(&idr);
idr_preload(GFP_KERNEL);
@@ -169,11 +177,11 @@ void idr_get_next_test(int base)
{
unsigned long i;
int nextid;
- DEFINE_IDR(idr);
- idr_init_base(&idr, base);
-
+ struct idr idr;
int indices[] = {4, 7, 9, 15, 65, 128, 1000, 99999, 0};
+ idr_init_base(&idr, base);
+
for(i = 0; indices[i]; i++) {
struct item *item = item_create(indices[i], 0);
assert(idr_alloc(&idr, item, indices[i], indices[i+1],
@@ -229,7 +237,8 @@ void idr_u32_test1(struct idr *idr, u32 handle)
void idr_u32_test(int base)
{
- DEFINE_IDR(idr);
+ struct idr idr;
+
idr_init_base(&idr, base);
idr_u32_test1(&idr, 10);
idr_u32_test1(&idr, 0x7fffffff);
@@ -360,7 +369,9 @@ void idr_find_test(void)
void idr_checks(void)
{
unsigned long i;
- DEFINE_IDR(idr);
+ struct idr idr;
+
+ idr_init(&idr);
for (i = 0; i < 10000; i++) {
struct item *item = item_create(i, 0);
diff --git a/tools/testing/radix-tree/iteration_check_2.c b/tools/testing/radix-tree/iteration_check_2.c
index aac5c50a3674c..f798603a6f28d 100644
--- a/tools/testing/radix-tree/iteration_check_2.c
+++ b/tools/testing/radix-tree/iteration_check_2.c
@@ -54,9 +54,11 @@ static void *throbber(void *arg)
void iteration_test2(unsigned test_duration)
{
pthread_t threads[2];
- DEFINE_XARRAY(array);
+ struct xarray array;
int i;
+ xa_init(&array);
+
printv(1, "Running iteration test 2 for %d seconds\n", test_duration);
test_complete = false;
diff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c
index f2cbc8e5b97c8..6f0f8eaa044d3 100644
--- a/tools/testing/radix-tree/main.c
+++ b/tools/testing/radix-tree/main.c
@@ -15,7 +15,9 @@
void __gang_check(unsigned long middle, long down, long up, int chunk, int hop)
{
long idx;
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
middle = 1 << 30;
@@ -78,7 +80,9 @@ void big_gang_check(bool long_run)
void add_and_check(void)
{
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
item_insert(&tree, 44);
item_check_present(&tree, 44);
@@ -89,7 +93,9 @@ void add_and_check(void)
void dynamic_height_check(void)
{
int i;
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
tree_verify_min_height(&tree, 0);
item_insert(&tree, 42);
@@ -155,11 +161,13 @@ void check_copied_tags(struct radix_tree_root *tree, unsigned long start, unsign
void copy_tag_check(void)
{
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
unsigned long idx[ITEMS];
unsigned long start, end, count = 0, tagged, cur, tmp;
int i;
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
+
// printf("generating radix tree indices...\n");
start = rand();
end = rand();
diff --git a/tools/testing/radix-tree/regression3.c b/tools/testing/radix-tree/regression3.c
index 9f9a3b280f56d..dc235bff00633 100644
--- a/tools/testing/radix-tree/regression3.c
+++ b/tools/testing/radix-tree/regression3.c
@@ -28,13 +28,15 @@
void regression3_test(void)
{
- RADIX_TREE(root, GFP_KERNEL);
+ struct radix_tree_root root;
void *ptr0 = (void *)4ul;
void *ptr = (void *)8ul;
struct radix_tree_iter iter;
void **slot;
bool first;
+ INIT_RADIX_TREE(&root, GFP_KERNEL);
+
printv(1, "running regression test 3 (should take milliseconds)\n");
radix_tree_insert(&root, 0, ptr0);
diff --git a/tools/testing/radix-tree/tag_check.c b/tools/testing/radix-tree/tag_check.c
index f898957b1a19c..51c0f0d6152c4 100644
--- a/tools/testing/radix-tree/tag_check.c
+++ b/tools/testing/radix-tree/tag_check.c
@@ -42,7 +42,9 @@ __simple_checks(struct radix_tree_root *tree, unsigned long index, int tag)
void simple_checks(void)
{
unsigned long index;
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
for (index = 0; index < 10000; index++) {
__simple_checks(&tree, index, 0);
@@ -61,7 +63,9 @@ void simple_checks(void)
*/
static void extend_checks(void)
{
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
item_insert(&tree, 43);
assert(item_tag_get(&tree, 43, 0) == 0);
@@ -90,7 +94,9 @@ static void contract_checks(void)
{
struct item *item;
int tmp;
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
tmp = 1<<RADIX_TREE_MAP_SHIFT;
item_insert(&tree, tmp);
@@ -271,9 +277,11 @@ static void do_thrash(struct radix_tree_root *tree, char *thrash_state, int tag)
static void thrash_tags(void)
{
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
char *thrash_state;
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
+
thrash_state = malloc(THRASH_SIZE);
memset(thrash_state, 0, THRASH_SIZE);
@@ -286,7 +294,9 @@ static void thrash_tags(void)
static void leak_check(void)
{
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
item_insert(&tree, 1000000);
item_delete(&tree, 1000000);
@@ -295,7 +305,9 @@ static void leak_check(void)
static void __leak_check(void)
{
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
+
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated);
item_insert(&tree, 1000000);
@@ -309,10 +321,12 @@ static void __leak_check(void)
static void single_check(void)
{
struct item *items[BATCH];
- RADIX_TREE(tree, GFP_KERNEL);
+ struct radix_tree_root tree;
int ret;
unsigned long first = 0;
+ INIT_RADIX_TREE(&tree, GFP_KERNEL);
+
item_insert(&tree, 0);
item_tag_set(&tree, 0, 0);
ret = radix_tree_gang_lookup_tag(&tree, (void **)items, 0, BATCH, 0);
diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h
index 4c58487b764e9..f2cdb9185ef9f 100644
--- a/tools/testing/vma/include/dup.h
+++ b/tools/testing/vma/include/dup.h
@@ -2,6 +2,8 @@
#pragma once
+#include <linux/compiler.h>
+
/* Forward declarations to avoid header cycle. */
struct vm_area_struct;
static inline void vma_start_write(struct vm_area_struct *vma);
@@ -435,7 +437,8 @@ struct vma_iterator {
}
#define DEFINE_MUTEX(mutexname) \
- struct mutex mutexname = {}
+ struct mutex mutexname = {}; \
+ ASSERT_STATIC_STORAGE(mutexname)
#define DECLARE_BITMAP(name, bits) \
unsigned long name[BITS_TO_LONGS(bits)]
diff --git a/tools/virtio/linux/compiler.h b/tools/virtio/linux/compiler.h
index 0f25db473f55c..3c1eca4a43808 100644
--- a/tools/virtio/linux/compiler.h
+++ b/tools/virtio/linux/compiler.h
@@ -15,6 +15,15 @@
#define __aligned(x) __attribute((__aligned__(x)))
+#ifndef __always_unused
+#define __always_unused __attribute__((__unused__))
+#endif
+
+/* Enforce static storage duration. */
+#define ASSERT_STATIC_STORAGE(name) \
+ static typeof(name) * const __always_unused \
+ name##_storage_check = &(name)
+
/**
* data_race - mark an expression as containing intentional data races
*
diff --git a/tools/virtio/linux/ratelimit.h b/tools/virtio/linux/ratelimit.h
index dcce1725f90d0..c15c82a5ca217 100644
--- a/tools/virtio/linux/ratelimit.h
+++ b/tools/virtio/linux/ratelimit.h
@@ -1,4 +1,8 @@
-#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) int name = 0
+#include <linux/compiler.h>
+
+#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \
+ int name = 0; \
+ ASSERT_STATIC_STORAGE(name)
#define __ratelimit(x) (*(x))
|
| 3/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15553 output: 19 thoughts: 84 Thoughts: **Analyzing the Patch: A Deep Dive** Okay, let's dissect this patch. My initial approach is always methodical: what's the core function of this commit? I need to understand its impact immediately. The first step is to carefully examine the diff itself. Beyond the lines changed, I'll leverage the `git log` and commit message – those are often goldmines for context and intent. I'll be looking for clues on why this change was made and what problem it's trying to solve. I'll be ready to bring out the big guns: I might employ a few quick `git` commands, or perhaps a `grep` to quickly search the codebase. For instance, I see `ASSERT_STATIC_STORAGE` mentioned, so I need to understand its role. Where is it defined? How does it function? This requires tracing it back through the includes, understanding what it expands to, and what constraints it imposes. Let's start by using grep to look for `ASSERT_STATIC_STORAGE` inside the `include/` directory. That's a great place to start looking for definitions and related usage. Understanding the macros at play is critical to fully appreciating this change, and I need to do so quickly. |
| 4/2 | 2026/09/15 04:07 | tool | grepper |
0mArgs:{
"Expression": "ASSERT_STATIC_STORAGE"
}Results: {
"Output": "include/linux/completion.h=34=static inline void complete_release(struct completion *x) {}\n--\ninclude/linux/completion.h-54-\tstruct completion work = COMPLETION_INITIALIZER(work);\t\\\ninclude/linux/completion.h:55:\tASSERT_STATIC_STORAGE(work)\ninclude/linux/completion.h-56-\n--\ninclude/linux/idr.h=20=struct idr {\n--\ninclude/linux/idr.h-58-\tstruct idr name = IDR_INIT(name);\t\\\ninclude/linux/idr.h:59:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/idr.h-60-\n--\ninclude/linux/klist.h=19=struct klist {\n--\ninclude/linux/klist.h-33-\tstruct klist _name = KLIST_INIT(_name, _get, _put);\t\t\\\ninclude/linux/klist.h:34:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/klist.h-35-\n--\ninclude/linux/kthread.h=162=struct kthread_delayed_work {\n--\ninclude/linux/kthread.h-183-\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn);\t\t\t\\\ninclude/linux/kthread.h:184:\tASSERT_STATIC_STORAGE(dwork)\ninclude/linux/kthread.h-185-\n--\ninclude/linux/mutex.h=62=do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/mutex.h-88-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:89:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-90-\n--\ninclude/linux/mutex.h=115=extern bool mutex_is_locked(struct mutex *lock);\n--\ninclude/linux/mutex.h-129-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:130:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-131-\n--\ninclude/linux/notifier.h=95=extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n--\ninclude/linux/notifier.h-118-\t\tATOMIC_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:119:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-120-#define BLOCKING_NOTIFIER_HEAD(name)\t\t\t\t\\\n--\ninclude/linux/notifier.h-122-\t\tBLOCKING_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:123:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-124-#define RAW_NOTIFIER_HEAD(name)\t\t\t\t\t\\\n--\ninclude/linux/notifier.h-132-\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data);\t\\\ninclude/linux/notifier.h:133:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-134-\n--\ninclude/linux/notifier.h-138-\t\t\tSRCU_NOTIFIER_INIT(name, name);\t\t\\\ninclude/linux/notifier.h:139:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-140-\n--\ninclude/linux/percpu-rwsem.h=33=is_static struct percpu_rw_semaphore name = {\t\t\t\t\\\n--\ninclude/linux/percpu-rwsem.h-40-};\t\t\t\t\t\t\t\t\t\\\ninclude/linux/percpu-rwsem.h:41:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/percpu-rwsem.h-42-\n--\ninclude/linux/radix-tree.h=56=static inline bool radix_tree_is_internal_node(void *ptr)\n--\ninclude/linux/radix-tree.h-83-\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask);\t\\\ninclude/linux/radix-tree.h:84:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/radix-tree.h-85-\n--\ninclude/linux/ratelimit_types.h=17=struct ratelimit_state {\n--\ninclude/linux/ratelimit_types.h-44-\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init);\t\\\ninclude/linux/ratelimit_types.h:45:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/ratelimit_types.h-46-\n--\ninclude/linux/rcu_sync.h=43=extern void rcu_sync_dtor(struct rcu_sync *);\n--\ninclude/linux/rcu_sync.h-52-\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name);\t\\\ninclude/linux/rcu_sync.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rcu_sync.h-54-\n--\ninclude/linux/rtmutex.h=86=do { \\\n--\ninclude/linux/rtmutex.h-108-\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/rtmutex.h:109:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/rtmutex.h-110-\n--\ninclude/linux/rwsem.h=85=static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)\n--\ninclude/linux/rwsem.h-115-\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name);\t\\\ninclude/linux/rwsem.h:116:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rwsem.h-117-\n--\ninclude/linux/rwsem.h=155=context_lock_struct(rw_semaphore) {\n--\ninclude/linux/rwsem.h-169-\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname);\t\\\ninclude/linux/rwsem.h:170:\tASSERT_STATIC_STORAGE(lockname)\ninclude/linux/rwsem.h-171-\n--\ninclude/linux/semaphore.h=16=struct semaphore {\n--\ninclude/linux/semaphore.h-48-\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n);\t\\\ninclude/linux/semaphore.h:49:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/semaphore.h-50-\n--\ninclude/linux/seqlock.h=801=static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)\n--\ninclude/linux/seqlock.h-827-\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl);\t\\\ninclude/linux/seqlock.h:828:\tASSERT_STATIC_STORAGE(sl)\ninclude/linux/seqlock.h-829-\n--\ninclude/linux/srcutiny.h=36=void srcu_tiny_irq_work(struct irq_work *irq_work);\n--\ninclude/linux/srcutiny.h-52-\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name);\t\\\ninclude/linux/srcutiny.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutiny.h-54-#define DEFINE_STATIC_SRCU(name) \\\n--\ninclude/linux/srcutree.h=106=struct srcu_struct {\n--\ninclude/linux/srcutree.h-221-\t\t__section(\"___srcu_struct_ptrs\") = \u0026name;\t\t\t\t\t\\\ninclude/linux/srcutree.h:222:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-223-#else\n--\ninclude/linux/srcutree.h-228-\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast);\t\t\\\ninclude/linux/srcutree.h:229:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-230-#endif\n--\ninclude/linux/swait.h=49=struct swait_queue {\n--\ninclude/linux/swait.h-68-\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/swait.h:69:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/swait.h-70-\n--\ninclude/linux/sysctl.h=210=static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)\n--\ninclude/linux/sysctl.h-220-\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name);\t\\\ninclude/linux/sysctl.h:221:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/sysctl.h-222-\n--\ninclude/linux/timer.h-66-\t\t__TIMER_INITIALIZER(_function, 0);\t\t\\\ninclude/linux/timer.h:67:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/timer.h-68-\n--\ninclude/linux/wait.h=42=struct task_struct;\n--\ninclude/linux/wait.h-61-\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/wait.h:62:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/wait.h-63-\n--\ninclude/linux/workqueue.h=224=struct execute_work {\n--\ninclude/linux/workqueue.h-254-\tstruct work_struct n = __WORK_INITIALIZER(n, f);\t\t\\\ninclude/linux/workqueue.h:255:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-256-\n--\ninclude/linux/workqueue.h-258-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0);\t\\\ninclude/linux/workqueue.h:259:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-260-\n--\ninclude/linux/workqueue.h-262-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE);\t\\\ninclude/linux/workqueue.h:263:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-264-\n--\ninclude/linux/xarray.h=300=struct xarray {\n--\ninclude/linux/xarray.h-324-\tstruct xarray name = XARRAY_INIT(name, flags);\t\t\t\\\ninclude/linux/xarray.h:325:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/xarray.h-326-\n--\ntools/testing/memblock/linux/mutex.h-8-\tint name;\t\t\t\t\\\ntools/testing/memblock/linux/mutex.h:9:\tASSERT_STATIC_STORAGE(name)\ntools/testing/memblock/linux/mutex.h-10-\n--\ntools/testing/vma/include/dup.h=425=struct vma_iterator {\n--\ntools/testing/vma/include/dup.h-440-\tstruct mutex mutexname = {};\t\t\\\ntools/testing/vma/include/dup.h:441:\tASSERT_STATIC_STORAGE(mutexname)\ntools/testing/vma/include/dup.h-442-\n--\ntools/virtio/linux/compiler.h-22-/* Enforce static storage duration. */\ntools/virtio/linux/compiler.h:23:#define ASSERT_STATIC_STORAGE(name) \\\ntools/virtio/linux/compiler.h-24-\tstatic typeof(name) * const __always_unused \\\n--\ntools/virtio/linux/ratelimit.h-4-\tint name = 0;\t\t\t\t\t\t\\\ntools/virtio/linux/ratelimit.h:5:\tASSERT_STATIC_STORAGE(name)\ntools/virtio/linux/ratelimit.h-6-\n"
} |
| 5/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19056 output: 28 thoughts: 39 Thoughts: Here's my thought process, summarized as you requested: **Investigating a Macro Definition** Okay, so I need to track down the definition of `ASSERT_STATIC_STORAGE`. This macro is likely used for compile-time assertions related to static storage, so it's probably important for some low-level memory management or initialization. Given that it's a Linux kernel-specific construct, my first assumption is that it resides within the kernel's include files. Since it's a compiler-related construct, I'll start by checking within the `include/linux/compiler*.h` files, as these often hold macro definitions pertaining to compiler specifics. I'll use `grep` to quickly search all `include/linux` subdirectories for the exact string "ASSERT_STATIC_STORAGE". This should pinpoint the exact location of the macro definition, giving me the context I need to understand its purpose and how it's used within the kernel. |
| 6/2 | 2026/09/15 04:07 | tool | grepper |
0mError:no matches Args: {
"Expression": "define ASSERT_STATIC_STORAGE",
"PathPrefix": "include/"
}Results: {
"error": "no matches"
} |
| 7/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19335 output: 19 thoughts: 29 Thoughts: Here's your summary: **Debugging a Missing Definition** Okay, so I just ran a build and hit a snag. The compiler's complaining it can't find `define ASSERT_STATIC_STORAGE` within the `include/` directory. That's immediately suspect. I need to make sure this macro is defined *somewhere*. My initial assumption about the include path was wrong. Right, time to expand the search. I need to cast a wider net to find where this macro is actually declared. I'm going to kick off a search across the entire codebase to locate where `ASSERT_STATIC_STORAGE` is defined. This is the first step to understand the build issue. Let's see what turns up. |
| 8/2 | 2026/09/15 04:07 | tool | grepper |
0mArgs:{
"Expression": "ASSERT_STATIC_STORAGE"
}Results: {
"Output": "include/linux/completion.h=34=static inline void complete_release(struct completion *x) {}\n--\ninclude/linux/completion.h-54-\tstruct completion work = COMPLETION_INITIALIZER(work);\t\\\ninclude/linux/completion.h:55:\tASSERT_STATIC_STORAGE(work)\ninclude/linux/completion.h-56-\n--\ninclude/linux/idr.h=20=struct idr {\n--\ninclude/linux/idr.h-58-\tstruct idr name = IDR_INIT(name);\t\\\ninclude/linux/idr.h:59:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/idr.h-60-\n--\ninclude/linux/klist.h=19=struct klist {\n--\ninclude/linux/klist.h-33-\tstruct klist _name = KLIST_INIT(_name, _get, _put);\t\t\\\ninclude/linux/klist.h:34:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/klist.h-35-\n--\ninclude/linux/kthread.h=162=struct kthread_delayed_work {\n--\ninclude/linux/kthread.h-183-\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn);\t\t\t\\\ninclude/linux/kthread.h:184:\tASSERT_STATIC_STORAGE(dwork)\ninclude/linux/kthread.h-185-\n--\ninclude/linux/mutex.h=62=do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/mutex.h-88-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:89:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-90-\n--\ninclude/linux/mutex.h=115=extern bool mutex_is_locked(struct mutex *lock);\n--\ninclude/linux/mutex.h-129-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:130:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-131-\n--\ninclude/linux/notifier.h=95=extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n--\ninclude/linux/notifier.h-118-\t\tATOMIC_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:119:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-120-#define BLOCKING_NOTIFIER_HEAD(name)\t\t\t\t\\\n--\ninclude/linux/notifier.h-122-\t\tBLOCKING_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:123:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-124-#define RAW_NOTIFIER_HEAD(name)\t\t\t\t\t\\\n--\ninclude/linux/notifier.h-132-\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data);\t\\\ninclude/linux/notifier.h:133:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-134-\n--\ninclude/linux/notifier.h-138-\t\t\tSRCU_NOTIFIER_INIT(name, name);\t\t\\\ninclude/linux/notifier.h:139:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-140-\n--\ninclude/linux/percpu-rwsem.h=33=is_static struct percpu_rw_semaphore name = {\t\t\t\t\\\n--\ninclude/linux/percpu-rwsem.h-40-};\t\t\t\t\t\t\t\t\t\\\ninclude/linux/percpu-rwsem.h:41:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/percpu-rwsem.h-42-\n--\ninclude/linux/radix-tree.h=56=static inline bool radix_tree_is_internal_node(void *ptr)\n--\ninclude/linux/radix-tree.h-83-\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask);\t\\\ninclude/linux/radix-tree.h:84:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/radix-tree.h-85-\n--\ninclude/linux/ratelimit_types.h=17=struct ratelimit_state {\n--\ninclude/linux/ratelimit_types.h-44-\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init);\t\\\ninclude/linux/ratelimit_types.h:45:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/ratelimit_types.h-46-\n--\ninclude/linux/rcu_sync.h=43=extern void rcu_sync_dtor(struct rcu_sync *);\n--\ninclude/linux/rcu_sync.h-52-\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name);\t\\\ninclude/linux/rcu_sync.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rcu_sync.h-54-\n--\ninclude/linux/rtmutex.h=86=do { \\\n--\ninclude/linux/rtmutex.h-108-\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/rtmutex.h:109:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/rtmutex.h-110-\n--\ninclude/linux/rwsem.h=85=static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)\n--\ninclude/linux/rwsem.h-115-\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name);\t\\\ninclude/linux/rwsem.h:116:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rwsem.h-117-\n--\ninclude/linux/rwsem.h=155=context_lock_struct(rw_semaphore) {\n--\ninclude/linux/rwsem.h-169-\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname);\t\\\ninclude/linux/rwsem.h:170:\tASSERT_STATIC_STORAGE(lockname)\ninclude/linux/rwsem.h-171-\n--\ninclude/linux/semaphore.h=16=struct semaphore {\n--\ninclude/linux/semaphore.h-48-\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n);\t\\\ninclude/linux/semaphore.h:49:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/semaphore.h-50-\n--\ninclude/linux/seqlock.h=801=static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)\n--\ninclude/linux/seqlock.h-827-\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl);\t\\\ninclude/linux/seqlock.h:828:\tASSERT_STATIC_STORAGE(sl)\ninclude/linux/seqlock.h-829-\n--\ninclude/linux/srcutiny.h=36=void srcu_tiny_irq_work(struct irq_work *irq_work);\n--\ninclude/linux/srcutiny.h-52-\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name);\t\\\ninclude/linux/srcutiny.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutiny.h-54-#define DEFINE_STATIC_SRCU(name) \\\n--\ninclude/linux/srcutree.h=106=struct srcu_struct {\n--\ninclude/linux/srcutree.h-221-\t\t__section(\"___srcu_struct_ptrs\") = \u0026name;\t\t\t\t\t\\\ninclude/linux/srcutree.h:222:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-223-#else\n--\ninclude/linux/srcutree.h-228-\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast);\t\t\\\ninclude/linux/srcutree.h:229:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-230-#endif\n--\ninclude/linux/swait.h=49=struct swait_queue {\n--\ninclude/linux/swait.h-68-\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/swait.h:69:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/swait.h-70-\n--\ninclude/linux/sysctl.h=210=static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)\n--\ninclude/linux/sysctl.h-220-\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name);\t\\\ninclude/linux/sysctl.h:221:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/sysctl.h-222-\n--\ninclude/linux/timer.h-66-\t\t__TIMER_INITIALIZER(_function, 0);\t\t\\\ninclude/linux/timer.h:67:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/timer.h-68-\n--\ninclude/linux/wait.h=42=struct task_struct;\n--\ninclude/linux/wait.h-61-\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/wait.h:62:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/wait.h-63-\n--\ninclude/linux/workqueue.h=224=struct execute_work {\n--\ninclude/linux/workqueue.h-254-\tstruct work_struct n = __WORK_INITIALIZER(n, f);\t\t\\\ninclude/linux/workqueue.h:255:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-256-\n--\ninclude/linux/workqueue.h-258-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0);\t\\\ninclude/linux/workqueue.h:259:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-260-\n--\ninclude/linux/workqueue.h-262-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE);\t\\\ninclude/linux/workqueue.h:263:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-264-\n--\ninclude/linux/xarray.h=300=struct xarray {\n--\ninclude/linux/xarray.h-324-\tstruct xarray name = XARRAY_INIT(name, flags);\t\t\t\\\ninclude/linux/xarray.h:325:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/xarray.h-326-\n--\ntools/testing/memblock/linux/mutex.h-8-\tint name;\t\t\t\t\\\ntools/testing/memblock/linux/mutex.h:9:\tASSERT_STATIC_STORAGE(name)\ntools/testing/memblock/linux/mutex.h-10-\n--\ntools/testing/vma/include/dup.h=425=struct vma_iterator {\n--\ntools/testing/vma/include/dup.h-440-\tstruct mutex mutexname = {};\t\t\\\ntools/testing/vma/include/dup.h:441:\tASSERT_STATIC_STORAGE(mutexname)\ntools/testing/vma/include/dup.h-442-\n--\ntools/virtio/linux/compiler.h-22-/* Enforce static storage duration. */\ntools/virtio/linux/compiler.h:23:#define ASSERT_STATIC_STORAGE(name) \\\ntools/virtio/linux/compiler.h-24-\tstatic typeof(name) * const __always_unused \\\n--\ntools/virtio/linux/ratelimit.h-4-\tint name = 0;\t\t\t\t\t\t\\\ntools/virtio/linux/ratelimit.h:5:\tASSERT_STATIC_STORAGE(name)\ntools/virtio/linux/ratelimit.h-6-\n"
} |
| 9/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22678 output: 35 thoughts: 50 Thoughts: Here's my take on those thoughts: **Investigating the Definition of ASSERT_STATIC_STORAGE** Okay, so I need to track down where `ASSERT_STATIC_STORAGE` is defined. This is likely in one of the core kernel include files related to compilation or build-time checks. My first instinct is to check `include/linux/compiler.h`. It makes the most sense. If that doesn't pan out, I'll move on to `include/linux/build_bug.h` or any other relevant include that might handle compile-time assertions. Let's start with `compiler.h`. Hopefully, it's straightforward. |
| 10/2 | 2026/09/15 04:07 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler.h",
"FirstLine": 270,
"LineCount": 80
}Results: {
"Contents": " 270:\t */\n 271:\t#define ___ADDRESSABLE(sym, __attrs)\t\t\t\t\t\t\\\n 272:\t\tstatic void * __used __attrs\t\t\t\t\t\t\\\n 273:\t\t__UNIQUE_ID(__PASTE(addressable_, sym)) = (void *)(uintptr_t)\u0026sym;\n 274:\t\n 275:\t#define __ADDRESSABLE(sym) \\\n 276:\t\t___ADDRESSABLE(sym, __section(\".discard.addressable\"))\n 277:\t\n 278:\t/*\n 279:\t * This returns a constant expression while determining if an argument is\n 280:\t * a constant expression, most importantly without evaluating the argument.\n 281:\t * Glory to Martin Uecker \u003cMartin.Uecker@med.uni-goettingen.de\u003e\n 282:\t *\n 283:\t * Details:\n 284:\t * - sizeof() return an integer constant expression, and does not evaluate\n 285:\t * the value of its operand; it only examines the type of its operand.\n 286:\t * - The results of comparing two integer constant expressions is also\n 287:\t * an integer constant expression.\n 288:\t * - The first literal \"8\" isn't important. It could be any literal value.\n 289:\t * - The second literal \"8\" is to avoid warnings about unaligned pointers;\n 290:\t * this could otherwise just be \"1\".\n 291:\t * - (long)(x) is used to avoid warnings about 64-bit types on 32-bit\n 292:\t * architectures.\n 293:\t * - The C Standard defines \"null pointer constant\", \"(void *)0\", as\n 294:\t * distinct from other void pointers.\n 295:\t * - If (x) is an integer constant expression, then the \"* 0l\" resolves\n 296:\t * it into an integer constant expression of value 0. Since it is cast to\n 297:\t * \"void *\", this makes the second operand a null pointer constant.\n 298:\t * - If (x) is not an integer constant expression, then the second operand\n 299:\t * resolves to a void pointer (but not a null pointer constant: the value\n 300:\t * is not an integer constant 0).\n 301:\t * - The conditional operator's third operand, \"(int *)8\", is an object\n 302:\t * pointer (to type \"int\").\n 303:\t * - The behavior (including the return type) of the conditional operator\n 304:\t * (\"operand1 ? operand2 : operand3\") depends on the kind of expressions\n 305:\t * given for the second and third operands. This is the central mechanism\n 306:\t * of the macro:\n 307:\t * - When one operand is a null pointer constant (i.e. when x is an integer\n 308:\t * constant expression) and the other is an object pointer (i.e. our\n 309:\t * third operand), the conditional operator returns the type of the\n 310:\t * object pointer operand (i.e. \"int *\"). Here, within the sizeof(), we\n 311:\t * would then get:\n 312:\t * sizeof(*((int *)(...)) == sizeof(int) == 4\n 313:\t * - When one operand is a void pointer (i.e. when x is not an integer\n 314:\t * constant expression) and the other is an object pointer (i.e. our\n 315:\t * third operand), the conditional operator returns a \"void *\" type.\n 316:\t * Here, within the sizeof(), we would then get:\n 317:\t * sizeof(*((void *)(...)) == sizeof(void) == 1\n 318:\t * - The equality comparison to \"sizeof(int)\" therefore depends on (x):\n 319:\t * sizeof(int) == sizeof(int) (x) was a constant expression\n 320:\t * sizeof(int) != sizeof(void) (x) was not a constant expression\n 321:\t */\n 322:\t#define __is_constexpr(x) \\\n 323:\t\t(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))\n 324:\t\n 325:\t/*\n 326:\t * Whether 'type' is a signed type or an unsigned type. Supports scalar types,\n 327:\t * bool and also pointer types.\n 328:\t */\n 329:\t#define is_signed_type(type) (((type)(-1)) \u003c (__force type)1)\n 330:\t#define is_unsigned_type(type) (!is_signed_type(type))\n 331:\t\n 332:\t/*\n 333:\t * Useful shorthand for \"is this condition known at compile-time?\"\n 334:\t *\n 335:\t * Note that the condition may involve non-constant values,\n 336:\t * but the compiler may know enough about the details of the\n 337:\t * values to determine that the condition is statically true.\n 338:\t */\n 339:\t#define statically_true(x) (__builtin_constant_p(x) \u0026\u0026 (x))\n 340:\t\n 341:\t/*\n 342:\t * Similar to statically_true() but produces a constant expression\n 343:\t *\n 344:\t * To be used in conjunction with macros, such as BUILD_BUG_ON_ZERO(),\n 345:\t * which require their input to be a constant expression and for which\n 346:\t * statically_true() would otherwise fail.\n 347:\t *\n 348:\t * This is a trade-off: const_true() requires all its operands to be\n 349:\t * compile time constants. Else, it would always returns false even on\n"
} |
| 11/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 24436 output: 35 thoughts: 15 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Diving into `include/linux/compiler.h`** Alright, let's get into the nitty-gritty. Time to dig down and see what the kernel's compiler magic is all about. The `include/linux/compiler.h` header file is where the action is, right? It's where the abstractions and macros are defined to handle various compiler-specific behaviors and platform optimizations. I'm especially keen to see how they handle things like memory barriers, likely specific architectures, and how they define attributes. I bet there are some clever tricks in here I can learn from. Let's see if this has changed in recent versions. |
| 12/2 | 2026/09/15 04:07 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler.h",
"FirstLine": 350,
"LineCount": 50
}Results: {
"Contents": " 350:\t * the most trivial cases like:\n 351:\t *\n 352:\t * true || non_const_var\n 353:\t *\n 354:\t * On the opposite, statically_true() is able to fold more complex\n 355:\t * tautologies and will return true on expressions such as:\n 356:\t *\n 357:\t * !(non_const_var * 8 % 4)\n 358:\t *\n 359:\t * For the general case, statically_true() is better.\n 360:\t */\n 361:\t#define const_true(x) __builtin_choose_expr(__is_constexpr(x), x, false)\n 362:\t\n 363:\t/*\n 364:\t * This is needed in functions which generate the stack canary, see\n 365:\t * arch/x86/kernel/smpboot.c::start_secondary() for an example.\n 366:\t */\n 367:\t#define prevent_tail_call_optimization()\tmb()\n 368:\t\n 369:\t#include \u003casm/rwonce.h\u003e\n 370:\t\n 371:\t#endif /* __LINUX_COMPILER_H */\n"
} |
| 13/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 24984 output: 29 thoughts: 77 Thoughts: **Debugging a Missing Macro** Okay, hold on a second. Where exactly *is* `ASSERT_STATIC_STORAGE` defined? I need to track down its origin. My first instinct would be to check the git history, perhaps using `git log -1` to see the last commit that touched it. But, shoot, we don't have git available here. No problem, I can still achieve the same goal through other means. Let's use `grep`. I'll start by searching in `include/linux/` again, that's usually where these things live. If that doesn't work, I'll broaden the search to look at anything with "compiler" in the filename, checking `compiler*.h`, just to be thorough. I'm confident we can find this macro. |
| 14/2 | 2026/09/15 04:07 | tool | grepper |
0mArgs:{
"Expression": "ASSERT_STATIC_STORAGE",
"PathPrefix": "include/linux/"
}Results: {
"Output": "include/linux/completion.h=34=static inline void complete_release(struct completion *x) {}\n--\ninclude/linux/completion.h-54-\tstruct completion work = COMPLETION_INITIALIZER(work);\t\\\ninclude/linux/completion.h:55:\tASSERT_STATIC_STORAGE(work)\ninclude/linux/completion.h-56-\n--\ninclude/linux/idr.h=20=struct idr {\n--\ninclude/linux/idr.h-58-\tstruct idr name = IDR_INIT(name);\t\\\ninclude/linux/idr.h:59:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/idr.h-60-\n--\ninclude/linux/klist.h=19=struct klist {\n--\ninclude/linux/klist.h-33-\tstruct klist _name = KLIST_INIT(_name, _get, _put);\t\t\\\ninclude/linux/klist.h:34:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/klist.h-35-\n--\ninclude/linux/kthread.h=162=struct kthread_delayed_work {\n--\ninclude/linux/kthread.h-183-\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn);\t\t\t\\\ninclude/linux/kthread.h:184:\tASSERT_STATIC_STORAGE(dwork)\ninclude/linux/kthread.h-185-\n--\ninclude/linux/mutex.h=62=do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/mutex.h-88-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:89:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-90-\n--\ninclude/linux/mutex.h=115=extern bool mutex_is_locked(struct mutex *lock);\n--\ninclude/linux/mutex.h-129-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:130:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-131-\n--\ninclude/linux/notifier.h=95=extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n--\ninclude/linux/notifier.h-118-\t\tATOMIC_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:119:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-120-#define BLOCKING_NOTIFIER_HEAD(name)\t\t\t\t\\\n--\ninclude/linux/notifier.h-122-\t\tBLOCKING_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:123:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-124-#define RAW_NOTIFIER_HEAD(name)\t\t\t\t\t\\\n--\ninclude/linux/notifier.h-132-\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data);\t\\\ninclude/linux/notifier.h:133:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-134-\n--\ninclude/linux/notifier.h-138-\t\t\tSRCU_NOTIFIER_INIT(name, name);\t\t\\\ninclude/linux/notifier.h:139:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-140-\n--\ninclude/linux/percpu-rwsem.h=33=is_static struct percpu_rw_semaphore name = {\t\t\t\t\\\n--\ninclude/linux/percpu-rwsem.h-40-};\t\t\t\t\t\t\t\t\t\\\ninclude/linux/percpu-rwsem.h:41:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/percpu-rwsem.h-42-\n--\ninclude/linux/radix-tree.h=56=static inline bool radix_tree_is_internal_node(void *ptr)\n--\ninclude/linux/radix-tree.h-83-\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask);\t\\\ninclude/linux/radix-tree.h:84:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/radix-tree.h-85-\n--\ninclude/linux/ratelimit_types.h=17=struct ratelimit_state {\n--\ninclude/linux/ratelimit_types.h-44-\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init);\t\\\ninclude/linux/ratelimit_types.h:45:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/ratelimit_types.h-46-\n--\ninclude/linux/rcu_sync.h=43=extern void rcu_sync_dtor(struct rcu_sync *);\n--\ninclude/linux/rcu_sync.h-52-\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name);\t\\\ninclude/linux/rcu_sync.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rcu_sync.h-54-\n--\ninclude/linux/rtmutex.h=86=do { \\\n--\ninclude/linux/rtmutex.h-108-\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/rtmutex.h:109:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/rtmutex.h-110-\n--\ninclude/linux/rwsem.h=85=static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)\n--\ninclude/linux/rwsem.h-115-\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name);\t\\\ninclude/linux/rwsem.h:116:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rwsem.h-117-\n--\ninclude/linux/rwsem.h=155=context_lock_struct(rw_semaphore) {\n--\ninclude/linux/rwsem.h-169-\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname);\t\\\ninclude/linux/rwsem.h:170:\tASSERT_STATIC_STORAGE(lockname)\ninclude/linux/rwsem.h-171-\n--\ninclude/linux/semaphore.h=16=struct semaphore {\n--\ninclude/linux/semaphore.h-48-\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n);\t\\\ninclude/linux/semaphore.h:49:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/semaphore.h-50-\n--\ninclude/linux/seqlock.h=801=static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)\n--\ninclude/linux/seqlock.h-827-\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl);\t\\\ninclude/linux/seqlock.h:828:\tASSERT_STATIC_STORAGE(sl)\ninclude/linux/seqlock.h-829-\n--\ninclude/linux/srcutiny.h=36=void srcu_tiny_irq_work(struct irq_work *irq_work);\n--\ninclude/linux/srcutiny.h-52-\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name);\t\\\ninclude/linux/srcutiny.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutiny.h-54-#define DEFINE_STATIC_SRCU(name) \\\n--\ninclude/linux/srcutree.h=106=struct srcu_struct {\n--\ninclude/linux/srcutree.h-221-\t\t__section(\"___srcu_struct_ptrs\") = \u0026name;\t\t\t\t\t\\\ninclude/linux/srcutree.h:222:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-223-#else\n--\ninclude/linux/srcutree.h-228-\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast);\t\t\\\ninclude/linux/srcutree.h:229:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-230-#endif\n--\ninclude/linux/swait.h=49=struct swait_queue {\n--\ninclude/linux/swait.h-68-\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/swait.h:69:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/swait.h-70-\n--\ninclude/linux/sysctl.h=210=static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)\n--\ninclude/linux/sysctl.h-220-\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name);\t\\\ninclude/linux/sysctl.h:221:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/sysctl.h-222-\n--\ninclude/linux/timer.h-66-\t\t__TIMER_INITIALIZER(_function, 0);\t\t\\\ninclude/linux/timer.h:67:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/timer.h-68-\n--\ninclude/linux/wait.h=42=struct task_struct;\n--\ninclude/linux/wait.h-61-\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/wait.h:62:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/wait.h-63-\n--\ninclude/linux/workqueue.h=224=struct execute_work {\n--\ninclude/linux/workqueue.h-254-\tstruct work_struct n = __WORK_INITIALIZER(n, f);\t\t\\\ninclude/linux/workqueue.h:255:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-256-\n--\ninclude/linux/workqueue.h-258-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0);\t\\\ninclude/linux/workqueue.h:259:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-260-\n--\ninclude/linux/workqueue.h-262-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE);\t\\\ninclude/linux/workqueue.h:263:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-264-\n--\ninclude/linux/xarray.h=300=struct xarray {\n--\ninclude/linux/xarray.h-324-\tstruct xarray name = XARRAY_INIT(name, flags);\t\t\t\\\ninclude/linux/xarray.h:325:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/xarray.h-326-\n"
} |
| 15/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 28089 output: 27 thoughts: 21 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Hunting Down ASSERT_STATIC_STORAGE** Okay, so I need to track down the definition of `ASSERT_STATIC_STORAGE`. That suggests it's likely a macro, probably used for compile-time assertions or static storage declarations. I'll need to start by searching the `include/` directory tree. It's a broad starting point, but it's where most header files and definitions reside. I expect it's going to be in a common header or utility file, related to memory management, debugging, or potentially some kind of static analysis feature. Let's fire up that search and see what we dig up. It's likely going to be in an include file. |
| 16/2 | 2026/09/15 04:07 | tool | grepper |
0mArgs:{
"Expression": "ASSERT_STATIC_STORAGE",
"PathPrefix": "include/"
}Results: {
"Output": "include/linux/completion.h=34=static inline void complete_release(struct completion *x) {}\n--\ninclude/linux/completion.h-54-\tstruct completion work = COMPLETION_INITIALIZER(work);\t\\\ninclude/linux/completion.h:55:\tASSERT_STATIC_STORAGE(work)\ninclude/linux/completion.h-56-\n--\ninclude/linux/idr.h=20=struct idr {\n--\ninclude/linux/idr.h-58-\tstruct idr name = IDR_INIT(name);\t\\\ninclude/linux/idr.h:59:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/idr.h-60-\n--\ninclude/linux/klist.h=19=struct klist {\n--\ninclude/linux/klist.h-33-\tstruct klist _name = KLIST_INIT(_name, _get, _put);\t\t\\\ninclude/linux/klist.h:34:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/klist.h-35-\n--\ninclude/linux/kthread.h=162=struct kthread_delayed_work {\n--\ninclude/linux/kthread.h-183-\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn);\t\t\t\\\ninclude/linux/kthread.h:184:\tASSERT_STATIC_STORAGE(dwork)\ninclude/linux/kthread.h-185-\n--\ninclude/linux/mutex.h=62=do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/mutex.h-88-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:89:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-90-\n--\ninclude/linux/mutex.h=115=extern bool mutex_is_locked(struct mutex *lock);\n--\ninclude/linux/mutex.h-129-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:130:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-131-\n--\ninclude/linux/notifier.h=95=extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n--\ninclude/linux/notifier.h-118-\t\tATOMIC_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:119:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-120-#define BLOCKING_NOTIFIER_HEAD(name)\t\t\t\t\\\n--\ninclude/linux/notifier.h-122-\t\tBLOCKING_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:123:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-124-#define RAW_NOTIFIER_HEAD(name)\t\t\t\t\t\\\n--\ninclude/linux/notifier.h-132-\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data);\t\\\ninclude/linux/notifier.h:133:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-134-\n--\ninclude/linux/notifier.h-138-\t\t\tSRCU_NOTIFIER_INIT(name, name);\t\t\\\ninclude/linux/notifier.h:139:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-140-\n--\ninclude/linux/percpu-rwsem.h=33=is_static struct percpu_rw_semaphore name = {\t\t\t\t\\\n--\ninclude/linux/percpu-rwsem.h-40-};\t\t\t\t\t\t\t\t\t\\\ninclude/linux/percpu-rwsem.h:41:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/percpu-rwsem.h-42-\n--\ninclude/linux/radix-tree.h=56=static inline bool radix_tree_is_internal_node(void *ptr)\n--\ninclude/linux/radix-tree.h-83-\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask);\t\\\ninclude/linux/radix-tree.h:84:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/radix-tree.h-85-\n--\ninclude/linux/ratelimit_types.h=17=struct ratelimit_state {\n--\ninclude/linux/ratelimit_types.h-44-\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init);\t\\\ninclude/linux/ratelimit_types.h:45:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/ratelimit_types.h-46-\n--\ninclude/linux/rcu_sync.h=43=extern void rcu_sync_dtor(struct rcu_sync *);\n--\ninclude/linux/rcu_sync.h-52-\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name);\t\\\ninclude/linux/rcu_sync.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rcu_sync.h-54-\n--\ninclude/linux/rtmutex.h=86=do { \\\n--\ninclude/linux/rtmutex.h-108-\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/rtmutex.h:109:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/rtmutex.h-110-\n--\ninclude/linux/rwsem.h=85=static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)\n--\ninclude/linux/rwsem.h-115-\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name);\t\\\ninclude/linux/rwsem.h:116:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rwsem.h-117-\n--\ninclude/linux/rwsem.h=155=context_lock_struct(rw_semaphore) {\n--\ninclude/linux/rwsem.h-169-\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname);\t\\\ninclude/linux/rwsem.h:170:\tASSERT_STATIC_STORAGE(lockname)\ninclude/linux/rwsem.h-171-\n--\ninclude/linux/semaphore.h=16=struct semaphore {\n--\ninclude/linux/semaphore.h-48-\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n);\t\\\ninclude/linux/semaphore.h:49:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/semaphore.h-50-\n--\ninclude/linux/seqlock.h=801=static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)\n--\ninclude/linux/seqlock.h-827-\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl);\t\\\ninclude/linux/seqlock.h:828:\tASSERT_STATIC_STORAGE(sl)\ninclude/linux/seqlock.h-829-\n--\ninclude/linux/srcutiny.h=36=void srcu_tiny_irq_work(struct irq_work *irq_work);\n--\ninclude/linux/srcutiny.h-52-\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name);\t\\\ninclude/linux/srcutiny.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutiny.h-54-#define DEFINE_STATIC_SRCU(name) \\\n--\ninclude/linux/srcutree.h=106=struct srcu_struct {\n--\ninclude/linux/srcutree.h-221-\t\t__section(\"___srcu_struct_ptrs\") = \u0026name;\t\t\t\t\t\\\ninclude/linux/srcutree.h:222:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-223-#else\n--\ninclude/linux/srcutree.h-228-\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast);\t\t\\\ninclude/linux/srcutree.h:229:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-230-#endif\n--\ninclude/linux/swait.h=49=struct swait_queue {\n--\ninclude/linux/swait.h-68-\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/swait.h:69:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/swait.h-70-\n--\ninclude/linux/sysctl.h=210=static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)\n--\ninclude/linux/sysctl.h-220-\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name);\t\\\ninclude/linux/sysctl.h:221:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/sysctl.h-222-\n--\ninclude/linux/timer.h-66-\t\t__TIMER_INITIALIZER(_function, 0);\t\t\\\ninclude/linux/timer.h:67:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/timer.h-68-\n--\ninclude/linux/wait.h=42=struct task_struct;\n--\ninclude/linux/wait.h-61-\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/wait.h:62:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/wait.h-63-\n--\ninclude/linux/workqueue.h=224=struct execute_work {\n--\ninclude/linux/workqueue.h-254-\tstruct work_struct n = __WORK_INITIALIZER(n, f);\t\t\\\ninclude/linux/workqueue.h:255:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-256-\n--\ninclude/linux/workqueue.h-258-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0);\t\\\ninclude/linux/workqueue.h:259:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-260-\n--\ninclude/linux/workqueue.h-262-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE);\t\\\ninclude/linux/workqueue.h:263:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-264-\n--\ninclude/linux/xarray.h=300=struct xarray {\n--\ninclude/linux/xarray.h-324-\tstruct xarray name = XARRAY_INIT(name, flags);\t\t\t\\\ninclude/linux/xarray.h:325:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/xarray.h-326-\n"
} |
| 17/2 | 2026/09/15 04:07 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31128 output: 34 thoughts: 31 Thoughts: Here's my take on the thought process, as if it were my own: **Investigating Compiler Type Definitions** Okay, hold on a second, before I dive too deep into this problem. I should probably start by checking the standard place for compiler-related type definitions. My gut says that's likely going to be in `include/linux/compiler_types.h`. That's where I usually find the platform-specific and compiler-specific stuff that affects how data types are handled. Let me just grep within that file. I can get a quick overview of what's defined and see if anything jumps out that's relevant to the current issue. A grep will quickly pinpoint any relevant macros or typedefs related to what I am working on. |
| 18/2 | 2026/09/15 04:08 | tool | grepper |
0mError:no matches Args: {
"Expression": "ASSERT_STATIC_STORAGE",
"PathPrefix": "include/linux/compiler_types.h"
}Results: {
"error": "no matches"
} |
| 19/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31365 output: 18 thoughts: 155 Thoughts: **Debugging a Missing Macro** Okay, hold on a second. I was expecting to find `ASSERT_STATIC_STORAGE` in either `include/linux/compiler_types.h` or `include/linux/compiler.h`. Why isn't it there? Did my grep across the whole tree even include *all* the files? I need to be sure. Aha! Now I see it, in `tools/virtio/linux/compiler.h`: ```c /* Enforce static storage duration. */ #define ASSERT_STATIC_STORAGE(name) \ static typeof(name) * const __always_unused \ name##_storage_check = &(name) ``` But that's in `tools/virtio/linux/`, not `include/linux/`... which is what I was searching. Why didn't `grepper` pick that up? That seems strange. Maybe it's defined in one of the sub-directories and included from a common header in include/linux? Alright, new plan. Let's try a different search strategy. I'm going to grep for `_storage_check` across the *entire* repository. That check is pretty unique, and that should quickly reveal where this macro is actually *being* used. That should help me figure out how it's getting included and what's going on with these include paths. |
| 20/2 | 2026/09/15 04:08 | tool | grepper |
0mArgs:{
"Expression": "_storage_check"
}Results: {
"Output": "kernel/bpf/local_storage.c=363=static long cgroup_storage_delete_elem(struct bpf_map *map, void *key)\n--\nkernel/bpf/local_storage.c-367-\nkernel/bpf/local_storage.c:368:static int cgroup_storage_check_btf(struct bpf_map *map,\nkernel/bpf/local_storage.c-369-\t\t\t\t const struct btf *btf,\n--\nkernel/bpf/local_storage.c=462=const struct bpf_map_ops cgroup_storage_map_ops = {\n--\nkernel/bpf/local_storage.c-468-\t.map_delete_elem = cgroup_storage_delete_elem,\nkernel/bpf/local_storage.c:469:\t.map_check_btf = cgroup_storage_check_btf,\nkernel/bpf/local_storage.c-470-\t.map_seq_show_elem = cgroup_storage_seq_show_elem,\n--\ntools/virtio/linux/compiler.h-24-\tstatic typeof(name) * const __always_unused \\\ntools/virtio/linux/compiler.h:25:\t\tname##_storage_check = \u0026(name)\ntools/virtio/linux/compiler.h-26-\n"
} |
| 21/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32183 output: 21 thoughts: 148 Thoughts: **Debugging a Kernel Macro** Okay, hold on a second. Where exactly *is* `ASSERT_STATIC_STORAGE` defined within the kernel? My first instinct is to check the standard spots, `include/linux/compiler_attributes.h` and `include/linux/build_bug.h`. Maybe it's also worth a quick glance at the git log, looking for when that macro was introduced or changed. Can't directly `git log` it like that, though. I'll have to use `git grep` - I'll try searching for `ASSERT_STATIC_STORAGE` without specifying a path. Hmm, that's odd. Grepping with the expression `define ASSERT_STATIC_STORAGE` didn't find anything in the `include/` directory. That's unexpected. Why didn't `grep` turn anything up? Could it be hiding in a different include directory? Perhaps something in `asm/` or another related directory? Alright, let's cast a wider net. I'm going to grep the entire repository for `define.*ASSERT_STATIC_STORAGE` to make absolutely sure I don't miss anything. Let's see if this reveals its location. |
| 22/2 | 2026/09/15 04:08 | tool | grepper |
0mArgs:{
"Expression": "define.*ASSERT_STATIC_STORAGE"
}Results: {
"Output": "tools/virtio/linux/compiler.h-22-/* Enforce static storage duration. */\ntools/virtio/linux/compiler.h:23:#define ASSERT_STATIC_STORAGE(name) \\\ntools/virtio/linux/compiler.h-24-\tstatic typeof(name) * const __always_unused \\\n"
} |
| 23/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32696 output: 17 thoughts: 335 Thoughts: **My Initial Troubleshooting Steps** Okay, hold on a second. This is odd. Why is `ASSERT_STATIC_STORAGE` only defined in `tools/virtio/linux/compiler.h`? Let me go back and re-examine the diff. Did the patch accidentally *remove* the definition from `include/linux/compiler.h`? I need to verify that. Let me take a look at `include/linux/compiler.h` within the context of the diff. * Aha! The `completion.h` file now *includes* `<linux/compiler.h>`. That is what is expected, so something is still wrong. Did someone forget to actually *define* `ASSERT_STATIC_STORAGE` in `include/linux/compiler.h`? Or is it being defined elsewhere? Let me check the contents of `include/linux/compiler.h` around the top 100 lines, or maybe I should just `grep` for `ASSERT_STATIC` within the `include/` directory. Right, I remember now. We did a `grep` for `ASSERT_STATIC_STORAGE` earlier, and we found its usage in completion.h, idr.h, klist.h, etc., but we *didn't* find the actual definition! That is still the issue. Let's use `git grep` on `ASSERT_STATIC` with the grepper tool to search the whole project. This should show me all instances and hopefully the definition! |
| 24/2 | 2026/09/15 04:08 | tool | grepper |
0mArgs:{
"Expression": "ASSERT_STATIC"
}Results: {
"Output": "include/linux/completion.h=34=static inline void complete_release(struct completion *x) {}\n--\ninclude/linux/completion.h-54-\tstruct completion work = COMPLETION_INITIALIZER(work);\t\\\ninclude/linux/completion.h:55:\tASSERT_STATIC_STORAGE(work)\ninclude/linux/completion.h-56-\n--\ninclude/linux/idr.h=20=struct idr {\n--\ninclude/linux/idr.h-58-\tstruct idr name = IDR_INIT(name);\t\\\ninclude/linux/idr.h:59:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/idr.h-60-\n--\ninclude/linux/klist.h=19=struct klist {\n--\ninclude/linux/klist.h-33-\tstruct klist _name = KLIST_INIT(_name, _get, _put);\t\t\\\ninclude/linux/klist.h:34:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/klist.h-35-\n--\ninclude/linux/kthread.h=162=struct kthread_delayed_work {\n--\ninclude/linux/kthread.h-183-\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn);\t\t\t\\\ninclude/linux/kthread.h:184:\tASSERT_STATIC_STORAGE(dwork)\ninclude/linux/kthread.h-185-\n--\ninclude/linux/mutex.h=62=do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/mutex.h-88-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:89:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-90-\n--\ninclude/linux/mutex.h=115=extern bool mutex_is_locked(struct mutex *lock);\n--\ninclude/linux/mutex.h-129-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:130:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-131-\n--\ninclude/linux/notifier.h=95=extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n--\ninclude/linux/notifier.h-118-\t\tATOMIC_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:119:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-120-#define BLOCKING_NOTIFIER_HEAD(name)\t\t\t\t\\\n--\ninclude/linux/notifier.h-122-\t\tBLOCKING_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:123:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-124-#define RAW_NOTIFIER_HEAD(name)\t\t\t\t\t\\\n--\ninclude/linux/notifier.h-132-\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data);\t\\\ninclude/linux/notifier.h:133:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-134-\n--\ninclude/linux/notifier.h-138-\t\t\tSRCU_NOTIFIER_INIT(name, name);\t\t\\\ninclude/linux/notifier.h:139:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-140-\n--\ninclude/linux/percpu-rwsem.h=33=is_static struct percpu_rw_semaphore name = {\t\t\t\t\\\n--\ninclude/linux/percpu-rwsem.h-40-};\t\t\t\t\t\t\t\t\t\\\ninclude/linux/percpu-rwsem.h:41:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/percpu-rwsem.h-42-\n--\ninclude/linux/radix-tree.h=56=static inline bool radix_tree_is_internal_node(void *ptr)\n--\ninclude/linux/radix-tree.h-83-\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask);\t\\\ninclude/linux/radix-tree.h:84:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/radix-tree.h-85-\n--\ninclude/linux/ratelimit_types.h=17=struct ratelimit_state {\n--\ninclude/linux/ratelimit_types.h-44-\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init);\t\\\ninclude/linux/ratelimit_types.h:45:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/ratelimit_types.h-46-\n--\ninclude/linux/rcu_sync.h=43=extern void rcu_sync_dtor(struct rcu_sync *);\n--\ninclude/linux/rcu_sync.h-52-\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name);\t\\\ninclude/linux/rcu_sync.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rcu_sync.h-54-\n--\ninclude/linux/rtmutex.h=86=do { \\\n--\ninclude/linux/rtmutex.h-108-\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/rtmutex.h:109:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/rtmutex.h-110-\n--\ninclude/linux/rwsem.h=85=static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)\n--\ninclude/linux/rwsem.h-115-\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name);\t\\\ninclude/linux/rwsem.h:116:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rwsem.h-117-\n--\ninclude/linux/rwsem.h=155=context_lock_struct(rw_semaphore) {\n--\ninclude/linux/rwsem.h-169-\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname);\t\\\ninclude/linux/rwsem.h:170:\tASSERT_STATIC_STORAGE(lockname)\ninclude/linux/rwsem.h-171-\n--\ninclude/linux/semaphore.h=16=struct semaphore {\n--\ninclude/linux/semaphore.h-48-\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n);\t\\\ninclude/linux/semaphore.h:49:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/semaphore.h-50-\n--\ninclude/linux/seqlock.h=801=static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)\n--\ninclude/linux/seqlock.h-827-\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl);\t\\\ninclude/linux/seqlock.h:828:\tASSERT_STATIC_STORAGE(sl)\ninclude/linux/seqlock.h-829-\n--\ninclude/linux/srcutiny.h=36=void srcu_tiny_irq_work(struct irq_work *irq_work);\n--\ninclude/linux/srcutiny.h-52-\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name);\t\\\ninclude/linux/srcutiny.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutiny.h-54-#define DEFINE_STATIC_SRCU(name) \\\n--\ninclude/linux/srcutree.h=106=struct srcu_struct {\n--\ninclude/linux/srcutree.h-221-\t\t__section(\"___srcu_struct_ptrs\") = \u0026name;\t\t\t\t\t\\\ninclude/linux/srcutree.h:222:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-223-#else\n--\ninclude/linux/srcutree.h-228-\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast);\t\t\\\ninclude/linux/srcutree.h:229:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-230-#endif\n--\ninclude/linux/swait.h=49=struct swait_queue {\n--\ninclude/linux/swait.h-68-\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/swait.h:69:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/swait.h-70-\n--\ninclude/linux/sysctl.h=210=static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)\n--\ninclude/linux/sysctl.h-220-\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name);\t\\\ninclude/linux/sysctl.h:221:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/sysctl.h-222-\n--\ninclude/linux/timer.h-66-\t\t__TIMER_INITIALIZER(_function, 0);\t\t\\\ninclude/linux/timer.h:67:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/timer.h-68-\n--\ninclude/linux/wait.h=42=struct task_struct;\n--\ninclude/linux/wait.h-61-\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/wait.h:62:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/wait.h-63-\n--\ninclude/linux/workqueue.h=224=struct execute_work {\n--\ninclude/linux/workqueue.h-254-\tstruct work_struct n = __WORK_INITIALIZER(n, f);\t\t\\\ninclude/linux/workqueue.h:255:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-256-\n--\ninclude/linux/workqueue.h-258-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0);\t\\\ninclude/linux/workqueue.h:259:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-260-\n--\ninclude/linux/workqueue.h-262-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE);\t\\\ninclude/linux/workqueue.h:263:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-264-\n--\ninclude/linux/xarray.h=300=struct xarray {\n--\ninclude/linux/xarray.h-324-\tstruct xarray name = XARRAY_INIT(name, flags);\t\t\t\\\ninclude/linux/xarray.h:325:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/xarray.h-326-\n--\ntools/testing/memblock/linux/mutex.h-8-\tint name;\t\t\t\t\\\ntools/testing/memblock/linux/mutex.h:9:\tASSERT_STATIC_STORAGE(name)\ntools/testing/memblock/linux/mutex.h-10-\n--\ntools/testing/vma/include/dup.h=425=struct vma_iterator {\n--\ntools/testing/vma/include/dup.h-440-\tstruct mutex mutexname = {};\t\t\\\ntools/testing/vma/include/dup.h:441:\tASSERT_STATIC_STORAGE(mutexname)\ntools/testing/vma/include/dup.h-442-\n--\ntools/virtio/linux/compiler.h-22-/* Enforce static storage duration. */\ntools/virtio/linux/compiler.h:23:#define ASSERT_STATIC_STORAGE(name) \\\ntools/virtio/linux/compiler.h-24-\tstatic typeof(name) * const __always_unused \\\n--\ntools/virtio/linux/ratelimit.h-4-\tint name = 0;\t\t\t\t\t\t\\\ntools/virtio/linux/ratelimit.h:5:\tASSERT_STATIC_STORAGE(name)\ntools/virtio/linux/ratelimit.h-6-\n"
} |
| 25/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36511 output: 17 thoughts: 126 Thoughts: **Investigating the `ASSERT_STATIC_STORAGE` Mystery** Okay, hold on a second! Before I dive too deep into this commit, let's rewind and take a peek at the previous one, maybe even just one commit back from the current HEAD. I need some context. Wait a minute... `ASSERT_STATIC_STORAGE` is *already* in the codebase? I thought this commit was introducing it! This throws a wrench in the works. My initial assumption was incorrect. Right, so where could this macro be defined? My gut tells me it’s in one of those core header files. Let's start by checking `include/linux/build_bug.h` or maybe `include/linux/compiler.h`. Those are good starting points for this type of thing. Hold on, this is strange! Why didn't `grepper` turn up any results for `define ASSERT_STATIC_STORAGE` in the `include/` directory? That's definitely suspicious. I need to figure out how this is already defined and where. Alright, I'm going to start reading `include/linux/compiler_types.h` to see if it is defined there. Then I'll search for related terms like `_storage_check`, `storage_check`, or `static_storage`. There has to be a trace of this macro somewhere. This will require some detective work. |
| 26/2 | 2026/09/15 04:08 | tool | grepper |
0mArgs:{
"Expression": "storage_check"
}Results: {
"Output": "arch/powerpc/include/asm/lv1call.h=315=LV1_CALL(storage_get_async_status, 1, 2, 249 )\narch/powerpc/include/asm/lv1call.h:316:LV1_CALL(storage_check_async_status, 2, 1, 254 )\narch/powerpc/include/asm/lv1call.h-317-LV1_CALL(panic, 1, 0, 255 )\n--\nkernel/bpf/local_storage.c=363=static long cgroup_storage_delete_elem(struct bpf_map *map, void *key)\n--\nkernel/bpf/local_storage.c-367-\nkernel/bpf/local_storage.c:368:static int cgroup_storage_check_btf(struct bpf_map *map,\nkernel/bpf/local_storage.c-369-\t\t\t\t const struct btf *btf,\n--\nkernel/bpf/local_storage.c=462=const struct bpf_map_ops cgroup_storage_map_ops = {\n--\nkernel/bpf/local_storage.c-468-\t.map_delete_elem = cgroup_storage_delete_elem,\nkernel/bpf/local_storage.c:469:\t.map_check_btf = cgroup_storage_check_btf,\nkernel/bpf/local_storage.c-470-\t.map_seq_show_elem = cgroup_storage_seq_show_elem,\n--\ntools/virtio/linux/compiler.h-24-\tstatic typeof(name) * const __always_unused \\\ntools/virtio/linux/compiler.h:25:\t\tname##_storage_check = \u0026(name)\ntools/virtio/linux/compiler.h-26-\n"
} |
| 27/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37425 output: 33 thoughts: 151 Thoughts: **Digging into the Completion Implementation** Okay, hold on a second. Let me re-examine this diff. Specifically, I'm looking at how completions are declared in `include/linux/completion.h`. I see: ```c #include <linux/compiler.h> #include <linux/swait.h> ... #define DECLARE_COMPLETION(work) \ struct completion work = COMPLETION_INITIALIZER(work); \ ASSERT_STATIC_STORAGE(work) ``` Huh. That's interesting. I'm seeing `ASSERT_STATIC_STORAGE` here. But wait… isn't that macro typically defined in the `linux/compiler.h` header? I could've sworn it was. Why isn't it right there alongside the compiler-related definitions? That's a little odd. It's making me wonder where it *is* defined. Alright, let's just quickly check the first 100 lines of `include/linux/compiler.h` to see if I can spot it. Let's see if it's there, or if it has to be defined elsewhere for some reason. |
| 28/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler.h",
"FirstLine": 1,
"LineCount": 80
}Results: {
"Contents": " 1:\t/* SPDX-License-Identifier: GPL-2.0 */\n 2:\t#ifndef __LINUX_COMPILER_H\n 3:\t#define __LINUX_COMPILER_H\n 4:\t\n 5:\t#include \u003clinux/compiler_types.h\u003e\n 6:\t\n 7:\t#ifndef __ASSEMBLY__\n 8:\t\n 9:\t#ifdef __KERNEL__\n 10:\t\n 11:\t/*\n 12:\t * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code\n 13:\t * to disable branch tracing on a per file basis.\n 14:\t */\n 15:\tvoid ftrace_likely_update(struct ftrace_likely_data *f, int val,\n 16:\t\t\t\t int expect, int is_constant);\n 17:\t#if defined(CONFIG_TRACE_BRANCH_PROFILING) \\\n 18:\t \u0026\u0026 !defined(DISABLE_BRANCH_PROFILING) \u0026\u0026 !defined(__CHECKER__)\n 19:\t#define likely_notrace(x)\t__builtin_expect(!!(x), 1)\n 20:\t#define unlikely_notrace(x)\t__builtin_expect(!!(x), 0)\n 21:\t\n 22:\t#define __branch_check__(x, expect, is_constant) ({\t\t\t\\\n 23:\t\t\t\tlong ______r;\t\t\t\t\t\\\n 24:\t\t\t\tstatic struct ftrace_likely_data\t\t\\\n 25:\t\t\t\t\t__aligned(4)\t\t\t\t\\\n 26:\t\t\t\t\t__section(\"_ftrace_annotated_branch\")\t\\\n 27:\t\t\t\t\t______f = {\t\t\t\t\\\n 28:\t\t\t\t\t.data.func = __func__,\t\t\t\\\n 29:\t\t\t\t\t.data.file = __FILE__,\t\t\t\\\n 30:\t\t\t\t\t.data.line = __LINE__,\t\t\t\\\n 31:\t\t\t\t};\t\t\t\t\t\t\\\n 32:\t\t\t\t______r = __builtin_expect(!!(x), expect);\t\\\n 33:\t\t\t\tftrace_likely_update(\u0026______f, ______r,\t\t\\\n 34:\t\t\t\t\t\t expect, is_constant);\t\\\n 35:\t\t\t\t______r;\t\t\t\t\t\\\n 36:\t\t\t})\n 37:\t\n 38:\t/*\n 39:\t * Using __builtin_constant_p(x) to ignore cases where the return\n 40:\t * value is always the same. This idea is taken from a similar patch\n 41:\t * written by Daniel Walker.\n 42:\t */\n 43:\t# ifndef likely\n 44:\t# define likely(x)\t(__branch_check__(x, 1, __builtin_constant_p(x)))\n 45:\t# endif\n 46:\t# ifndef unlikely\n 47:\t# define unlikely(x)\t(__branch_check__(x, 0, __builtin_constant_p(x)))\n 48:\t# endif\n 49:\t\n 50:\t#ifdef CONFIG_PROFILE_ALL_BRANCHES\n 51:\t/*\n 52:\t * \"Define 'is'\", Bill Clinton\n 53:\t * \"Define 'if'\", Steven Rostedt\n 54:\t */\n 55:\t#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )\n 56:\t\n 57:\t#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))\n 58:\t\n 59:\t#define __trace_if_value(cond) ({\t\t\t\\\n 60:\t\tstatic struct ftrace_branch_data\t\t\\\n 61:\t\t\t__aligned(4)\t\t\t\t\\\n 62:\t\t\t__section(\"_ftrace_branch\")\t\t\\\n 63:\t\t\t__if_trace = {\t\t\t\t\\\n 64:\t\t\t\t.func = __func__,\t\t\\\n 65:\t\t\t\t.file = __FILE__,\t\t\\\n 66:\t\t\t\t.line = __LINE__,\t\t\\\n 67:\t\t\t};\t\t\t\t\t\\\n 68:\t\t(cond) ?\t\t\t\t\t\\\n 69:\t\t\t(__if_trace.miss_hit[1]++,1) :\t\t\\\n 70:\t\t\t(__if_trace.miss_hit[0]++,0);\t\t\\\n 71:\t})\n 72:\t\n 73:\t#endif /* CONFIG_PROFILE_ALL_BRANCHES */\n 74:\t\n 75:\t#else\n 76:\t# define likely(x)\t__builtin_expect(!!(x), 1)\n 77:\t# define unlikely(x)\t__builtin_expect(!!(x), 0)\n 78:\t# define likely_notrace(x)\tlikely(x)\n 79:\t# define unlikely_notrace(x)\tunlikely(x)\n 80:\t#endif\n"
} |
| 29/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 39081 output: 35 thoughts: 22 Thoughts: Here's my summary, as though I'm reading and processing that section of `include/linux/compiler.h`:
**Analyzing Compiler Intrinsics and Attributes**
Okay, so I'm diving into lines 81 through 270 of `include/linux/compiler.h`. This is where the kernel defines a lot of its compiler-specific macros and attributes. Immediately, I'm expecting to see a lot of conditional compilation, which I do. There's probably a ton of `#ifdef` blocks checking for various compiler vendors (GCC, Clang, ICC, etc.) and versions.
I'm looking for the standard stuff – things like `__attribute__((always_inline))` to hint to the compiler that certain functions should *always* be inlined for performance reasons. I also expect to find macros for marking functions as likely or unlikely, again, for branch prediction optimization. See, I'm already seeing some of those macros pop up! There's `likely()` and `unlikely()`, as expected, and some architecture-specific implementations of them.
I'm also paying close attention to any memory barrier or synchronization primitives defined here. These are critical for multi-threaded or multi-core environments, and I need to see how the kernel handles these at a low level to ensure data integrity and avoid race conditions. I see `barrier()` and related macros, confirming my suspicions. They'll have a role in the architecture-specific aspects of the code.
Beyond that, I'm anticipating some tricks to handle situations where a function should *never* be inlined or is prone to be optimized too aggressively. Sometimes you want the compiler to *not* optimize something, especially if you have a special purpose in mind. Those can be crucial. And there is a section regarding `__builtin_unreachable()`, a compiler intrinsic used for indicating that a piece of code is logically unreachable, giving the compiler free reign to do more optimizations.
I'm also scanning for any code related to function attributes like `__noreturn`, `__format`, `__malloc`, or `__attribute__((section("..."))`. These indicate special properties of functions or variables. Things like `__noreturn` are particularly important for ensuring the compiler knows how a function behaves, and how the program control flow changes.
Essentially, I'm looking for the foundation upon which the kernel builds its platform-independent yet optimized code, to see how the kernel interacts with the various compiler implementations. I need to get a grip on those internal mechanisms to better understand how everything works together.
|
| 30/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler.h",
"FirstLine": 81,
"LineCount": 100
}Results: {
"Contents": " 81:\t\n 82:\t/* Optimization barrier */\n 83:\t#ifndef barrier\n 84:\t/* The \"volatile\" is due to gcc bugs */\n 85:\t# define barrier() __asm__ __volatile__(\"\": : :\"memory\")\n 86:\t#endif\n 87:\t\n 88:\t#ifndef barrier_data\n 89:\t/*\n 90:\t * This version is i.e. to prevent dead stores elimination on @ptr\n 91:\t * where gcc and llvm may behave differently when otherwise using\n 92:\t * normal barrier(): while gcc behavior gets along with a normal\n 93:\t * barrier(), llvm needs an explicit input variable to be assumed\n 94:\t * clobbered. The issue is as follows: while the inline asm might\n 95:\t * access any memory it wants, the compiler could have fit all of\n 96:\t * @ptr into memory registers instead, and since @ptr never escaped\n 97:\t * from that, it proved that the inline asm wasn't touching any of\n 98:\t * it. This version works well with both compilers, i.e. we're telling\n 99:\t * the compiler that the inline asm absolutely may see the contents\n 100:\t * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495\n 101:\t */\n 102:\t# define barrier_data(ptr) __asm__ __volatile__(\"\": :\"r\"(ptr) :\"memory\")\n 103:\t#endif\n 104:\t\n 105:\t/* workaround for GCC PR82365 if needed */\n 106:\t#ifndef barrier_before_unreachable\n 107:\t# define barrier_before_unreachable() do { } while (0)\n 108:\t#endif\n 109:\t\n 110:\t/* Unreachable code */\n 111:\t#ifdef CONFIG_OBJTOOL\n 112:\t/* Annotate a C jump table to allow objtool to follow the code flow */\n 113:\t#define __annotate_jump_table __section(\".data.rel.ro.c_jump_table\")\n 114:\t#else /* !CONFIG_OBJTOOL */\n 115:\t#define __annotate_jump_table\n 116:\t#endif /* CONFIG_OBJTOOL */\n 117:\t\n 118:\t/*\n 119:\t * Mark a position in code as unreachable. This can be used to\n 120:\t * suppress control flow warnings after asm blocks that transfer\n 121:\t * control elsewhere.\n 122:\t */\n 123:\t#define unreachable() do {\t\t\\\n 124:\t\tbarrier_before_unreachable();\t\\\n 125:\t\t__builtin_unreachable();\t\\\n 126:\t} while (0)\n 127:\t\n 128:\t/*\n 129:\t * KENTRY - kernel entry point\n 130:\t * This can be used to annotate symbols (functions or data) that are used\n 131:\t * without their linker symbol being referenced explicitly. For example,\n 132:\t * interrupt vector handlers, or functions in the kernel image that are found\n 133:\t * programatically.\n 134:\t *\n 135:\t * Not required for symbols exported with EXPORT_SYMBOL, or initcalls. Those\n 136:\t * are handled in their own way (with KEEP() in linker scripts).\n 137:\t *\n 138:\t * KENTRY can be avoided if the symbols in question are marked as KEEP() in the\n 139:\t * linker script. For example an architecture could KEEP() its entire\n 140:\t * boot/exception vector code rather than annotate each function and data.\n 141:\t */\n 142:\t#ifndef KENTRY\n 143:\t# define KENTRY(sym)\t\t\t\t\t\t\\\n 144:\t\textern typeof(sym) sym;\t\t\t\t\t\\\n 145:\t\tstatic const unsigned long __kentry_##sym\t\t\\\n 146:\t\t__used\t\t\t\t\t\t\t\\\n 147:\t\t__attribute__((__section__(\"___kentry+\" #sym)))\t\t\\\n 148:\t\t= (unsigned long)\u0026sym;\n 149:\t#endif\n 150:\t\n 151:\t#ifndef RELOC_HIDE\n 152:\t# define RELOC_HIDE(ptr, off) ((typeof(ptr))((unsigned long)(ptr) + (off)))\n 153:\t#endif\n 154:\t\n 155:\t#define absolute_pointer(val)\tRELOC_HIDE((void *)(val), 0)\n 156:\t\n 157:\t#ifndef OPTIMIZER_HIDE_VAR\n 158:\t/* Make the optimizer believe the variable can be manipulated arbitrarily. */\n 159:\t#define OPTIMIZER_HIDE_VAR(var)\t\t\t\t\t\t\\\n 160:\t\t__asm__ (\"\" : \"=r\" (var) : \"0\" (var))\n 161:\t#endif\n 162:\t\n 163:\t/* Format: __UNIQUE_ID_\u003cname\u003e_\u003c__COUNTER__\u003e */\n 164:\t#define __UNIQUE_ID(name)\t\t\t\t\t\\\n 165:\t\t__PASTE(__UNIQUE_ID_,\t\t\t\t\t\\\n 166:\t\t__PASTE(name,\t\t\t\t\t\t\\\n 167:\t\t__PASTE(_, __COUNTER__)))\n 168:\t\n 169:\t/**\n 170:\t * data_race - mark an expression as containing intentional data races\n 171:\t *\n 172:\t * This data_race() macro is useful for situations in which data races\n 173:\t * should be forgiven. One example is diagnostic code that accesses\n 174:\t * shared variables but is not a part of the core synchronization design.\n 175:\t * For example, if accesses to a given variable are protected by a lock,\n 176:\t * except for diagnostic code, then the accesses under the lock should\n 177:\t * be plain C-language accesses and those in the diagnostic code should\n 178:\t * use data_race(). This way, KCSAN will complain if buggy lockless\n 179:\t * accesses to that variable are introduced, even if the buggy accesses\n 180:\t * are protected by READ_ONCE() or WRITE_ONCE().\n"
} |
| 31/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 41295 output: 35 thoughts: 54 Thoughts: Here's my attempt at summarizing the thought process, as if I were thinking it: **Digging into Kernel Static Storage Assertions** Okay, hold on a second. I need to figure out where `ASSERT_STATIC_STORAGE` is actually defined within the kernel's source code. I know it's related to compile-time storage checks, but the details are escaping me. Let's try a few quick searches: I'll start with a `grep` for variations on the theme. I should try `_storage_check`, and `storage_check` first – that seems like a likely candidate name. Maybe there is a macro named `ASSERT_STATIC` that does the work! If all else fails, I should definitely check `include/linux/compiler_types.h`; that's usually the go-to place for core compiler-related macros and type definitions. Hopefully, I can pinpoint its definition and figure out the exact mechanisms at play. |
| 32/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler_types.h",
"FirstLine": 1,
"LineCount": 80
}Results: {
"Contents": " 1:\t/* SPDX-License-Identifier: GPL-2.0 */\n 2:\t#ifndef __LINUX_COMPILER_TYPES_H\n 3:\t#define __LINUX_COMPILER_TYPES_H\n 4:\t\n 5:\t/*\n 6:\t * __has_builtin is supported on gcc \u003e= 10, clang \u003e= 3 and icc \u003e= 21.\n 7:\t * In the meantime, to support gcc \u003c 10, we implement __has_builtin\n 8:\t * by hand.\n 9:\t */\n 10:\t#ifndef __has_builtin\n 11:\t#define __has_builtin(x) (0)\n 12:\t#endif\n 13:\t\n 14:\t/* Indirect macros required for expanded argument pasting, eg. __LINE__. */\n 15:\t#define ___PASTE(a, b) a##b\n 16:\t#define __PASTE(a, b) ___PASTE(a, b)\n 17:\t\n 18:\t#ifndef __ASSEMBLY__\n 19:\t\n 20:\t/*\n 21:\t * C23 introduces \"auto\" as a standard way to define type-inferred\n 22:\t * variables, but \"auto\" has been a (useless) keyword even since K\u0026R C,\n 23:\t * so it has always been \"namespace reserved.\"\n 24:\t *\n 25:\t * Until at some future time we require C23 support, we need the gcc\n 26:\t * extension __auto_type, but there is no reason to put that elsewhere\n 27:\t * in the source code.\n 28:\t */\n 29:\t#if __STDC_VERSION__ \u003c 202311L\n 30:\t# define auto __auto_type\n 31:\t#endif\n 32:\t\n 33:\t/*\n 34:\t * Skipped when running bindgen due to a libclang issue;\n 35:\t * see https://github.com/rust-lang/rust-bindgen/issues/2244.\n 36:\t */\n 37:\t#if defined(CONFIG_DEBUG_INFO_BTF) \u0026\u0026 defined(CONFIG_PAHOLE_HAS_BTF_TAG) \u0026\u0026 \\\n 38:\t\t__has_attribute(btf_type_tag) \u0026\u0026 !defined(__BINDGEN__)\n 39:\t# define BTF_TYPE_TAG(value) __attribute__((btf_type_tag(#value)))\n 40:\t#else\n 41:\t# define BTF_TYPE_TAG(value) /* nothing */\n 42:\t#endif\n 43:\t\n 44:\t#include \u003clinux/compiler-context-analysis.h\u003e\n 45:\t\n 46:\t/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */\n 47:\t#ifdef __CHECKER__\n 48:\t/* address spaces */\n 49:\t# define __kernel\t__attribute__((address_space(0)))\n 50:\t# define __user\t\t__attribute__((noderef, address_space(__user)))\n 51:\t# define __iomem\t__attribute__((noderef, address_space(__iomem)))\n 52:\t# define __percpu\t__attribute__((noderef, address_space(__percpu)))\n 53:\t# define __rcu\t\t__attribute__((noderef, address_space(__rcu)))\n 54:\tstatic inline void __chk_user_ptr(const volatile void __user *ptr) { }\n 55:\tstatic inline void __chk_io_ptr(const volatile void __iomem *ptr) { }\n 56:\t/* other */\n 57:\t# define __force\t__attribute__((force))\n 58:\t# define __nocast\t__attribute__((nocast))\n 59:\t# define __safe\t\t__attribute__((safe))\n 60:\t# define __private\t__attribute__((noderef))\n 61:\t# define ACCESS_PRIVATE(p, member) (*((typeof((p)-\u003emember) __force *) \u0026(p)-\u003emember))\n 62:\t#else /* __CHECKER__ */\n 63:\t/* address spaces */\n 64:\t# define __kernel\n 65:\t# ifdef STRUCTLEAK_PLUGIN\n 66:\t# define __user\t__attribute__((user))\n 67:\t# else\n 68:\t# define __user\tBTF_TYPE_TAG(user)\n 69:\t# endif\n 70:\t# define __iomem\n 71:\t# define __percpu\t__percpu_qual BTF_TYPE_TAG(percpu)\n 72:\t# define __rcu\t\tBTF_TYPE_TAG(rcu)\n 73:\t\n 74:\t# define __chk_user_ptr(x)\t(void)0\n 75:\t# define __chk_io_ptr(x)\t(void)0\n 76:\t/* other */\n 77:\t# define __force\n 78:\t# define __nocast\n 79:\t# define __safe\n 80:\t# define __private\n"
} |
| 33/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 42887 output: 37 thoughts: 18 Thoughts: Here's my take on the contents of `include/linux/compiler_types.h`, from my perspective: **Diving into the Compiler Types Header** Okay, time to dig into the guts of `compiler_types.h`. I'm guessing this file probably houses the fundamental macro definitions that the kernel relies on for compiler-specific features and data type attributes. I'm expecting to see stuff related to attribute declarations, data alignment, likely type qualifiers for optimization hints, and potentially checks for compiler version compatibility or specific features. Knowing this stuff is crucial. These low-level details are the bedrock of portability and performance within the kernel. I'll be looking to see how they've handled things like `__attribute__((...))` to specify likely branch conditions, or how they define things like `__packed__` and other attributes to influence data layout. I'm especially interested in whether they've got custom macros to handle different compilers and their respective peculiarities. Let's get reading and see what treasures this file holds. |
| 34/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler_types.h",
"FirstLine": 300,
"LineCount": 80
}Results: {
"Contents": " 300:\t * of core kernel data structs will be volatile in some objects and not in\n 301:\t * others. Instead define it globally for KCSAN kernels.\n 302:\t */\n 303:\t# define __data_racy volatile\n 304:\t#else\n 305:\t# define __data_racy\n 306:\t#endif\n 307:\t\n 308:\t#ifdef __SANITIZE_THREAD__\n 309:\t/*\n 310:\t * Clang still emits instrumentation for __tsan_func_{entry,exit}() and builtin\n 311:\t * atomics even with __no_sanitize_thread (to avoid false positives in userspace\n 312:\t * ThreadSanitizer). The kernel's requirements are stricter and we really do not\n 313:\t * want any instrumentation with __no_kcsan.\n 314:\t *\n 315:\t * Therefore we add __disable_sanitizer_instrumentation where available to\n 316:\t * disable all instrumentation. See Kconfig.kcsan where this is mandatory.\n 317:\t */\n 318:\t# define __no_kcsan __no_sanitize_thread __disable_sanitizer_instrumentation\n 319:\t# define __no_sanitize_or_inline __no_kcsan notrace __maybe_unused\n 320:\t#else\n 321:\t# define __no_kcsan\n 322:\t#endif\n 323:\t\n 324:\t#ifdef __SANITIZE_MEMORY__\n 325:\t/*\n 326:\t * Similarly to KASAN and KCSAN, KMSAN loses function attributes of inlined\n 327:\t * functions, therefore disabling KMSAN checks also requires disabling inlining.\n 328:\t *\n 329:\t * __no_sanitize_or_inline effectively prevents KMSAN from reporting errors\n 330:\t * within the function and marks all its outputs as initialized.\n 331:\t */\n 332:\t# define __no_sanitize_or_inline __no_kmsan_checks notrace __maybe_unused\n 333:\t#endif\n 334:\t\n 335:\t#ifndef __no_sanitize_or_inline\n 336:\t#define __no_sanitize_or_inline __always_inline\n 337:\t#endif\n 338:\t\n 339:\t/*\n 340:\t * The assume attribute is used to indicate that a certain condition is\n 341:\t * assumed to be true. If this condition is violated at runtime, the behavior\n 342:\t * is undefined. Compilers may or may not use this indication to generate\n 343:\t * optimized code.\n 344:\t *\n 345:\t * Note that the clang documentation states that optimizers may react\n 346:\t * differently to this attribute, and this may even have a negative\n 347:\t * performance impact. Therefore this attribute should be used with care.\n 348:\t *\n 349:\t * Optional: only supported since gcc \u003e= 13\n 350:\t * Optional: only supported since clang \u003e= 19\n 351:\t *\n 352:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#index-assume-statement-attribute\n 353:\t * clang: https://clang.llvm.org/docs/AttributeReference.html#id13\n 354:\t *\n 355:\t */\n 356:\t#ifdef CONFIG_CC_HAS_ASSUME\n 357:\t# define __assume(expr)\t\t\t__attribute__((__assume__(expr)))\n 358:\t#else\n 359:\t# define __assume(expr)\n 360:\t#endif\n 361:\t\n 362:\t/*\n 363:\t * Optional: only supported since gcc \u003e= 15\n 364:\t * Optional: only supported since clang \u003e= 18\n 365:\t *\n 366:\t * gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896\n 367:\t * clang: https://clang.llvm.org/docs/AttributeReference.html#counted-by-counted-by-or-null-sized-by-sized-by-or-null\n 368:\t *\n 369:\t * __bdos on clang \u003c 19.1.2 can erroneously return 0:\n 370:\t * https://github.com/llvm/llvm-project/pull/110497\n 371:\t *\n 372:\t * __bdos on clang \u003c 19.1.3 can be off by 4:\n 373:\t * https://github.com/llvm/llvm-project/pull/112636\n 374:\t */\n 375:\t#ifdef CONFIG_CC_HAS_COUNTED_BY\n 376:\t# define __counted_by(member)\t\t__attribute__((__counted_by__(member)))\n 377:\t#else\n 378:\t# define __counted_by(member)\n 379:\t#endif\n"
} |
| 35/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 44499 output: 37 thoughts: 17 Thoughts: Here's a summary of my immediate thought process, delivered as if it were my internal monologue, keeping in mind my field of expertise: **Diving into compiler_types.h** Wait a second... hold on. My brain immediately snaps to the end of `include/linux/compiler_types.h`. That's where things usually get interesting, especially in the context of kernel-level type definitions and optimizations. I need to refresh my memory on any recent changes or additions there. I'm expecting to see architecture-specific definitions, potentially some crucial macros for compiler intrinsics, or maybe even subtle tricks to handle byte order or alignment. My mental checklist kicks in: Are they using any new `__attribute__` directives I haven't seen before? Did they introduce any new data type definitions relevant to memory barriers or atomic operations? Time to dig in and see what's changed. |
| 36/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler_types.h",
"FirstLine": 380,
"LineCount": 40
}Results: {
"Contents": " 380:\t\n 381:\t/*\n 382:\t * Runtime track number of objects pointed to by a pointer member for use by\n 383:\t * CONFIG_FORTIFY_SOURCE and CONFIG_UBSAN_BOUNDS.\n 384:\t *\n 385:\t * Optional: only supported since gcc \u003e= 16\n 386:\t * Optional: only supported since clang \u003e= 22\n 387:\t *\n 388:\t * gcc: https://gcc.gnu.org/pipermail/gcc-patches/2025-April/681727.html\n 389:\t * clang: https://clang.llvm.org/docs/AttributeReference.html#counted-by-counted-by-or-null-sized-by-sized-by-or-null\n 390:\t */\n 391:\t#ifdef CONFIG_CC_HAS_COUNTED_BY_PTR\n 392:\t#define __counted_by_ptr(member)\t__attribute__((__counted_by__(member)))\n 393:\t#else\n 394:\t#define __counted_by_ptr(member)\n 395:\t#endif\n 396:\t\n 397:\t/*\n 398:\t * Optional: only supported since gcc \u003e= 15\n 399:\t * Optional: not supported by Clang\n 400:\t *\n 401:\t * gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178\n 402:\t */\n 403:\t#ifdef CONFIG_CC_HAS_MULTIDIMENSIONAL_NONSTRING\n 404:\t# define __nonstring_array\t\t__attribute__((__nonstring__))\n 405:\t#else\n 406:\t# define __nonstring_array\n 407:\t#endif\n 408:\t\n 409:\t/*\n 410:\t * Apply __counted_by() when the Endianness matches to increase test coverage.\n 411:\t */\n 412:\t#ifdef __LITTLE_ENDIAN\n 413:\t#define __counted_by_le(member)\t__counted_by(member)\n 414:\t#define __counted_by_be(member)\n 415:\t#else\n 416:\t#define __counted_by_le(member)\n 417:\t#define __counted_by_be(member)\t__counted_by(member)\n 418:\t#endif\n 419:\t\n"
} |
| 37/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 45401 output: 37 thoughts: 14 Thoughts: Okay, I'm ready to dive into this. Let's get down to brass tacks. **Analyzing Lines 420-450: A Critical Examination** Alright, so I'm honing in on lines 420-450. As an expert in my field, I need to understand this section's context and implications. Immediately, I'm looking for the core arguments presented within this specific segment. What key concepts are introduced or elaborated upon here? I'm dissecting the structure of the argument; are there logical fallacies, or are the points well-supported? My primary concern is this: Does this section align with the overall narrative, or does it deviate or introduce a discordant element that might need addressing or further explanation? I also need to see if the analysis addresses any known issues or debates within the field – is it adding new insights or rehashing existing knowledge? Are the sources cited credible, and are the conclusions defensible given the evidence provided? Is the writing clear, concise, and effectively communicating the intended message, or is it dense, obscure, or potentially misleading? What assumptions are being made here, and do I agree with them? Overall, it's a careful review and evaluation of the material. |
| 38/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler_types.h",
"FirstLine": 420,
"LineCount": 40
}Results: {
"Contents": " 420:\t/*\n 421:\t * This designates the minimum number of elements a passed array parameter must\n 422:\t * have. For example:\n 423:\t *\n 424:\t * void some_function(u8 param[at_least 7]);\n 425:\t *\n 426:\t * If a caller passes an array with fewer than 7 elements, the compiler will\n 427:\t * emit a warning.\n 428:\t */\n 429:\t#ifndef __CHECKER__\n 430:\t#define at_least static\n 431:\t#else\n 432:\t#define at_least\n 433:\t#endif\n 434:\t\n 435:\t/* Section for code which can't be instrumented at all */\n 436:\t#define __noinstr_section(section)\t\t\t\t\t\\\n 437:\t\tnoinline notrace __attribute((__section__(section)))\t\t\\\n 438:\t\t__no_kcsan __no_sanitize_address __no_profile __no_sanitize_coverage \\\n 439:\t\t__no_sanitize_memory\n 440:\t\n 441:\t#define noinstr __noinstr_section(\".noinstr.text\")\n 442:\t\n 443:\t/*\n 444:\t * The __cpuidle section is used twofold:\n 445:\t *\n 446:\t * 1) the original use -- identifying if a CPU is 'stuck' in idle state based\n 447:\t * on it's instruction pointer. See cpu_in_idle().\n 448:\t *\n 449:\t * 2) supressing instrumentation around where cpuidle disables RCU; where the\n 450:\t * function isn't strictly required for #1, this is interchangeable with\n 451:\t * noinstr.\n 452:\t */\n 453:\t#define __cpuidle __noinstr_section(\".cpuidle.text\")\n 454:\t\n 455:\t#endif /* __KERNEL__ */\n 456:\t\n 457:\t#endif /* __ASSEMBLY__ */\n 458:\t\n 459:\t/*\n"
} |
| 39/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46300 output: 37 thoughts: 6 Thoughts: Okay, I'm ready. Here's a summary, in the first person, assuming I'm an expert in the field, starting with the provided text information at line 460+: **Analyzing the Implications of the Data - Lines 460+** Alright, let's dig into this section. From what I'm seeing starting at line 460, the core of the analysis is... [I'd fill in the specifics here, referencing the content of the lines provided, such as:] ...we're focusing on the correlation between X and Y, using Z as a potential confounding variable. Immediately, I'm considering the strengths and weaknesses of the model being employed here. Is the sample size adequate for the complexity of the relationships we're trying to tease out? I'm assessing the assumptions inherent in the statistical tests; are they being met, or are we risking spurious correlations? Are we truly controlling for all the relevant factors, or is there a lurking variable that could be skewing our results? I'm also paying close attention to the sensitivity of the analysis. A minor change to the model or a different treatment of the outliers -- could these introduce subtle but significant shifts in the interpretation? I'm comparing the findings to similar studies that I'm familiar with -- do they confirm, contradict, or extend our understanding of the phenomenon? I'm thinking about the robustness of the methodology. If the results are significant, I'm mentally running through potential alternative explanations. Are there any weaknesses in the data acquisition procedures? Is there any potential for bias in the selection of the dataset? Are the error bars sufficiently tight to support the claims being made? I'm already anticipating the peer review and the questions that will be raised. I'm looking for where I can strengthen the argument and identify any weaknesses in the data or the analysis. Ultimately, my goal here is to arrive at a truly accurate and nuanced understanding of these relationships. This isn't just about finding a "p < 0.05" result. It's about building a compelling narrative that stands up to scrutiny, and, ultimately, it's about the bigger picture -- how this fits into the grand scheme of things in the field. |
| 40/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler_types.h",
"FirstLine": 460,
"LineCount": 40
}Results: {
"Contents": " 460:\t * The below symbols may be defined for one or more, but not ALL, of the above\n 461:\t * compilers. We don't consider that to be an error, so set them to nothing.\n 462:\t * For example, some of them are for compiler specific plugins.\n 463:\t */\n 464:\t#ifndef __latent_entropy\n 465:\t# define __latent_entropy\n 466:\t#endif\n 467:\t\n 468:\t#if defined(RANDSTRUCT) \u0026\u0026 !defined(__CHECKER__)\n 469:\t# define __randomize_layout __designated_init __attribute__((randomize_layout))\n 470:\t# define __no_randomize_layout __attribute__((no_randomize_layout))\n 471:\t/* This anon struct can add padding, so only enable it under randstruct. */\n 472:\t# define randomized_struct_fields_start\tstruct {\n 473:\t# define randomized_struct_fields_end\t} __randomize_layout;\n 474:\t#else\n 475:\t# define __randomize_layout __designated_init\n 476:\t# define __no_randomize_layout\n 477:\t# define randomized_struct_fields_start\n 478:\t# define randomized_struct_fields_end\n 479:\t#endif\n 480:\t\n 481:\t#ifndef __no_kstack_erase\n 482:\t# define __no_kstack_erase\n 483:\t#endif\n 484:\t\n 485:\t#ifndef __noscs\n 486:\t# define __noscs\n 487:\t#endif\n 488:\t\n 489:\t#if defined(CONFIG_CFI)\n 490:\t# define __nocfi\t\t__attribute__((__no_sanitize__(\"kcfi\")))\n 491:\t#else\n 492:\t# define __nocfi\n 493:\t#endif\n 494:\t\n 495:\t#if defined(CONFIG_ARCH_USES_CFI_GENERIC_LLVM_PASS)\n 496:\t# define __nocfi_generic\t__nocfi\n 497:\t#else\n 498:\t# define __nocfi_generic\n 499:\t#endif\n"
} |
| 41/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 47424 output: 17 thoughts: 41 Thoughts: **Finding the Asserted Static Storage Definition** Okay, hold on a second. I need to figure out where this `ASSERT_STATIC_STORAGE` macro is actually defined. It's giving me a moment's pause. Let's not panic. First, my instincts tell me to check in the standard include directory, `include/linux/build_bug.h`. That's a logical starting point for compile-time assertion-related stuff. But, you know me, I like to be thorough. I'll probably broaden my search. Let's do a quick repository-wide search for any instance of the name `STATIC_STORAGE`. That should turn up the source, one way or another. Alright, let's get to it. |
| 42/2 | 2026/09/15 04:08 | tool | grepper |
0mArgs:{
"Expression": "STATIC_STORAGE"
}Results: {
"Output": "include/linux/completion.h=34=static inline void complete_release(struct completion *x) {}\n--\ninclude/linux/completion.h-54-\tstruct completion work = COMPLETION_INITIALIZER(work);\t\\\ninclude/linux/completion.h:55:\tASSERT_STATIC_STORAGE(work)\ninclude/linux/completion.h-56-\n--\ninclude/linux/idr.h=20=struct idr {\n--\ninclude/linux/idr.h-58-\tstruct idr name = IDR_INIT(name);\t\\\ninclude/linux/idr.h:59:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/idr.h-60-\n--\ninclude/linux/klist.h=19=struct klist {\n--\ninclude/linux/klist.h-33-\tstruct klist _name = KLIST_INIT(_name, _get, _put);\t\t\\\ninclude/linux/klist.h:34:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/klist.h-35-\n--\ninclude/linux/kthread.h=162=struct kthread_delayed_work {\n--\ninclude/linux/kthread.h-183-\t\tKTHREAD_DELAYED_WORK_INIT(dwork, fn);\t\t\t\\\ninclude/linux/kthread.h:184:\tASSERT_STATIC_STORAGE(dwork)\ninclude/linux/kthread.h-185-\n--\ninclude/linux/mutex.h=62=do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/mutex.h-88-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:89:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-90-\n--\ninclude/linux/mutex.h=115=extern bool mutex_is_locked(struct mutex *lock);\n--\ninclude/linux/mutex.h-129-\tstruct mutex mutexname = __MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/mutex.h:130:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/mutex.h-131-\n--\ninclude/linux/notifier.h=95=extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);\n--\ninclude/linux/notifier.h-118-\t\tATOMIC_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:119:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-120-#define BLOCKING_NOTIFIER_HEAD(name)\t\t\t\t\\\n--\ninclude/linux/notifier.h-122-\t\tBLOCKING_NOTIFIER_INIT(name);\t\t\t\\\ninclude/linux/notifier.h:123:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-124-#define RAW_NOTIFIER_HEAD(name)\t\t\t\t\t\\\n--\ninclude/linux/notifier.h-132-\t\t\tSRCU_NOTIFIER_INIT(name, name##_head_srcu_data);\t\\\ninclude/linux/notifier.h:133:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-134-\n--\ninclude/linux/notifier.h-138-\t\t\tSRCU_NOTIFIER_INIT(name, name);\t\t\\\ninclude/linux/notifier.h:139:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/notifier.h-140-\n--\ninclude/linux/percpu-rwsem.h=33=is_static struct percpu_rw_semaphore name = {\t\t\t\t\\\n--\ninclude/linux/percpu-rwsem.h-40-};\t\t\t\t\t\t\t\t\t\\\ninclude/linux/percpu-rwsem.h:41:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/percpu-rwsem.h-42-\n--\ninclude/linux/radix-tree.h=56=static inline bool radix_tree_is_internal_node(void *ptr)\n--\ninclude/linux/radix-tree.h-83-\tstruct radix_tree_root name = RADIX_TREE_INIT(name, mask);\t\\\ninclude/linux/radix-tree.h:84:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/radix-tree.h-85-\n--\ninclude/linux/ratelimit_types.h=17=struct ratelimit_state {\n--\ninclude/linux/ratelimit_types.h-44-\t\tRATELIMIT_STATE_INIT(name, interval_init, burst_init);\t\\\ninclude/linux/ratelimit_types.h:45:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/ratelimit_types.h-46-\n--\ninclude/linux/rcu_sync.h=43=extern void rcu_sync_dtor(struct rcu_sync *);\n--\ninclude/linux/rcu_sync.h-52-\tstruct rcu_sync name = __RCU_SYNC_INITIALIZER(name);\t\\\ninclude/linux/rcu_sync.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rcu_sync.h-54-\n--\ninclude/linux/rtmutex.h=86=do { \\\n--\ninclude/linux/rtmutex.h-108-\tstruct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname);\t\\\ninclude/linux/rtmutex.h:109:\tASSERT_STATIC_STORAGE(mutexname)\ninclude/linux/rtmutex.h-110-\n--\ninclude/linux/rwsem.h=85=static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)\n--\ninclude/linux/rwsem.h-115-\tstruct rw_semaphore name = __RWSEM_INITIALIZER(name);\t\\\ninclude/linux/rwsem.h:116:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/rwsem.h-117-\n--\ninclude/linux/rwsem.h=155=context_lock_struct(rw_semaphore) {\n--\ninclude/linux/rwsem.h-169-\tstruct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname);\t\\\ninclude/linux/rwsem.h:170:\tASSERT_STATIC_STORAGE(lockname)\ninclude/linux/rwsem.h-171-\n--\ninclude/linux/semaphore.h=16=struct semaphore {\n--\ninclude/linux/semaphore.h-48-\tstruct semaphore _name = __SEMAPHORE_INITIALIZER(_name, _n);\t\\\ninclude/linux/semaphore.h:49:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/semaphore.h-50-\n--\ninclude/linux/seqlock.h=801=static __always_inline void write_seqcount_latch_end(seqcount_latch_t *s)\n--\ninclude/linux/seqlock.h-827-\t\tseqlock_t sl = __SEQLOCK_UNLOCKED(sl);\t\\\ninclude/linux/seqlock.h:828:\tASSERT_STATIC_STORAGE(sl)\ninclude/linux/seqlock.h-829-\n--\ninclude/linux/srcutiny.h=36=void srcu_tiny_irq_work(struct irq_work *irq_work);\n--\ninclude/linux/srcutiny.h-52-\tstruct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name, name);\t\\\ninclude/linux/srcutiny.h:53:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutiny.h-54-#define DEFINE_STATIC_SRCU(name) \\\n--\ninclude/linux/srcutree.h=106=struct srcu_struct {\n--\ninclude/linux/srcutree.h-221-\t\t__section(\"___srcu_struct_ptrs\") = \u0026name;\t\t\t\t\t\\\ninclude/linux/srcutree.h:222:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-223-#else\n--\ninclude/linux/srcutree.h-228-\t\t__SRCU_STRUCT_INIT(name, name##_srcu_usage, name##_srcu_data, fast);\t\t\\\ninclude/linux/srcutree.h:229:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/srcutree.h-230-#endif\n--\ninclude/linux/swait.h=49=struct swait_queue {\n--\ninclude/linux/swait.h-68-\tstruct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/swait.h:69:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/swait.h-70-\n--\ninclude/linux/sysctl.h=210=static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)\n--\ninclude/linux/sysctl.h-220-\tstruct ctl_table_poll name = __CTL_TABLE_POLL_INITIALIZER(name);\t\\\ninclude/linux/sysctl.h:221:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/sysctl.h-222-\n--\ninclude/linux/timer.h-66-\t\t__TIMER_INITIALIZER(_function, 0);\t\t\\\ninclude/linux/timer.h:67:\tASSERT_STATIC_STORAGE(_name)\ninclude/linux/timer.h-68-\n--\ninclude/linux/wait.h=42=struct task_struct;\n--\ninclude/linux/wait.h-61-\tstruct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name);\t\\\ninclude/linux/wait.h:62:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/wait.h-63-\n--\ninclude/linux/workqueue.h=224=struct execute_work {\n--\ninclude/linux/workqueue.h-254-\tstruct work_struct n = __WORK_INITIALIZER(n, f);\t\t\\\ninclude/linux/workqueue.h:255:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-256-\n--\ninclude/linux/workqueue.h-258-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0);\t\\\ninclude/linux/workqueue.h:259:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-260-\n--\ninclude/linux/workqueue.h-262-\tstruct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE);\t\\\ninclude/linux/workqueue.h:263:\tASSERT_STATIC_STORAGE(n)\ninclude/linux/workqueue.h-264-\n--\ninclude/linux/xarray.h=300=struct xarray {\n--\ninclude/linux/xarray.h-324-\tstruct xarray name = XARRAY_INIT(name, flags);\t\t\t\\\ninclude/linux/xarray.h:325:\tASSERT_STATIC_STORAGE(name)\ninclude/linux/xarray.h-326-\n--\ntools/testing/memblock/linux/mutex.h-8-\tint name;\t\t\t\t\\\ntools/testing/memblock/linux/mutex.h:9:\tASSERT_STATIC_STORAGE(name)\ntools/testing/memblock/linux/mutex.h-10-\n--\ntools/testing/vma/include/dup.h=425=struct vma_iterator {\n--\ntools/testing/vma/include/dup.h-440-\tstruct mutex mutexname = {};\t\t\\\ntools/testing/vma/include/dup.h:441:\tASSERT_STATIC_STORAGE(mutexname)\ntools/testing/vma/include/dup.h-442-\n--\ntools/virtio/linux/compiler.h-22-/* Enforce static storage duration. */\ntools/virtio/linux/compiler.h:23:#define ASSERT_STATIC_STORAGE(name) \\\ntools/virtio/linux/compiler.h-24-\tstatic typeof(name) * const __always_unused \\\n--\ntools/virtio/linux/ratelimit.h-4-\tint name = 0;\t\t\t\t\t\t\\\ntools/virtio/linux/ratelimit.h:5:\tASSERT_STATIC_STORAGE(name)\ntools/virtio/linux/ratelimit.h-6-\n"
} |
| 43/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 50781 output: 35 thoughts: 782 Thoughts: **Investigating the Compiler Inclusion Mystery** Okay, first things first, I need to understand this patch. Why are they adding `#include <linux/compiler.h>` to all these seemingly unrelated headers: `completion.h`, `klist.h`, `kthread.h`, `mutex.h`, and the rest? And, wait, did the diff *itself* even change `compiler.h`? No, it looks like it's `tools/virtio/linux/compiler.h` that's being touched, which is already a red flag. Right, let's back up and make sure I haven't missed something obvious. Has `ASSERT_STATIC_STORAGE` been defined anywhere else in the kernel? I ran `grepper` and it turns out, it's defined in all those headers, *plus* some in the `tools/` directory – especially `tools/virtio/linux/compiler.h` which is what was modified in the diff! But here's the kicker: I see `ASSERT_STATIC_STORAGE` defined in `tools/virtio/linux/compiler.h`, which seems to *contradict* the initial inclusion of `<linux/compiler.h>` in these other headers. Why are we including the main compiler header if the macro is defined in a more specific, tools-related one? That just doesn't make sense. This raises another question: Where is `ASSERT_STATIC_STORAGE` *actually* defined for a typical kernel build, if it's not always in the header that's included? Is there an inclusion of another compiler-related header, like `include/linux/compiler_attributes.h`, `include/linux/compiler-gcc.h`, or `include/linux/compiler-clang.h`, that might be overriding or providing the definition? I should check those next, because `grepper` should've found it if it was. Let's start with `include/linux/compiler_attributes.h`. |
| 44/2 | 2026/09/15 04:08 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler_attributes.h",
"FirstLine": 1,
"LineCount": 80
}Results: {
"Contents": " 1:\t/* SPDX-License-Identifier: GPL-2.0 */\n 2:\t#ifndef __LINUX_COMPILER_ATTRIBUTES_H\n 3:\t#define __LINUX_COMPILER_ATTRIBUTES_H\n 4:\t\n 5:\t/*\n 6:\t * The attributes in this file are unconditionally defined and they directly\n 7:\t * map to compiler attribute(s), unless one of the compilers does not support\n 8:\t * the attribute. In that case, __has_attribute is used to check for support\n 9:\t * and the reason is stated in its comment (\"Optional: ...\").\n 10:\t *\n 11:\t * Any other \"attributes\" (i.e. those that depend on a configuration option,\n 12:\t * on a compiler, on an architecture, on plugins, on other attributes...)\n 13:\t * should be defined elsewhere (e.g. compiler_types.h or compiler-*.h).\n 14:\t * The intention is to keep this file as simple as possible, as well as\n 15:\t * compiler- and version-agnostic (e.g. avoiding GCC_VERSION checks).\n 16:\t *\n 17:\t * This file is meant to be sorted (by actual attribute name,\n 18:\t * not by #define identifier). Use the __attribute__((__name__)) syntax\n 19:\t * (i.e. with underscores) to avoid future collisions with other macros.\n 20:\t * Provide links to the documentation of each supported compiler, if it exists.\n 21:\t */\n 22:\t\n 23:\t/*\n 24:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alias-function-attribute\n 25:\t */\n 26:\t#define __alias(symbol) __attribute__((__alias__(#symbol)))\n 27:\t\n 28:\t/*\n 29:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-aligned-function-attribute\n 30:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-aligned-type-attribute\n 31:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-aligned-variable-attribute\n 32:\t */\n 33:\t#define __aligned(x) __attribute__((__aligned__(x)))\n 34:\t#define __aligned_largest __attribute__((__aligned__))\n 35:\t\n 36:\t/*\n 37:\t * Note: do not use this directly. Instead, use __alloc_size() since it is conditionally\n 38:\t * available and includes other attributes. For GCC \u003c 9.1, __alloc_size__ gets undefined\n 39:\t * in compiler-gcc.h, due to misbehaviors.\n 40:\t *\n 41:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alloc_005fsize-function-attribute\n 42:\t * clang: https://clang.llvm.org/docs/AttributeReference.html#alloc-size\n 43:\t */\n 44:\t#define __alloc_size__(x, ...)\t\t__attribute__((__alloc_size__(x, ## __VA_ARGS__)))\n 45:\t\n 46:\t/*\n 47:\t * Note: users of __always_inline currently do not write \"inline\" themselves,\n 48:\t * which seems to be required by gcc to apply the attribute according\n 49:\t * to its docs (and also \"warning: always_inline function might not be\n 50:\t * inlinable [-Wattributes]\" is emitted).\n 51:\t *\n 52:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-always_005finline-function-attribute\n 53:\t * clang: mentioned\n 54:\t */\n 55:\t#define __always_inline inline __attribute__((__always_inline__))\n 56:\t\n 57:\t/*\n 58:\t * The second argument is optional (default 0), so we use a variadic macro\n 59:\t * to make the shorthand.\n 60:\t *\n 61:\t * Beware: Do not apply this to functions which may return\n 62:\t * ERR_PTRs. Also, it is probably unwise to apply it to functions\n 63:\t * returning extra information in the low bits (but in that case the\n 64:\t * compiler should see some alignment anyway, when the return value is\n 65:\t * massaged by 'flags = ptr \u0026 3; ptr \u0026= ~3;').\n 66:\t *\n 67:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-assume_005faligned-function-attribute\n 68:\t * clang: https://clang.llvm.org/docs/AttributeReference.html#assume-aligned\n 69:\t */\n 70:\t#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))\n 71:\t\n 72:\t/*\n 73:\t * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-cleanup-variable-attribute\n 74:\t * clang: https://clang.llvm.org/docs/AttributeReference.html#cleanup\n 75:\t */\n 76:\t#define __cleanup(func)\t\t\t__attribute__((__cleanup__(func)))\n 77:\t\n 78:\t/*\n 79:\t * Note the long name.\n 80:\t *\n"
} |
| 45/2 | 2026/09/15 04:08 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 53492 output: 35 thoughts: 100 Thoughts: **Kernel Header Search** Okay, hold on a second. I need to pinpoint where `ASSERT_STATIC_STORAGE` is defined within the kernel headers. My first instinct, given its nature, is to think it's likely a compiler-related macro, right? Didn't we already go through `include/linux/compiler.h`? I thought we *had* checked that file already, but perhaps I missed it. Let's make sure we haven't overlooked it. Alright, back to `include/linux/compiler.h` and let's go a bit more granular this time, I'm going to start at line 180 and check it through line 270 just to be sure. I'll search that section very carefully. |
| 46/2 | 2026/09/15 04:09 | tool | read-file |
0mArgs:{
"File": "include/linux/compiler.h",
"FirstLine": 180,
"LineCount": 80
}Results: {
"Contents": " 180:\t * are protected by READ_ONCE() or WRITE_ONCE().\n 181:\t *\n 182:\t * This macro *does not* affect normal code generation, but is a hint\n 183:\t * to tooling that data races here are to be ignored. If the access must\n 184:\t * be atomic *and* KCSAN should ignore the access, use both data_race()\n 185:\t * and READ_ONCE(), for example, data_race(READ_ONCE(x)).\n 186:\t */\n 187:\t#define data_race(expr)\t\t\t\t\t\t\t\\\n 188:\t({\t\t\t\t\t\t\t\t\t\\\n 189:\t\t__kcsan_disable_current();\t\t\t\t\t\\\n 190:\t\tdisable_context_analysis();\t\t\t\t\t\\\n 191:\t\tauto __v = (expr);\t\t\t\t\t\t\\\n 192:\t\tenable_context_analysis();\t\t\t\t\t\\\n 193:\t\t__kcsan_enable_current();\t\t\t\t\t\\\n 194:\t\t__v;\t\t\t\t\t\t\t\t\\\n 195:\t})\n 196:\t\n 197:\t#ifdef __CHECKER__\n 198:\t#define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) (0)\n 199:\t#else /* __CHECKER__ */\n 200:\t#define __BUILD_BUG_ON_ZERO_MSG(e, msg, ...) ((int)sizeof(struct {_Static_assert(!(e), msg);}))\n 201:\t#endif /* __CHECKER__ */\n 202:\t\n 203:\t/* \u0026a[0] degrades to a pointer: a different type from an array */\n 204:\t#define __is_array(a)\t\t(!__same_type((a), \u0026(a)[0]))\n 205:\t#define __must_be_array(a)\t__BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \\\n 206:\t\t\t\t\t\t\t\t\"must be array\")\n 207:\t\n 208:\t#define __is_byte_array(a)\t(__is_array(a) \u0026\u0026 sizeof((a)[0]) == 1)\n 209:\t#define __must_be_byte_array(a)\t__BUILD_BUG_ON_ZERO_MSG(!__is_byte_array(a), \\\n 210:\t\t\t\t\t\t\t\t\"must be byte array\")\n 211:\t\n 212:\t/*\n 213:\t * If the \"nonstring\" attribute isn't available, we have to return true\n 214:\t * so the __must_*() checks pass when \"nonstring\" isn't supported.\n 215:\t */\n 216:\t#if __has_attribute(__nonstring__) \u0026\u0026 defined(__annotated)\n 217:\t#define __is_cstr(a)\t\t(!__annotated(a, nonstring))\n 218:\t#define __is_noncstr(a)\t\t(__annotated(a, nonstring))\n 219:\t#else\n 220:\t#define __is_cstr(a)\t\t(true)\n 221:\t#define __is_noncstr(a)\t\t(true)\n 222:\t#endif\n 223:\t\n 224:\t/* Require C Strings (i.e. NUL-terminated) lack the \"nonstring\" attribute. */\n 225:\t#define __must_be_cstr(p) \\\n 226:\t\t__BUILD_BUG_ON_ZERO_MSG(!__is_cstr(p), \\\n 227:\t\t\t\t\t\"must be C-string (NUL-terminated)\")\n 228:\t#define __must_be_noncstr(p) \\\n 229:\t\t__BUILD_BUG_ON_ZERO_MSG(!__is_noncstr(p), \\\n 230:\t\t\t\t\t\"must be non-C-string (not NUL-terminated)\")\n 231:\t\n 232:\t/*\n 233:\t * Define TYPEOF_UNQUAL() to use __typeof_unqual__() as typeof\n 234:\t * operator when available, to return an unqualified type of the exp.\n 235:\t */\n 236:\t#if defined(USE_TYPEOF_UNQUAL)\n 237:\t# define TYPEOF_UNQUAL(exp) __typeof_unqual__(exp)\n 238:\t#else\n 239:\t# define TYPEOF_UNQUAL(exp) __typeof__(exp)\n 240:\t#endif\n 241:\t\n 242:\t#endif /* __KERNEL__ */\n 243:\t\n 244:\t#if defined(CONFIG_CFI) \u0026\u0026 !defined(__DISABLE_EXPORTS) \u0026\u0026 !defined(BUILD_VDSO)\n 245:\t/*\n 246:\t * Force a reference to the external symbol so the compiler generates\n 247:\t * __kcfi_typid.\n 248:\t */\n 249:\t#define KCFI_REFERENCE(sym) __ADDRESSABLE(sym)\n 250:\t#else\n 251:\t#define KCFI_REFERENCE(sym)\n 252:\t#endif\n 253:\t\n 254:\t/**\n 255:\t * offset_to_ptr - convert a relative memory offset to an absolute pointer\n 256:\t * @off:\tthe address of the 32-bit offset value\n 257:\t */\n 258:\tstatic inline void *offset_to_ptr(const int *off)\n 259:\t{\n"
} |
| 47/2 | 2026/09/15 04:09 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 55202 output: 35 thoughts: 2301 Thoughts: **The Mystery of the Missing `ASSERT_STATIC_STORAGE`** Okay, so I was looking for the definition of `ASSERT_STATIC_STORAGE`. My initial assumption was it'd be in `include/linux/compiler.h`, but it wasn't there! That was the first red flag. Where *is* it? I needed to track this down, so I started looking through the `include/linux/` directory again, and used `grepper` to search for the definition. The `grepper` output gave me a list of hits across various header files. Nothing screamed "obvious location" but I saw tools/virtio/linux/compiler.h. Okay, that's not where I expected it. I re-ran the `grepper` just in case, double-checking my search, but confirmed that *only* the virtio tools directory contained the definition! I started to wonder, why *only* there? Was there some deliberate reason? Did someone make a mistake and forget to move it? Or is it deliberately in tools? I went back and checked `include/linux/compiler.h`'s history, and the files it included to see if I could find something. Nothing. Then, I looked at a few diffs where `DECLARE_COMPLETION(work)` was used, where it expands to `struct completion work = COMPLETION_INITIALIZER(work); ASSERT_STATIC_STORAGE(work)`. Suddenly the use became clear. I needed to understand what `ASSERT_STATIC_STORAGE` was actually doing. I reviewed the code in `tools/virtio/linux/compiler.h`, that defines `ASSERT_STATIC_STORAGE`: ```c /* Enforce static storage duration. */ #define ASSERT_STATIC_STORAGE(name) \ static typeof(name) * const __always_unused \ name##_storage_check = &(name) ``` The lightbulb started to come on! This `ASSERT_STATIC_STORAGE` is a compile-time check! The `static` variable `name##_storage_check` must be initialized with an address constant. If the variable `name` is declared on the stack, it's *not* an address constant! So this construct will trigger a compile error if a variable such as a mutex, completion, idr, or semaphore (all of which are potentially part of file-scoped or static variables) is defined *inside* a function, like on the stack. I started looking at the patch that introduced the check. It was clear that the intention was to ensure that certain kernel data structures are *not* defined on the stack, preventing potential issues with lifetime and scope. I saw the list of files that were modified: many test cases had variables originally defined on the stack and the patches moved them to file-scope variables. The patch was ensuring that things like mutexes, radx-trees, and completion structures are not used on the stack, and, therefore, do *not* have an indeterminate scope. This is the key. It's a compile-time guard to prevent a common class of bugs. So, the mystery is solved (I think). `ASSERT_STATIC_STORAGE` *is* in the kernel, but it's deliberately defined in the tools directory, and then the patch includes `<linux/compiler.h>`, which pulls it in for these builds. The check, and corresponding compile errors, are only needed for a handful of structures, so, the check is included in those source files. |
| 48/2 | 2026/09/15 04:09 | tool | read-file |
0mArgs:{
"File": "include/linux/build_bug.h",
"FirstLine": 1,
"LineCount": 80
}Results: {
"Contents": " 1:\t/* SPDX-License-Identifier: GPL-2.0 */\n 2:\t#ifndef _LINUX_BUILD_BUG_H\n 3:\t#define _LINUX_BUILD_BUG_H\n 4:\t\n 5:\t#include \u003clinux/compiler.h\u003e\n 6:\t\n 7:\t/*\n 8:\t * Force a compilation error if condition is true, but also produce a\n 9:\t * result (of value 0 and type int), so the expression can be used\n 10:\t * e.g. in a structure initializer (or where-ever else comma expressions\n 11:\t * aren't permitted).\n 12:\t *\n 13:\t * Take an error message as an optional second argument. If omitted,\n 14:\t * default to the stringification of the tested expression.\n 15:\t */\n 16:\t#define BUILD_BUG_ON_ZERO(e, ...) \\\n 17:\t\t__BUILD_BUG_ON_ZERO_MSG(e, ##__VA_ARGS__, #e \" is true\")\n 18:\t\n 19:\t/* Force a compilation error if a constant expression is not a power of 2 */\n 20:\t#define __BUILD_BUG_ON_NOT_POWER_OF_2(n)\t\\\n 21:\t\tBUILD_BUG_ON(((n) \u0026 ((n) - 1)) != 0)\n 22:\t#define BUILD_BUG_ON_NOT_POWER_OF_2(n)\t\t\t\\\n 23:\t\tBUILD_BUG_ON((n) == 0 || (((n) \u0026 ((n) - 1)) != 0))\n 24:\t\n 25:\t/*\n 26:\t * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the\n 27:\t * expression but avoids the generation of any code, even if that expression\n 28:\t * has side-effects.\n 29:\t */\n 30:\t#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))\n 31:\t\n 32:\t/**\n 33:\t * BUILD_BUG_ON_MSG - break compile if a condition is true \u0026 emit supplied\n 34:\t *\t\t error message.\n 35:\t * @cond: the condition which the compiler should know is false.\n 36:\t * @msg: build-time error message\n 37:\t *\n 38:\t * See BUILD_BUG_ON for description.\n 39:\t */\n 40:\t#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)\n 41:\t\n 42:\t/**\n 43:\t * BUILD_BUG_ON - break compile if a condition is true.\n 44:\t * @condition: the condition which the compiler should know is false.\n 45:\t *\n 46:\t * If you have some code which relies on certain constants being equal, or\n 47:\t * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to\n 48:\t * detect if someone changes it.\n 49:\t */\n 50:\t#define BUILD_BUG_ON(condition) \\\n 51:\t\tBUILD_BUG_ON_MSG(condition, \"BUILD_BUG_ON failed: \" #condition)\n 52:\t\n 53:\t/**\n 54:\t * BUILD_BUG - break compile if used.\n 55:\t *\n 56:\t * If you have some code that you expect the compiler to eliminate at\n 57:\t * build time, you should use BUILD_BUG to detect if it is\n 58:\t * unexpectedly used.\n 59:\t */\n 60:\t#define BUILD_BUG() BUILD_BUG_ON_MSG(1, \"BUILD_BUG failed\")\n 61:\t\n 62:\t/**\n 63:\t * static_assert - check integer constant expression at build time\n 64:\t * @expr: expression to be checked\n 65:\t *\n 66:\t * static_assert() is a wrapper for the C11 _Static_assert, with a\n 67:\t * little macro magic to make the message optional (defaulting to the\n 68:\t * stringification of the tested expression).\n 69:\t *\n 70:\t * Contrary to BUILD_BUG_ON(), static_assert() can be used at global\n 71:\t * scope, but requires the expression to be an integer constant\n 72:\t * expression (i.e., it is not enough that __builtin_constant_p() is\n 73:\t * true for expr).\n 74:\t *\n 75:\t * Also note that BUILD_BUG_ON() fails the build if the condition is\n 76:\t * true, while static_assert() fails the build if the expression is\n 77:\t * false.\n 78:\t */\n 79:\t#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)\n 80:\t#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)\n"
} |
| 49/2 | 2026/09/15 04:09 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 59558 output: 36 thoughts: 22 Thoughts: Here's my take on those lines from `include/linux/build_bug.h`, as if I were processing them myself: **Digging into `build_bug.h`** Okay, let's see what's going on in this `build_bug.h` file. Specifically, I'm focusing on lines 81 through 120. Right, this is where they're dealing with compile-time assertions, preventing us from creating a mess in the runtime code. I can see they're using a few different macros and techniques to achieve this. It's a classic case of pushing the validation as early as possible. The core idea seems to be generating a compile-time error if a certain condition isn't met. This is *crucial* for catching potential issues early, preventing downstream problems that could be difficult to diagnose. I'm seeing `__must_be_constant_p()` used, which is good; ensuring the condition being checked is itself a constant expression is vital for the compiler to do its thing. Otherwise, you're just shifting the issue around. They're clearly trying to use the C language's type system to their advantage here, leveraging the compiler's type checking capabilities. I see some constructs that look like they're attempting to define a structure with a deliberately oversized or invalid member, based on the condition. The compiler will complain when instantiating such a structure. Clever! It's a roundabout way to trigger a compilation error, but it's a proven technique. This is definitely better than runtime checks whenever possible. There's some complex interplay between macros like `BUILD_BUG_ON_ZERO`, `BUILD_BUG_ON`, and `__build_bug_if`. The `__build_bug_if` is what's generating that specific error message. I appreciate the way they've constructed this; it allows for pretty flexible and readable compile-time assertions. The macros' structure suggests a clear hierarchy and a way to easily enable/disable debugging. Always good to see clean code. I also see a possible warning about the macro argument. Overall, it's a well-engineered piece of code. It's doing exactly what it needs to do: pushing validation to the compile time, and it's doing so in a reasonably maintainable way. Good stuff. |
| 50/2 | 2026/09/15 04:09 | tool | read-file |
0mArgs:{
"File": "include/linux/build_bug.h",
"FirstLine": 81,
"LineCount": 40
}Results: {
"Contents": " 81:\t\n 82:\t\n 83:\t/*\n 84:\t * Compile time check that field has an expected offset\n 85:\t */\n 86:\t#define ASSERT_STRUCT_OFFSET(type, field, expected_offset)\t\\\n 87:\t\tBUILD_BUG_ON_MSG(offsetof(type, field) != (expected_offset),\t\\\n 88:\t\t\t\"Offset of \" #field \" in \" #type \" has changed.\")\n 89:\t\n 90:\t\n 91:\t#endif\t/* _LINUX_BUILD_BUG_H */\n"
} |
| 51/2 | 2026/09/15 04:09 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 60272 output: 29 thoughts: 2867 Thoughts: **Analyzing a Suspect Kernel Patch: A Deep Dive** Okay, here's what's running through my head. This commit diff... something's off. First, I carefully review the patch itself. It looks like it's touching several core kernel headers and some driver code, specifically within the Macintosh and WireGuard subtrees. The core change seems to be introducing `ASSERT_STATIC_STORAGE` into many definitions related to synchronization primitives and data structures. Completions, mutexes, notifiers, semaphores, workqueues, you name it, they all get the `ASSERT_STATIC_STORAGE` treatment. This is aimed at enforcing static storage duration for these, which is a good practice for kernel code, preventing potential issues with stack allocation and race conditions, *IF* done correctly. But wait, here's where my alarm bells start ringing. I see all these includes added: `<linux/compiler.h>`. That's a strong indicator. I'm thinking, "Okay, this person's trying to use a macro *defined* in `<linux/compiler.h>`. That's the correct approach in most cases. Now, the diff **claims** to be adding `ASSERT_STATIC_STORAGE` to all those definitions. Okay, I accept this because I can see it. But... the *definition* of `ASSERT_STATIC_STORAGE` isn't in `<linux/compiler.h>`. The diff shows a definition *in `tools/virtio/linux/compiler.h`*! My initial thought is, "Wait, that's not right! Why is it defined in a tools directory?" The normal place for this is the kernel's include directory! I start going through the logic of this, checking if it could be defined elsewhere. Nope! It's *only* defined in a tool directory, which doesn't make any sense. I'm starting to suspect a significant blunder. It's either a mistake, or something that's only correct in *this specific* build environment. It could be that the author thought it was in the kernel includes directory. So, let's step back. If `ASSERT_STATIC_STORAGE` isn't defined in the kernel's core include directory, the kernel *shouldn't* compile at all, or might have unexpected runtime behavior, or in the worst case, work sometimes by accident. The code has been applied. Which suggests this build works, even though it's likely wrong. This is where I start questioning, "Am I missing something? Did they forget to include a *preceding* commit that *actually* defines `ASSERT_STATIC_STORAGE` in the right place? Or is it defined elsewhere?" Given the summary, this doesn't seem likely. I need to be sure. I confirm that this is a HEAD commit. Now it's not clear what this build setup looks like, but even for a custom build, including compiler headers from a tools directory is, well, not a normal practice, unless the code is built by `kbuild` itself. I'm starting to think, this patch is fundamentally flawed, as far as it can be told by reading the diff. The include paths and the lack of a proper definition for `ASSERT_STATIC_STORAGE` are extremely concerning. The author must have made a mistake in their paths, or they are working in a custom build system. |
| 52/2 | 2026/09/15 04:09 | tool | grepper |
0mArgs:{
"Expression": "ams-pmu",
"PathPrefix": "drivers/macintosh/"
}Results: {
"Output": "drivers/macintosh/ams/Makefile=6=ams-y\t\t\t\t\t:= ams-core.o ams-input.o\ndrivers/macintosh/ams/Makefile:7:ams-$(CONFIG_SENSORS_AMS_PMU)\t\t+= ams-pmu.o\ndrivers/macintosh/ams/Makefile-8-ams-$(CONFIG_SENSORS_AMS_I2C)\t\t+= ams-i2c.o\n"
} |
| 53/2 | 2026/09/15 04:09 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 63997 output: 23 thoughts: 20 Thoughts: Here's my thought process, as if I were considering this: **Investigating a PMU Driver Configuration** Okay, time to dive into this. The task at hand is definitely related to the `CONFIG_SENSORS_AMS_PMU` Kconfig option. I'll need to confirm what's enabled, or more importantly, what isn't configured in the kernel build. I know this particular symbol likely pertains to the power management unit driver for AMS sensors. Therefore, I need to check the Kconfig files related to sensors to be absolutely certain of what it does. I should quickly go verify this option's dependencies, the implications of enabling/disabling it, and whether there are any conflicts with other configurations. I'll need to understand if the current build has this enabled or disabled. This will guide my next steps. Then I can verify where and how this is used in the kernel driver code. |
| 54/2 | 2026/09/15 04:10 | tool | grepper |
0mArgs:{
"Expression": "config SENSORS_AMS_PMU"
}Results: {
"Output": "drivers/macintosh/Kconfig=255=config SENSORS_AMS\n--\ndrivers/macintosh/Kconfig-264-\ndrivers/macintosh/Kconfig:265:config SENSORS_AMS_PMU\ndrivers/macintosh/Kconfig-266-\tbool \"PMU variant\" if SENSORS_AMS_I2C\n"
} |
| 55/2 | 2026/09/15 04:10 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 64330 output: 35 thoughts: 20 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Diving into Macintosh Kernel Configuration** Okay, let's zero in on the `drivers/macintosh/Kconfig` file. I'm specifically interested in what's happening around line 255. That area usually holds some crucial details regarding the configuration of Macintosh-specific drivers within the kernel. I'm expecting to find either an important boolean, a default value assignment, or perhaps some conditional logic tied to a particular hardware variant or a build option. Line 255 is often a key area in Kconfig files, so it's a good place to begin. I'm ready to parse the context and see what variables and dependencies are in play. My experience says that it's likely a relatively fundamental option, one way or another. |
| 56/2 | 2026/09/15 04:10 | tool | read-file |
0mArgs:{
"File": "drivers/macintosh/Kconfig",
"FirstLine": 250,
"LineCount": 35
}Results: {
"Contents": " 250:\t\tdepends on PPC_PMAC\n 251:\t\thelp\n 252:\t\t This driver provides some support to control the front panel\n 253:\t\t blue LEDs \"vu-meter\" of the XServer macs.\n 254:\t\n 255:\tconfig SENSORS_AMS\n 256:\t\ttristate \"Apple Motion Sensor driver\"\n 257:\t\tdepends on PPC_PMAC \u0026\u0026 !PPC64 \u0026\u0026 INPUT \u0026\u0026 ((ADB_PMU \u0026\u0026 I2C = y) || (ADB_PMU \u0026\u0026 !I2C) || I2C)\n 258:\t\thelp\n 259:\t\t Support for the motion sensor included in PowerBooks. Includes\n 260:\t\t implementations for PMU and I2C.\n 261:\t\n 262:\t\t This driver can also be built as a module. If so, the module\n 263:\t\t will be called ams.\n 264:\t\n 265:\tconfig SENSORS_AMS_PMU\n 266:\t\tbool \"PMU variant\" if SENSORS_AMS_I2C\n 267:\t\tdepends on SENSORS_AMS \u0026\u0026 ADB_PMU\n 268:\t\tdefault y\n 269:\t\thelp\n 270:\t\t PMU variant of motion sensor, found in late 2005 PowerBooks.\n 271:\t\n 272:\tconfig SENSORS_AMS_I2C\n 273:\t\tbool \"I2C variant\"\n 274:\t\tdepends on SENSORS_AMS \u0026\u0026 I2C\n 275:\t\tdefault y\n 276:\t\thelp\n 277:\t\t I2C variant of motion sensor, found in early 2005 PowerBooks and\n 278:\t\t iBooks.\n 279:\t\n 280:\tendif # MACINTOSH_DRIVERS\n"
} |
| 57/2 | 2026/09/15 04:10 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 65053 output: 42 thoughts: 158 Thoughts: **Analyzing Kernel Configuration and Code Paths** Okay, so the configuration option `SENSORS_AMS` hinges on `PPC_PMAC` and the exclusion of `PPC64`. That immediately flags it as a 32-bit PowerPC concern. Good to know. Since my target architecture for this analysis is amd64, that means any code paths specific to 32-bit PowerPC, and not the target architecture, are of interest. This means the file `drivers/macintosh/ams/ams-pmu.c` is very likely PPC-only and worth a closer look, potentially dealing with old PowerBook hardware, given the context. Now, shifting gears, let's look at `drivers/net/wireguard/selftest/allowedips.c`. I'll want to take a look at this file, specifically around lines 257 and 499, and see what's going on there. |
| 58/2 | 2026/09/15 04:10 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireguard/selftest/allowedips.c",
"FirstLine": 250,
"LineCount": 40
}Results: {
"Contents": " 250:\t\t}\n 251:\t\n 252:\t}\n 253:\t\n 254:\tstatic __init bool randomized_test(void)\n 255:\t{\n 256:\t\tunsigned int i, j, k, mutate_amount, cidr;\n 257:\t\tu8 ip[16], mutate_mask[16], mutated[16];\n 258:\t\tstruct wg_peer **peers, *peer;\n 259:\t\tstruct horrible_allowedips h;\n 260:\t\tstruct mutex mutex;\n 261:\t\tstruct allowedips t;\n 262:\t\tbool ret = false;\n 263:\t\n 264:\t\tmutex_init(\u0026mutex);\n 265:\t\n 266:\t\twg_allowedips_init(\u0026t);\n 267:\t\thorrible_allowedips_init(\u0026h);\n 268:\t\n 269:\t\tpeers = kzalloc_objs(*peers, NUM_PEERS);\n 270:\t\tif (unlikely(!peers)) {\n 271:\t\t\tpr_err(\"allowedips random self-test malloc: FAIL\\n\");\n 272:\t\t\tgoto free;\n 273:\t\t}\n 274:\t\tfor (i = 0; i \u003c NUM_PEERS; ++i) {\n 275:\t\t\tpeers[i] = kzalloc_obj(*peers[i]);\n 276:\t\t\tif (unlikely(!peers[i])) {\n 277:\t\t\t\tpr_err(\"allowedips random self-test malloc: FAIL\\n\");\n 278:\t\t\t\tgoto free;\n 279:\t\t\t}\n 280:\t\t\tkref_init(\u0026peers[i]-\u003erefcount);\n 281:\t\t\tINIT_LIST_HEAD(\u0026peers[i]-\u003eallowedips_list);\n 282:\t\t}\n 283:\t\n 284:\t\tmutex_lock(\u0026mutex);\n 285:\t\n 286:\t\tfor (i = 0; i \u003c NUM_RAND_ROUTES; ++i) {\n 287:\t\t\tget_random_bytes(ip, 4);\n 288:\t\t\tcidr = get_random_u32_inclusive(1, 32);\n 289:\t\t\tpeer = peers[get_random_u32_below(NUM_PEERS)];\n"
} |
| 59/2 | 2026/09/15 04:10 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 66056 output: 42 thoughts: 66 Thoughts: **Analyzing the Mutex Change** Okay, so I'm looking at this patch for `randomized_test()` and immediately a red flag pops up. Before the patch, they're using `DEFINE_MUTEX(mutex);` and after it's been changed to `struct mutex mutex;`. That's not the critical issue, but interesting. What REALLY has me intrigued is on line 264 - `mutex_init(&mutex);` was *already* present. That's... odd. Why change the declaration if the initialization was already being done? Let me quickly skip down to line 499 and see what's going on there. |
| 60/2 | 2026/09/15 04:10 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireguard/selftest/allowedips.c",
"FirstLine": 490,
"LineCount": 40
}Results: {
"Contents": " 490:\t\t} while (0)\n 491:\t\n 492:\tbool __init wg_allowedips_selftest(void)\n 493:\t{\n 494:\t\tbool found_a = false, found_b = false, found_c = false, found_d = false,\n 495:\t\t found_e = false, found_other = false;\n 496:\t\tstruct wg_peer *a = init_peer(), *b = init_peer(), *c = init_peer(),\n 497:\t\t\t *d = init_peer(), *e = init_peer(), *f = init_peer(),\n 498:\t\t\t *g = init_peer(), *h = init_peer();\n 499:\t\tstruct allowedips_node *iter_node;\n 500:\t\tbool success = false;\n 501:\t\tstruct allowedips t;\n 502:\t\tstruct mutex mutex;\n 503:\t\tstruct in6_addr ip;\n 504:\t\tsize_t i = 0, count = 0;\n 505:\t\t__be64 part;\n 506:\t\n 507:\t\tmutex_init(\u0026mutex);\n 508:\t\tmutex_lock(\u0026mutex);\n 509:\t\twg_allowedips_init(\u0026t);\n 510:\t\n 511:\t\tif (!a || !b || !c || !d || !e || !f || !g || !h) {\n 512:\t\t\tpr_err(\"allowedips self-test malloc: FAIL\\n\");\n 513:\t\t\tgoto free;\n 514:\t\t}\n 515:\t\n 516:\t\tinsert(4, a, 192, 168, 4, 0, 24);\n 517:\t\tinsert(4, b, 192, 168, 4, 4, 32);\n 518:\t\tinsert(4, c, 192, 168, 0, 0, 16);\n 519:\t\tinsert(4, d, 192, 95, 5, 64, 27);\n 520:\t\t/* replaces previous entry, and maskself is required */\n 521:\t\tinsert(4, c, 192, 95, 5, 65, 27);\n 522:\t\tinsert(6, d, 0x26075300, 0x60006b00, 0, 0xc05f0543, 128);\n 523:\t\tinsert(6, c, 0x26075300, 0x60006b00, 0, 0, 64);\n 524:\t\tinsert(4, e, 0, 0, 0, 0, 0);\n 525:\t\tinsert(6, e, 0, 0, 0, 0, 0);\n 526:\t\t/* replaces previous entry */\n 527:\t\tinsert(6, f, 0, 0, 0, 0, 0);\n 528:\t\tinsert(6, g, 0x24046800, 0, 0, 0, 32);\n 529:\t\t/* maskself is required */\n"
} |
| 61/2 | 2026/09/15 04:10 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 67168 output: 21 thoughts: 121 Thoughts: **Analyzing a WiringGuard Patch** Okay, let's dive into this WiringGuard patch. My initial focus is on line 502 and 507. I see the pre-patch code uses `DEFINE_MUTEX(mutex)`, followed by an explicit `mutex_init(&mutex)`. The post-patch code refactors this to `struct mutex mutex;` followed by `mutex_init(&mutex);`. It's a subtle change, but I need to understand the reasoning. My immediate thought is, are we simplifying initialization, or is there a subtle change in the memory model implied? Then, the note about `randomized_test` and `wg_allowedips_selftest` being `__init` functions flags a potential concern. These are initialization-time self-tests, which is good. But the timing matters. I need to be *absolutely* sure of the order in which these tests run to understand any potential synchronization issues, *especially* if the mutex initialization changes have consequences. So, *when* does `wg_allowedips_selftest` run? I have to trace the callers to understand its execution path. I'm going to look at the cross-references right now, to determine precisely when `wg_allowedips_selftest` gets invoked. That's the key to figuring out if this mutex change has any unforeseen side effects in this specific context. Understanding the call stack is paramount to a full code review. |
| 62/2 | 2026/09/15 04:10 | tool | grepper |
0mArgs:{
"Expression": "wg_allowedips_selftest"
}Results: {
"Output": "drivers/net/wireguard/allowedips.h=53=struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table,\n--\ndrivers/net/wireguard/allowedips.h-56-#ifdef DEBUG\ndrivers/net/wireguard/allowedips.h:57:bool wg_allowedips_selftest(void);\ndrivers/net/wireguard/allowedips.h-58-#endif\n--\ndrivers/net/wireguard/main.c=20=static int __init wg_mod_init(void)\n--\ndrivers/net/wireguard/main.c-29-\tret = -ENOTRECOVERABLE;\ndrivers/net/wireguard/main.c:30:\tif (!wg_allowedips_selftest() || !wg_packet_counter_selftest() ||\ndrivers/net/wireguard/main.c-31-\t !wg_ratelimiter_selftest())\n--\ndrivers/net/wireguard/selftest/allowedips.c=448=static __init struct wg_peer *init_peer(void)\n--\ndrivers/net/wireguard/selftest/allowedips.c-491-\ndrivers/net/wireguard/selftest/allowedips.c:492:bool __init wg_allowedips_selftest(void)\ndrivers/net/wireguard/selftest/allowedips.c-493-{\n"
} |
| 63/2 | 2026/09/15 04:10 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 67960 output: 210 thoughts: 11847 Thoughts: **Compile-time Assertions and Unreachable Code: Not Worth Fuzzing** Alright, let's break this down. My initial thought was, "Hey, `wg_mod_init` is involved, that's interesting!". But wait, it's an `__init` selftest – only running at boot or module load. Okay, let's look at what's actually *changed*. First, this PowerPC code in `ams-pmu.c` – completely irrelevant to the target architecture (amd64). It's unreachable. Second, `allowedips.c` – again, `__init` functions. Changing a `DEFINE_MUTEX` and then calling `mutex_init` to `struct mutex` and calling `mutex_init`. Same thing, initialzed `mutex`, only running at boot or module-load. Can't be fuzzed from userspace. Then there are all these `tools/` changes. Those are user-space tools, self-tests, and scripts, so it falls into a negative criteria. Now, the main header changes... Ah, here we get to the core. `ASSERT_STATIC_STORAGE` is being added to various macros. The intent is to enforce that these are used with statically allocated storage. *Compile-time* assertions! These aren't runtime checks. They're compile-time checks to prevent someone from accidentally using a static initialization macro on the stack. The important thing is that these do NOT translate to any executable code. They are completely and utterly non-executable! Furthermore, the code that's not affected by `CONFIG_LOCKDEP` expands to the same expansions as before. The changes were to the `_ONSTACK` definitions so that, if lockdep is disabled, there's no compile time error. This is also completely non-executable. The initial thought was "Should we fuzz it?" Then I realized it's all compile-time assertions, and changes to unreachable code and module initialization functions. Essentially, *nothing* is really being changed here that impacts the run-time kernel image or is reachable by a fuzzer. This patch is aimed at catching *developer errors* during compilation, not exposing runtime bugs. **Therefore, WorthFuzzing=false** because the changes fall under the negative criteria specified: modifications to code exclusive to other architectures, user-space tools, and compile-time assertions. |
| 64/2 | 2026/09/15 04:11 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch series introduces a compile-time static storage duration check (ASSERT_STATIC_STORAGE) for DEFINE_* and DECLARE_* macros to prevent misuse on the stack. The changes in include/linux/* add purely compile-time assertions and keep equivalent expansions for on-stack macro variants, introducing no runtime executable code or runtime assertions. The changes under tools/ affect only user-space tests. The modification in drivers/macintosh/ams/ams-pmu.c is exclusive to PowerPC architecture (CONFIG_PPC_PMAC) and unreachable on amd64. Finally, the WireGuard changes in drivers/net/wireguard/selftest/allowedips.c adjust mutex declarations in __init boot-time self-tests where mutex_init() was already called immediately afterwards, causing no functional change in executable kernel logic. None of the changes warrant fuzzing.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series introduces a compile-time static storage duration check (ASSERT_STATIC_STORAGE) for DEFINE_* and DECLARE_* macros to prevent misuse on the stack. The changes in include/linux/* add purely compile-time assertions and keep equivalent expansions for on-stack macro variants, introducing no runtime executable code or runtime assertions. The changes under tools/ affect only user-space tests. The modification in drivers/macintosh/ams/ams-pmu.c is exclusive to PowerPC architecture (CONFIG_PPC_PMAC) and unreachable on amd64. Finally, the WireGuard changes in drivers/net/wireguard/selftest/allowedips.c adjust mutex declarations in __init boot-time self-tests where mutex_init() was already called immediately afterwards, causing no functional change in executable kernel logic. None of the changes warrant fuzzing.",
"WorthFuzzing": false
} |
| 65/1 | 2026/09/15 04:11 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|