AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/09/04 15:18 flow patch-triage
2m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [
    "netdev_rx_csum_fault",
    "skb_checksum_help",
    "xfs_file_ioctl",
    "xfs_fs_fill_super"
  ],
  "KMSANReasoning": "The patch refactors the `__ONCE_LITE_IF` macro in `include/linux/once_lite.h` into a standalone `__ONCE_LITE()` helper and short-circuiting `__ONCE_LITE_IF(condition)`.\n\nAll variables used within the macros (`__already_done` in `.data..once` and local boolean `__ret_once = false`) are static or explicitly initialized. The patch does not touch dynamically allocated memory, uninitialized stack variables, memory copied to userspace, or data structures where uninitialized fields could be read. There are no uninitialized memory risks or infoleaks, making a dedicated KMSAN session unnecessary.",
  "NeedsKMSAN": false,
  "Reasoning": "The patch refactors the DO_ONCE_LITE / __ONCE_LITE_IF helper macro definitions in include/linux/once_lite.h, separating out __ONCE_LITE() and altering the condition evaluation logic for one-time execution across the kernel. This is reachable core infrastructure used in networking, filesystems, and generic bug/warning macros, warranting fuzzing to verify runtime evaluation behavior.",
  "WorthFuzzing": true
}

1/1 2026/09/04 15:18 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 52116c7b958f885afa734a9edad37e0d0c7194bd\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Fri Sep 4 15:18:35 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/include/linux/once_lite.h b/include/linux/once_lite.h\nindex 236592c4eeb1a..5e2b67039aaf0 100644\n--- a/include/linux/once_lite.h\n+++ b/include/linux/once_lite.h\n@@ -10,19 +10,21 @@\n #define DO_ONCE_LITE(func, ...)\t\t\t\t\t\t\\\n \tDO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)\n \n-#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\n+#define __ONCE_LITE()\t\t\t\t\t\t\t\\\n \t({\t\t\t\t\t\t\t\t\\\n \t\tstatic bool __section(\".data..once\") __already_done;\t\\\n-\t\tbool __ret_cond = !!(condition);\t\t\t\\\n \t\tbool __ret_once = false;\t\t\t\t\\\n \t\t\t\t\t\t\t\t\t\\\n-\t\tif (unlikely(__ret_cond) \u0026\u0026 unlikely(!__already_done)) {\\\n+\t\tif (unlikely(!__already_done)) {\t\t\t\\\n \t\t\t__already_done = true;\t\t\t\t\\\n \t\t\t__ret_once = true;\t\t\t\t\\\n \t\t}\t\t\t\t\t\t\t\\\n \t\tunlikely(__ret_once);\t\t\t\t\t\\\n \t})\n \n+#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\n+\t(unlikely(condition) \u0026\u0026 __ONCE_LITE())\n+\n #define DO_ONCE_LITE_IF(condition, func, ...)\t\t\t\t\\\n \t({\t\t\t\t\t\t\t\t\\\n \t\tbool __ret_do_once = !!(condition);\t\t\t\\\n"
}

2/1 2026/09/04 15:18 agent patch-evaluator
1m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [
    "netdev_rx_csum_fault",
    "skb_checksum_help",
    "xfs_file_ioctl",
    "xfs_fs_fill_super"
  ],
  "Reasoning": "The patch refactors the DO_ONCE_LITE / __ONCE_LITE_IF helper macro definitions in include/linux/once_lite.h, separating out __ONCE_LITE() and altering the condition evaluation logic for one-time execution across the kernel. This is reachable core infrastructure used in networking, filesystems, and generic bug/warning macros, warranting fuzzing to verify runtime evaluation behavior.",
  "WorthFuzzing": true
}

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 52116c7b958f885afa734a9edad37e0d0c7194bd
Author: syz-cluster <triage@syzkaller.com>
Date:   Fri Sep 4 15:18:35 2026 +0000

    syz-cluster: applied patch under review

diff --git a/include/linux/once_lite.h b/include/linux/once_lite.h
index 236592c4eeb1a..5e2b67039aaf0 100644
--- a/include/linux/once_lite.h
+++ b/include/linux/once_lite.h
@@ -10,19 +10,21 @@
 #define DO_ONCE_LITE(func, ...)						\
 	DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)
 
-#define __ONCE_LITE_IF(condition)					\
+#define __ONCE_LITE()							\
 	({								\
 		static bool __section(".data..once") __already_done;	\
-		bool __ret_cond = !!(condition);			\
 		bool __ret_once = false;				\
 									\
-		if (unlikely(__ret_cond) && unlikely(!__already_done)) {\
+		if (unlikely(!__already_done)) {			\
 			__already_done = true;				\
 			__ret_once = true;				\
 		}							\
 		unlikely(__ret_once);					\
 	})
 
+#define __ONCE_LITE_IF(condition)					\
+	(unlikely(condition) && __ONCE_LITE())
+
 #define DO_ONCE_LITE_IF(condition, func, ...)				\
 	({								\
 		bool __ret_do_once = !!(condition);			\

3/2 2026/09/04 15:18 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 3049
							output: 35
							thoughts: 48
						

Thoughts:
Okay, let's dive into this. Here's my thought process on this patch, from my expert perspective:

**Patch Analysis and Impact Assessment**

Alright, the first thing I do is analyze the patch. It seems we're looking at a modification to `include/linux/once_lite.h`. So, my immediate next step is to examine that file. I need to understand what this `once_lite.h` is all about. Is it a critical piece of infrastructure, something used throughout the kernel, or more localized? Knowing the scope is essential.

Next, I'll need to scrutinize the changes within `once_lite.h` itself. I need to understand *what* has changed. Is it just whitespace, a bug fix, an optimization, or is it a fundamental alteration of the functionality of the `once_lite` mechanism? I need to look for any new API calls, changes to data structures, or modifications that could affect existing code. Finally, where is this header file used? A quick grep through the code base will highlight all of the references to this file, and reveal the areas of the kernel that depend on this mechanism. I will then perform a code review on those files, to examine how they are affected by the changes. Only then can I truly assess the impact and risk associated with this patch.



4/2 2026/09/04 15:18 tool read-file
0m Args:
{
  "File": "include/linux/once_lite.h",
  "FirstLine": 1,
  "LineCount": 50
}

Results:
{
  "Contents": "   1:\t/* SPDX-License-Identifier: GPL-2.0 */\n   2:\t#ifndef _LINUX_ONCE_LITE_H\n   3:\t#define _LINUX_ONCE_LITE_H\n   4:\t\n   5:\t#include \u003clinux/types.h\u003e\n   6:\t\n   7:\t/* Call a function once. Similar to DO_ONCE(), but does not use jump label\n   8:\t * patching via static keys.\n   9:\t */\n  10:\t#define DO_ONCE_LITE(func, ...)\t\t\t\t\t\t\\\n  11:\t\tDO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)\n  12:\t\n  13:\t#define __ONCE_LITE()\t\t\t\t\t\t\t\\\n  14:\t\t({\t\t\t\t\t\t\t\t\\\n  15:\t\t\tstatic bool __section(\".data..once\") __already_done;\t\\\n  16:\t\t\tbool __ret_once = false;\t\t\t\t\\\n  17:\t\t\t\t\t\t\t\t\t\t\\\n  18:\t\t\tif (unlikely(!__already_done)) {\t\t\t\\\n  19:\t\t\t\t__already_done = true;\t\t\t\t\\\n  20:\t\t\t\t__ret_once = true;\t\t\t\t\\\n  21:\t\t\t}\t\t\t\t\t\t\t\\\n  22:\t\t\tunlikely(__ret_once);\t\t\t\t\t\\\n  23:\t\t})\n  24:\t\n  25:\t#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\n  26:\t\t(unlikely(condition) \u0026\u0026 __ONCE_LITE())\n  27:\t\n  28:\t#define DO_ONCE_LITE_IF(condition, func, ...)\t\t\t\t\\\n  29:\t\t({\t\t\t\t\t\t\t\t\\\n  30:\t\t\tbool __ret_do_once = !!(condition);\t\t\t\\\n  31:\t\t\t\t\t\t\t\t\t\t\\\n  32:\t\t\tif (__ONCE_LITE_IF(__ret_do_once))\t\t\t\\\n  33:\t\t\t\tfunc(__VA_ARGS__);\t\t\t\t\\\n  34:\t\t\t\t\t\t\t\t\t\t\\\n  35:\t\t\tunlikely(__ret_do_once);\t\t\t\t\\\n  36:\t\t})\n  37:\t\n  38:\t#endif /* _LINUX_ONCE_LITE_H */\n"
}

5/2 2026/09/04 15:18 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 3958
							output: 19
							thoughts: 18
						

Thoughts:
Here's a summary of my thought process, as requested:

**Investigating `once_lite.h` Usage**

Alright, let's dive in. My immediate focus is to understand the scope and impact of `once_lite.h` within the kernel. I need to pinpoint every instance where this header file is included and, more importantly, *how* it's being used within those contexts. This isn't just about finding the includes, I need to understand the control flow, any dependencies, and potential bottlenecks related to it. I'll need to go beyond a simple `grep` or `find` to really understand the implications of `once_lite.h` in the kernel. Are there any unusual calling patterns? Are there any areas that look ripe for optimization related to its usage? Time to dig in and do some serious static analysis. Let's see what we can uncover!



6/2 2026/09/04 15:18 tool grepper
0m Args:
{
  "Expression": "once_lite\\.h"
}

Results:
{
  "Output": "fs/xfs/xfs_message.h-4-\nfs/xfs/xfs_message.h:5:#include \u003clinux/once_lite.h\u003e\nfs/xfs/xfs_message.h-6-\n--\ninclude/asm-generic/bug.h-6-#include \u003clinux/instrumentation.h\u003e\ninclude/asm-generic/bug.h:7:#include \u003clinux/once_lite.h\u003e\ninclude/asm-generic/bug.h-8-\n--\ninclude/linux/printk.h-9-#include \u003clinux/ratelimit_types.h\u003e\ninclude/linux/printk.h:10:#include \u003clinux/once_lite.h\u003e\ninclude/linux/printk.h-11-\n--\nkernel/trace/trace.h-22-#include \u003clinux/ctype.h\u003e\nkernel/trace/trace.h:23:#include \u003clinux/once_lite.h\u003e\nkernel/trace/trace.h-24-#include \u003clinux/ftrace_regs.h\u003e\n--\nnet/core/dev.c-157-#include \u003clinux/prandom.h\u003e\nnet/core/dev.c:158:#include \u003clinux/once_lite.h\u003e\nnet/core/dev.c-159-#include \u003cnet/netdev_lock.h\u003e\n--\nnet/mac80211/debug.h-7-#define __MAC80211_DEBUG_H\nnet/mac80211/debug.h:8:#include \u003clinux/once_lite.h\u003e\nnet/mac80211/debug.h-9-#include \u003cnet/cfg80211.h\u003e\n"
}

7/2 2026/09/04 15:18 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 4593
							output: 20
							thoughts: 73
						

Thoughts:
Here's my thought process, as requested:

**Investigating the "ONCE_LITE" Macros**

Okay, so I need to track down the usage of these `__ONCE_LITE_IF`, `__ONCE_LITE`, `DO_ONCE_LITE`, and `DO_ONCE_LITE_IF` macros.  The goal here is probably to understand how they are being used within the codebase. First, a logical starting point is to check how `bug.h` in the generic assembly includes utilizes them since that's where the investigation started. Let's dig into `include/asm-generic/bug.h` and see what's going on.



8/2 2026/09/04 15:18 tool grepper
0m Args:
{
  "Expression": "__ONCE_LITE"
}

Results:
{
  "Output": "arch/x86/mm/extable.c=166=static bool ex_handler_msr(const struct exception_table_entry *fixup,\n--\narch/x86/mm/extable.c-168-{\narch/x86/mm/extable.c:169:\tif (__ONCE_LITE_IF(!safe \u0026\u0026 wrmsr)) {\narch/x86/mm/extable.c-170-\t\tpr_warn(\"unchecked MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pS)\\n\",\n--\narch/x86/mm/extable.c-175-\narch/x86/mm/extable.c:176:\tif (__ONCE_LITE_IF(!safe \u0026\u0026 !wrmsr)) {\narch/x86/mm/extable.c-177-\t\tpr_warn(\"unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\\n\",\n--\ninclude/linux/once_lite.h-12-\ninclude/linux/once_lite.h:13:#define __ONCE_LITE()\t\t\t\t\t\t\t\\\ninclude/linux/once_lite.h-14-\t({\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/once_lite.h-24-\ninclude/linux/once_lite.h:25:#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\ninclude/linux/once_lite.h:26:\t(unlikely(condition) \u0026\u0026 __ONCE_LITE())\ninclude/linux/once_lite.h-27-\n--\ninclude/linux/once_lite.h-31-\t\t\t\t\t\t\t\t\t\\\ninclude/linux/once_lite.h:32:\t\tif (__ONCE_LITE_IF(__ret_do_once))\t\t\t\\\ninclude/linux/once_lite.h-33-\t\t\tfunc(__VA_ARGS__);\t\t\t\t\\\n"
}

9/2 2026/09/04 15:18 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 5341
							output: 21
							thoughts: 44
						

Thoughts:
Okay, here's my take on those thoughts, framed as if they're mine:

**Digging into the "Once" Mechanism**

Alright, time to get my hands dirty. I'm thinking I need to understand this "once" mechanism better, specifically how it's implemented. I'm going to start by searching the codebase for instances of `DO_ONCE_LITE`, `WARN_ONCE`, or even how that `once_lite.h` header file is utilized. I figure if I track down where those macros are being *used*, I'll get a better handle on the underlying concepts. I also might look at how they interact with important files like `bug.h` or `printk.h` since they are essential in kernel debugging. That's usually a good starting point. Let's see what the grep can find!



10/2 2026/09/04 15:18 tool grepper
0m Args:
{
  "Expression": "DO_ONCE_LITE"
}

Results:
{
  "Output": "drivers/iommu/amd/iommu.c=1234=static int wait_on_sem(struct amd_iommu *iommu, u64 data)\n--\ndrivers/iommu/amd/iommu.c-1254-\t\tif (amd_iommu_dump)\ndrivers/iommu/amd/iommu.c:1255:\t\t\tDO_ONCE_LITE(dump_command_buffer, iommu);\ndrivers/iommu/amd/iommu.c-1256-\n--\nfs/erofs/internal.h=446=erofs_get_aops(struct inode *realinode)\n--\nfs/erofs/internal.h-450-\t\t\treturn ERR_PTR(-EOPNOTSUPP);\nfs/erofs/internal.h:451:\t\tDO_ONCE_LITE_IF(realinode-\u003ei_blkbits != PAGE_SHIFT,\nfs/erofs/internal.h-452-\t\t\t  erofs_info, realinode-\u003ei_sb,\n--\nfs/xfs/xfs_message.h=50=do {\t\t\t\t\t\t\t\t\t\\\n--\nfs/xfs/xfs_message.h-58-#define xfs_printk_once(func, dev, fmt, ...)\t\t\t\\\nfs/xfs/xfs_message.h:59:\tDO_ONCE_LITE(func, dev, fmt, ##__VA_ARGS__)\nfs/xfs/xfs_message.h-60-\n--\ninclude/asm-generic/bug.h=103=extern __printf(1, 2) void __warn_printk(const char *fmt, ...);\n--\ninclude/asm-generic/bug.h-179-#define WARN_ON_ONCE(condition)\t\t\t\t\t\\\ninclude/asm-generic/bug.h:180:\tDO_ONCE_LITE_IF(condition, WARN_ON, 1)\ninclude/asm-generic/bug.h-181-#endif\n--\ninclude/asm-generic/bug.h-184-#define WARN_ONCE(condition, format...)\t\t\t\t\\\ninclude/asm-generic/bug.h:185:\tDO_ONCE_LITE_IF(condition, WARN, 1, format)\ninclude/asm-generic/bug.h-186-#endif\n--\ninclude/asm-generic/bug.h-188-#define WARN_TAINT_ONCE(condition, taint, format...)\t\t\\\ninclude/asm-generic/bug.h:189:\tDO_ONCE_LITE_IF(condition, WARN_TAINT, 1, taint, format)\ninclude/asm-generic/bug.h-190-\n--\ninclude/linux/once_lite.h-9- */\ninclude/linux/once_lite.h:10:#define DO_ONCE_LITE(func, ...)\t\t\t\t\t\t\\\ninclude/linux/once_lite.h:11:\tDO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)\ninclude/linux/once_lite.h-12-\n--\ninclude/linux/once_lite.h-27-\ninclude/linux/once_lite.h:28:#define DO_ONCE_LITE_IF(condition, func, ...)\t\t\t\t\\\ninclude/linux/once_lite.h-29-\t({\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/printk.h=407=struct pi_entry {\n--\ninclude/linux/printk.h-649-#define printk_once(fmt, ...)\t\t\t\t\t\\\ninclude/linux/printk.h:650:\tDO_ONCE_LITE(printk, fmt, ##__VA_ARGS__)\ninclude/linux/printk.h-651-#define printk_deferred_once(fmt, ...)\t\t\t\t\\\ninclude/linux/printk.h:652:\tDO_ONCE_LITE(printk_deferred, fmt, ##__VA_ARGS__)\ninclude/linux/printk.h-653-#else\n--\ninclude/linux/skbuff.h=2750=static inline void skb_assert_len(struct sk_buff *skb)\n--\ninclude/linux/skbuff.h-2753-\tif (WARN_ONCE(!skb-\u003elen, \"%s\\n\", __func__))\ninclude/linux/skbuff.h:2754:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\ninclude/linux/skbuff.h-2755-#endif /* CONFIG_DEBUG_NET */\n--\nkernel/trace/trace.h=37=enum trace_type {\n--\nkernel/trace/trace.h-129-#define MEM_FAIL(condition, fmt, ...)\t\t\t\t\t\\\nkernel/trace/trace.h:130:\tDO_ONCE_LITE_IF(condition, pr_err, \"ERROR: \" fmt, ##__VA_ARGS__)\nkernel/trace/trace.h-131-\n--\nnet/core/dev.c=3617=int skb_checksum_help(struct sk_buff *skb)\n--\nnet/core/dev.c-3645-\tif (unlikely(offset \u003e= skb_headlen(skb))) {\nnet/core/dev.c:3646:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\nnet/core/dev.c-3647-\t\tWARN_ONCE(true, \"offset (%d) \u003e= skb_headlen() (%u)\\n\",\n--\nnet/core/dev.c-3654-\tif (unlikely(offset + sizeof(__sum16) \u003e skb_headlen(skb))) {\nnet/core/dev.c:3655:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\nnet/core/dev.c-3656-\t\tWARN_ONCE(true, \"offset+2 (%zu) \u003e skb_headlen() (%u)\\n\",\n--\nnet/core/dev.c=3740=void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)\nnet/core/dev.c-3741-{\nnet/core/dev.c:3742:\tDO_ONCE_LITE(do_netdev_rx_csum_fault, dev, skb);\nnet/core/dev.c-3743-}\n--\nnet/ipv4/tcp_input.c=227=static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb)\n--\nnet/ipv4/tcp_input.c-263-\t\t/* Account for possibly-removed options */\nnet/ipv4/tcp_input.c:264:\t\tDO_ONCE_LITE_IF(len \u003e icsk-\u003eicsk_ack.rcv_mss + MAX_TCP_OPTION_SPACE,\nnet/ipv4/tcp_input.c-265-\t\t\t\ttcp_gro_dev_warn, sk, skb, len);\n--\nnet/mac80211/debug.h=125=do {\t\t\t\t\t\t\t\t\t\\\n--\nnet/mac80211/debug.h-156-#define link_err_once(link, fmt, ...)\t\t\t\t\t\\\nnet/mac80211/debug.h:157:\tDO_ONCE_LITE(link_err, link, fmt, ##__VA_ARGS__)\nnet/mac80211/debug.h-158-#define link_id_info(sdata, link_id, fmt, ...)\t\t\t\t\\\n--\nrust/kernel/print.rs=426=macro_rules! pr_cont (\n--\nrust/kernel/print.rs-433-///\nrust/kernel/print.rs:434:/// This structure provides the Rust equivalent of the kernel's `DO_ONCE_LITE` macro.\nrust/kernel/print.rs-435-/// While it would be possible to implement the feature entirely as a Rust macro,\n--\nrust/kernel/print.rs=468=    pub fn call_once\u003cF\u003e(\u0026self, f: F) -\u003e bool\n--\nrust/kernel/print.rs-491-///\nrust/kernel/print.rs:492:/// This is equivalent to the kernel's `DO_ONCE_LITE` macro.\nrust/kernel/print.rs-493-///\n"
}

11/2 2026/09/04 15:18 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 7670
							output: 31
							thoughts: 664
						

Thoughts:
**Analyzing the Optimization of the `__ONCE_LITE` Macros**

Okay, let's break down this code change. My initial thought is to understand the core alteration and its implications. I see the original `__ONCE_LITE_IF` macro and then the new implementation, and the first thing that jumps out is the introduction of a new macro, `__ONCE_LITE()`.

In the old code, `__ONCE_LITE_IF(condition)` wrapped the `__already_done` check directly within the conditional logic. The `__already_done` flag was local to that macro. This meant the check and setting of the flag only occurred if the `condition` was true. However, the flag was declared *inside* the macro.

The new code refactors this. `__ONCE_LITE()` is now a standalone macro responsible solely for the "do-once" behavior – checking and setting `__already_done`. Crucially, `__ONCE_LITE_IF(condition)` now *calls* `__ONCE_LITE()`, but uses short-circuiting. This means that if `condition` is false, `__ONCE_LITE()` isn't evaluated at all. The impact is we get the same behavior of executing `__already_done` only if the condition is met, but now the flag is separate and potentially reusable.

Aha! This also clarifies the likely intent. The introduction of `__ONCE_LITE()` offers a way to invoke the "do-once" logic without an explicit condition, which wasn't as clean in the original version. Now, I see that the original `DO_ONCE_LITE` macro used `DO_ONCE_LITE_IF(true, ...)`; now we can simply call the base function.

But, a quick reality check: is this even used anywhere? Let me check the call sites to make sure this isn't dead code! I recall `WARN_ON_ONCE` leverages this, or something similar, and it's used in different architectures... Specifically, I know that `asm-generic/bug.h` might use this, and the AMD64 architecture is an important case for me, so let's check `arch/x86/include/asm/bug.h` to confirm the implementation. Gotta make sure this change is actually relevant and not a hypothetical optimization.



12/2 2026/09/04 15:19 tool grepper
0m Args:
{
  "Expression": "WARN_ON_ONCE",
  "PathPrefix": "arch/x86"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 3554 lines.\nUse more precise expression if possible.\n\narch/x86/coco/sev/vc-handle.c=39=static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,\n--\narch/x86/coco/sev/vc-handle.c-61-\narch/x86/coco/sev/vc-handle.c:62:\tif (WARN_ON_ONCE(pte_val(*pte) \u0026 _PAGE_ENC))\narch/x86/coco/sev/vc-handle.c-63-\t\t/* Emulated MMIO to/from encrypted memory not supported */\n--\narch/x86/coco/tdx/tdx.c=578=static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)\n--\narch/x86/coco/tdx/tdx.c-587-\t/* Only in-kernel MMIO is supported */\narch/x86/coco/tdx/tdx.c:588:\tif (WARN_ON_ONCE(user_mode(regs)))\narch/x86/coco/tdx/tdx.c-589-\t\treturn -EFAULT;\n--\narch/x86/coco/tdx/tdx.c-597-\tmmio = insn_decode_mmio(\u0026insn, \u0026size);\narch/x86/coco/tdx/tdx.c:598:\tif (WARN_ON_ONCE(mmio == INSN_MMIO_DECODE_FAILED))\narch/x86/coco/tdx/tdx.c-599-\t\treturn -EINVAL;\n--\narch/x86/coco/tdx/tdx.c-677-\t\t/* All other cases has to be covered with the first switch() */\narch/x86/coco/tdx/tdx.c:678:\t\tWARN_ON_ONCE(1);\narch/x86/coco/tdx/tdx.c-679-\t\treturn -EINVAL;\n--\narch/x86/entry/common.c=18=noinstr void x86_entry_from_kvm(unsigned int event_type, unsigned int vector)\n--\narch/x86/entry/common.c-45-\narch/x86/entry/common.c:46:\tWARN_ON_ONCE(event_type != EVENT_TYPE_NMI);\narch/x86/entry/common.c-47-\n--\narch/x86/entry/entry_fred.c=127=void __init fred_install_sysvec(unsigned int sysvec, idtentry_t handler)\narch/x86/entry/entry_fred.c-128-{\narch/x86/entry/entry_fred.c:129:\tif (WARN_ON_ONCE(sysvec \u003c FIRST_SYSTEM_VECTOR))\narch/x86/entry/entry_fred.c-130-\t\treturn;\narch/x86/entry/entry_fred.c-131-\narch/x86/entry/entry_fred.c:132:\tif (WARN_ON_ONCE(fred_setup_done))\narch/x86/entry/entry_fred.c-133-\t\treturn;\narch/x86/entry/entry_fred.c-134-\narch/x86/entry/entry_fred.c:135:\tif (!WARN_ON_ONCE(sysvec_table[sysvec - FIRST_SYSTEM_VECTOR]))\narch/x86/entry/entry_fred.c-136-\t\t sysvec_table[sysvec - FIRST_SYSTEM_VECTOR] = handler;\n--\narch/x86/entry/entry_fred.c=160=static noinstr void fred_extint(struct pt_regs *regs)\n--\narch/x86/entry/entry_fred.c-163-\narch/x86/entry/entry_fred.c:164:\tif (WARN_ON_ONCE(vector \u003c FIRST_EXTERNAL_VECTOR))\narch/x86/entry/entry_fred.c-165-\t\treturn;\n--\narch/x86/entry/entry_fred.c=289=__visible noinstr void __fred_entry_from_kvm(struct pt_regs *regs)\n--\narch/x86/entry/entry_fred.c-296-\tdefault:\narch/x86/entry/entry_fred.c:297:\t\tWARN_ON_ONCE(1);\narch/x86/entry/entry_fred.c-298-\t}\n--\narch/x86/entry/vsyscall/vsyscall_64.c=257=bool emulate_vsyscall_pf(unsigned long error_code, struct pt_regs *regs,\n--\narch/x86/entry/vsyscall/vsyscall_64.c-285-\tif (cpu_feature_enabled(X86_FEATURE_NX))\narch/x86/entry/vsyscall/vsyscall_64.c:286:\t\tWARN_ON_ONCE(!(error_code \u0026 X86_PF_INSTR));\narch/x86/entry/vsyscall/vsyscall_64.c-287-\n--\narch/x86/events/amd/brs.c=281=void amd_brs_drain(void)\n--\narch/x86/events/amd/brs.c-301-\t/* Sanity check [0-x86_pmu.lbr_nr] */\narch/x86/events/amd/brs.c:302:\tif (WARN_ON_ONCE(cfg.msroff \u003e= x86_pmu.lbr_nr))\narch/x86/events/amd/brs.c-303-\t\tgoto empty;\n--\narch/x86/events/amd/core.c=580=static int amd_pmu_cpu_prepare(int cpu)\n--\narch/x86/events/amd/core.c-588-\narch/x86/events/amd/core.c:589:\tWARN_ON_ONCE(cpuc-\u003eamd_nb);\narch/x86/events/amd/core.c-590-\n--\narch/x86/events/amd/core.c=604=static void amd_pmu_cpu_starting(int cpu)\n--\narch/x86/events/amd/core.c-617-\tnb_id = topology_amd_node_id(cpu);\narch/x86/events/amd/core.c:618:\tWARN_ON_ONCE(nb_id == BAD_APICID);\narch/x86/events/amd/core.c-619-\n--\narch/x86/events/amd/core.c-621-\t\tnb = per_cpu(cpu_hw_events, i).amd_nb;\narch/x86/events/amd/core.c:622:\t\tif (WARN_ON_ONCE(!nb))\narch/x86/events/amd/core.c-623-\t\t\tcontinue;\n--\narch/x86/events/amd/ibs.c=555=static void perf_ibs_start(struct perf_event *event, int flags)\n--\narch/x86/events/amd/ibs.c-561-\narch/x86/events/amd/ibs.c:562:\tif (WARN_ON_ONCE(!(hwc-\u003estate \u0026 PERF_HES_STOPPED)))\narch/x86/events/amd/ibs.c-563-\t\treturn;\narch/x86/events/amd/ibs.c-564-\narch/x86/events/amd/ibs.c:565:\tWARN_ON_ONCE(!(hwc-\u003estate \u0026 PERF_HES_UPTODATE));\narch/x86/events/amd/ibs.c-566-\thwc-\u003estate = 0;\n--\narch/x86/events/amd/ibs.c=597=static void perf_ibs_stop(struct perf_event *event, int flags)\n--\narch/x86/events/amd/ibs.c-633-\t\tclear_bit(IBS_STARTED, pcpu-\u003estate);\narch/x86/events/amd/ibs.c:634:\t\tWARN_ON_ONCE(hwc-\u003estate \u0026 PERF_HES_STOPPED);\narch/x86/events/amd/ibs.c-635-\t\thwc-\u003estate |= PERF_HES_STOPPED;\n--\narch/x86/events/amd/ibs.c=1406=static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)\n--\narch/x86/events/amd/ibs.c-1433-\narch/x86/events/amd/ibs.c:1434:\tif (WARN_ON_ONCE(!event))\narch/x86/events/amd/ibs.c-1435-\t\tgoto fail;\n--\narch/x86/events/amd/iommu.c=279=static void perf_iommu_start(struct perf_event *event, int flags)\n--\narch/x86/events/amd/iommu.c-282-\narch/x86/events/amd/iommu.c:283:\tif (WARN_ON_ONCE(!(hwc-\u003estate \u0026 PERF_HES_STOPPED)))\narch/x86/events/amd/iommu.c-284-\t\treturn;\narch/x86/events/amd/iommu.c-285-\narch/x86/events/amd/iommu.c:286:\tWARN_ON_ONCE(!(hwc-\u003estate \u0026 PERF_HES_UPTODATE));\narch/x86/events/amd/iommu.c-287-\thwc-\u003estate = 0;\n--\narch/x86/events/amd/iommu.c=331=static void perf_iommu_stop(struct perf_event *event, int flags)\n--\narch/x86/events/amd/iommu.c-345-\tperf_iommu_disable_event(event);\narch/x86/events/amd/iommu.c:346:\tWARN_ON_ONCE(hwc-\u003estate \u0026 PERF_HES_STOPPED);\narch/x86/events/amd/iommu.c-347-\thwc-\u003estate |= PERF_HES_STOPPED;\n--\narch/x86/events/amd/lbr.c=363=void amd_pmu_lbr_del(struct perf_event *event)\n--\narch/x86/events/amd/lbr.c-373-\tcpuc-\u003elbr_users--;\narch/x86/events/amd/lbr.c:374:\tWARN_ON_ONCE(cpuc-\u003elbr_users \u003c 0);\narch/x86/events/amd/lbr.c-375-\tperf_sched_cb_dec(event-\u003epmu);\n--\narch/x86/events/amd/power.c=75=static void __pmu_event_start(struct perf_event *event)\narch/x86/events/amd/power.c-76-{\narch/x86/events/amd/power.c:77:\tif (WARN_ON_ONCE(!(event-\u003ehw.state \u0026 PERF_HES_STOPPED)))\narch/x86/events/amd/power.c-78-\t\treturn;\n--\narch/x86/events/core.c=796=struct pmu *x86_get_pmu(unsigned int cpu)\n--\narch/x86/events/core.c-803-\t */\narch/x86/events/core.c:804:\tif (WARN_ON_ONCE(!cpuc-\u003epmu))\narch/x86/events/core.c-805-\t\treturn \u0026pmu;\n--\narch/x86/events/core.c=862=static void perf_sched_save_state(struct perf_sched *sched)\narch/x86/events/core.c-863-{\narch/x86/events/core.c:864:\tif (WARN_ON_ONCE(sched-\u003esaved_states \u003e= SCHED_STATES_MAX))\narch/x86/events/core.c-865-\t\treturn;\n--\narch/x86/events/core.c=1008=int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)\n--\narch/x86/events/core.c-1035-\t\t */\narch/x86/events/core.c:1036:\t\tWARN_ON_ONCE((c \u0026\u0026 i \u003e= n0) || (!c \u0026\u0026 i \u003c n0));\narch/x86/events/core.c-1037-\n--\narch/x86/events/core.c=1551=static void x86_pmu_start(struct perf_event *event, int flags)\n--\narch/x86/events/core.c-1555-\narch/x86/events/core.c:1556:\tif (WARN_ON_ONCE(!(event-\u003ehw.state \u0026 PERF_HES_STOPPED)))\narch/x86/events/core.c-1557-\t\treturn;\narch/x86/events/core.c-1558-\narch/x86/events/core.c:1559:\tif (WARN_ON_ONCE(idx == -1))\narch/x86/events/core.c-1560-\t\treturn;\n--\narch/x86/events/core.c-1562-\tif (flags \u0026 PERF_EF_RELOAD) {\narch/x86/events/core.c:1563:\t\tWARN_ON_ONCE(!(event-\u003ehw.state \u0026 PERF_HES_UPTODATE));\narch/x86/events/core.c-1564-\t\tstatic_call(x86_pmu_set_period)(event);\n--\narch/x86/events/core.c=1637=void x86_pmu_stop(struct perf_event *event, int flags)\n--\narch/x86/events/core.c-1644-\t\t__clear_bit(hwc-\u003eidx, cpuc-\u003eactive_mask);\narch/x86/events/core.c:1645:\t\tWARN_ON_ONCE(hwc-\u003estate \u0026 PERF_HES_STOPPED);\narch/x86/events/core.c-1646-\t\thwc-\u003estate |= PERF_HES_STOPPED;\n--\narch/x86/events/core.c=1659=static void x86_pmu_del(struct perf_event *event, int flags)\n--\narch/x86/events/core.c-1688-\narch/x86/events/core.c:1689:\tif (WARN_ON_ONCE(i == cpuc-\u003en_events)) /* called -\u003edel() without -\u003eadd() ? */\narch/x86/events/core.c-1690-\t\treturn;\n--\narch/x86/events/core.c=2319=static void x86_pmu_start_txn(struct pmu *pmu, unsigned int txn_flags)\n--\narch/x86/events/core.c-2322-\narch/x86/events/core.c:2323:\tWARN_ON_ONCE(cpuc-\u003etxn_flags);\t\t/* txn already in flight */\narch/x86/events/core.c-2324-\n--\narch/x86/events/core.c=2340=static void x86_pmu_cancel_txn(struct pmu *pmu)\n--\narch/x86/events/core.c-2344-\narch/x86/events/core.c:2345:\tWARN_ON_ONCE(!cpuc-\u003etxn_flags);\t/* no txn in flight */\narch/x86/events/core.c-2346-\n--\narch/x86/events/core.c=2370=static int x86_pmu_commit_txn(struct pmu *pmu)\n--\narch/x86/events/core.c-2375-\narch/x86/events/core.c:2376:\tWARN_ON_ONCE(!cpuc-\u003etxn_flags);\t/* no txn in flight */\narch/x86/events/core.c-2377-\n--\narch/x86/events/core.c=3144=void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)\n--\narch/x86/events/core.c-3146-\t/* This API doesn't currently support enumerating hybrid PMUs. */\narch/x86/events/core.c:3147:\tif (WARN_ON_ONCE(cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) ||\narch/x86/events/core.c-3148-\t    !x86_pmu_initialized()) {\n--\narch/x86/events/intel/bts.c=340=void intel_bts_enable_local(void)\n--\narch/x86/events/intel/bts.c-354-\t */\narch/x86/events/intel/bts.c:355:\tif (WARN_ON_ONCE(state == BTS_STATE_ACTIVE))\narch/x86/events/intel/bts.c-356-\t\treturn;\n--\narch/x86/events/intel/core.c=2777=static void __intel_pmu_enable_all(int added, bool pmi)\n--\narch/x86/events/intel/core.c-2795-\narch/x86/events/intel/core.c:2796:\t\tif (WARN_ON_ONCE(!event))\narch/x86/events/intel/core.c-2797-\t\t\treturn;\n--\narch/x86/events/intel/core.c=4280=intel_start_scheduling(struct cpu_hw_events *cpuc)\n--\narch/x86/events/intel/core.c-4294-\t */\narch/x86/events/intel/core.c:4295:\tif (WARN_ON_ONCE(!excl_cntrs))\narch/x86/events/intel/core.c-4296-\t\treturn;\n--\narch/x86/events/intel/core.c=4309=static void intel_commit_scheduling(struct cpu_hw_events *cpuc, int idx, int cntr)\n--\narch/x86/events/intel/core.c-4318-\narch/x86/events/intel/core.c:4319:\tif (WARN_ON_ONCE(!excl_cntrs))\narch/x86/events/intel/core.c-4320-\t\treturn;\n--\narch/x86/events/intel/core.c=4336=intel_stop_scheduling(struct cpu_hw_events *cpuc)\n--\narch/x86/events/intel/core.c-4349-\t */\narch/x86/events/intel/core.c:4350:\tif (WARN_ON_ONCE(!excl_cntrs))\narch/x86/events/intel/core.c-4351-\t\treturn;\n--\narch/x86/events/intel/core.c=4363=dyn_constraint(struct cpu_hw_events *cpuc, struct event_constraint *c, int idx)\narch/x86/events/intel/core.c-4364-{\narch/x86/events/intel/core.c:4365:\tWARN_ON_ONCE(!cpuc-\u003econstraint_list);\narch/x86/events/intel/core.c-4366-\n--\narch/x86/events/intel/core.c=4392=intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event,\n--\narch/x86/events/intel/core.c-4409-\t */\narch/x86/events/intel/core.c:4410:\tif (WARN_ON_ONCE(!excl_cntrs))\narch/x86/events/intel/core.c-4411-\t\treturn c;\n--\narch/x86/events/intel/core.c=4492=intel_get_event_constraints(struct cpu_hw_events *cpuc, int idx,\n--\narch/x86/events/intel/core.c-4505-\tif (c1) {\narch/x86/events/intel/core.c:4506:\t        WARN_ON_ONCE(!(c1-\u003eflags \u0026 PERF_X86_EVENT_DYNAMIC));\narch/x86/events/intel/core.c-4507-\t\tbitmap_copy(c1-\u003eidxmsk, c2-\u003eidxmsk, X86_PMC_IDX_MAX);\n--\narch/x86/events/intel/core.c=4524=static void intel_put_excl_constraints(struct cpu_hw_events *cpuc,\n--\narch/x86/events/intel/core.c-4537-\narch/x86/events/intel/core.c:4538:\tif (WARN_ON_ONCE(!excl_cntrs))\narch/x86/events/intel/core.c-4539-\t\treturn;\n--\narch/x86/events/intel/core.c=6338=static bool init_hybrid_pmu(int cpu)\n--\narch/x86/events/intel/core.c-6342-\narch/x86/events/intel/core.c:6343:\tif (WARN_ON_ONCE(!pmu || (pmu-\u003epmu.type == -1))) {\narch/x86/events/intel/core.c-6344-\t\tcpuc-\u003epmu = NULL;\n--\narch/x86/events/intel/core.c=6373=static void intel_pmu_cpu_starting(int cpu)\n--\narch/x86/events/intel/core.c-6394-\tif (x86_pmu.flags \u0026 PMU_FL_TFA) {\narch/x86/events/intel/core.c:6395:\t\tWARN_ON_ONCE(cpuc-\u003etfa_shadow);\narch/x86/events/intel/core.c-6396-\t\tcpuc-\u003etfa_shadow = ~0ULL;\n--\narch/x86/events/intel/core.c=6765=static __init void intel_pebs_isolation_quirk(void)\narch/x86/events/intel/core.c-6766-{\narch/x86/events/intel/core.c:6767:\tWARN_ON_ONCE(x86_pmu.check_microcode);\narch/x86/events/intel/core.c-6768-\tx86_pmu.check_microcode = intel_check_pebs_isolation;\n--\narch/x86/events/intel/ds.c=455=static u64 __grt_latency_data(struct perf_event *event, u64 status,\n--\narch/x86/events/intel/ds.c-459-\narch/x86/events/intel/ds.c:460:\tWARN_ON_ONCE(is_hybrid() \u0026\u0026\narch/x86/events/intel/ds.c-461-\t\t     hybrid_pmu(event-\u003epmu)-\u003epmu_type == hybrid_big);\n--\narch/x86/events/intel/ds.c=2947=static void intel_pmu_drain_pebs_core(struct pt_regs *iregs, struct perf_sample_data *data)\n--\narch/x86/events/intel/ds.c-2968-\narch/x86/events/intel/ds.c:2969:\tWARN_ON_ONCE(!event);\narch/x86/events/intel/ds.c-2970-\n--\narch/x86/events/intel/ds.c=3005=static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, struct perf_sample_data *data)\n--\narch/x86/events/intel/ds.c-3098-\t\tevent = cpuc-\u003eevents[bit];\narch/x86/events/intel/ds.c:3099:\t\tif (WARN_ON_ONCE(!event))\narch/x86/events/intel/ds.c-3100-\t\t\tcontinue;\narch/x86/events/intel/ds.c-3101-\narch/x86/events/intel/ds.c:3102:\t\tif (WARN_ON_ONCE(!event-\u003eattr.precise_ip))\narch/x86/events/intel/ds.c-3103-\t\t\tcontinue;\n--\narch/x86/events/intel/ds.c=3122=__intel_pmu_handle_pebs_record(struct pt_regs *iregs,\n--\narch/x86/events/intel/ds.c-3135-\narch/x86/events/intel/ds.c:3136:\t\tif (WARN_ON_ONCE(!event) ||\narch/x86/events/intel/ds.c:3137:\t\t    WARN_ON_ONCE(!event-\u003eattr.precise_ip))\narch/x86/events/intel/ds.c-3138-\t\t\tcontinue;\n--\narch/x86/events/intel/ds.c=3222=static void intel_pmu_drain_arch_pebs(struct pt_regs *iregs,\n--\narch/x86/events/intel/ds.c-3265-\narch/x86/events/intel/ds.c:3266:\t\tif (WARN_ON_ONCE(!header-\u003esize))\narch/x86/events/intel/ds.c-3267-\t\t\tbreak;\n--\narch/x86/events/intel/lbr.c=661=void intel_pmu_lbr_del(struct perf_event *event)\n--\narch/x86/events/intel/lbr.c-687-\tcpuc-\u003elbr_users--;\narch/x86/events/intel/lbr.c:688:\tWARN_ON_ONCE(cpuc-\u003elbr_users \u003c 0);\narch/x86/events/intel/lbr.c:689:\tWARN_ON_ONCE(cpuc-\u003elbr_pebs_users \u003c 0);\narch/x86/events/intel/lbr.c-690-\tperf_sched_cb_dec(event-\u003epmu);\n--\narch/x86/events/intel/lbr.c=951=static void intel_pmu_lbr_counters_reorder(struct cpu_hw_events *cpuc,\n--\narch/x86/events/intel/lbr.c-967-\narch/x86/events/intel/lbr.c:968:\tWARN_ON_ONCE(!pos);\narch/x86/events/intel/lbr.c-969-\n--\narch/x86/events/intel/p4.c=952=static void __p4_pmu_enable_event(struct perf_event *event)\n--\narch/x86/events/intel/p4.c-967-\t */\narch/x86/events/intel/p4.c:968:\tWARN_ON_ONCE(p4_is_event_cascaded(hwc-\u003econfig));\narch/x86/events/intel/p4.c:969:\tWARN_ON_ONCE(hwc-\u003eidx == 1);\narch/x86/events/intel/p4.c-970-\n--\narch/x86/events/intel/p4.c=1034=static int p4_pmu_handle_irq(struct pt_regs *regs)\n--\narch/x86/events/intel/p4.c-1057-\narch/x86/events/intel/p4.c:1058:\t\tWARN_ON_ONCE(hwc-\u003eidx != idx);\narch/x86/events/intel/p4.c-1059-\n--\narch/x86/events/intel/pt.c=1011=pt_topa_entry_for_page(struct pt_buffer *buf, unsigned int pg)\n--\narch/x86/events/intel/pt.c-1019-\t */\narch/x86/events/intel/pt.c:1020:\tif (WARN_ON_ONCE(pg \u003e= buf-\u003enr_pages))\narch/x86/events/intel/pt.c-1021-\t\treturn NULL;\n--\narch/x86/events/intel/pt.c-1035-\t */\narch/x86/events/intel/pt.c:1036:\tWARN_ON_ONCE(1);\narch/x86/events/intel/pt.c-1037-\n--\narch/x86/events/intel/pt.c-1043-\t */\narch/x86/events/intel/pt.c:1044:\tif (WARN_ON_ONCE(topa-\u003elast == -1))\narch/x86/events/intel/pt.c-1045-\t\treturn NULL;\n--\narch/x86/events/intel/pt.c-1075-\t */\narch/x86/events/intel/pt.c:1076:\tWARN_ON_ONCE(1);\narch/x86/events/intel/pt.c-1077-\n--\narch/x86/events/intel/pt.c=1671=static void pt_event_stop(struct perf_event *event, int mode)\n--\narch/x86/events/intel/pt.c-1717-\tif ((mode \u0026 PERF_EF_UPDATE) || !buf-\u003esnapshot) {\narch/x86/events/intel/pt.c:1718:\t\tif (WARN_ON_ONCE(pt-\u003ehandle.event != event))\narch/x86/events/intel/pt.c-1719-\t\t\treturn;\n--\narch/x86/events/intel/pt.c=1736=static long pt_event_snapshot_aux(struct perf_event *event,\n--\narch/x86/events/intel/pt.c-1744-\narch/x86/events/intel/pt.c:1745:\tif (WARN_ON_ONCE(!buf))\narch/x86/events/intel/pt.c-1746-\t\treturn 0;\n--\narch/x86/events/intel/pt.c-1751-\t */\narch/x86/events/intel/pt.c:1752:\tif (WARN_ON_ONCE(!buf-\u003esnapshot))\narch/x86/events/intel/pt.c-1753-\t\treturn 0;\n--\narch/x86/events/intel/uncore.c=523=void uncore_pmu_event_start(struct perf_event *event, int flags)\n--\narch/x86/events/intel/uncore.c-527-\narch/x86/events/intel/uncore.c:528:\tif (WARN_ON_ONCE(idx == -1 || idx \u003e= UNCORE_PMC_IDX_MAX))\narch/x86/events/intel/uncore.c-529-\t\treturn;\n--\narch/x86/events/intel/uncore.c-545-\narch/x86/events/intel/uncore.c:546:\tif (WARN_ON_ONCE(!(event-\u003ehw.state \u0026 PERF_HES_STOPPED)))\narch/x86/events/intel/uncore.c-547-\t\treturn;\n--\narch/x86/events/intel/uncore.c=561=void uncore_pmu_event_stop(struct perf_event *event, int flags)\n--\narch/x86/events/intel/uncore.c-578-\t\tbox-\u003eevents[hwc-\u003eidx] = NULL;\narch/x86/events/intel/uncore.c:579:\t\tWARN_ON_ONCE(hwc-\u003estate \u0026 PERF_HES_STOPPED);\narch/x86/events/intel/uncore.c-580-\t\thwc-\u003estate |= PERF_HES_STOPPED;\n--\narch/x86/events/intel/uncore.c=1198=static int uncore_pci_pmu_register(struct pci_dev *pdev,\n--\narch/x86/events/intel/uncore.c-1205-\narch/x86/events/intel/uncore.c:1206:\tif (WARN_ON_ONCE(pmu-\u003eboxes[die] != NULL))\narch/x86/events/intel/uncore.c-1207-\t\treturn -EINVAL;\n--\narch/x86/events/intel/uncore.c=1514=static void uncore_change_type_ctx(struct intel_uncore_type *type, int old_cpu,\n--\narch/x86/events/intel/uncore.c-1527-\t\tif (old_cpu \u003c 0) {\narch/x86/events/intel/uncore.c:1528:\t\t\tWARN_ON_ONCE(box-\u003ecpu != -1);\narch/x86/events/intel/uncore.c-1529-\t\t\tif (uncore_die_has_box(type, die, pmu-\u003epmu_idx) \u0026\u0026\n--\narch/x86/events/intel/uncore.c-1536-\narch/x86/events/intel/uncore.c:1537:\t\tWARN_ON_ONCE(box-\u003ecpu != -1 \u0026\u0026 box-\u003ecpu != old_cpu);\narch/x86/events/intel/uncore.c-1538-\t\tcpumask_clear_cpu(old_cpu, \u0026pmu-\u003ecpu_mask);\n--\narch/x86/events/intel/uncore_nhmex.c=556=static bool nhmex_mbox_get_shared_reg(struct intel_uncore_box *box, int idx, u64 config)\n--\narch/x86/events/intel/uncore_nhmex.c-580-\tidx -= EXTRA_REG_NHMEX_M_ZDP_CTL_FVC;\narch/x86/events/intel/uncore_nhmex.c:581:\tif (WARN_ON_ONCE(idx \u003e= 4))\narch/x86/events/intel/uncore_nhmex.c-582-\t\treturn false;\n--\narch/x86/events/intel/uncore_nhmex.c=768=static int nhmex_mbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)\n--\narch/x86/events/intel/uncore_nhmex.c-787-\t\tmsr = er-\u003emsr + type-\u003emsr_offset * box-\u003epmu-\u003epmu_idx;\narch/x86/events/intel/uncore_nhmex.c:788:\t\tif (WARN_ON_ONCE(msr \u003e= 0xffff || er-\u003eidx \u003e= 0xff))\narch/x86/events/intel/uncore_nhmex.c-789-\t\t\treturn -EINVAL;\n--\narch/x86/events/intel/uncore_nhmex.c-793-\t\t\treg_idx = 1;\narch/x86/events/intel/uncore_nhmex.c:794:\t\telse if (WARN_ON_ONCE(reg_idx \u003e 0))\narch/x86/events/intel/uncore_nhmex.c-795-\t\t\treturn -EINVAL;\n--\narch/x86/events/perf_event.h=1513=static inline void amd_pmu_brs_del(struct perf_event *event)\n--\narch/x86/events/perf_event.h-1517-\tcpuc-\u003elbr_users--;\narch/x86/events/perf_event.h:1518:\tWARN_ON_ONCE(cpuc-\u003elbr_users \u003c 0);\narch/x86/events/perf_event.h-1519-\n--\narch/x86/events/rapl.c=281=static void __rapl_pmu_event_start(struct rapl_pmu *rapl_pmu,\n--\narch/x86/events/rapl.c-283-{\narch/x86/events/rapl.c:284:\tif (WARN_ON_ONCE(!(event-\u003ehw.state \u0026 PERF_HES_STOPPED)))\narch/x86/events/rapl.c-285-\t\treturn;\n--\narch/x86/events/rapl.c=308=static void rapl_pmu_event_stop(struct perf_event *event, int mode)\n--\narch/x86/events/rapl.c-317-\tif (!(hwc-\u003estate \u0026 PERF_HES_STOPPED)) {\narch/x86/events/rapl.c:318:\t\tWARN_ON_ONCE(rapl_pmu-\u003en_active \u003c= 0);\narch/x86/events/rapl.c-319-\t\trapl_pmu-\u003en_active--;\n--\narch/x86/events/rapl.c-324-\narch/x86/events/rapl.c:325:\t\tWARN_ON_ONCE(hwc-\u003estate \u0026 PERF_HES_STOPPED);\narch/x86/events/rapl.c-326-\t\thwc-\u003estate |= PERF_HES_STOPPED;\n--\narch/x86/hyperv/hv_init.c=118=static int hv_cpu_init(unsigned int cpu)\n--\narch/x86/hyperv/hv_init.c-158-\t\t\tif (*hvp \u0026\u0026 !ms_hyperv.paravisor_present \u0026\u0026 hv_isolation_type_snp()) {\narch/x86/hyperv/hv_init.c:159:\t\t\t\tWARN_ON_ONCE(set_memory_decrypted((unsigned long)(*hvp), 1));\narch/x86/hyperv/hv_init.c-160-\t\t\t\tmemset(*hvp, 0, PAGE_SIZE);\n--\narch/x86/hyperv/irqdomain.c=361=static void hv_msi_domain_free(struct irq_domain *d, unsigned int virq,\n--\narch/x86/hyperv/irqdomain.c-368-\t\tdesc = irq_data_get_msi_desc(irqd);\narch/x86/hyperv/irqdomain.c:369:\t\tif (!desc || !desc-\u003eirq || WARN_ON_ONCE(!dev_is_pci(desc-\u003edev)))\narch/x86/hyperv/irqdomain.c-370-\t\t\tcontinue;\n--\narch/x86/hyperv/ivm.c=632=static void hv_vtom_kexec_finish(void)\n--\narch/x86/hyperv/ivm.c-658-\t\t\t\t\tcur, 0, input, NULL);\narch/x86/hyperv/ivm.c:659:\t\t\t\tWARN_ON_ONCE(!hv_result_success(hv_status));\narch/x86/hyperv/ivm.c-660-\t\t\t\tcur = 0;\n--\narch/x86/hyperv/ivm.c=677=static int hv_mark_gpa_visibility(u16 count, const u64 pfn[],\n--\narch/x86/hyperv/ivm.c-730-\t */\narch/x86/hyperv/ivm.c:731:\tWARN_ON_ONCE(ret);\narch/x86/hyperv/ivm.c-732-\n--\narch/x86/include/asm/apic.h=487=static inline u32 safe_apic_wait_icr_idle(void) { return 0; }\narch/x86/include/asm/apic.h:488:static inline void apic_native_eoi(void) { WARN_ON_ONCE(1); }\narch/x86/include/asm/apic.h-489-static inline void apic_setup_apic_calls(void) { }\n--\narch/x86/include/asm/entry-common.h=13=static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs)\n--\narch/x86/include/asm/entry-common.h-30-\narch/x86/include/asm/entry-common.h:31:\t\tWARN_ON_ONCE(flags \u0026 mask);\narch/x86/include/asm/entry-common.h-32-\narch/x86/include/asm/entry-common.h-33-\t\t/* We think we came from user mode. Make sure pt_regs agrees. */\narch/x86/include/asm/entry-common.h:34:\t\tWARN_ON_ONCE(!user_mode(regs));\narch/x86/include/asm/entry-common.h-35-\n--\narch/x86/include/asm/entry-common.h-40-\t\t */\narch/x86/include/asm/entry-common.h:41:\t\tWARN_ON_ONCE(!on_thread_stack());\narch/x86/include/asm/entry-common.h:42:\t\tWARN_ON_ONCE(regs != task_pt_regs(current));\narch/x86/include/asm/entry-common.h-43-\t}\n--\narch/x86/include/asm/pgtable.h=730=static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)\n--\narch/x86/include/asm/pgtable.h-733-\t/* This bit combination is used to mark shadow stacks */\narch/x86/include/asm/pgtable.h:734:\tWARN_ON_ONCE((pgprot_val(pgprot) \u0026 (_PAGE_DIRTY | _PAGE_RW)) ==\narch/x86/include/asm/pgtable.h-735-\t\t\t_PAGE_DIRTY);\n--\narch/x86/include/asm/pgtable.h=1703=bool arch_is_platform_page(u64 paddr);\n--\narch/x86/include/asm/pgtable.h-1716-({ \\\narch/x86/include/asm/pgtable.h:1717:\tWARN_ON_ONCE(pte_present(*ptep) \u0026\u0026 !pte_same(*ptep, pte)); \\\narch/x86/include/asm/pgtable.h-1718-\tset_pte(ptep, pte); \\\n--\narch/x86/include/asm/pgtable.h-1722-({ \\\narch/x86/include/asm/pgtable.h:1723:\tWARN_ON_ONCE(pmd_present(*pmdp) \u0026\u0026 !pmd_same(*pmdp, pmd)); \\\narch/x86/include/asm/pgtable.h-1724-\tset_pmd(pmdp, pmd); \\\n--\narch/x86/include/asm/pgtable.h-1728-({ \\\narch/x86/include/asm/pgtable.h:1729:\tWARN_ON_ONCE(pud_present(*pudp) \u0026\u0026 !pud_same(*pudp, pud)); \\\narch/x86/include/asm/pgtable.h-1730-\tset_pud(pudp, pud); \\\n--\narch/x86/include/asm/pgtable.h-1734-({ \\\narch/x86/include/asm/pgtable.h:1735:\tWARN_ON_ONCE(p4d_present(*p4dp) \u0026\u0026 !p4d_same(*p4dp, p4d)); \\\narch/x86/include/asm/pgtable.h-1736-\tset_p4d(p4dp, p4d); \\\n--\narch/x86/include/asm/pgtable.h-1740-({ \\\narch/x86/include/asm/pgtable.h:1741:\tWARN_ON_ONCE(pgd_present(*pgdp) \u0026\u0026 !pgd_same(*pgdp, pgd)); \\\narch/x86/include/asm/pgtable.h-1742-\tset_pgd(pgdp, pgd); \\\n--\narch/x86/include/asm/posted_intr.h=170=static inline bool pi_pending_this_cpu(unsigned int vector)\n--\narch/x86/include/asm/posted_intr.h-173-\narch/x86/include/asm/posted_intr.h:174:\tif (WARN_ON_ONCE(vector \u003e NR_VECTORS || vector \u003c FIRST_EXTERNAL_VECTOR))\narch/x86/include/asm/posted_intr.h-175-\t\treturn false;\n--\n\n"
}

13/2 2026/09/04 15:19 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 20578
							output: 37
							thoughts: 227
						

Thoughts:
**Examining Kernel MSR Access and Potential Bugs**

Okay, let's dive into this. I'm looking at `arch/x86/mm/extable.c` right now, specifically the `ex_handler_msr` function. My initial thought is that this section is critical for handling exceptions related to Model Specific Register (MSR) access, which is a sensitive area. The code is clearly checking for potential issues with both `WRMSR` (write) and `RDMSR` (read) instructions, especially when the access isn't deemed "safe." The `__ONCE_LITE_IF` macro is interesting; it suggests this check is optimized for performance, but only performs the check once in a while. The `pr_warn` calls are concerning, of course, as they indicate a potential unchecked MSR access error is happening. I need to keep in mind the register state (`struct pt_regs *regs`), the safety flag, and whether it's a read or write operation (`wrmsr`) to fully understand the context of these warnings. The logged MSR address and instruction pointer (`rIP`) are essential for debugging should a warning be encountered. Now, I'm going to shift my focus to `include/asm-generic/bug.h` – I need to check the generic bug handling mechanisms to understand what happens when one of these MSR access issues trips a bug. Understanding the interplay between these two files is key to assessing the robustness of the system with respect to MSR access.



14/2 2026/09/04 15:19 tool read-file
0m Args:
{
  "File": "include/asm-generic/bug.h",
  "FirstLine": 170,
  "LineCount": 40
}

Results:
{
  "Contents": " 170:\t\n 171:\t#define WARN_TAINT(condition, taint, format...) ({\t\t\t\\\n 172:\t\tint __ret_warn_on = !!(condition);\t\t\t\t\\\n 173:\t\tif (unlikely(__ret_warn_on))\t\t\t\t\t\\\n 174:\t\t\t__WARN_printf(taint, format);\t\t\t\t\\\n 175:\t\tunlikely(__ret_warn_on);\t\t\t\t\t\\\n 176:\t})\n 177:\t\n 178:\t#ifndef WARN_ON_ONCE\n 179:\t#define WARN_ON_ONCE(condition)\t\t\t\t\t\\\n 180:\t\tDO_ONCE_LITE_IF(condition, WARN_ON, 1)\n 181:\t#endif\n 182:\t\n 183:\t#ifndef WARN_ONCE\n 184:\t#define WARN_ONCE(condition, format...)\t\t\t\t\\\n 185:\t\tDO_ONCE_LITE_IF(condition, WARN, 1, format)\n 186:\t#endif\n 187:\t\n 188:\t#define WARN_TAINT_ONCE(condition, taint, format...)\t\t\\\n 189:\t\tDO_ONCE_LITE_IF(condition, WARN_TAINT, 1, taint, format)\n 190:\t\n 191:\t#else /* !CONFIG_BUG */\n 192:\t#ifndef HAVE_ARCH_BUG\n 193:\t#define BUG() do {\t\t\\\n 194:\t\tdo {} while (1);\t\\\n 195:\t\tunreachable();\t\t\\\n 196:\t} while (0)\n 197:\t#endif\n 198:\t\n 199:\t#ifndef HAVE_ARCH_BUG_ON\n 200:\t#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)\n 201:\t#endif\n 202:\t\n 203:\t#ifndef HAVE_ARCH_WARN_ON\n 204:\t#define WARN_ON(condition) ({\t\t\t\t\t\t\\\n 205:\t\tint __ret_warn_on = !!(condition);\t\t\t\t\\\n 206:\t\tunlikely(__ret_warn_on);\t\t\t\t\t\\\n 207:\t})\n 208:\t#endif\n 209:\t\n"
}

15/2 2026/09/04 15:19 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 21785
							output: 21
							thoughts: 132
						

Thoughts:
**Investigating the Once-Only Print Macros**

Okay, so I'm diving into these macros: `WARN_ON_ONCE`, `WARN_ONCE`, and `WARN_TAINT_ONCE`. They're all defined in `asm-generic/bug.h`, and it looks like they leverage `DO_ONCE_LITE_IF`. Right, and `DO_ONCE_LITE_IF` in turn uses `__ONCE_LITE_IF`.  Hmm, seems like a pattern here for "print this message once and only once". Then there's `printk_once`, which uses `DO_ONCE_LITE`, and even `ex_handler_msr` is in on the action using `__ONCE_LITE_IF`. Interesting.  I need to figure out the history and the rationale behind their introduction and usage, so the next logical step is to consult the git commit log, probably by checking the context of the files, to find the commit where these were first introduced to upstream Linux. That should give me a good understanding of what they're actually trying to achieve and any potential gotchas.



16/2 2026/09/04 15:19 tool grepper
0m Args:
{
  "Expression": "define __ONCE_LITE"
}

Results:
{
  "Output": "include/linux/once_lite.h-12-\ninclude/linux/once_lite.h:13:#define __ONCE_LITE()\t\t\t\t\t\t\t\\\ninclude/linux/once_lite.h-14-\t({\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/once_lite.h-24-\ninclude/linux/once_lite.h:25:#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\ninclude/linux/once_lite.h-26-\t(unlikely(condition) \u0026\u0026 __ONCE_LITE())\n"
}

17/2 2026/09/04 15:19 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 22325
							output: 30
							thoughts: 1797
						

Thoughts:
**Fuzzing Evaluation: once_lite.h Macro Refactoring**

Alright, let's break this down. My initial assessment is that these `__ONCE_LITE()` and `__ONCE_LITE_IF(condition)` macros in `include/linux/once_lite.h` are foundational – they spawn a lot of other important constructs like `DO_ONCE_LITE`, `WARN_ON_ONCE`, and so on. My first thought is "Is this macro a big deal, is it widely used?", and the answer is yes, very. This means this change has potentially far-reaching consequences across the kernel.

Now, let's carefully apply the established fuzzing guidelines. Reachability is the core concept, so let's focus on if the code is actually *executed*. From the guidelines, I know I can't take claims of "no functional change" at face value, refactorings are often where the subtle bugs hide, so this is critical. It's a refactoring of `__ONCE_LITE_IF(condition)` to separate the `__ONCE_LITE()` logic and redefine `__ONCE_LITE_IF` to wrap it in an `unlikely(condition)`. The conditional logic changes in all the callers, so I'm already in "fuzz this" territory.

Since this touches reachable and *executable* code, the answer is *yes*, this patch *does* modify reachable executable code. This warrants fuzzing. The guidelines instruct me to extract specific kernel functions into `FocusSymbols` to prevent the fuzzer from being diluted. No ubiquitous lifecycle functions should be listed, so general memory allocators, page fault, etc. are right out. I need to get as specific as possible. The primary changes are in static inline functions in the .h file. This means I need to identify non-static, feature-specific caller functions that actually *use* them. I've already done that by identifying `DO_ONCE_LITE` / `__ONCE_LITE_IF` / `DO_ONCE_LITE_IF` users, so now I need to choose the best symbols.

From the existing list I've got, here's what I'm thinking for `FocusSymbols`:

*   `net/ipv4/tcp_input.c:tcp_gro_dev_warn` since it is the function passed to `DO_ONCE_LITE_IF`. This is a very specific use-case I can focus on.
*   `arch/x86/mm/extable.c:ex_handler_msr`. This handles the MSR exceptions.
*   `net/core/dev.c:skb_checksum_help` and `net/core/dev.c:netdev_rx_csum_fault`, these are network focused functions, and not overly general, and should reveal interesting interactions.

I need to confirm if there are any `CONFIG_` options to enable and include them as the `EnableConfigs`. This should be relatively straightforward by checking the `Kconfig` files and `#ifdef`s.



18/2 2026/09/04 15:19 tool grepper
0m Args:
{
  "Expression": "(DO_ONCE_LITE|__ONCE_LITE)"
}

Results:
{
  "Output": "arch/x86/mm/extable.c=166=static bool ex_handler_msr(const struct exception_table_entry *fixup,\n--\narch/x86/mm/extable.c-168-{\narch/x86/mm/extable.c:169:\tif (__ONCE_LITE_IF(!safe \u0026\u0026 wrmsr)) {\narch/x86/mm/extable.c-170-\t\tpr_warn(\"unchecked MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pS)\\n\",\n--\narch/x86/mm/extable.c-175-\narch/x86/mm/extable.c:176:\tif (__ONCE_LITE_IF(!safe \u0026\u0026 !wrmsr)) {\narch/x86/mm/extable.c-177-\t\tpr_warn(\"unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\\n\",\n--\ndrivers/iommu/amd/iommu.c=1234=static int wait_on_sem(struct amd_iommu *iommu, u64 data)\n--\ndrivers/iommu/amd/iommu.c-1254-\t\tif (amd_iommu_dump)\ndrivers/iommu/amd/iommu.c:1255:\t\t\tDO_ONCE_LITE(dump_command_buffer, iommu);\ndrivers/iommu/amd/iommu.c-1256-\n--\nfs/erofs/internal.h=446=erofs_get_aops(struct inode *realinode)\n--\nfs/erofs/internal.h-450-\t\t\treturn ERR_PTR(-EOPNOTSUPP);\nfs/erofs/internal.h:451:\t\tDO_ONCE_LITE_IF(realinode-\u003ei_blkbits != PAGE_SHIFT,\nfs/erofs/internal.h-452-\t\t\t  erofs_info, realinode-\u003ei_sb,\n--\nfs/xfs/xfs_message.h=50=do {\t\t\t\t\t\t\t\t\t\\\n--\nfs/xfs/xfs_message.h-58-#define xfs_printk_once(func, dev, fmt, ...)\t\t\t\\\nfs/xfs/xfs_message.h:59:\tDO_ONCE_LITE(func, dev, fmt, ##__VA_ARGS__)\nfs/xfs/xfs_message.h-60-\n--\ninclude/asm-generic/bug.h=103=extern __printf(1, 2) void __warn_printk(const char *fmt, ...);\n--\ninclude/asm-generic/bug.h-179-#define WARN_ON_ONCE(condition)\t\t\t\t\t\\\ninclude/asm-generic/bug.h:180:\tDO_ONCE_LITE_IF(condition, WARN_ON, 1)\ninclude/asm-generic/bug.h-181-#endif\n--\ninclude/asm-generic/bug.h-184-#define WARN_ONCE(condition, format...)\t\t\t\t\\\ninclude/asm-generic/bug.h:185:\tDO_ONCE_LITE_IF(condition, WARN, 1, format)\ninclude/asm-generic/bug.h-186-#endif\n--\ninclude/asm-generic/bug.h-188-#define WARN_TAINT_ONCE(condition, taint, format...)\t\t\\\ninclude/asm-generic/bug.h:189:\tDO_ONCE_LITE_IF(condition, WARN_TAINT, 1, taint, format)\ninclude/asm-generic/bug.h-190-\n--\ninclude/linux/once_lite.h-9- */\ninclude/linux/once_lite.h:10:#define DO_ONCE_LITE(func, ...)\t\t\t\t\t\t\\\ninclude/linux/once_lite.h:11:\tDO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)\ninclude/linux/once_lite.h-12-\ninclude/linux/once_lite.h:13:#define __ONCE_LITE()\t\t\t\t\t\t\t\\\ninclude/linux/once_lite.h-14-\t({\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/once_lite.h-24-\ninclude/linux/once_lite.h:25:#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\ninclude/linux/once_lite.h:26:\t(unlikely(condition) \u0026\u0026 __ONCE_LITE())\ninclude/linux/once_lite.h-27-\ninclude/linux/once_lite.h:28:#define DO_ONCE_LITE_IF(condition, func, ...)\t\t\t\t\\\ninclude/linux/once_lite.h-29-\t({\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/once_lite.h-31-\t\t\t\t\t\t\t\t\t\\\ninclude/linux/once_lite.h:32:\t\tif (__ONCE_LITE_IF(__ret_do_once))\t\t\t\\\ninclude/linux/once_lite.h-33-\t\t\tfunc(__VA_ARGS__);\t\t\t\t\\\n--\ninclude/linux/printk.h=407=struct pi_entry {\n--\ninclude/linux/printk.h-649-#define printk_once(fmt, ...)\t\t\t\t\t\\\ninclude/linux/printk.h:650:\tDO_ONCE_LITE(printk, fmt, ##__VA_ARGS__)\ninclude/linux/printk.h-651-#define printk_deferred_once(fmt, ...)\t\t\t\t\\\ninclude/linux/printk.h:652:\tDO_ONCE_LITE(printk_deferred, fmt, ##__VA_ARGS__)\ninclude/linux/printk.h-653-#else\n--\ninclude/linux/skbuff.h=2750=static inline void skb_assert_len(struct sk_buff *skb)\n--\ninclude/linux/skbuff.h-2753-\tif (WARN_ONCE(!skb-\u003elen, \"%s\\n\", __func__))\ninclude/linux/skbuff.h:2754:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\ninclude/linux/skbuff.h-2755-#endif /* CONFIG_DEBUG_NET */\n--\nkernel/trace/trace.h=37=enum trace_type {\n--\nkernel/trace/trace.h-129-#define MEM_FAIL(condition, fmt, ...)\t\t\t\t\t\\\nkernel/trace/trace.h:130:\tDO_ONCE_LITE_IF(condition, pr_err, \"ERROR: \" fmt, ##__VA_ARGS__)\nkernel/trace/trace.h-131-\n--\nnet/core/dev.c=3617=int skb_checksum_help(struct sk_buff *skb)\n--\nnet/core/dev.c-3645-\tif (unlikely(offset \u003e= skb_headlen(skb))) {\nnet/core/dev.c:3646:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\nnet/core/dev.c-3647-\t\tWARN_ONCE(true, \"offset (%d) \u003e= skb_headlen() (%u)\\n\",\n--\nnet/core/dev.c-3654-\tif (unlikely(offset + sizeof(__sum16) \u003e skb_headlen(skb))) {\nnet/core/dev.c:3655:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\nnet/core/dev.c-3656-\t\tWARN_ONCE(true, \"offset+2 (%zu) \u003e skb_headlen() (%u)\\n\",\n--\nnet/core/dev.c=3740=void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)\nnet/core/dev.c-3741-{\nnet/core/dev.c:3742:\tDO_ONCE_LITE(do_netdev_rx_csum_fault, dev, skb);\nnet/core/dev.c-3743-}\n--\nnet/ipv4/tcp_input.c=227=static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb)\n--\nnet/ipv4/tcp_input.c-263-\t\t/* Account for possibly-removed options */\nnet/ipv4/tcp_input.c:264:\t\tDO_ONCE_LITE_IF(len \u003e icsk-\u003eicsk_ack.rcv_mss + MAX_TCP_OPTION_SPACE,\nnet/ipv4/tcp_input.c-265-\t\t\t\ttcp_gro_dev_warn, sk, skb, len);\n--\nnet/mac80211/debug.h=125=do {\t\t\t\t\t\t\t\t\t\\\n--\nnet/mac80211/debug.h-156-#define link_err_once(link, fmt, ...)\t\t\t\t\t\\\nnet/mac80211/debug.h:157:\tDO_ONCE_LITE(link_err, link, fmt, ##__VA_ARGS__)\nnet/mac80211/debug.h-158-#define link_id_info(sdata, link_id, fmt, ...)\t\t\t\t\\\n--\nrust/kernel/print.rs=426=macro_rules! pr_cont (\n--\nrust/kernel/print.rs-433-///\nrust/kernel/print.rs:434:/// This structure provides the Rust equivalent of the kernel's `DO_ONCE_LITE` macro.\nrust/kernel/print.rs-435-/// While it would be possible to implement the feature entirely as a Rust macro,\n--\nrust/kernel/print.rs=468=    pub fn call_once\u003cF\u003e(\u0026self, f: F) -\u003e bool\n--\nrust/kernel/print.rs-491-///\nrust/kernel/print.rs:492:/// This is equivalent to the kernel's `DO_ONCE_LITE` macro.\nrust/kernel/print.rs-493-///\n"
}

19/2 2026/09/04 15:19 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 27367
							output: 21
							thoughts: 65
						

Thoughts:
Okay, let's dive into this. I need to get a handle on the current state of affairs, so I'll quickly check some key variables and functions related to network checksum offload and Generic Receive Offload (GRO). I'm thinking specifically about `ex_handler_msr`, `netdev_rx_csum_fault`, `skb_checksum_help`, and `tcp_gro_dev_warn`. These seem like the prime suspects in whatever I'm troubleshooting.

Now, a crucial detail to verify is whether `tcp_gro_dev_warn` is declared as static or non-static. The scope and visibility of that function will significantly impact how it's being used and potentially where the problem lies. That’s a key piece of information that will direct my next investigative steps. Static or not, that'll be telling.



20/2 2026/09/04 15:20 tool grepper
0m Args:
{
  "Expression": "tcp_gro_dev_warn"
}

Results:
{
  "Output": "net/ipv4/tcp_input.c=205=static void bpf_skops_established(struct sock *sk, int bpf_op,\n--\nnet/ipv4/tcp_input.c-210-\nnet/ipv4/tcp_input.c:211:static __cold void tcp_gro_dev_warn(const struct sock *sk, const struct sk_buff *skb,\nnet/ipv4/tcp_input.c-212-\t\t\t\t    unsigned int len)\n--\nnet/ipv4/tcp_input.c=227=static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb)\n--\nnet/ipv4/tcp_input.c-264-\t\tDO_ONCE_LITE_IF(len \u003e icsk-\u003eicsk_ack.rcv_mss + MAX_TCP_OPTION_SPACE,\nnet/ipv4/tcp_input.c:265:\t\t\t\ttcp_gro_dev_warn, sk, skb, len);\nnet/ipv4/tcp_input.c-266-\t\t/* If the skb has a len of exactly 1*MSS and has the PSH bit\n"
}

21/2 2026/09/04 15:20 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 27931
							output: 20
							thoughts: 212
						

Thoughts:
**Investigating Potential Network Checksum Issues**

Okay, let's dive into this. First, I'm taking a look at `netdev_rx_csum_fault`. It's a key function for handling checksum faults, and from the code snippet, it looks pretty straightforward; it just calls `DO_ONCE_LITE`. The fact that it's exported, or at least not static, immediately makes it interesting from a dependency standpoint. I need to keep that in mind.

Next, I'll examine `skb_checksum_help`. This one is *explicitly* exported via `EXPORT_SYMBOL`, which means it's designed to be used by other parts of the kernel. That's a strong signal, and I need to consider its implications. This is important to understand the overall picture.

Then, there's `ex_handler_msr`, which is where things get a bit more nuanced. It’s declared as static, which typically limits its scope, but I see that it’s called by `fixup_exception`. That’s worth noting, as internal calls can still have implications depending on how the error handling and exception framework works. So, even though it's static, it's still being used, just internally, so I'll consider its role in the exception path.

Finally, I'll pivot and check the callers of `xfs_printk_once` within the XFS filesystem code. This might provide further insights into how checksum errors or related issues are being handled or logged within the file system itself, which might be helpful from a diagnostics point of view. I want to build a complete picture of where these functions are being used.



22/2 2026/09/04 15:20 tool grepper
0m Args:
{
  "Expression": "xfs_.*_once"
}

Results:
{
  "Output": "fs/xfs/xfs_ioctl.c=1219=xfs_file_ioctl(\n--\nfs/xfs/xfs_ioctl.c-1242-\tcase XFS_IOC_FREESP64:\nfs/xfs/xfs_ioctl.c:1243:\t\txfs_warn_once(mp,\nfs/xfs/xfs_ioctl.c-1244-\t\"%s should use fallocate; XFS_IOC_{ALLOC,FREE}SP ioctl unsupported\",\n--\nfs/xfs/xfs_log_recover.c=2888=xlog_recover_process(\n--\nfs/xfs/xfs_log_recover.c-2908-\t\tif (other_crc == expected_crc) {\nfs/xfs/xfs_log_recover.c:2909:\t\t\txfs_notice_once(log-\u003el_mp,\nfs/xfs/xfs_log_recover.c-2910-\t\"Fixing up incorrect CRC due to padding.\");\n--\nfs/xfs/xfs_message.h=50=do {\t\t\t\t\t\t\t\t\t\\\n--\nfs/xfs/xfs_message.h-57-\nfs/xfs/xfs_message.h:58:#define xfs_printk_once(func, dev, fmt, ...)\t\t\t\\\nfs/xfs/xfs_message.h-59-\tDO_ONCE_LITE(func, dev, fmt, ##__VA_ARGS__)\n--\nfs/xfs/xfs_message.h-77-\nfs/xfs/xfs_message.h:78:#define xfs_warn_once(dev, fmt, ...)\t\t\t\t\\\nfs/xfs/xfs_message.h:79:\txfs_printk_once(xfs_warn, dev, fmt, ##__VA_ARGS__)\nfs/xfs/xfs_message.h:80:#define xfs_notice_once(dev, fmt, ...)\t\t\t\t\\\nfs/xfs/xfs_message.h:81:\txfs_printk_once(xfs_notice, dev, fmt, ##__VA_ARGS__)\nfs/xfs/xfs_message.h:82:#define xfs_info_once(dev, fmt, ...)\t\t\t\t\\\nfs/xfs/xfs_message.h:83:\txfs_printk_once(xfs_info, dev, fmt, ##__VA_ARGS__)\nfs/xfs/xfs_message.h-84-\n--\nfs/xfs/xfs_mount.c=1447=xfs_dec_freecounter(\n--\nfs/xfs/xfs_mount.c-1496-\t\t\tif (ctr == XC_FREE_BLOCKS)\nfs/xfs/xfs_mount.c:1497:\t\t\t\txfs_warn_once(mp,\nfs/xfs/xfs_mount.c-1498-\"Reserve blocks depleted! Consider increasing reserve pool size.\");\n--\nfs/xfs/xfs_super.c=778=STATIC void\nfs/xfs/xfs_super.c:779:xfs_fs_inode_init_once(\nfs/xfs/xfs_super.c-780-\tvoid\t\t\t*inode)\n--\nfs/xfs/xfs_super.c=1702=xfs_fs_fill_super(\n--\nfs/xfs/xfs_super.c-1812-\t\t}\nfs/xfs/xfs_super.c:1813:\t\txfs_warn_once(mp,\nfs/xfs/xfs_super.c-1814-\t\"Deprecated V4 format (crc=0) will not be supported after September 2030.\");\n--\nfs/xfs/xfs_super.c-1819-#ifdef CONFIG_XFS_SUPPORT_ASCII_CI\nfs/xfs/xfs_super.c:1820:\t\txfs_warn_once(mp,\nfs/xfs/xfs_super.c-1821-\t\"Deprecated ASCII case-insensitivity feature (ascii-ci=1) will not be supported after September 2030.\");\n--\nfs/xfs/xfs_super.c=2353=xfs_init_caches(void)\n--\nfs/xfs/xfs_super.c-2428-\t\t\t\t\t    SLAB_ACCOUNT),\nfs/xfs/xfs_super.c:2429:\t\t\t\t\t   xfs_fs_inode_init_once);\nfs/xfs/xfs_super.c-2430-\tif (!xfs_inode_cache)\n"
}

23/2 2026/09/04 15:20 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 29667
							output: 159
							thoughts: 558
						

Thoughts:
**Fuzzing Decision for `once_lite.h`**

Okay, let's break this down. First, I need to confirm if `once_lite.h` requires any special configuration to be enabled. It looks like it's always included without any specific config guard, so no, no specific configs are required – it uses the standard kernel configurations.

Now, the critical question: is this worth fuzzing? The changes are modifying core kernel infrastructure, specifically `include/linux/once_lite.h`, and that's used throughout the kernel – networking, bug handling, filesystems – the works. Given the guidelines I have, the answer is a definitive *yes*. The criteria explicitly state that any modification to "core subsystems" like synchronization/locking or refactorings that restructure reachable data structures or algorithm flows warrant fuzzing. This definitely falls into both categories. So, `WorthFuzzing` is `true`.

Next, I need to identify suitable focus symbols. I'm looking for non-ubiquitous, feature-specific functions that exercise `__ONCE_LITE_IF` or related macros. I've got a list of potential candidates: `netdev_rx_csum_fault`, `skb_checksum_help`, `xfs_file_ioctl`, and `xfs_fs_fill_super`. After reviewing them, these are good choices. They all directly invoke `DO_ONCE_LITE` or `DO_ONCE_LITE_IF`. Perfect.

Finally, let's assemble the `set-results` data.

*   `WorthFuzzing`: `true`
*   `Reasoning`: Modification of core kernel infrastructure (`include/linux/once_lite.h`), directly impacting synchronization primitives used across core subsystems (networking, bug handling, filesystems). Refactoring of reachable data structures and algorithm flows.
*   `FocusSymbols`: `["netdev_rx_csum_fault", "skb_checksum_help", "xfs_file_ioctl", "xfs_fs_fill_super"]`
*   `EnableConfigs`: `[]` (because `once_lite.h` is always included)

Time to call `set-results`.



24/2 2026/09/04 15:20 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [
    "netdev_rx_csum_fault",
    "skb_checksum_help",
    "xfs_file_ioctl",
    "xfs_fs_fill_super"
  ],
  "Reasoning": "The patch refactors the DO_ONCE_LITE / __ONCE_LITE_IF helper macro definitions in include/linux/once_lite.h, separating out __ONCE_LITE() and altering the condition evaluation logic for one-time execution across the kernel. This is reachable core infrastructure used in networking, filesystems, and generic bug/warning macros, warranting fuzzing to verify runtime evaluation behavior.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [
    "netdev_rx_csum_fault",
    "skb_checksum_help",
    "xfs_file_ioctl",
    "xfs_fs_fill_super"
  ],
  "Reasoning": "The patch refactors the DO_ONCE_LITE / __ONCE_LITE_IF helper macro definitions in include/linux/once_lite.h, separating out __ONCE_LITE() and altering the condition evaluation logic for one-time execution across the kernel. This is reachable core infrastructure used in networking, filesystems, and generic bug/warning macros, warranting fuzzing to verify runtime evaluation behavior.",
  "WorthFuzzing": true
}

25/1 2026/09/04 15:20 action If
0m Args:
{
  "WorthFuzzing": true
}

Results:
null

26/2 2026/09/04 15:20 agent kmsan-evaluator
0m Model:
core

Args:
null

Results:
{
  "KMSANReasoning": "The patch refactors the `__ONCE_LITE_IF` macro in `include/linux/once_lite.h` into a standalone `__ONCE_LITE()` helper and short-circuiting `__ONCE_LITE_IF(condition)`.\n\nAll variables used within the macros (`__already_done` in `.data..once` and local boolean `__ret_once = false`) are static or explicitly initialized. The patch does not touch dynamically allocated memory, uninitialized stack variables, memory copied to userspace, or data structures where uninitialized fields could be read. There are no uninitialized memory risks or infoleaks, making a dedicated KMSAN session unnecessary.",
  "NeedsKMSAN": false
}

Instruction:
You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.

CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
  a comprehensive suite of debugging tools and sanitizers, including KASAN
  (out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
  (locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
  or page allocations) and kernel-to-user memory info-leaks.

Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.

Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.

Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
   attributes, ioctl output arguments, socket options, or BPF buffers) where fields
   or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
   or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
   could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
   uninitialized bytes of existing buffers.

Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
  dereferences, locking deadlocks, or use-after-free bugs (these are already caught
  by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
  or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.

Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
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 52116c7b958f885afa734a9edad37e0d0c7194bd
Author: syz-cluster <triage@syzkaller.com>
Date:   Fri Sep 4 15:18:35 2026 +0000

    syz-cluster: applied patch under review

diff --git a/include/linux/once_lite.h b/include/linux/once_lite.h
index 236592c4eeb1a..5e2b67039aaf0 100644
--- a/include/linux/once_lite.h
+++ b/include/linux/once_lite.h
@@ -10,19 +10,21 @@
 #define DO_ONCE_LITE(func, ...)						\
 	DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)
 
-#define __ONCE_LITE_IF(condition)					\
+#define __ONCE_LITE()							\
 	({								\
 		static bool __section(".data..once") __already_done;	\
-		bool __ret_cond = !!(condition);			\
 		bool __ret_once = false;				\
 									\
-		if (unlikely(__ret_cond) && unlikely(!__already_done)) {\
+		if (unlikely(!__already_done)) {			\
 			__already_done = true;				\
 			__ret_once = true;				\
 		}							\
 		unlikely(__ret_once);					\
 	})
 
+#define __ONCE_LITE_IF(condition)					\
+	(unlikely(condition) && __ONCE_LITE())
+
 #define DO_ONCE_LITE_IF(condition, func, ...)				\
 	({								\
 		bool __ret_do_once = !!(condition);			\

27/3 2026/09/04 15:20 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 2261
							output: 35
							thoughts: 429
						

Thoughts:
**Analyzing the `once_lite.h` Patch**

Okay, let's dive into this patch. My initial thought is that it's related to some optimization or perhaps simplification of a "once" execution pattern within the kernel. The diff suggests that we're looking at a header file, so this likely provides macros or inline functions.

I see a revised implementation of `__ONCE_LITE_IF`. Previously, it appears to have a boolean `condition` passed into the macro; now there's an `__ONCE_LITE()` macro. The goal is likely to execute some code *only once* if a condition is met, so `DO_ONCE_LITE_IF` must be critical in allowing that control. I see the usage of `unlikely()` which indicates optimization toward performance based on an expected, but not certain, condition. I also notice the use of a static boolean variable `__already_done` located in `.data..once`. Putting it there probably guarantees initialization to zero and placement within a section likely meant for initialized data that won't be modified.

I'll need to look at the surrounding code to fully understand the impact. I suspect there may be a performance improvement. By pulling the initial `condition` check out into the macro definition, there's possibly less overhead. Now, the condition is evaluated only within the `DO_ONCE_LITE_IF` macro and only once. If the condition is always false, there is no overhead from the once code. Also, if there are multiple calls to the same once condition, this will short-circuit any later invocations.

This seems like a careful and focused patch. I'll need to check the full context to ensure that it has no unintended side effects, but it seems like a reasonable optimization or simplification of the `once` pattern.



28/3 2026/09/04 15:20 tool read-file
0m Args:
{
  "File": "include/linux/once_lite.h",
  "FirstLine": 1,
  "LineCount": 50
}

Results:
{
  "Contents": "   1:\t/* SPDX-License-Identifier: GPL-2.0 */\n   2:\t#ifndef _LINUX_ONCE_LITE_H\n   3:\t#define _LINUX_ONCE_LITE_H\n   4:\t\n   5:\t#include \u003clinux/types.h\u003e\n   6:\t\n   7:\t/* Call a function once. Similar to DO_ONCE(), but does not use jump label\n   8:\t * patching via static keys.\n   9:\t */\n  10:\t#define DO_ONCE_LITE(func, ...)\t\t\t\t\t\t\\\n  11:\t\tDO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)\n  12:\t\n  13:\t#define __ONCE_LITE()\t\t\t\t\t\t\t\\\n  14:\t\t({\t\t\t\t\t\t\t\t\\\n  15:\t\t\tstatic bool __section(\".data..once\") __already_done;\t\\\n  16:\t\t\tbool __ret_once = false;\t\t\t\t\\\n  17:\t\t\t\t\t\t\t\t\t\t\\\n  18:\t\t\tif (unlikely(!__already_done)) {\t\t\t\\\n  19:\t\t\t\t__already_done = true;\t\t\t\t\\\n  20:\t\t\t\t__ret_once = true;\t\t\t\t\\\n  21:\t\t\t}\t\t\t\t\t\t\t\\\n  22:\t\t\tunlikely(__ret_once);\t\t\t\t\t\\\n  23:\t\t})\n  24:\t\n  25:\t#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\n  26:\t\t(unlikely(condition) \u0026\u0026 __ONCE_LITE())\n  27:\t\n  28:\t#define DO_ONCE_LITE_IF(condition, func, ...)\t\t\t\t\\\n  29:\t\t({\t\t\t\t\t\t\t\t\\\n  30:\t\t\tbool __ret_do_once = !!(condition);\t\t\t\\\n  31:\t\t\t\t\t\t\t\t\t\t\\\n  32:\t\t\tif (__ONCE_LITE_IF(__ret_do_once))\t\t\t\\\n  33:\t\t\t\tfunc(__VA_ARGS__);\t\t\t\t\\\n  34:\t\t\t\t\t\t\t\t\t\t\\\n  35:\t\t\tunlikely(__ret_do_once);\t\t\t\t\\\n  36:\t\t})\n  37:\t\n  38:\t#endif /* _LINUX_ONCE_LITE_H */\n"
}

29/3 2026/09/04 15:20 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 3658
							output: 19
							thoughts: 274
						

Thoughts:
**Analyzing the `once_lite.h` Implementation**

Okay, let's dive into this `once_lite.h` header and understand its purpose. I see the original implementation of `__ONCE_LITE_IF` uses a static boolean flag, `__already_done`, placed in the `.data..once` section. It seems to be implementing a lightweight "once" execution paradigm, likely for initialization or conditional execution that should happen only once. The original code's approach is interesting; it's using the `({ ... })` GCC statement expression to provide some sort of atomic (or as atomic as the compiler allows) test-and-set operation, along with a return value that indicates whether the condition was true and the action was taken for the first time.

The patch simplifies things by defining `__ONCE_LITE()` and using it within `__ONCE_LITE_IF(condition)`. It's still using the same `__already_done` static boolean, but now it checks for a `condition` before calling the "once" check. The logic in the patched version is clearer; the intent is to only execute something if the condition is *unlikely* to be true and the "once" check hasn't happened.

Now, my next step is to figure out where this macro is actually used in the kernel. I need to see the context to really grasp its practical application. I'll need to search the kernel source for instances of `__ONCE_LITE`, `__ONCE_LITE_IF`, and `DO_ONCE_LITE` to understand how it's being leveraged in practice. That will illuminate the optimizations or specific use cases this is designed for.



30/3 2026/09/04 15:20 tool grepper
0m Args:
{
  "Expression": "ONCE_LITE"
}

Results:
{
  "Output": "arch/x86/mm/extable.c=166=static bool ex_handler_msr(const struct exception_table_entry *fixup,\n--\narch/x86/mm/extable.c-168-{\narch/x86/mm/extable.c:169:\tif (__ONCE_LITE_IF(!safe \u0026\u0026 wrmsr)) {\narch/x86/mm/extable.c-170-\t\tpr_warn(\"unchecked MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pS)\\n\",\n--\narch/x86/mm/extable.c-175-\narch/x86/mm/extable.c:176:\tif (__ONCE_LITE_IF(!safe \u0026\u0026 !wrmsr)) {\narch/x86/mm/extable.c-177-\t\tpr_warn(\"unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\\n\",\n--\ndrivers/iommu/amd/iommu.c=1234=static int wait_on_sem(struct amd_iommu *iommu, u64 data)\n--\ndrivers/iommu/amd/iommu.c-1254-\t\tif (amd_iommu_dump)\ndrivers/iommu/amd/iommu.c:1255:\t\t\tDO_ONCE_LITE(dump_command_buffer, iommu);\ndrivers/iommu/amd/iommu.c-1256-\n--\nfs/erofs/internal.h=446=erofs_get_aops(struct inode *realinode)\n--\nfs/erofs/internal.h-450-\t\t\treturn ERR_PTR(-EOPNOTSUPP);\nfs/erofs/internal.h:451:\t\tDO_ONCE_LITE_IF(realinode-\u003ei_blkbits != PAGE_SHIFT,\nfs/erofs/internal.h-452-\t\t\t  erofs_info, realinode-\u003ei_sb,\n--\nfs/xfs/xfs_message.h=50=do {\t\t\t\t\t\t\t\t\t\\\n--\nfs/xfs/xfs_message.h-58-#define xfs_printk_once(func, dev, fmt, ...)\t\t\t\\\nfs/xfs/xfs_message.h:59:\tDO_ONCE_LITE(func, dev, fmt, ##__VA_ARGS__)\nfs/xfs/xfs_message.h-60-\n--\ninclude/asm-generic/bug.h=103=extern __printf(1, 2) void __warn_printk(const char *fmt, ...);\n--\ninclude/asm-generic/bug.h-179-#define WARN_ON_ONCE(condition)\t\t\t\t\t\\\ninclude/asm-generic/bug.h:180:\tDO_ONCE_LITE_IF(condition, WARN_ON, 1)\ninclude/asm-generic/bug.h-181-#endif\n--\ninclude/asm-generic/bug.h-184-#define WARN_ONCE(condition, format...)\t\t\t\t\\\ninclude/asm-generic/bug.h:185:\tDO_ONCE_LITE_IF(condition, WARN, 1, format)\ninclude/asm-generic/bug.h-186-#endif\n--\ninclude/asm-generic/bug.h-188-#define WARN_TAINT_ONCE(condition, taint, format...)\t\t\\\ninclude/asm-generic/bug.h:189:\tDO_ONCE_LITE_IF(condition, WARN_TAINT, 1, taint, format)\ninclude/asm-generic/bug.h-190-\n--\ninclude/linux/once_lite.h-1-/* SPDX-License-Identifier: GPL-2.0 */\ninclude/linux/once_lite.h:2:#ifndef _LINUX_ONCE_LITE_H\ninclude/linux/once_lite.h:3:#define _LINUX_ONCE_LITE_H\ninclude/linux/once_lite.h-4-\n--\ninclude/linux/once_lite.h-9- */\ninclude/linux/once_lite.h:10:#define DO_ONCE_LITE(func, ...)\t\t\t\t\t\t\\\ninclude/linux/once_lite.h:11:\tDO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)\ninclude/linux/once_lite.h-12-\ninclude/linux/once_lite.h:13:#define __ONCE_LITE()\t\t\t\t\t\t\t\\\ninclude/linux/once_lite.h-14-\t({\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/once_lite.h-24-\ninclude/linux/once_lite.h:25:#define __ONCE_LITE_IF(condition)\t\t\t\t\t\\\ninclude/linux/once_lite.h:26:\t(unlikely(condition) \u0026\u0026 __ONCE_LITE())\ninclude/linux/once_lite.h-27-\ninclude/linux/once_lite.h:28:#define DO_ONCE_LITE_IF(condition, func, ...)\t\t\t\t\\\ninclude/linux/once_lite.h-29-\t({\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/once_lite.h-31-\t\t\t\t\t\t\t\t\t\\\ninclude/linux/once_lite.h:32:\t\tif (__ONCE_LITE_IF(__ret_do_once))\t\t\t\\\ninclude/linux/once_lite.h-33-\t\t\tfunc(__VA_ARGS__);\t\t\t\t\\\n--\ninclude/linux/once_lite.h-37-\ninclude/linux/once_lite.h:38:#endif /* _LINUX_ONCE_LITE_H */\n--\ninclude/linux/printk.h=407=struct pi_entry {\n--\ninclude/linux/printk.h-649-#define printk_once(fmt, ...)\t\t\t\t\t\\\ninclude/linux/printk.h:650:\tDO_ONCE_LITE(printk, fmt, ##__VA_ARGS__)\ninclude/linux/printk.h-651-#define printk_deferred_once(fmt, ...)\t\t\t\t\\\ninclude/linux/printk.h:652:\tDO_ONCE_LITE(printk_deferred, fmt, ##__VA_ARGS__)\ninclude/linux/printk.h-653-#else\n--\ninclude/linux/skbuff.h=2750=static inline void skb_assert_len(struct sk_buff *skb)\n--\ninclude/linux/skbuff.h-2753-\tif (WARN_ONCE(!skb-\u003elen, \"%s\\n\", __func__))\ninclude/linux/skbuff.h:2754:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\ninclude/linux/skbuff.h-2755-#endif /* CONFIG_DEBUG_NET */\n--\nkernel/trace/trace.h=37=enum trace_type {\n--\nkernel/trace/trace.h-129-#define MEM_FAIL(condition, fmt, ...)\t\t\t\t\t\\\nkernel/trace/trace.h:130:\tDO_ONCE_LITE_IF(condition, pr_err, \"ERROR: \" fmt, ##__VA_ARGS__)\nkernel/trace/trace.h-131-\n--\nnet/core/dev.c=3617=int skb_checksum_help(struct sk_buff *skb)\n--\nnet/core/dev.c-3645-\tif (unlikely(offset \u003e= skb_headlen(skb))) {\nnet/core/dev.c:3646:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\nnet/core/dev.c-3647-\t\tWARN_ONCE(true, \"offset (%d) \u003e= skb_headlen() (%u)\\n\",\n--\nnet/core/dev.c-3654-\tif (unlikely(offset + sizeof(__sum16) \u003e skb_headlen(skb))) {\nnet/core/dev.c:3655:\t\tDO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);\nnet/core/dev.c-3656-\t\tWARN_ONCE(true, \"offset+2 (%zu) \u003e skb_headlen() (%u)\\n\",\n--\nnet/core/dev.c=3740=void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)\nnet/core/dev.c-3741-{\nnet/core/dev.c:3742:\tDO_ONCE_LITE(do_netdev_rx_csum_fault, dev, skb);\nnet/core/dev.c-3743-}\n--\nnet/ipv4/tcp_input.c=227=static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb)\n--\nnet/ipv4/tcp_input.c-263-\t\t/* Account for possibly-removed options */\nnet/ipv4/tcp_input.c:264:\t\tDO_ONCE_LITE_IF(len \u003e icsk-\u003eicsk_ack.rcv_mss + MAX_TCP_OPTION_SPACE,\nnet/ipv4/tcp_input.c-265-\t\t\t\ttcp_gro_dev_warn, sk, skb, len);\n--\nnet/mac80211/debug.h=125=do {\t\t\t\t\t\t\t\t\t\\\n--\nnet/mac80211/debug.h-156-#define link_err_once(link, fmt, ...)\t\t\t\t\t\\\nnet/mac80211/debug.h:157:\tDO_ONCE_LITE(link_err, link, fmt, ##__VA_ARGS__)\nnet/mac80211/debug.h-158-#define link_id_info(sdata, link_id, fmt, ...)\t\t\t\t\\\n--\nrust/kernel/print.rs=426=macro_rules! pr_cont (\n--\nrust/kernel/print.rs-433-///\nrust/kernel/print.rs:434:/// This structure provides the Rust equivalent of the kernel's `DO_ONCE_LITE` macro.\nrust/kernel/print.rs-435-/// While it would be possible to implement the feature entirely as a Rust macro,\n--\nrust/kernel/print.rs=468=    pub fn call_once\u003cF\u003e(\u0026self, f: F) -\u003e bool\n--\nrust/kernel/print.rs-491-///\nrust/kernel/print.rs:492:/// This is equivalent to the kernel's `DO_ONCE_LITE` macro.\nrust/kernel/print.rs-493-///\n"
}

31/3 2026/09/04 15:20 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 6994
							output: 171
							thoughts: 685
						

Thoughts:
**Analyzing the Refactoring of `__ONCE_LITE_IF`**

Okay, let's break this down. This patch is a straightforward refactoring of the `__ONCE_LITE_IF` macro in `include/linux/once_lite.h`. The original version was a bit clunky, combining the condition check and the "once" execution within a single macro. This refactoring cleanly separates the condition evaluation from the "once" execution into two macros: `__ONCE_LITE_IF(condition)` and `__ONCE_LITE()`.

The key change is the introduction of `__ONCE_LITE()`, which encapsulates the logic for the "once" execution.  It checks a static boolean variable, `__already_done`, in the `.data..once` section. Critically, this static variable is initialized to `false` (zero-initialized), as it resides in a BSS/data section. The condition check in the new `__ONCE_LITE_IF` is now a simple short-circuit evaluation: `unlikely(condition) && __ONCE_LITE()`. This means if the condition is *unlikely* to be true and the *condition* is *true*, then `__ONCE_LITE()` runs only once.

My immediate concern is, of course, uninitialized memory risks. But, reviewing the code, it's clear there are none.

*   No new memory buffers are allocated on either the stack or the heap.
*   No data is copied to or from userspace, so there are no potential information leaks.
*   The `__already_done` variable is static and thus initialized by the linker to `false`.
*   The `__ret_once` variable is explicitly initialized to `false`.
*   The logic itself is a straightforward boolean evaluation with a static flag's state change, so there's no way it relies on uninitialized values.

I'm thinking about KASAN and KMSAN here. KASAN will catch general memory safety issues, including problems with static variables, and KMSAN is all about detecting uninitialized memory reads (heap, stack, page allocations) and leaks to userspace. This patch is a pure refactor; it optimizes the existing logic. It doesn't introduce any new memory, nor does it read uninitialized values.

Therefore, this refactoring does not need KMSAN analysis, and `NeedsKMSAN` is definitely `false`. I can go ahead and construct the response.



32/3 2026/09/04 15:21 tool set-results
0m Args:
{
  "KMSANReasoning": "The patch refactors the `__ONCE_LITE_IF` macro in `include/linux/once_lite.h` into a standalone `__ONCE_LITE()` helper and short-circuiting `__ONCE_LITE_IF(condition)`.\n\nAll variables used within the macros (`__already_done` in `.data..once` and local boolean `__ret_once = false`) are static or explicitly initialized. The patch does not touch dynamically allocated memory, uninitialized stack variables, memory copied to userspace, or data structures where uninitialized fields could be read. There are no uninitialized memory risks or infoleaks, making a dedicated KMSAN session unnecessary.",
  "NeedsKMSAN": false
}

Results:
{
  "KMSANReasoning": "The patch refactors the `__ONCE_LITE_IF` macro in `include/linux/once_lite.h` into a standalone `__ONCE_LITE()` helper and short-circuiting `__ONCE_LITE_IF(condition)`.\n\nAll variables used within the macros (`__already_done` in `.data..once` and local boolean `__ret_once = false`) are static or explicitly initialized. The patch does not touch dynamically allocated memory, uninitialized stack variables, memory copied to userspace, or data structures where uninitialized fields could be read. There are no uninitialized memory risks or infoleaks, making a dedicated KMSAN session unnecessary.",
  "NeedsKMSAN": false
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)