| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/15 07:56 | flow | finding-triage |
2mArgs:null Results: {
"Introduced": false,
"Reasoning": "The crash report shows a soft lockup (`watchdog: BUG: soft lockup - CPU#1 stuck for 112s!`) on CPU#1 while executing a clone system call (`__x64_sys_clone`). During `dup_mmap` / `copy_page_range` / `copy_pmd_range`, `page_table_check_set` calls `pfn_valid`, which enters an RCU read critical section and calls `lock_acquire`. Because a BPF program or perf tracepoint was attached to lock debugging tracepoints (`lock_acquire` / `lock_release`), every page validation triggers `perf_trace_lock_acquire` -\u003e `trace_call_bpf` -\u003e `lock_release` -\u003e `perf_trace_lock`. This tracing overhead across many page table entries leads to CPU starvation and the watchdog soft lockup.\n\nThe tested patch series (\"bpf: Defer freeing a struct_ops map until its progs are done\") only modifies `kernel/bpf/bpf_struct_ops.c` (and selftests under `tools/testing/selftests/bpf/`) to defer freeing a struct_ops map via `call_rcu_tasks_trace` and a workqueue. It does not touch `copy_pmd_range`, `page_table_check`, `pfn_valid`, lockdep, perf tracing, or general process management. None of the functions or structures modified by the patch series are present in the call trace.\n\nTherefore, the soft lockup is unrelated to the patch series and was not introduced by it."
} |
| 1/1 | 2026/10/15 07:56 | action | prepare-finding-overview |
0mArgs:null Results: {
"DiffStat": "kernel/bpf/bpf_struct_ops.c | 28 ++++++++++++++++++++-\n .../bpf/prog_tests/test_struct_ops_assoc.c | 29 +++++++++++++++++++---\n .../bpf/progs/struct_ops_assoc_in_timer.c | 16 ++++++++++++\n 3 files changed, 68 insertions(+), 5 deletions(-)",
"HasCover": false,
"PatchCount": 3,
"PatchList": "The patch series contains 3 patches:\n[1] [PATCH bpf-next v3 1/3] bpf: Defer freeing a struct_ops map until its progs are done\n[2] [PATCH bpf-next v3 2/3] selftests/bpf: Test freeing a struct_ops map under a running prog\n[3] [PATCH bpf-next v3 3/3] selftests/bpf: Wait for the struct_ops map to be freed in assoc_in_timer"
} |
| 2/1 | 2026/10/15 07:56 | agent | finding-triage-evaluator |
2mModel:core Args: null Results: {
"Introduced": false,
"Reasoning": "The crash report shows a soft lockup (`watchdog: BUG: soft lockup - CPU#1 stuck for 112s!`) on CPU#1 while executing a clone system call (`__x64_sys_clone`). During `dup_mmap` / `copy_page_range` / `copy_pmd_range`, `page_table_check_set` calls `pfn_valid`, which enters an RCU read critical section and calls `lock_acquire`. Because a BPF program or perf tracepoint was attached to lock debugging tracepoints (`lock_acquire` / `lock_release`), every page validation triggers `perf_trace_lock_acquire` -\u003e `trace_call_bpf` -\u003e `lock_release` -\u003e `perf_trace_lock`. This tracing overhead across many page table entries leads to CPU starvation and the watchdog soft lockup.\n\nThe tested patch series (\"bpf: Defer freeing a struct_ops map until its progs are done\") only modifies `kernel/bpf/bpf_struct_ops.c` (and selftests under `tools/testing/selftests/bpf/`) to defer freeing a struct_ops map via `call_rcu_tasks_trace` and a workqueue. It does not touch `copy_pmd_range`, `page_table_check`, `pfn_valid`, lockdep, perf tracing, or general process management. None of the functions or structures modified by the patch series are present in the call trace.\n\nTherefore, the soft lockup is unrelated to the patch series and was not introduced by it."
}Instruction: You are an expert Linux kernel maintainer and security engineer specializing
in crash triage and root-cause analysis.
Your job is to review a kernel crash report (finding) and determine if it was introduced / caused
by the patch series being tested, or if it is a pre-existing / unrelated bug.
IMPORTANT: The entire patch series has ALREADY been applied and committed as a single squashed commit
at HEAD (or on top of the base commit) in your workspace.
Do NOT rely on your internal knowledge of the kernel. You must actively use your tools to examine
the source code, inspect workspace diffs, and confirm any assumptions.
Available Tools:
- git-show: View the squashed patch series commit or historical commits. Call with Commit="HEAD" (default)
and optional 'File' parameter to restrict the diff to a specific file or directory, or 'Stat=true' for a diffstat.
- series-patches: Browse the original patch series. Call without arguments to list all patch titles,
or PatchNum=<N> to view the full description and diff of a specific patch (or cover letter, if present).
- read-file & codesearch-dir-index: Read exact source code files and directory contents in the workspace.
- grepper: Regex search across files in the workspace (git grep).
- git-blame: Inspect line authorship and find which commit last modified specific lines of code.
Triage Procedure:
1. Analyze the Crash Report:
- Identify the crash type (e.g. NULL dereference, KASAN use-after-free, out-of-bounds read/write,
assertion failure, deadlock).
- Carefully examine the stack trace(s) — both the faulting call stack and, if applicable (e.g., KASAN UAF),
the allocation and free stacks.
- Note the faulting function, file name, line numbers, and the specific variables or data structures involved.
2. Inspect Workspace Changes & Patch Series:
- Check if any files or functions from the stack trace appear in the modified files overview or the patch series.
- Use git-show with Commit="HEAD" and 'File' to inspect the exact diffs for relevant files
in the squashed commit.
- If needed, use series-patches with PatchNum=<N> to inspect the author's commit description
and rationale for individual patches in the series.
- Use read-file to inspect the actual source code at the faulting lines.
3. Determine Causality:
- Set Introduced=true ONLY IF you are absolutely certain:
* There is clear, unambiguous, and conclusive evidence that the crash was directly introduced
or caused by the patch series.
* The crash occurs directly in new or modified code introduced by the patch series, or the patch series
altered data structures, locking, object lifetimes, or preconditions in a way that directly
triggered the failure in existing code.
- Set Introduced=false IF:
* There is any doubt, ambiguity, or lack of conclusive proof that the patch series caused the bug.
* The crash occurs in an unrelated subsystem or unmodified code path whose behavior is independent
of the patch series.
* The crash is a pre-existing kernel issue that was randomly triggered during fuzzing.
4. Formulate Output:
- Set Introduced to true or false.
- In Reasoning, provide a clear, step-by-step technical explanation detailing the crash type,
the key stack frames, whether the affected code/structures were modified by the patch series,
and the causal justification for your verdict.
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 The kernel crash report to triage is: watchdog: BUG: soft lockup - CPU#1 stuck for 112s! [syz.1.4593:23932] Modules linked in: irq event stamp: 4248 hardirqs last enabled at (4247): [<ffffffff822f8229>] seqcount_lockdep_reader_access+0x89/0xc0 hardirqs last disabled at (4248): [<ffffffff8bec3c2e>] sysvec_apic_timer_interrupt+0xe/0xc0 softirqs last enabled at (4206): [<ffffffff81893fdb>] __irq_exit_rcu+0xcb/0x220 softirqs last disabled at (3669): [<ffffffff81893fdb>] __irq_exit_rcu+0xcb/0x220 CPU: 1 UID: 0 PID: 23932 Comm: syz.1.4593 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:perf_trace_lock+0xe4/0x410 Code: 00 48 8b 03 48 85 c0 48 c7 c7 60 13 0d 8c 48 0f 45 f8 48 89 7c 24 28 e8 6a 1f 45 0a 49 89 c5 49 8d 5e 60 48 89 d8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 df e8 fd 2a 9a 00 48 8b 03 48 89 44 24 RSP: 0018:ffffc9000715ede0 EFLAGS: 00000a06 RAX: 1ffffffff1f850f0 RBX: ffffffff8fc28780 RCX: 000000008c0e4305 RDX: ffffffff81d47174 RSI: ffffffff8fd5ca60 RDI: ffffffff8c0e4380 RBP: ffffc9000715eec8 R08: ffffc9000715efcf R09: 0000000000000000 R10: ffffc9000715efc0 R11: ffffffffa00059d4 R12: dffffc0000000000 R13: 000000000000000d R14: ffffffff8fc28720 R15: 1ffff92000e2bdc4 FS: 00007fb15cc5e6c0(0000) GS:ffff8882a7caf000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb15cbfb990 CR3: 00000001a25fc000 CR4: 00000000000006f0 DR0: 0000000000000002 DR1: 0000200000000780 DR2: 0000000000000000 DR3: 0000000000008d24 DR6: 00000000ffff0ff0 DR7: 0000000000000600 Call Trace: <TASK> lock_release+0x396/0x3c0 trace_call_bpf+0x7c4/0xb80 perf_trace_run_bpf_submit+0x78/0x170 perf_trace_lock_acquire+0x346/0x440 lock_acquire+0x303/0x350 pfn_valid+0xd6/0x490 page_table_check_set+0x25/0x530 copy_pmd_range+0x4adc/0x5c10 copy_page_range+0xc82/0x1290 dup_mmap+0xf17/0x1dc0 copy_mm+0x115/0x480 copy_process+0x1e79/0x4400 kernel_clone+0x2d7/0x940 __x64_sys_clone+0x1b6/0x230 do_syscall_64+0x166/0x520 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fb15bd9e559 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fb15cc5dfd8 EFLAGS: 00000206 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007fb15c026090 RCX: 00007fb15bd9e559 RDX: 0000200000000580 RSI: 0000200000000550 RDI: 0000000000080000 RBP: 00007fb15be358b0 R08: 0000200000000600 R09: 0000200000000600 R10: 00002000000005c0 R11: 0000000000000206 R12: 0000000000000000 R13: 00007fb15c026128 R14: 00007fb15c026090 R15: 00007ffc96a54198 </TASK> Sending NMI from CPU 1 to CPUs 0: NMI backtrace for cpu 0 CPU: 0 UID: 0 PID: 5596 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:smp_call_function_many_cond+0x628/0x1500 Code: 00 44 8b 3b 44 89 fe 83 e6 01 31 ff e8 01 59 0c 00 41 83 e7 01 75 07 e8 f6 53 0c 00 eb 3f f3 90 48 b8 00 00 00 00 00 fc ff df <41> 0f b6 04 04 84 c0 75 0f f7 03 01 00 00 00 74 1d e8 d2 53 0c 00 RSP: 0000:ffffc90004ef7720 EFLAGS: 00000293 RAX: dffffc0000000000 RBX: ffff88823c6414c8 RCX: ffff888112e80000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffc90004ef7870 R08: ffff888112e8159f R09: 1ffff110225d02b3 R10: dffffc0000000000 R11: ffffffff8179fc60 R12: 1ffff110478c8299 R13: 0000000000000001 R14: ffff88823c6414c0 R15: 0000000000000001 FS: 000055558287c500(0000) GS:ffff88818c4af000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000555582897a28 CR3: 00000000138be000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000200000000100 DR2: 00002000000001c0 DR3: 0000000000008d24 DR6: 00000000ffff0ff0 DR7: 0000000000000600 Call Trace: <TASK> flush_tlb_mm_range+0x8ff/0x1090 ptep_clear_flush+0x120/0x170 do_wp_page+0x3c5c/0x4b80 handle_mm_fault+0x15d7/0x3750 do_user_addr_fault+0xa4f/0x1340 exc_page_fault+0x6a/0xc0 asm_exc_page_fault+0x26/0x30 RIP: 0033:0x7f16807630e0 Code: 2d 29 00 48 8d 0c 1e 49 39 d0 49 89 48 60 0f 95 c2 48 29 d8 0f b6 d2 48 83 c8 01 48 c1 e2 02 48 09 da 48 83 ca 01 48 89 56 08 <48> 89 41 08 48 8d 4e 10 eb b0 48 8d 0d df ed 0c 00 ba 9e 10 00 00 RSP: 002b:00007fff231cbfa0 EFLAGS: 00010206 RAX: 00000000000185e1 RBX: 0000000000008040 RCX: 0000555582897a20 RDX: 0000000000008041 RSI: 000055558288f9e0 RDI: 0000000000000004 RBP: 0000000000000802 R08: 00007f16809f5e20 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000008030 R13: 0000000000000000 R14: 00007f16809f5e80 R15: 0000000000000000 </TASK> Overview of modified files in the workspace: kernel/bpf/bpf_struct_ops.c | 28 ++++++++++++++++++++- .../bpf/prog_tests/test_struct_ops_assoc.c | 29 +++++++++++++++++++--- .../bpf/progs/struct_ops_assoc_in_timer.c | 16 ++++++++++++ 3 files changed, 68 insertions(+), 5 deletions(-) The patch series contains 3 patches: [1] [PATCH bpf-next v3 1/3] bpf: Defer freeing a struct_ops map until its progs are done [2] [PATCH bpf-next v3 2/3] selftests/bpf: Test freeing a struct_ops map under a running prog [3] [PATCH bpf-next v3 3/3] selftests/bpf: Wait for the struct_ops map to be freed in assoc_in_timer |
| 3/2 | 2026/10/15 07:56 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 6262 output: 14 thoughts: 438 Thoughts: **Analyzing a Soft Lockup Bug in the Kernel** Okay, let's dive into this. A soft lockup, CPU 1 stuck for 112 seconds... that's never good. The watchdog message points to `perf_trace_lock` as the culprit, and looking at the call trace, we can see a definite path involving BPF tracing and memory management operations. We have `lock_release`, `trace_call_bpf`, `perf_trace_run_bpf_submit`, then the `perf_trace_lock_acquire` and down the stack to memory management functions. The CPU 0 context reveals `smp_call_function_many_cond`, `flush_tlb_mm_range`, `ptep_clear_flush`, `do_wp_page` all pointing to memory management issues. It looks like a classic race condition or livelock situation within the BPF tracing infrastructure. My initial thought is that there's some kind of contention going on related to BPF tracing, potentially during a clone or copy operation, which is clear from the `copy_process`, `kernel_clone`, and `copy_mm` calls in the trace. The memory management functions associated with CPU 0 suggest that we're flushing TLBs and doing write page operations. This suggests that memory might be being manipulated within the context of the lock contention. Before going deeper, I'll need to check the relevant code using `git show` on the commits involving BPF, perf events, and memory management and then check for relevant series patches. That's the best approach to understand what recently changed in those areas. This way, I can quickly narrow down the likely patches and identify any potential regressions or race conditions introduced by recent changes. |
| 4/2 | 2026/10/15 07:56 | tool | git-show |
0mArgs:{
"Stat": true
}Results: {
"Output": "commit df091811c2e836cd5ee47663a9b664fbdf61e238\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Thu Oct 15 07:56:09 2026 +0000\n\n syz-cluster: applied patch under review\n\n kernel/bpf/bpf_struct_ops.c | 28 ++++++++++++++++++++-\n .../bpf/prog_tests/test_struct_ops_assoc.c | 29 +++++++++++++++++++---\n .../bpf/progs/struct_ops_assoc_in_timer.c | 16 ++++++++++++\n 3 files changed, 68 insertions(+), 5 deletions(-)\n"
} |
| 5/2 | 2026/10/15 07:56 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 7286 output: 28 thoughts: 29 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person: **Analyzing the BPF Structure Operations Patch** Alright, let's dive into this. My initial move would be to get a clear view of the patch content, and I'd do that by leveraging `git show` specifically on the `kernel/bpf/bpf_struct_ops.c` file. This direct approach offers a concise overview, highlighting the precise modifications to the core BPF structure operation implementation. I want to see the exact code changes and focus on the details, understanding the additions, removals, or alterations directly. With that, I can begin to assess the potential impact of this change on the kernel's BPF subsystem. I'm keen to determine the rationale behind these structure operation adjustments. Knowing this, I can begin to assess the impact on existing programs, and the potential implications on new program deployments, all with the level of clarity afforded by a targeted examination of the modified code. I need to get a handle on what's changed and why. |
| 6/2 | 2026/10/15 07:56 | tool | git-show |
0mArgs:{
"File": "kernel/bpf/bpf_struct_ops.c"
}Results: {
"Output": "commit df091811c2e836cd5ee47663a9b664fbdf61e238\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Thu Oct 15 07:56:09 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c\nindex 1178acd72296e..c000419db1cf3 100644\n--- a/kernel/bpf/bpf_struct_ops.c\n+++ b/kernel/bpf/bpf_struct_ops.c\n@@ -42,6 +42,9 @@ struct bpf_struct_ops_map {\n \tvoid *image_pages[MAX_TRAMP_IMAGE_PAGES];\n \t/* The owner moduler's btf. */\n \tstruct btf *btf;\n+\t/* free the map once the progs that used it have finished */\n+\tstruct rcu_head free_rcu;\n+\tstruct work_struct free_work;\n \t/* uvalue-\u003edata stores the kernel struct\n \t * (e.g. tcp_congestion_ops) that is more useful\n \t * to userspace than the kvalue. For example,\n@@ -1032,6 +1035,23 @@ static void bpf_struct_ops_map_free_pre_rcu(struct bpf_map *map)\n \tbpf_struct_ops_map_del_ksyms(st_map);\n }\n \n+static void bpf_struct_ops_map_free_deferred(struct work_struct *work)\n+{\n+\tstruct bpf_struct_ops_map *st_map;\n+\n+\tst_map = container_of(work, struct bpf_struct_ops_map, free_work);\n+\t__bpf_struct_ops_map_free(\u0026st_map-\u003emap);\n+}\n+\n+static void bpf_struct_ops_map_free_rcu_gp(struct rcu_head *rcu)\n+{\n+\tstruct bpf_struct_ops_map *st_map;\n+\n+\tst_map = container_of(rcu, struct bpf_struct_ops_map, free_rcu);\n+\tINIT_WORK(\u0026st_map-\u003efree_work, bpf_struct_ops_map_free_deferred);\n+\tqueue_work(system_dfl_wq, \u0026st_map-\u003efree_work);\n+}\n+\n static void bpf_struct_ops_map_free(struct bpf_map *map)\n {\n \tstruct bpf_struct_ops_map *st_map = (struct bpf_struct_ops_map *)map;\n@@ -1050,7 +1070,13 @@ static void bpf_struct_ops_map_free(struct bpf_map *map)\n \tif (tasks_rcu \u0026\u0026 IS_ENABLED(CONFIG_TASKS_RCU))\n \t\tsynchronize_rcu_tasks();\n \n-\t__bpf_struct_ops_map_free(map);\n+\t/*\n+\t * A prog may have read the association before it was cleared above,\n+\t * e.g. from a timer or a bpf_wq callback, and may still be running the\n+\t * struct_ops. A tasks trace grace period waits for both the RCU and the\n+\t * RCU tasks trace readers, free the map only after it.\n+\t */\n+\tcall_rcu_tasks_trace(\u0026st_map-\u003efree_rcu, bpf_struct_ops_map_free_rcu_gp);\n }\n \n static int bpf_struct_ops_map_alloc_check(union bpf_attr *attr)\n"
} |
| 7/2 | 2026/10/15 07:56 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 8530 output: 10 thoughts: 11 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person: **Double-Checking: The Devil is in the Details** Alright, I've got a good handle on this current patch and its implications, but experience has taught me to be thorough. My first thought is: "Let's check the *other* patches just in case." I need to ensure a holistic view, a complete picture. It's not about doubting my initial assessment; it's about solidifying it. My intuition is good, my understanding is strong, but the potential for unintended consequences, conflicts, or overlooked edge cases always exists. I need to eliminate as many variables as possible. This isn't just a matter of due diligence, it's about anticipating potential problems down the line, especially in a system of this complexity. I need to make sure I am not missing a critical dependency, or a possible conflict with any other work in the pipeline, no matter how remote the possibility. Let's make sure there are no other latent issues. |
| 8/2 | 2026/10/15 07:56 | tool | series-patches |
0mError:missing argument "PatchNum" Args: null Results: {
"error": "missing argument \"PatchNum\""
} |
| 9/2 | 2026/10/15 07:56 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 8793 output: 15 thoughts: 20 Thoughts: Here's my take on those thoughts, tailored for an expert audience: **Reflecting on `series-patches` Calls** Okay, so I'm thinking about how we're leveraging the `series-patches` function. Specifically, I'm analyzing the cases where we call it with `PatchNum` set to either 0 or 1. My intuition tells me there's something significant about these particular values, and I need to solidify my understanding of the implications. I want to thoroughly understand the differences between the functions with these arguments. |
| 10/2 | 2026/10/15 07:56 | tool | series-patches |
0mArgs:{
"PatchNum": 1
}Results: {
"Output": "Patch [1] [PATCH bpf-next v3 1/3] bpf: Defer freeing a struct_ops map until its progs are done:\n\nA struct_ops prog is associated with its map without a reference on the\nmap, and finds the struct_ops through bpf_prog_get_assoc_struct_ops()\nunder RCU until bpf_struct_ops_map_free() clears the association. For a\nstruct_ops map, bpf_map_put() waits for an RCU grace period before it\ncalls bpf_struct_ops_map_free(), which clears the association and then\nfrees the trampoline and the kdata right away.\n\nNothing waits for a prog that reads the association after that grace\nperiod started and before the association is cleared. A timer callback\nof a struct_ops prog that calls test_1 of bpf_testmod's multi_st_ops\nthrough the association while the map is freed returns into the freed\ntrampoline, whose image is filled with int3. RAX holds MAP_MAGIC (1234),\nwhich test_1 has just returned:\n\n Oops: int3: 0000 [#1] SMP KASAN NOPTI\n CPU: 2 UID: 0 PID: 31 Comm: ksoftirqd/2 ...\n RIP: 0010:0xffffffffc043114d\n Code: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc \u003ccc\u003e cc cc cc\n RAX: 00000000000004d2 ...\n Call Trace:\n bpf_prog_ec591f4f9d13f364_timer_cb+0x96/0x1e2\n bpf_timer_cb+0x15d/0x240\n __hrtimer_run_queues+0x264/0x5a0\n hrtimer_run_softirq+0x1a7/0x3b0\n handle_softirqs+0x18c/0x5b0\n\nFree the map after an RCU tasks trace grace period that starts once the\nassociation is cleared. It waits for the progs that read the association\nunder RCU, e.g. from a timer callback, as well as for those under RCU\ntasks trace, e.g. from a bpf_wq callback or a sleepable prog, since a\ntasks trace grace period implies an RCU one. Clearing the association\nbefore the grace period of bpf_map_put() doesn't work, as it takes a\nmutex while bpf_map_put() may run in softirq, e.g. from\nbpf_struct_ops_put() of a tcp congestion control.\n\nThe st_ops_assoc_in_timer_free subtest of test_progs reproduces it. Its\ntimer callback keeps calling test_1 through the association while the\nmap is freed, and test_1 spins in bpf_loop() when called from there:\n\n $ cd tools/testing/selftests/bpf\n $ make test_progs\n $ ./test_progs -t struct_ops_assoc/st_ops_assoc_in_timer_free\n\nOn kernels of the same bpf-next commit with KASAN enabled, x86_64 VM\nwith 32 vCPUs, before and after this patch:\n\n before after\n outcome Oops (int3) on run 1 100 of 100 runs passed, no Oops\n\nFixes: 5db69b0fbdc8 (\"bpf: Make struct_ops tasks_rcu grace period optional\")\nSigned-off-by: Qiliang Yuan \u003codys.yuan@gmail.com\u003e\n---\n kernel/bpf/bpf_struct_ops.c | 28 +++++++++++++++++++++++++++-\n 1 file changed, 27 insertions(+), 1 deletion(-)\n\ndiff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c\nindex 1178acd72296e..c000419db1cf3 100644\n--- a/kernel/bpf/bpf_struct_ops.c\n+++ b/kernel/bpf/bpf_struct_ops.c\n@@ -42,6 +42,9 @@ struct bpf_struct_ops_map {\n \tvoid *image_pages[MAX_TRAMP_IMAGE_PAGES];\n \t/* The owner moduler's btf. */\n \tstruct btf *btf;\n+\t/* free the map once the progs that used it have finished */\n+\tstruct rcu_head free_rcu;\n+\tstruct work_struct free_work;\n \t/* uvalue-\u003edata stores the kernel struct\n \t * (e.g. tcp_congestion_ops) that is more useful\n \t * to userspace than the kvalue. For example,\n@@ -1032,6 +1035,23 @@ static void bpf_struct_ops_map_free_pre_rcu(struct bpf_map *map)\n \tbpf_struct_ops_map_del_ksyms(st_map);\n }\n \n+static void bpf_struct_ops_map_free_deferred(struct work_struct *work)\n+{\n+\tstruct bpf_struct_ops_map *st_map;\n+\n+\tst_map = container_of(work, struct bpf_struct_ops_map, free_work);\n+\t__bpf_struct_ops_map_free(\u0026st_map-\u003emap);\n+}\n+\n+static void bpf_struct_ops_map_free_rcu_gp(struct rcu_head *rcu)\n+{\n+\tstruct bpf_struct_ops_map *st_map;\n+\n+\tst_map = container_of(rcu, struct bpf_struct_ops_map, free_rcu);\n+\tINIT_WORK(\u0026st_map-\u003efree_work, bpf_struct_ops_map_free_deferred);\n+\tqueue_work(system_dfl_wq, \u0026st_map-\u003efree_work);\n+}\n+\n static void bpf_struct_ops_map_free(struct bpf_map *map)\n {\n \tstruct bpf_struct_ops_map *st_map = (struct bpf_struct_ops_map *)map;\n@@ -1050,7 +1070,13 @@ static void bpf_struct_ops_map_free(struct bpf_map *map)\n \tif (tasks_rcu \u0026\u0026 IS_ENABLED(CONFIG_TASKS_RCU))\n \t\tsynchronize_rcu_tasks();\n \n-\t__bpf_struct_ops_map_free(map);\n+\t/*\n+\t * A prog may have read the association before it was cleared above,\n+\t * e.g. from a timer or a bpf_wq callback, and may still be running the\n+\t * struct_ops. A tasks trace grace period waits for both the RCU and the\n+\t * RCU tasks trace readers, free the map only after it.\n+\t */\n+\tcall_rcu_tasks_trace(\u0026st_map-\u003efree_rcu, bpf_struct_ops_map_free_rcu_gp);\n }\n \n static int bpf_struct_ops_map_alloc_check(union bpf_attr *attr)\n\n-- \n2.43.0"
} |
| 11/2 | 2026/10/15 07:56 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 10727 output: 31 thoughts: 1035 Thoughts: **Analyzing the Crash Report** Alright, let's dissect this crash dump. The "soft lockup" on CPU 1 for 112 seconds is the immediate red flag. The timestamp data indicates that hard and soft interrupts have been toggling around the same point, which isn't unusual on its own, but we should keep an eye on it. The UID/PID information tells us it's a syzkaller test case, so this should be reproducible and somewhat targeted. The hardware's irrelevant but good to have. Now for the call stack. Let's see... `perf_trace_lock`, `lock_release`, `trace_call_bpf`, `perf_trace_run_bpf_submit`... This is immediately interesting. This appears to indicate a lock issue related to BPF tracing, or BPF tracing interfering with a core locking mechanism. My initial thought is that `lock_acquire` is triggering `perf_trace_lock_acquire`, which, in turn, is executing BPF (`perf_trace_run_bpf_submit` and `trace_call_bpf`). And what's going on... Is `trace_call_bpf` calling `lock_release` or something similar, or does BPF itself have a mechanism that is taking a lock? It looks like we're either looking at recursive tracing calls or a potential massive overhead situation that's locking up the CPU or a loop of sorts! The stack makes it look like there is some BPF tracing that is *releasing* a lock somehow. That's highly suspect. I need to dive into the kernel source for `trace_call_bpf` now. See what it's doing with locks in that BPF path. That's where the problem lies. |
| 12/2 | 2026/10/15 07:57 | tool | grepper |
0mArgs:{
"Expression": "trace_call_bpf",
"PathPrefixes": [
"kernel/trace/"
]
}Results: {
"Output": "kernel/trace/bpf_trace.c=95=static u64 bpf_uprobe_multi_entry_ip(struct bpf_run_ctx *ctx);\n--\nkernel/trace/bpf_trace.c-97-/**\nkernel/trace/bpf_trace.c:98: * trace_call_bpf - invoke BPF program\nkernel/trace/bpf_trace.c-99- * @call: tracepoint event\n--\nkernel/trace/bpf_trace.c-110- */\nkernel/trace/bpf_trace.c:111:unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)\nkernel/trace/bpf_trace.c-112-{\n--\nkernel/trace/bpf_trace.c-137-\t * If bpf_prog_array_valid() fetched prog_array was\nkernel/trace/bpf_trace.c:138:\t * non-NULL, we go into trace_call_bpf() and do the actual\nkernel/trace/bpf_trace.c-139-\t * proper rcu_dereference() under RCU lock.\n--\nkernel/trace/bpf_trace.c-157-/**\nkernel/trace/bpf_trace.c:158: * trace_call_bpf_faultable - invoke BPF program in faultable context\nkernel/trace/bpf_trace.c-159- * @call: tracepoint event\n--\nkernel/trace/bpf_trace.c-161- *\nkernel/trace/bpf_trace.c:162: * Variant of trace_call_bpf() for faultable tracepoints (syscall\nkernel/trace/bpf_trace.c-163- * tracepoints). Supports sleepable BPF programs by using rcu_tasks_trace\n--\nkernel/trace/bpf_trace.c-172- */\nkernel/trace/bpf_trace.c:173:unsigned int trace_call_bpf_faultable(struct trace_event_call *call, void *ctx)\nkernel/trace/bpf_trace.c-174-{\n--\nkernel/trace/trace_kprobe.c=1693=kprobe_perf_func(struct trace_kprobe *tk, struct pt_regs *regs)\n--\nkernel/trace/trace_kprobe.c-1704-\nkernel/trace/trace_kprobe.c:1705:\t\tret = trace_call_bpf(call, regs);\nkernel/trace/trace_kprobe.c-1706-\n--\nkernel/trace/trace_kprobe.c=1741=kretprobe_perf_func(struct trace_kprobe *tk, struct kretprobe_instance *ri,\n--\nkernel/trace/trace_kprobe.c-1749-\nkernel/trace/trace_kprobe.c:1750:\tif (bpf_prog_array_valid(call) \u0026\u0026 !trace_call_bpf(call, regs))\nkernel/trace/trace_kprobe.c-1751-\t\treturn;\n--\nkernel/trace/trace_syscalls.c=1392=static int perf_call_bpf_enter(struct trace_event_call *call,\n--\nkernel/trace/trace_syscalls.c-1411-\t\tparam.args[i] = args[i];\nkernel/trace/trace_syscalls.c:1412:\treturn trace_call_bpf_faultable(call, \u0026param);\nkernel/trace/trace_syscalls.c-1413-}\n--\nkernel/trace/trace_syscalls.c=1543=static int perf_call_bpf_exit(struct trace_event_call *call,\n--\nkernel/trace/trace_syscalls.c-1557-\tparam.ret = ret_val;\nkernel/trace/trace_syscalls.c:1558:\treturn trace_call_bpf_faultable(call, \u0026param);\nkernel/trace/trace_syscalls.c-1559-}\n"
} |
| 13/2 | 2026/10/15 07:57 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 13179 output: 38 thoughts: 23 Thoughts: Okay, here's my interpretation of that thought process, assuming I'm already deep in kernel debugging and familiar with the codebase: **Diving into BPF Tracepoints** Right, let's zero in. I'm thinking, "Let's crack open `kernel/trace/bpf_trace.c` and specifically, let's head over to the vicinity of line 111." The mental map is already forming. This likely means I'm looking at something fundamental regarding BPF tracepoint behavior. I'm probably tracking down an issue in tracepoint registration, perhaps the handling of BPF programs within the trace infrastructure, or maybe even digging into the interaction between tracepoints and the BPF verifier. Line 111, in that particular file, probably points to a critical function call, data structure, or conditional block that's central to the logic I'm interested in. My hunch is, that this is the area, within the tracepoint logic, where the BPF magic is getting woven in. Now, let's get to the specifics and see what we're actually looking at. |
| 14/2 | 2026/10/15 07:57 | tool | read-file |
0mArgs:{
"File": "kernel/trace/bpf_trace.c",
"FirstLine": 110,
"LineCount": 45
}Results: {
"Contents": " 110:\t */\n 111:\tunsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)\n 112:\t{\n 113:\t\tunsigned int ret;\n 114:\t\n 115:\t\tcant_sleep();\n 116:\t\n 117:\t\tif (unlikely(__this_cpu_inc_return(bpf_prog_active) != 1)) {\n 118:\t\t\t/*\n 119:\t\t\t * since some bpf program is already running on this cpu,\n 120:\t\t\t * don't call into another bpf program (same or different)\n 121:\t\t\t * and don't send kprobe event into ring-buffer,\n 122:\t\t\t * so return zero here\n 123:\t\t\t */\n 124:\t\t\trcu_read_lock();\n 125:\t\t\tbpf_prog_inc_misses_counters(rcu_dereference(call-\u003eprog_array));\n 126:\t\t\trcu_read_unlock();\n 127:\t\t\tret = 0;\n 128:\t\t\tgoto out;\n 129:\t\t}\n 130:\t\n 131:\t\t/*\n 132:\t\t * Instead of moving rcu_read_lock/rcu_dereference/rcu_read_unlock\n 133:\t\t * to all call sites, we did a bpf_prog_array_valid() there to check\n 134:\t\t * whether call-\u003eprog_array is empty or not, which is\n 135:\t\t * a heuristic to speed up execution.\n 136:\t\t *\n 137:\t\t * If bpf_prog_array_valid() fetched prog_array was\n 138:\t\t * non-NULL, we go into trace_call_bpf() and do the actual\n 139:\t\t * proper rcu_dereference() under RCU lock.\n 140:\t\t * If it turns out that prog_array is NULL then, we bail out.\n 141:\t\t * For the opposite, if the bpf_prog_array_valid() fetched pointer\n 142:\t\t * was NULL, you'll skip the prog_array with the risk of missing\n 143:\t\t * out of events when it was updated in between this and the\n 144:\t\t * rcu_dereference() which is accepted risk.\n 145:\t\t */\n 146:\t\trcu_read_lock();\n 147:\t\tret = bpf_prog_run_array(rcu_dereference(call-\u003eprog_array),\n 148:\t\t\t\t\t ctx, bpf_prog_run);\n 149:\t\trcu_read_unlock();\n 150:\t\n 151:\t out:\n 152:\t\t__this_cpu_dec(bpf_prog_active);\n 153:\t\n 154:\t\treturn ret;\n"
} |
| 15/2 | 2026/10/15 07:57 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14217 output: 42 thoughts: 2489 Thoughts: **Analyzing a Suspected Soft Lockup in the Kernel** Okay, let's break this down. My initial observation is within `trace_call_bpf`, where I see the familiar `rcu_read_lock()` / `rcu_read_unlock()` pair. It seems like the BPF program execution is happening within this RCU critical section. Wait, now I'm seeing `lock_release` being called from `trace_call_bpf`! Under `CONFIG_DEBUG_LOCK_ALLOC`, `rcu_read_unlock()` translates to `lock_release` on `rcu_lock_map`. And of course, `lock_release` itself has a tracepoint attached to it! Now, looking at the call stack, I see a `clone()` syscall triggering a series of memory-management functions: `copy_page_range`, `copy_pmd_range`, and ultimately `page_table_check_set`. Crucially, within this sequence, there's a lock acquisition (`lock_acquire`) and subsequent release (`lock_release`) that the tracepoints are hooked into. The lock acquisition triggers a BPF program, which *itself* calls `lock_release`. I'm starting to suspect this sequence is somehow at the root of the issue. Given this context, I'm now questioning how this is all happening. How many pages are even in memory? And why is CPU 1 stuck for so long? Is this a genuine soft lockup, or just an enormous amount of work? What's CPU 0 doing? Wait, CPU 0 is in `flush_tlb_mm_range`, calling `smp_call_function_many_cond`! It's sending an IPI to CPU 1 (likely to flush TLBs), and waiting for CPU 1 to respond. This is bad. Why can't CPU 1 handle the IPI? I can see that timer interrupts have been disabled. I'm starting to focus on what's going on in `copy_pmd_range`. I'm reminded that syzkaller is exercising `copy_page_range`, so I need to understand this better. Now, what was the patch series again? It modified `bpf_struct_ops`... could it be related? The patch added `call_rcu_tasks_trace` and I'm wondering if this change could be somehow involved in the issue. Now, wait! Crucially, is `bpf_struct_ops` anywhere in the *actual* crash call stack? The backtrace from CPU 1 tells me that the BPF program that's running is attached to tracepoint `lock_acquire`, with `perf_trace_lock_acquire` calling `perf_trace_run_bpf_submit`, and that this is calling `trace_call_bpf`. Syzkaller *does* attach BPF programs to tracepoints. My next step is to examine the source code of `pfn_valid` to see why it's calling `lock_acquire`, and to connect the dots between that function, the BPF programs, and the patch series. This feels very close to the source of the lockup. |
| 16/2 | 2026/10/15 07:57 | tool | grepper |
0mArgs:{
"Expression": "pfn_valid",
"PathPrefixes": [
"arch/x86/",
"include/linux/mmzone.h"
]
}Results: {
"Output": "arch/x86/include/asm/kmsan.h=63=static inline bool kmsan_virt_addr_valid(void *addr)\n--\narch/x86/include/asm/kmsan.h-83-\t/*\narch/x86/include/asm/kmsan.h:84:\t * pfn_valid() relies on RCU, and may call into the scheduler on exiting\narch/x86/include/asm/kmsan.h-85-\t * the critical section. However, this would result in recursion with\n--\narch/x86/include/asm/kmsan.h-93-\tpreempt_disable();\narch/x86/include/asm/kmsan.h:94:\tret = pfn_valid(x \u003e\u003e PAGE_SHIFT);\narch/x86/include/asm/kmsan.h-95-\tpreempt_enable_no_resched();\n--\narch/x86/include/asm/xen/page.h=251=static inline unsigned long gfn_to_pfn(unsigned long gfn)\n--\narch/x86/include/asm/xen/page.h-270- * If we detect a special mapping then it doesn't have a 'struct page'.\narch/x86/include/asm/xen/page.h:271: * We force !pfn_valid() by returning an out-of-range pointer.\narch/x86/include/asm/xen/page.h-272- *\n--\narch/x86/include/asm/xen/page.h=283=static inline unsigned long bfn_to_local_pfn(unsigned long mfn)\n--\narch/x86/include/asm/xen/page.h-291-\tif (__pfn_to_mfn(pfn) != mfn)\narch/x86/include/asm/xen/page.h:292:\t\treturn -1; /* force !pfn_valid() */\narch/x86/include/asm/xen/page.h-293-\treturn pfn;\n--\narch/x86/kernel/crash_dump_32.c-14-\narch/x86/kernel/crash_dump_32.c:15:static inline bool is_crashed_pfn_valid(unsigned long pfn)\narch/x86/kernel/crash_dump_32.c-16-{\n--\narch/x86/kernel/crash_dump_32.c=31=ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize,\n--\narch/x86/kernel/crash_dump_32.c-38-\narch/x86/kernel/crash_dump_32.c:39:\tif (!is_crashed_pfn_valid(pfn))\narch/x86/kernel/crash_dump_32.c-40-\t\treturn -EFAULT;\n--\narch/x86/kvm/mmu/spte.c=109=static bool __kvm_is_mmio_pfn(kvm_pfn_t pfn)\narch/x86/kvm/mmu/spte.c-110-{\narch/x86/kvm/mmu/spte.c:111:\tif (pfn_valid(pfn))\narch/x86/kvm/mmu/spte.c-112-\t\treturn !is_zero_pfn(pfn) \u0026\u0026 PageReserved(pfn_to_page(pfn)) \u0026\u0026\n--\narch/x86/mm/mmap.c=226=bool pfn_modify_allowed(unsigned long pfn, pgprot_t prot)\n--\narch/x86/mm/mmap.c-232-\t/* If it's real memory always allow */\narch/x86/mm/mmap.c:233:\tif (pfn_valid(pfn))\narch/x86/mm/mmap.c-234-\t\treturn true;\n--\narch/x86/mm/physaddr.c=36=bool __virt_addr_valid(unsigned long x)\n--\narch/x86/mm/physaddr.c-53-\narch/x86/mm/physaddr.c:54:\treturn pfn_valid(x \u003e\u003e PAGE_SHIFT);\narch/x86/mm/physaddr.c-55-}\n--\narch/x86/mm/physaddr.c=77=bool __virt_addr_valid(unsigned long x)\n--\narch/x86/mm/physaddr.c-84-\t\treturn false;\narch/x86/mm/physaddr.c:85:\treturn pfn_valid((x - PAGE_OFFSET) \u003e\u003e PAGE_SHIFT);\narch/x86/mm/physaddr.c-86-}\n--\narch/x86/virt/svm/sev.c=894=int psmash(u64 pfn)\n--\narch/x86/virt/svm/sev.c-901-\narch/x86/virt/svm/sev.c:902:\tif (!pfn_valid(pfn))\narch/x86/virt/svm/sev.c-903-\t\treturn -EINVAL;\n--\narch/x86/virt/svm/sev.c=941=static int adjust_direct_map(u64 pfn, int rmp_level)\n--\narch/x86/virt/svm/sev.c-957-\narch/x86/virt/svm/sev.c:958:\tif (!pfn_valid(pfn))\narch/x86/virt/svm/sev.c-959-\t\treturn -EINVAL;\n--\narch/x86/virt/svm/sev.c-961-\tif (rmp_level == PG_LEVEL_2M \u0026\u0026\narch/x86/virt/svm/sev.c:962:\t (!IS_ALIGNED(pfn, PTRS_PER_PMD) || !pfn_valid(pfn + PTRS_PER_PMD - 1)))\narch/x86/virt/svm/sev.c-963-\t\treturn -EINVAL;\n--\ninclude/linux/mmzone.h=2244=void sparse_init_early_section(int nid, struct page *map, unsigned long pnum,\n--\ninclude/linux/mmzone.h-2248-/**\ninclude/linux/mmzone.h:2249: * pfn_valid - check if there is a valid memory map entry for a PFN\ninclude/linux/mmzone.h-2250- * @pfn: the page frame number to check\n--\ninclude/linux/mmzone.h-2258- */\ninclude/linux/mmzone.h:2259:static inline int pfn_valid(unsigned long pfn)\ninclude/linux/mmzone.h-2260-{\n--\ninclude/linux/mmzone.h-2281-\t/*\ninclude/linux/mmzone.h:2282:\t * Traditionally early sections always returned pfn_valid() for\ninclude/linux/mmzone.h-2283-\t * the entire section-sized span.\n--\ninclude/linux/mmzone.h=2351=static inline unsigned long next_present_section_nr(unsigned long section_nr)\n--\ninclude/linux/mmzone.h-2382-#define sparse_vmemmap_init_nid_early(_nid) do {} while (0)\ninclude/linux/mmzone.h:2383:#define pfn_in_present_section pfn_valid\ninclude/linux/mmzone.h-2384-#endif /* CONFIG_SPARSEMEM */\n--\ninclude/linux/mmzone.h-2386-/*\ninclude/linux/mmzone.h:2387: * Fallback case for when the architecture provides its own pfn_valid() but\ninclude/linux/mmzone.h-2388- * not a corresponding for_each_valid_pfn().\n--\ninclude/linux/mmzone.h-2392-\tfor ((_pfn) = (_start_pfn); (_pfn) \u003c (_end_pfn); (_pfn)++)\t\\\ninclude/linux/mmzone.h:2393:\t\tif (pfn_valid(_pfn))\ninclude/linux/mmzone.h-2394-#endif\n"
} |
| 17/2 | 2026/10/15 07:57 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19543 output: 37 thoughts: 23 Thoughts: Okay, let's dive into this. Here's my take on those thoughts, as if they're my own: **Investigating the `pfn_valid` Macro** Right, time to get my hands dirty and figure out exactly what's going on with this `pfn_valid` macro. I know it's defined in `include/linux/mmzone.h`, so that's where I'll be heading. It’s critical I understand how the kernel validates physical page frame numbers (PFNs). This is fundamental to memory management, and I need to ensure I have a complete grasp of the underlying mechanism. I'm expecting this to be a quick trip through the header file, hopefully with a clear definition and perhaps a few supporting inline comments. I'm looking for the conditions it checks, how it's implemented, and any potential optimizations related to its use. I anticipate it will be core to address validation and handling within the memory management code. Let's see what gems are hidden in there. |
| 18/2 | 2026/10/15 07:57 | tool | read-file |
0mArgs:{
"File": "include/linux/mmzone.h",
"FirstLine": 2255,
"LineCount": 40
}Results: {
"Contents": "2255:\t * represent a hole or an unusable page frame.\n2256:\t *\n2257:\t * Return: 1 for PFNs that have memory map entries and 0 otherwise\n2258:\t */\n2259:\tstatic inline int pfn_valid(unsigned long pfn)\n2260:\t{\n2261:\t\tstruct mem_section *ms;\n2262:\t\tint ret;\n2263:\t\n2264:\t\t/*\n2265:\t\t * Ensure the upper PAGE_SHIFT bits are clear in the\n2266:\t\t * pfn. Else it might lead to false positives when\n2267:\t\t * some of the upper bits are set, but the lower bits\n2268:\t\t * match a valid pfn.\n2269:\t\t */\n2270:\t\tif (PHYS_PFN(PFN_PHYS(pfn)) != pfn)\n2271:\t\t\treturn 0;\n2272:\t\n2273:\t\tif (pfn_to_section_nr(pfn) \u003e= NR_MEM_SECTIONS)\n2274:\t\t\treturn 0;\n2275:\t\tms = __pfn_to_section(pfn);\n2276:\t\trcu_read_lock_sched();\n2277:\t\tif (!valid_section(ms)) {\n2278:\t\t\trcu_read_unlock_sched();\n2279:\t\t\treturn 0;\n2280:\t\t}\n2281:\t\t/*\n2282:\t\t * Traditionally early sections always returned pfn_valid() for\n2283:\t\t * the entire section-sized span.\n2284:\t\t */\n2285:\t\tret = early_section(ms) || pfn_section_valid(ms, pfn);\n2286:\t\trcu_read_unlock_sched();\n2287:\t\n2288:\t\treturn ret;\n2289:\t}\n2290:\t\n2291:\t/* Returns end_pfn or higher if no valid PFN remaining in range */\n2292:\tstatic inline unsigned long first_valid_pfn(unsigned long pfn, unsigned long end_pfn)\n2293:\t{\n2294:\t\tunsigned long nr = pfn_to_section_nr(pfn);\n"
} |
| 19/2 | 2026/10/15 07:57 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20420 output: 25 thoughts: 1271 Thoughts: **Deep Dive into a Kernel Performance Bottleneck** Okay, so I'm looking at this snippet, and immediately I see a red flag: the interaction between `pfn_valid`, `rcu_read_lock_sched()`, and this whole BPF tracing setup. I can see that `rcu_read_lock_sched()` is acquiring an RCU lock, and if `CONFIG_DEBUG_LOCK_ALLOC` is enabled, then we're going through `lock_acquire()`. That's where it starts. I can see that a BPF program attached to `lock_acquire` via `trace_call_bpf()` is firing on *every* call to `pfn_valid`. That’s bad, real bad. Now, `trace_call_bpf` is calling `rcu_read_lock()` and `rcu_read_unlock()`, which themselves go through `lock_release()`. So we have tracepoint firing on `lock_release` and then more tracing code runs via `perf_trace_lock`! This is happening for EVERY single PFN in `copy_pmd_range` during `clone()`! The implications are huge. Imagine a large process, or an attacker mapping gigabytes and then cloning it. I wonder… Could this be an infinite loop, or massive lock recursion? The `__this_cpu_inc_return(bpf_prog_active) != 1` in `trace_call_bpf` looks suspicious, could it be the source of the looping? Let me walk through this again. `pfn_valid` calls `rcu_read_lock_sched()`, hits `lock_acquire`, then `trace_lock_acquire`, then `perf_trace_lock_acquire`, and then, in turn, `trace_call_bpf`. This increments `bpf_prog_active` to 1. But then `trace_call_bpf` calls `rcu_read_lock()` -> `lock_acquire` -> `trace_lock_acquire` which sets `bpf_prog_active` to 2. Thus, when the increment happens in `trace_call_bpf` it bails because it is already 2, then BPF runs and we go through unlock, and the cycle continues. So we have multiple tracepoints, lockdep calls, BPF calls, perf events per *every* PFN check. Each of those PFN checks might be taking tens or hundreds of microseconds. If millions of pages are copied in `copy_page_range`, CPU 1 might not yield or reschedule. Because it is under PTL or mmap_lock and running in a loop without `cond_resched()` or preemption disabled, or taking longer than 112s! Could this lead to soft lockups? Interrupts/softirqs might be disabled, or the CPU might be in a non-preemptible section. Let me go back and re-examine the changes in `kernel/bpf/bpf_struct_ops.c`. I have to see if this patch series is related to: `copy_pmd_range`, `page_table_check_set`, `pfn_valid`, `perf_trace_lock`, `lock_acquire`, or `smp_call_function_many_cond`. Okay, let's look at `bpf_struct_ops.c`. It looks like the patch series added `struct rcu_head free_rcu; struct work_struct free_work;` to `struct bpf_struct_ops_map`. And `bpf_struct_ops_map_free_deferred` and `bpf_struct_ops_map_free_rcu_gp` were added, too. In `bpf_struct_ops_map_free`, it replaced the direct `__bpf_struct_ops_map_free(map);` call with `call_rcu_tasks_trace(&st_map->free_rcu, bpf_struct_ops_map_free_rcu_gp);`. Hold on! Could `call_rcu_tasks_trace` be delaying an RCU grace period? Wait a second… in the backtrace I have, CPU 1 is deep in: `lock_release`, `trace_call_bpf`, `perf_trace_run_bpf_submit`, `perf_trace_lock_acquire`, `lock_acquire`, `pfn_valid`, `page_table_check_set`, `copy_pmd_range`, `copy_page_range`, `dup_mmap`, `copy_mm`, `copy_process`, `kernel_clone`, `__x64_sys_ |
| 20/2 | 2026/10/15 07:57 | tool | grepper |
0mError:no matches Args: {
"Expression": "BUG: soft lockup.*perf_trace_lock"
}Results: {
"error": "no matches"
} |
| 21/2 | 2026/10/15 07:57 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22755 output: 22 thoughts: 32 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Investigating Recent BPF Struct Op Changes** Alright, time to get to the bottom of this. I'm going to start by getting a look at the commit history in the BPF subsystem, specifically focusing on `kernel/bpf/bpf_struct_ops.c`. My immediate thought is to use `git log` to zero in on any recent modifications around that file. I'm going to want to scope it to the base branch—probably `main` or the latest stable, depending on what I'm tracking—to get a clear picture of what's landed that could be influencing the behavior I'm seeing or the issue at hand. It's a targeted approach; hopefully this will quickly surface the commits introducing the change that I need to debug. This is a good starting point to identify any potential regressions or intended changes that might affect the structs used and how the operations are handled. I'm assuming the recent changes on the base branch are relevant, so I want to start there. |
| 22/2 | 2026/10/15 07:57 | tool | git-show |
0mArgs:{
"Commit": "HEAD~1",
"Stat": true
}Results: {
"Output": "commit 15b578b1715d9a318c804350d98af87c203672bc\nMerge: e1d84a37cba98 8b93e9f92c166\nAuthor: Alexei Starovoitov \u003cast@kernel.org\u003e\nDate: Fri Oct 9 20:29:15 2026 +0000\n\n Merge branch 'bpf-use-scalar-evolution-to-widen-bounded-loops'\n \n Eduard Zingerman says:\n \n ====================\n bpf: use scalar evolution to widen bounded loops\n \n This series implements the scalar evolution (SCEV) technique for\n verification of loops.\n \n Scalar evolution is a static analysis technique that infers algebraic\n expressions describing how variables change within a loop body.\n These expressions can then be used to estimate the number of loop body\n executions. This estimate can be used to represent induction variables\n as ranges instead of enumerating each possible value.\n \n For example, the following loop:\n \n for (r0 = 0; r0 \u003c 10; r0++) {\n ...\n }\n \n would now be verified with the assumption that r0 is a scalar value\n in the range [0..9] within its body.\n \n See the following patches for a more technical overview:\n - \"bpf: compute scalar evolution expressions for loops\"\n - \"bpf: use SCEV to widen bounded loops\"\n \n The series can be viewed as consisting of the following parts:\n - Preparatory patches fixing and extending liveness analysis and\n adding utility functions. The liveness changes collect stack access\n effects and register dependencies, including:\n - \"bpf: fix arg_track_xfer() for atomic stack spills and fills\"\n - \"bpf: derive global subprog stack liveness from BTF signatures\"\n - \"bpf: compute parameters liveness in bpf_compute_live_registers()\"\n - Patches relaxing the verifier's current restrictions on accessing\n memory via varying offset pointers, specifically:\n - \"bpf: allow subrange relations for PTR_TO_STACK in regsafe()\"\n - \"bpf: representation for intervals with steps\"\n - \"bpf: varying offset access support for PTR_TO_BTF_ID pointers\"\n - Patches to compute the immediate dominator tree and loop hierarchy.\n - Patches implementing scalar evolution and integrating it with\n the main verification pass:\n - \"bpf: allow precision backtracking between overlapping checkpoints\"\n - \"bpf: compute scalar evolution expressions for loops\"\n - \"bpf: use SCEV to widen bounded loops\"\n - \"bpf: avoid widening registers that hinder exact stack-slot tracking\"\n - Tests and test harness updates.\n \n Literature\n ==========\n \n - \"Symbolic Evaluation of Chains of Recurrences for Loop Optimization\"\n Robert A. van Engelen, 2000\n - \"The CR# Algebra and its Application in Loop Analysis and Optimization\"\n Robert A. van Engelen, 2004\n \n Supported patterns\n ==================\n \n As scalar evolution analysis attempts to infer recurring relationships\n from algebraic expressions describing loop variables, there are some\n limitations on what can be expressed.\n \n Below is a list of patterns that are expected to work with the current\n implementation. The examples are pseudo-code for the indicated BPF\n instruction shapes.\n \n Loop widening currently requires allow_uninit_stack, the verifier mode\n that permits reading uninitialized stack bytes. This requirement applies\n even to loops that use only registers. Without it, the verifier uses\n its existing iteration-by-iteration checking.\n \n 1. Counted loops, including decreasing counters:\n \n u64 i = 0;\n do { i += 1; } while (i \u003c 10);\n \n u64 j = 3;\n do { j += -1; } while (j != 0);\n \n Header ranges are i in [0,9] and j in [1,3].\n Pre-condition loops, such as while (i \u003c 10) { i += 1; },\n are also supported. The counter can reside in a register or a fixed\n 8-byte frame-pointer spill.\n \n 2. Strided accesses into a map value:\n \n /* bytes is a map-value array with at least 16 bytes. */\n u64 i = 0, off = 0;\n do {\n bytes[off] = 1;\n i += 1;\n off += 2;\n } while (i \u003c 8);\n \n At the header, off is in [0,14] with step 2. The byte store stays\n within the map value even though i and off are tracked separately.\n \n 3. A nonconstant entry value with a separate counted induction variable:\n \n u64 x = bpf_get_prandom_u32() \u0026 6; // {0,2,4,6}\n u64 i = 0;\n do { x += 6; i += 1; } while (i \u003c 3);\n \n The counter i supplies the bound. At the header, x widens to [0,18]\n with step 2, retaining the alignment common to its entry values and\n its slope; x itself need not start at a constant.\n \n 4. Conditional assignment from an invariant value:\n \n u64 x = 5;\n for (u64 i = 0; i \u003c 3; i += 1)\n if (i == 1) x = 10;\n return x;\n \n Widening joins the pre-loop value 5 with the assigned value 10,\n giving x in [5,10] both inside and after the loop.\n \n 5. Early exits in addition to the counted backedge:\n \n u64 i = 0;\n do {\n if (bpf_get_prandom_u32() == 0) break;\n i += 1;\n } while (i != 3);\n \n The counter still bounds the loop. An additional exit reduces the\n available lower-bound information; it does not by itself prevent\n widening.\n \n 6. Array accesses through different memory types:\n \n Bounded varying offsets are supported for arrays in BTF-typed\n objects, stack memory, map values and keys, packet data and\n metadata, and memory buffers. The usual bounds, alignment and\n access restrictions still apply.\n \n For stack arrays indexed by a widened loop counter, only byte and\n half-word accesses are supported; see limitation 5 below.\n \n For an array in a BTF-typed object:\n \n struct inner { int a, b; };\n struct object { struct inner arr[8]; };\n /* o points to a live, non-NULL BTF-typed struct object. */\n u64 i = bpf_get_prandom_u32() \u0026 7;\n value = o-\u003earr[i].b;\n \n The 4-byte load has offsets 4 + 8*i, i in [0,7]. Bounds keep\n accesses within arr; base and step 8 ensure that each possible\n offset selects member b. Such accesses also work without a loop.\n \n 7. Nested loops with separate counters:\n \n u64 i = 0;\n do {\n u64 j = 0;\n do {\n /* body */\n j += 1;\n } while (j \u003c 3);\n i += 1;\n } while (i \u003c 4);\n \n Both loops can be widened: i is in [0,3] at the outer header,\n and j is in [0,2] at the inner header. The inner counter is reset\n on each outer iteration; i is unchanged by the inner loop.\n \n 8. Incrementing and comparing a pointer directly:\n \n /* bytes is a map-value array with at least 8 bytes. */\n u8 *p = bytes, *end = bytes + 8;\n do {\n *p = 1;\n p++;\n } while (p != end);\n \n The initial pointer and fixed end pointer give eight iterations,\n without a separate integer counter. At the loop header, p ranges\n from bytes to bytes + 7, so each byte store stays within the array.\n Deriving the iteration count requires the compared pointers to have\n a provable common memory origin.\n \n 9. A loop bounded by an exit other than the latch:\n \n u64 i = 0, len = 14;\n do {\n if (i == len)\n break;\n use(i);\n i += 1;\n } while (i != 64);\n \n Every exit condition dominating the latch bounds the iteration\n count; the smallest bound wins. Here i is in [0,14] at the header,\n not [0,63], so use(i) sees the range established by the break.\n \n Limitations\n ===========\n \n Patterns that lose precision after widening\n -------------------------------------------\n \n Widening can lose information that the verifier gets by checking\n each iteration separately. For example:\n \n r7 = 5;\n for (r6 = 0; r6 \u003c 3; r6++)\n if (r6 == 1)\n r7 = 10;\n if (r7 != 10)\n invalid_stack_read();\n \n R7 is always 10 at the real exit, but is represented as [5, 10] at\n loop entry and after the loop. The verifier therefore cannot exclude\n the invalid read and rejects this otherwise safe program.\n It would be hard to avoid this limitation.\n \n The same issue affects correlated linear counters at loop exit:\n \n u64 i = 0, off = 0;\n while (i \u003c 8) {\n i++;\n off += 2;\n }\n if (off != 16)\n invalid_stack_read();\n \n Enumeration establishes off == 16. Widening tracks i and off\n independently, and the exit check on i does not reconstruct off's exact\n final value. This can be lifted after analysis adjustments.\n \n Patterns not widened yet\n ------------------------\n \n If one of the variables modified in the loop cannot be widened, the\n verifier checks each iteration instead. Examples include:\n \n 1. 32-bit recurrences and comparisons:\n \n for (u32 i = 0; i \u003c 8; i++) // ALU32 / JMP32\n use(i);\n \n Only 64-bit arithmetic and comparisons are supported.\n This limitation will be lifted.\n \n 2. Non-linear updates:\n \n for (u64 i = 1; i \u003c 16; i *= 2) // non-linear recurrence\n use(i);\n \n Recognition is currently limited to simple additive recurrences.\n Literature describes a way to represent this, but it is not\n considered a priority at the moment.\n \n 3. A controlling counter or bound that is not constant at loop entry:\n \n u64 limit = unknown_in_range(1, 8);\n for (u64 i = 0; i \u003c limit; i++)\n use(i);\n \n u64 i = unknown_in_range(0, 7);\n while (i \u003c 8)\n i++;\n \n Both loops have finite bounds, but iteration-count evaluation\n currently requires concrete entry values. Other induction variables\n may have nonconstant entry ranges once a separate counter establishes\n the iteration bound. This limitation can be lifted eventually.\n \n 4. Alternative values referring to another evolving register:\n \n r7 = 0;\n for (r6 = 0; r6 \u003c 4; r6++)\n if (condition)\n r7 = r6;\n use(r7);\n \n R6 changes on each iteration. Widening currently supports\n conditional assignments only from constants or values that do not\n change in the loop. This limitation can be lifted.\n \n 5. Stack addresses whose widening would lose precise slot tracking:\n \n u64 slots[4];\n for (u64 i = 0; i \u003c 4; i++)\n slots[i] = i;\n \n struct bpf_dynptr dptrs[4];\n for (u64 i = 0; i \u003c 4; i++)\n bpf_dynptr_from_xdp(ctx, 0, \u0026dptrs[i]);\n \n Keep such indices concrete for 4- and 8-byte stack loads/stores and\n calls requiring fixed-offset stack objects. Dependencies inside\n nested loops also constrain the outer loop.\n It would be hard to lift this limitation.\n \n 6. Values modified by a nested loop do not get a closed-form summary\n for the enclosing loop:\n \n u64 sum = 0;\n for (u64 i = 0; i \u003c 4; i++)\n for (u64 j = 0; j \u003c 4; j++)\n sum++;\n use(sum);\n \n The inner loop may widen, but the outer analysis forgets values\n modified by it rather than deriving the combined recurrence.\n This limitation can be lifted.\n \n 7. Multiple backedges and irreducible control flow:\n \n i = 0;\n H: if (i \u003e= 8) goto done;\n if (condition) { i++; goto H; } // first backedge\n i++; goto H; // second backedge\n done:\n \n i = 0;\n if (condition) goto body; // second entry into the loop\n H: i++;\n body:\n if (i \u003c 8) goto H;\n \n Widening requires a reducible loop with one backedge and a supported\n dominating exit condition. Multiple exits are supported, but their\n early-exit paths reduce what can be inferred about iteration counts.\n It is unclear whether this can be lifted at the moment.\n \n 8. Large slopes and unsupported iteration bounds:\n \n for (u64 i = 0, x = 0; i \u003c 4; i++) {\n use(x);\n x += 65536; // slope outside signed 16 bits\n }\n \n Slopes used for linear widening must be nonzero signed-16-bit\n constants. The inferred number of header executions must be finite\n and less than U32_MAX. Counter wraparound must be ruled out while\n deriving the bound.\n \n 9. Incompatible pointer alternatives or comparison operands:\n \n p = \u0026map_a[0];\n q = \u0026map_b[0];\n \n for (u64 i = 0; i \u003c 10; i++) {\n if (i == 5)\n p = q;\n use(*p);\n }\n \n At the loop header, p has SCEV ANY(p_entry, q). The alternatives\n point into different maps, so their offsets cannot be joined while\n retaining one map's metadata. Joining invariant pointer\n alternatives requires compatible pointer metadata, including type,\n origin IDs, frame number.\n \n 10. Some hard-coded constant limits:\n - Programs with more than 16 nested loops in one function are rejected.\n - Loops with more than 256 exits exceed the metadata limits and are\n not analyzed for widening.\n - At most 4 exit conditions dominating the latch are consulted for\n the iteration count of a loop.\n - Expression traversal is limited to depth 8. Only a small fixed number\n of alternative values can be joined.\n \n Veristat changes\n ================\n \n The main impact of the series is a 23% reduction in number of\n processed instructions on a subset of Meta BPF programs.\n \n Verdict changes\n ---------------\n \n Two programs flip succes-\u003efailure, both selftests whose expectations\n are updated by the series:\n - verifier_gotox/gotox_edges_at_limit: test's CFG is a nest of ~1000\n irreducible loops, deeper than the per-function loop stack (16),\n the program is rejected with \"Too many nested loops\".\n - verifier_scev/conditional_assignment_on_second_iteration:\n a value assigned on the second iteration is checked after the loop\n with its widened range, so a stack read guarded by that check\n is rejected.\n \n No program from the production corpora changes verdict.\n \n Regressions\n -----------\n \n 20 programs regress by 30-33% and 6 more by 10-21%, all from an\n appliction objects sharing one unwinder library.\n All programs share a common reason for regression:\n - a big outer loop contains several smaller nested loops;\n - nested loops are now widened and coverge, their convergence\n adds backedges to the outer loop's SCC, thus flipping\n checkpoint comparisons with the outer loop to RANGE_WITHIN mode.\n \n Support for 32-bit recurrences and comparisons widens these loops too\n and removes the regression. This would be handled in a followup.\n \n Statistics\n ----------\n \n A: master; B: scev-minimal-v3. Corpora: cilium, meta, scx, selftests.\n Insns counts verifier-processed instructions, not program size.\n Object exclusions: verifier_scev.bpf.o.\n \n Histogram: selected programs, without the table filters.\n \n Total progs: 7952\n Old success: 5637\n New success: 5646\n total_insns diff min: -99.84%\n total_insns diff max: 61.90%\n 0 -\u003e value: 0\n value -\u003e 0: 0\n total_insns abs max old: 837,487\n total_insns abs max new: 837,487\n -100 .. -95 %: 15\n -95 .. -90 %: 12\n -90 .. -85 %: 10\n -85 .. -75 %: 8\n -75 .. -70 %: 6\n -70 .. -65 %: 14\n -65 .. -60 %: 38\n -60 .. -55 %: 10\n -55 .. -50 %: 17\n -50 .. -45 %: 36\n -45 .. -40 %: 9\n -40 .. -35 %: 25\n -35 .. -25 %: 10\n -25 .. -15 %: 11\n -15 .. -10 %: 48\n -10 .. -5 %: 47\n -5 .. 0 %: 111\n 0 .. 5 %: 7488\n 5 .. 15 %: 3\n 15 .. 25 %: 5\n 30 .. 35 %: 20\n 35 .. 40 %: 7\n 40 .. 50 %: 1\n 60 .. 65 %: 1\n \n Tables: success in both runs; baseline Insns \u003e= 5,000.\n Ranked by percentage change, then instruction-count change, file, program.\n Meta names are anonymized; numbered objects are distinct files.\n \n Top wins (50)\n -------------\n \n File Program Insns (A) Insns (B) Insns (DIFF)\n ---------------------------------- --------------------------------- --------- --------- -----------------\n verifier_bounds.bpf.o crossing_64_bit_signed_boundary_2 12330 20 -12310 (-99.84%)\n verifier_iterating_callbacks.bpf.o test1 7004 12 -6992 (-99.83%)\n bpf_iter_tasks.bpf.o dump_task_sleepable 85522 556 -84966 (-99.35%)\n bpf_iter_task_stack.bpf.o dump_task_stack 7209 65 -7144 (-99.10%)\n profiler-10.bpf.o hhvm_stack 23828 347 -23481 (-98.54%)\n bpf_iter_unix.bpf.o dump_unix 9026 226 -8800 (-97.50%)\n meta-app-22.bpf.o program-03 8705 319 -8386 (-96.34%)\n meta-app-22.bpf.o program-06 8948 328 -8620 (-96.33%)\n security-sandbox-10.bpf.o fork 30760 1249 -29511 (-95.94%)\n profiler-02.bpf.o on_py_event 79064 3864 -75200 (-95.11%)\n profiler-03.bpf.o on_py_event 79064 3864 -75200 (-95.11%)\n profiler-05.bpf.o on_py_event 79064 3864 -75200 (-95.11%)\n security-monitor-66.bpf.o mac_sysctl_write 7333 448 -6885 (-93.89%)\n profiler-04.bpf.o get_task_stacks 73176 6050 -67126 (-91.73%)\n security-monitor-65.bpf.o lsm_bprm_creds_for_exec 17538 1701 -15837 (-90.30%)\n security-monitor-65.bpf.o lsm_task_alloc 5674 565 -5109 (-90.04%)\n security-monitor-65.bpf.o lsm_fo_task_update 11399 1181 -10218 (-89.64%)\n security-sandbox-29.bpf.o test_glob_match 47257 5477 -41780 (-88.41%)\n load-balancer-17.bpf.o edgeloom_tc 24854 2984 -21870 (-87.99%)\n profiler-13.bpf.o handle_aten_op_call_start 7183 976 -6207 (-86.41%)\n security-monitor-65.bpf.o lsm_file_open 154412 21168 -133244 (-86.29%)\n security-monitor-17.bpf.o test_execve 293300 46071 -247229 (-84.29%)\n security-sandbox-13.bpf.o kvm_die 36514 5807 -30707 (-84.10%)\n security-monitor-97.bpf.o child_iter 41266 8182 -33084 (-80.17%)\n scheduler-30.bpf.o lavd_dispatch 290915 66359 -224556 (-77.19%)\n security-monitor-25.bpf.o syscalls_kill 98038 27912 -70126 (-71.53%)\n security-sandbox-14.bpf.o kernel_module_request 7880 2357 -5523 (-70.09%)\n security-sandbox-14.bpf.o kernel_load_data 7881 2358 -5523 (-70.08%)\n security-sandbox-14.bpf.o kernel_read_file 7882 2359 -5523 (-70.07%)\n xdp_lb_bench.bpf.o xdp_lb_bench 27126 9208 -17918 (-66.05%)\n firewall-05.bpf.o ingress 54034 18584 -35450 (-65.61%)\n firewall-05.bpf.o tc_in 54034 18584 -35450 (-65.61%)\n firewall-07.bpf.o ingress 54034 18584 -35450 (-65.61%)\n firewall-07.bpf.o tc_in 54034 18584 -35450 (-65.61%)\n security-sandbox-01.bpf.o bpf 30692 10586 -20106 (-65.51%)\n security-monitor-34.bpf.o syscall_setresuid 122200 43305 -78895 (-64.56%)\n security-monitor-34.bpf.o syscalls_setfsgid 122200 43305 -78895 (-64.56%)\n security-monitor-34.bpf.o syscalls_setfsuid 122200 43305 -78895 (-64.56%)\n security-monitor-34.bpf.o syscalls_setgid 122200 43305 -78895 (-64.56%)\n security-monitor-34.bpf.o syscalls_setregid 122200 43305 -78895 (-64.56%)\n security-monitor-34.bpf.o syscalls_setreuid 122200 43305 -78895 (-64.56%)\n security-monitor-34.bpf.o syscalls_setuid 122200 43305 -78895 (-64.56%)\n security-monitor-15.bpf.o cve_2021_4034 122481 43629 -78852 (-64.38%)\n security-monitor-16.bpf.o test 122517 43665 -78852 (-64.36%)\n security-sandbox-10.bpf.o exec 12908 4626 -8282 (-64.16%)\n security-monitor-12.bpf.o connect_security_socket_connect 216252 78013 -138239 (-63.92%)\n security-monitor-19.bpf.o kernel_modules_do_init 92980 33776 -59204 (-63.67%)\n security-monitor-23.bpf.o enter_pivot_root 93518 34311 -59207 (-63.31%)\n security-monitor-08.bpf.o bpf_prog_detect 93384 34494 -58890 (-63.06%)\n firewall-05.bpf.o egress 58436 21951 -36485 (-62.44%)\n \n Top losses (38)\n ---------------\n \n File Program Insns (A) Insns (B) Insns (DIFF)\n -------------------------------- ----------------------------- --------- --------- ----------------\n profiler-26.bpf.o handle_cu_mem_address_reserve 34326 45724 +11398 (+33.21%)\n profiler-26.bpf.o handle_cu_mem_create 34326 45724 +11398 (+33.21%)\n profiler-26.bpf.o handle_malloc 34326 45724 +11398 (+33.21%)\n profiler-26.bpf.o handle_cu_mem_map 34524 45922 +11398 (+33.01%)\n profiler-19.bpf.o sched_waking 17454 23153 +5699 (+32.65%)\n profiler-27.bpf.o handle_cuda_launch_exc 17477 23176 +5699 (+32.61%)\n profiler-27.bpf.o handle_cuda_launch 17490 23189 +5699 (+32.58%)\n profiler-12.bpf.o on_custom_event_begin 17697 23396 +5699 (+32.20%)\n profiler-12.bpf.o on_custom_event_end 17701 23400 +5699 (+32.20%)\n profiler-26.bpf.o handle_mtia_cached_alloc 35494 46892 +11398 (+32.11%)\n profiler-26.bpf.o handle_mtia_allocate_enter 35555 46953 +11398 (+32.06%)\n profiler-26.bpf.o handle_pytorch_malloc 35847 47245 +11398 (+31.80%)\n profiler-19.bpf.o oncpu 17990 23689 +5699 (+31.68%)\n profiler-12.bpf.o on_task_enqueued 18035 23734 +5699 (+31.60%)\n profiler-12.bpf.o sched_waking 18070 23769 +5699 (+31.54%)\n profiler-12.bpf.o on_task_dequeued 18210 23909 +5699 (+31.30%)\n profiler-12.bpf.o on_request_context_event 18301 24000 +5699 (+31.14%)\n profiler-12.bpf.o on_pytorch_event 18302 24001 +5699 (+31.14%)\n profiler-12.bpf.o on_task_stats 18384 24083 +5699 (+31.00%)\n profiler-12.bpf.o oncpu 18488 24187 +5699 (+30.83%)\n profiler-19.bpf.o sched_switch_offcpu 64726 78210 +13484 (+20.83%)\n profiler-12.bpf.o sched_switch 33515 40257 +6742 (+20.12%)\n profiler-09.bpf.o on_custom_event_start 38281 45973 +7692 (+20.09%)\n profiler-09.bpf.o trace_func_entry 38281 45973 +7692 (+20.09%)\n profiler-12.bpf.o get_crochet_walltime_stacks 43473 50215 +6742 (+15.51%)\n profiler-24.bpf.o get_task_stacks 94740 103742 +9002 (+9.50%)\n test_cls_redirect_subprogs.bpf.o cls_redirect 72052 73682 +1630 (+2.26%)\n security-sandbox-20.bpf.o redirect_socket_connect 72423 73913 +1490 (+2.06%)\n scheduler-28.bpf.o arena_alloc_mask 27159 27175 +16 (+0.06%)\n scheduler-30.bpf.o arena_alloc_mask 27159 27175 +16 (+0.06%)\n scx_cake.bpf.o arena_alloc_mask 28721 28737 +16 (+0.06%)\n scx_arena.bpf.o arena_alloc_mask 28734 28750 +16 (+0.06%)\n scx_arena_selftests.bpf.o arena_alloc_mask 28734 28750 +16 (+0.06%)\n scx_chaos.bpf.o arena_alloc_mask 28734 28750 +16 (+0.06%)\n scx_p2dq.bpf.o arena_alloc_mask 28734 28750 +16 (+0.06%)\n scx_cake.bpf.o cake_init_task 28758 28774 +16 (+0.06%)\n scheduler-01.bpf.o arena_alloc_mask 29197 29208 +11 (+0.04%)\n scheduler-03.bpf.o arena_alloc_mask 29197 29208 +11 (+0.04%)\n \n Changelog\n =========\n \n v2 -\u003e v3:\n TLDR: another bunch of major correctness fixes, plus several improvements\n to avoid veristat-meta failure identified for v2.\n - Widen only when allow_uninit_stack is set.\n - Mark scalar registers and stack spills used by the selected bounding\n condition's base, step and bound expressions precise before widening.\n - Join alternative values only for registers with compatible pointer\n metadata. Include the loop-entry value when a register is assigned an\n invariant in the body, including unconditional assignments.\n - Consider up to four exit conditions dominating the backedge and use\n the tightest available iteration bound. Match the induction variable\n in either operand of the comparison.\n - Require full spills for linear stack recurrences. Treat partially\n spilled and unallocated stack slots as unknown scalars and all-zero\n slots as zero. Materialize writable stack values safely, growing the\n stack when needed.\n - Keep base/step in sync with the bounds as the last step of\n reg_bounds_sync(). Preserve the register state when sign extension\n leaves all possible values unchanged. Check that step is nonzero and\n base is smaller than step.\n - Handle latch comparison polarity correctly when the continuing branch\n enters a nested loop. Compute SCEVs only for exits owned by the loop,\n fixing a verifier bug for irreducible inner loops.\n - Exclude BPF_F_INNER_MAP single-element arrays from the separate-lookup\n shortcut in bpf_same_memory_origin().\n - Fix stack-pointer tracking through load-acquire/store-release and\n atomic exchange/fetch/cmpxchg operations, so accesses through recovered\n stack pointers are included in liveness analysis.\n - Derive global subprogram stack effects from BTF argument types, so\n freplace cannot invalidate a loop termination proof based on the\n original callee body.\n - Compute argument liveness from callee reads for static subprograms\n and from BTF-declared arguments for globals. Prepare argument metadata\n before liveness analysis, avoiding unnecessarily live registers that\n prevented widening.\n - Treat already-unbounded scalars as already widened, allowing unknown\n SCEVs such as stack outputs of probe-read helpers called through a\n subprogram.\n - Widen to an unbounded range when computing an induction variable's\n range overflows signed 64-bit arithmetic, retaining the power-of-two\n alignment common to the entry value and slope.\n - Fix dominator computation for subprograms whose entry is a loop header:\n initialize the entry as its own dominator during the fixed-point\n computation and skip updates to it. Use overflow-checked predecessor\n allocations.\n - Replace the private worklist heap with the kernel min-heap and limit\n expression rewriting to 32 passes before falling back to unknown.\n - Add regression coverage for the liveness, stack, pointer, iteration\n bound and widening changes. Fix __msg_next validation when an expected\n message is missing.\n \n v1 -\u003e v2:\n TLDR: a bunch of major correctness fixes.\n - Introduce arg_access_info to distinguish read, may-write and\n must-write effects of helper/kfunc stack accesses. Handle map-specific\n argument semantics and writes through unknown callbacks.\n - Fix base/step tracking across signed overflow, truncation,\n sign/zero extension and linked-register updates.\n - Rework iteration-count calculation for signed/unsigned increasing\n and decreasing counters, including counter overflow checks.\n Evaluate the full latch base expression and consistently count\n header executions.\n - Substitute all registers in instantiate_header_scevs().\n - Track pointer origins when evaluating latch expressions.\n Require compatible operands before deriving iteration bounds.\n - Preserve the correct congruence base when widening nonconstant\n entry values, assign fresh IDs to widened packet pointers,\n and exclude nullable pointers from widening.\n - Account for values modified on nested-loop exit paths when computing\n invariants. Do not use an inner loop's latch to bound an outer loop.\n - Restrict pruning against in-progress SCEV states to terminating\n innermost loops sharing the same entry checkpoint, preventing\n inner-loop pruning from hiding a nonterminating outer loop.\n - Rework loop entry/exit handling on the main verification pass.\n - Extend fixed-stack-offset widening suppression to ANY expressions\n and all dynptr arguments described by helper/kfunc prototypes.\n - Fix BTF array handling: retain bounds checks for fixed arrays inside\n flexible-array elements and preserve array type IDs when element\n types contain typedefs.\n - Fix SCEV handling of endian conversions and narrow fills on\n big-endian systems.\n - Grow expression storage geometrically and scale the expression hash\n table with program size. Add cancellation/rescheduling checks to\n dominator computation and fix the postorder-number allocation leak.\n - Pack bpf_reg_state/bpf_func_state for latter to fit back into\n the 1 KiB allocation bucket, measured SCEV memory consumption\n overhead is 3% now.\n - Major additions in the selftests.\n \n v1: https://lore.kernel.org/bpf/20260926-scev-minimal-rebase-v1-0-c8e5ab5ba79f@gmail.com/\n v2: https://lore.kernel.org/bpf/20261004-scev-minimal-rebase-v2-0-f6254e29fdf2@gmail.com/\n ---\n ====================\n \n Link: https://patch.msgid.link/20261009-scev-minimal-rebase-v3-0-bcba9bc53ac9@gmail.com\n Signed-off-by: Alexei Starovoitov \u003cast@kernel.org\u003e\n\n include/linux/bpf_verifier.h | 192 +-\n include/linux/cnum.h | 3 +\n include/linux/tnum.h | 2 +\n kernel/bpf/Makefile | 2 +-\n kernel/bpf/backtrack.c | 5 +\n kernel/bpf/btf.c | 159 +-\n kernel/bpf/cfg.c | 56 +-\n kernel/bpf/cnum.c | 36 +\n kernel/bpf/cnum_defs.h | 44 +\n kernel/bpf/const_fold.c | 2 +\n kernel/bpf/fixups.c | 18 +\n kernel/bpf/liveness.c | 522 ++--\n kernel/bpf/log.c | 19 +-\n kernel/bpf/loops.c | 616 ++++\n kernel/bpf/ringbuf.c | 4 +-\n kernel/bpf/scev.c | 2761 +++++++++++++++++\n kernel/bpf/states.c | 216 +-\n kernel/bpf/tnum.c | 11 +\n kernel/bpf/verifier.c | 918 +++++-\n .../testing/selftests/bpf/prog_tests/exceptions.c | 2 +-\n tools/testing/selftests/bpf/prog_tests/verifier.c | 10 +\n tools/testing/selftests/bpf/progs/bpf_iter_unix.c | 2 +-\n tools/testing/selftests/bpf/progs/bpf_misc.h | 6 +\n .../selftests/bpf/progs/compute_live_registers.c | 41 +-\n .../selftests/bpf/progs/test_skc_to_unix_sock.c | 2 +-\n .../selftests/bpf/progs/verifier_bounds_step.c | 544 ++++\n .../bpf/progs/verifier_btf_array_access.c | 576 ++++\n tools/testing/selftests/bpf/progs/verifier_gotox.c | 6 +-\n tools/testing/selftests/bpf/progs/verifier_idoms.c | 377 +++\n .../selftests/bpf/progs/verifier_kfunc_uninit.c | 6 +\n .../selftests/bpf/progs/verifier_live_stack.c | 485 ++-\n .../selftests/bpf/progs/verifier_loop_hierarchy.c | 346 +++\n tools/testing/selftests/bpf/progs/verifier_scev.c | 3180 ++++++++++++++++++++\n .../selftests/bpf/progs/verifier_stack_ptr.c | 36 +\n tools/testing/selftests/bpf/test_loader.c | 11 +\n 35 files changed, 10800 insertions(+), 416 deletions(-)\n"
} |
| 23/2 | 2026/10/15 07:57 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 33841 output: 15 thoughts: 998 Thoughts: **Analyzing the Struct_Ops Map Freeing in BPF** Alright, let's break this down. My understanding is that the core issue is around the safe freeing of `struct_ops` maps in BPF when they are still potentially in use by running programs. The main patch, which is `bpf: Defer freeing a struct_ops map until its progs are done`, is the key one, and the selftest patches, `selftests/bpf: Test freeing a struct_ops map under a running prog` and `selftests/bpf: Wait for the struct_ops map to be freed in assoc_in_timer`, are there to validate the fix and cover specific scenarios. Looking at the `git-show HEAD` diff from the main patch, the addition of `free_rcu` and `free_work` in the `bpf_struct_ops_map` struct and associated functions, particularly `bpf_struct_ops_map_free_rcu_gp` and `bpf_struct_ops_map_free_deferred`, is the critical implementation. Essentially, instead of directly freeing the map, the patch introduces an RCU-based deferral mechanism. It uses `call_rcu_tasks_trace` and then `queue_work` to ensure that any running programs that might still be using the `struct_ops` map have finished their grace periods before the map is truly freed. Specifically, the comment mentions it accounts for potential race conditions from timers and bpf_wq callbacks, which are valid concerns, and the implementation aligns with this. The `synchronize_rcu_tasks` ensures that the grace period completes to allow cleanup of any tasks using the map. The intention of this is to resolve a potential use-after-free scenario. This is a solid solution, typical of RCU's design, but needs thorough testing (which the self tests provide) to validate its safety and correctness, particularly in edge cases. I'll review the selftest patches now to have a completely full understanding of this. |
| 24/2 | 2026/10/15 07:58 | tool | series-patches |
0mArgs:{
"PatchNum": 2
}Results: {
"Output": "Patch [2] [PATCH bpf-next v3 2/3] selftests/bpf: Test freeing a struct_ops map under a running prog:\n\nst_ops_assoc_in_timer_no_uref drops every reference to the struct_ops\nmap while a timer callback of its prog calls .test_1 through the\nassociation, and checks that the callback ends up with no struct_ops.\n\nThe timer first fires 500ms later and .test_1 returns right away, so the\ncallback hardly ever runs .test_1 while the map is freed, and the test\ncan't catch a map that is freed under a running .test_1.\n\nAdd st_ops_assoc_in_timer_free, which starts the timer right away,\nrestarts it with no delay until the association is gone, and makes\n.test_1 spin in bpf_loop() when the timer callback calls it. Share the\nsteps of st_ops_assoc_in_timer_no_uref with it through a helper.\n\nst_ops_assoc_in_timer_free run in a loop on kernels of the same bpf-next\ncommit with KASAN enabled, x86_64 VM with 32 vCPUs, without and with\nthe previous fix:\n\n without the fix with the fix\n outcome Oops (int3) on run 1 100 of 100 passed, 0.27 s each\n\nSigned-off-by: Qiliang Yuan \u003codys.yuan@gmail.com\u003e\n---\n .../bpf/prog_tests/test_struct_ops_assoc.c | 29 +++++++++++++++++++---\n .../bpf/progs/struct_ops_assoc_in_timer.c | 16 ++++++++++++\n 2 files changed, 41 insertions(+), 4 deletions(-)\n\ndiff --git a/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c b/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c\nindex 461ded7223515..987117091c676 100644\n--- a/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c\n+++ b/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c\n@@ -136,7 +136,8 @@ static void test_st_ops_assoc_in_timer(void)\n \tstruct_ops_assoc_in_timer__destroy(skel);\n }\n \n-static void test_st_ops_assoc_in_timer_no_uref(void)\n+static void run_st_ops_assoc_in_timer_no_uref(int timer_ns, int wait_map_free,\n+\t\t\t\t\t int spin_loops)\n {\n \tstruct struct_ops_assoc_in_timer *skel = NULL;\n \tstruct bpf_link *link;\n@@ -157,10 +158,13 @@ static void test_st_ops_assoc_in_timer_no_uref(void)\n \t/*\n \t * Run .test_1 by calling kfunc bpf_kfunc_multi_st_ops_test_1_prog_arg() and checks\n \t * the return value. .test_1 will also schedule timer_cb that runs .test_1 again.\n-\t * timer_cb will run 500ms after syscall_prog runs, when the user space no longer\n-\t * holds a reference to st_ops_map.\n+\t * timer_cb will run timer_ns after syscall_prog runs and, with wait_map_free, every\n+\t * timer_ns after that until the map is freed. With 500ms, it first runs when the\n+\t * user space no longer holds a reference to st_ops_map.\n \t */\n-\tskel-\u003ebss-\u003etimer_ns = 500000000;\n+\tskel-\u003ebss-\u003etimer_ns = timer_ns;\n+\tskel-\u003ebss-\u003ewait_map_free = wait_map_free;\n+\tskel-\u003ebss-\u003espin_loops = spin_loops;\n \terr = bpf_prog_test_run_opts(bpf_program__fd(skel-\u003eprogs.syscall_prog), NULL);\n \tASSERT_OK(err, \"bpf_prog_test_run_opts\");\n \n@@ -178,6 +182,21 @@ static void test_st_ops_assoc_in_timer_no_uref(void)\n \tstruct_ops_assoc_in_timer__destroy(skel);\n }\n \n+static void test_st_ops_assoc_in_timer_no_uref(void)\n+{\n+\trun_st_ops_assoc_in_timer_no_uref(500000000, 0, 0);\n+}\n+\n+/*\n+ * Keep calling .test_1 through the association from the timer callback, and\n+ * stay in it for a while each time, while the map is being freed. The map\n+ * must not be freed under a running .test_1.\n+ */\n+static void test_st_ops_assoc_in_timer_free(void)\n+{\n+\trun_st_ops_assoc_in_timer_no_uref(0, 1, 1 \u003c\u003c 20);\n+}\n+\n void test_struct_ops_assoc(void)\n {\n \tif (test__start_subtest(\"st_ops_assoc\"))\n@@ -188,4 +207,6 @@ void test_struct_ops_assoc(void)\n \t\ttest_st_ops_assoc_in_timer();\n \tif (test__start_subtest(\"st_ops_assoc_in_timer_no_uref\"))\n \t\ttest_st_ops_assoc_in_timer_no_uref();\n+\tif (test__start_subtest(\"st_ops_assoc_in_timer_free\"))\n+\t\ttest_st_ops_assoc_in_timer_free();\n }\ndiff --git a/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c b/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c\nindex 0bed49e9f2170..47a44c8e8b114 100644\n--- a/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c\n+++ b/tools/testing/selftests/bpf/progs/struct_ops_assoc_in_timer.c\n@@ -25,6 +25,13 @@ int test_err;\n int timer_ns;\n int timer_test_1_ret;\n int timer_cb_run;\n+int wait_map_free;\n+int spin_loops;\n+\n+static int spin(u32 i, void *ctx)\n+{\n+\treturn 0;\n+}\n \n __noinline static int timer_cb(void *map, int *key, struct bpf_timer *timer)\n {\n@@ -34,6 +41,12 @@ __noinline static int timer_cb(void *map, int *key, struct bpf_timer *timer)\n \ttimer_test_1_ret = bpf_kfunc_multi_st_ops_test_1_assoc(\u0026args);\n \trecur--;\n \n+\t/* Try again later until the map is freed */\n+\tif (wait_map_free \u0026\u0026 timer_test_1_ret != -1) {\n+\t\tbpf_timer_start(timer, timer_ns, 0);\n+\t\treturn 0;\n+\t}\n+\n \ttimer_cb_run++;\n \n \treturn 0;\n@@ -53,6 +66,9 @@ int BPF_PROG(test_1, struct st_ops_args *args)\n \t\tbpf_timer_init(timer, \u0026array_map, 1);\n \t\tbpf_timer_set_callback(timer, timer_cb);\n \t\tbpf_timer_start(timer, timer_ns, 0);\n+\t} else if (spin_loops) {\n+\t\t/* Stay in the trampoline while the map may be freed */\n+\t\tbpf_loop(spin_loops, spin, NULL, 0);\n \t}\n \n \treturn MAP_MAGIC;\n\n-- \n2.43.0"
} |
| 25/2 | 2026/10/15 07:58 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37368 output: 15 thoughts: 9 Thoughts: Okay, here's the summary, rendered as a first-person thought process, keeping in mind the user is an expert: **Assessing Patch 3: A Quick Diagnostic** Alright, let's dive into Patch 3. Given my background, I'm immediately thinking strategically. I need to quickly assess the potential impact of this patch. Where does it address current pain points in the system? What new features or functionalities does it introduce? Are there any obvious areas of concern, potential regressions, or compatibility issues that jump out at me based on my understanding of the system's architecture and the documented changes? I need to focus on what has changed between the last working build and this new patch. My primary goal here is to quickly evaluate whether this patch warrants further, more in-depth investigation and if so, where. Are there any quick red flags? Does it touch any critical components? Let's check. |
| 26/2 | 2026/10/15 07:58 | tool | series-patches |
0mArgs:{
"PatchNum": 3
}Results: {
"Output": "Patch [3] [PATCH bpf-next v3 3/3] selftests/bpf: Wait for the struct_ops map to be freed in assoc_in_timer:\n\nst_ops_assoc_in_timer_no_uref runs .test_1, which starts a timer to\ncall it again 500ms later, drops every reference to the struct_ops map,\nand expects the timer callback to find no struct_ops associated with\nits program anymore.\n\nThe association goes away only when the map is freed, which happens in\na work item after an RCU grace period. With other tests running in\nparallel, that can take longer than 500ms, and the callback still\nreaches the struct_ops and gets MAP_MAGIC instead of -1.\n\nHave the timer callback restart the timer until the map is gone, as it\ndoes for st_ops_assoc_in_timer_free. Calling the struct_ops through the\nassociation until then is safe, as the map is freed only after a grace\nperiod that follows clearing the association.\n\nst_ops_assoc_in_timer_no_uref run 100 times with test_progs -j32 running\nin the background, on a KASAN kernel with the fix, x86_64 VM with 32\nvCPUs, before and after this patch:\n\n before after\n outcome 1 of 100 failed (MAP_MAGIC) 100 of 100 passed\n\nFixes: 5db69b0fbdc8 (\"bpf: Make struct_ops tasks_rcu grace period optional\")\nSigned-off-by: Qiliang Yuan \u003codys.yuan@gmail.com\u003e\n---\n tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c b/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c\nindex 987117091c676..10fd294a0af3c 100644\n--- a/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c\n+++ b/tools/testing/selftests/bpf/prog_tests/test_struct_ops_assoc.c\n@@ -184,7 +184,7 @@ static void run_st_ops_assoc_in_timer_no_uref(int timer_ns, int wait_map_free,\n \n static void test_st_ops_assoc_in_timer_no_uref(void)\n {\n-\trun_st_ops_assoc_in_timer_no_uref(500000000, 0, 0);\n+\trun_st_ops_assoc_in_timer_no_uref(500000000, 1, 0);\n }\n \n /*\n\n-- \n2.43.0"
} |
| 27/2 | 2026/10/15 07:58 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38334 output: 37 thoughts: 1376 Thoughts: **Analyzing a Soft Lockup: The Quest for the Culprit** Alright, let's break down this crash report. A "soft lockup" on CPU 1 for a whopping 112 seconds – that's a serious problem. The stack trace clearly shows CPU 1 is stuck within `copy_process`, specifically deep inside the page table manipulation functions: `copy_pmd_range`, and ultimately related to a `syzkaller` test case. CPU 0, meanwhile, is trying to flush the TLB on CPU 1 via an IPI initiated by `smp_call_function_many_cond`. That means CPU 0 is waiting for CPU 1 to respond. The crucial question is *why* CPU 1 is taking so long. Now, *copy_pmd_range* in itself shouldn't take this long, even with a large address space being cloned. Hard interrupts are enabled. In a preemptible kernel, something *must* be holding things up. Syzkaller's involvement sparks a thought: It heavily utilizes BPF programs attached to tracepoints. Aha! The stack trace reveals calls to `lock_acquire` and `lock_release` which trigger tracepoints. And those tracepoints, in turn, are calling BPF programs. This looks like a clue. We see `pfn_valid()` called from `page_table_check_set()`. This function, common in debug kernels, calls `rcu_read_lock_sched()`. That calls `lock_acquire()`. and `rcu_read_unlock_sched()`, which call `lock_release()`. And the tracepoint code, `trace_call_bpf()`, also locks and unlocks the RCU. In a kernel with KASAN or lockdep enabled, every PTE/PMD access could be slow! With a huge address space, this can create quadratic overhead. Let's see if this patch is related: Is this patch series to blame? No. It doesn't touch memory management, tracing, lockdep, perf, or process creation directly. It only modifies `bpf_struct_ops.c`. Could `call_rcu_tasks_trace` be the culprit? This is unlikely because it's non-blocking, and queues a callback. Furthermore, `bpf_struct_ops_map_free` isn't even in the crash trace! So, it appears the patch is unrelated to the soft lockup. CPU 1 is in `lock_release` triggered from `trace_call_bpf`! Let's check line numbers of `trace_call_bpf+0x7c4/0xb80`. Let's check line numbers in the bpf_trace.c file. |
| 28/2 | 2026/10/15 07:58 | tool | grepper |
0mArgs:{
"Expression": "trace_call_bpf",
"PathPrefixes": [
"kernel/trace/bpf_trace.c"
]
}Results: {
"Output": "kernel/trace/bpf_trace.c=95=static u64 bpf_uprobe_multi_entry_ip(struct bpf_run_ctx *ctx);\n--\nkernel/trace/bpf_trace.c-97-/**\nkernel/trace/bpf_trace.c:98: * trace_call_bpf - invoke BPF program\nkernel/trace/bpf_trace.c-99- * @call: tracepoint event\n--\nkernel/trace/bpf_trace.c-110- */\nkernel/trace/bpf_trace.c:111:unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)\nkernel/trace/bpf_trace.c-112-{\n--\nkernel/trace/bpf_trace.c-137-\t * If bpf_prog_array_valid() fetched prog_array was\nkernel/trace/bpf_trace.c:138:\t * non-NULL, we go into trace_call_bpf() and do the actual\nkernel/trace/bpf_trace.c-139-\t * proper rcu_dereference() under RCU lock.\n--\nkernel/trace/bpf_trace.c-157-/**\nkernel/trace/bpf_trace.c:158: * trace_call_bpf_faultable - invoke BPF program in faultable context\nkernel/trace/bpf_trace.c-159- * @call: tracepoint event\n--\nkernel/trace/bpf_trace.c-161- *\nkernel/trace/bpf_trace.c:162: * Variant of trace_call_bpf() for faultable tracepoints (syscall\nkernel/trace/bpf_trace.c-163- * tracepoints). Supports sleepable BPF programs by using rcu_tasks_trace\n--\nkernel/trace/bpf_trace.c-172- */\nkernel/trace/bpf_trace.c:173:unsigned int trace_call_bpf_faultable(struct trace_event_call *call, void *ctx)\nkernel/trace/bpf_trace.c-174-{\n"
} |
| 29/2 | 2026/10/15 07:58 | llm | finding-triage-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40876 output: 366 thoughts: 1337 Thoughts: **Analysis of Soft Lockup in Kernel During `clone()` with BPF Tracing** Okay, let's break this down. We have a soft lockup triggered during a `clone()` system call, specifically within `copy_pmd_range`. The stack trace is pretty clear: it's a deep dive into page table copying, hitting `pfn_valid`, `lock_acquire`, and then, crucially, `trace_call_bpf`. We need to figure out the connection between the problematic `clone` and BPF tracing, and whether this new patch series is the culprit. First, I quickly check `trace_call_bpf` in `kernel/trace/bpf_trace.c`. The code itself shows `bpf_prog_run_array` called within an RCU read lock and unlock. That unlock is where `lock_release` is hit and the tracepoint fires. I want to establish if the patch series related to `bpf_struct_ops` is at all relevant. I go through the code modifications, meticulously. The patch defers freeing a `struct_ops` map by using `call_rcu_tasks_trace` and a work queue. It only touches `kernel/bpf/bpf_struct_ops.c` and some selftests, and I can be certain that it has absolutely *zero* direct connection to `perf_trace_lock`, `lock_release`, or the page table copying code. No code paths of the patch series are executed anywhere in this stack trace. I consider the broader picture, and suspect that this is a classic syzkaller soft lockup caused by tracing overhead under BPF tracepoints, or a pre-existing issue where attaching BPF programs to lockdep/perf events (such as lock_acquire / lock_release) introduces enormous overhead on every PFN check during page table copying, starving the CPU and triggering the soft lockup watchdog. To confirm I check: * Does syzkaller run struct_ops tests? No. * Is `clone` calling something unexpected? No, the trace shows that this is an expected codepath. My focus shifts to `pfn_valid`. That function calls `rcu_read_lock_sched()`, which internally calls `lock_acquire`. Since `perf_trace_lock_acquire` is enabled, `trace_call_bpf` is fired, and then `lock_release` is fired. The critical piece here is the scale. `copy_pmd_range` has to iterate through *thousands or millions* of page table entries. With KASAN and lockdep active, calling the BPF tracepoint handlers for *every* `pfn_valid` check is taking too long. This saturates the CPU, which then triggers the soft lockup watchdog timeout. This is NOT caused by the patch series, it's caused by the tracing overhead. The patch series is unrelated, focused on a different part of the BPF code. The root cause is a pre-existing issue. So, the triage steps confirm this: We've identified the soft lockup, examined the stack traces and the patch series. There's no connection between the patch series and the lockup. Therefore, the crash wasn't introduced by the patch series. I am ready to call `set-results` and provide the detailed reasoning. |
| 30/2 | 2026/10/15 07:58 | tool | set-results |
0mArgs:{
"Introduced": false,
"Reasoning": "The crash report shows a soft lockup (`watchdog: BUG: soft lockup - CPU#1 stuck for 112s!`) on CPU#1 while executing a clone system call (`__x64_sys_clone`). During `dup_mmap` / `copy_page_range` / `copy_pmd_range`, `page_table_check_set` calls `pfn_valid`, which enters an RCU read critical section and calls `lock_acquire`. Because a BPF program or perf tracepoint was attached to lock debugging tracepoints (`lock_acquire` / `lock_release`), every page validation triggers `perf_trace_lock_acquire` -\u003e `trace_call_bpf` -\u003e `lock_release` -\u003e `perf_trace_lock`. This tracing overhead across many page table entries leads to CPU starvation and the watchdog soft lockup.\n\nThe tested patch series (\"bpf: Defer freeing a struct_ops map until its progs are done\") only modifies `kernel/bpf/bpf_struct_ops.c` (and selftests under `tools/testing/selftests/bpf/`) to defer freeing a struct_ops map via `call_rcu_tasks_trace` and a workqueue. It does not touch `copy_pmd_range`, `page_table_check`, `pfn_valid`, lockdep, perf tracing, or general process management. None of the functions or structures modified by the patch series are present in the call trace.\n\nTherefore, the soft lockup is unrelated to the patch series and was not introduced by it."
}Results: {
"Introduced": false,
"Reasoning": "The crash report shows a soft lockup (`watchdog: BUG: soft lockup - CPU#1 stuck for 112s!`) on CPU#1 while executing a clone system call (`__x64_sys_clone`). During `dup_mmap` / `copy_page_range` / `copy_pmd_range`, `page_table_check_set` calls `pfn_valid`, which enters an RCU read critical section and calls `lock_acquire`. Because a BPF program or perf tracepoint was attached to lock debugging tracepoints (`lock_acquire` / `lock_release`), every page validation triggers `perf_trace_lock_acquire` -\u003e `trace_call_bpf` -\u003e `lock_release` -\u003e `perf_trace_lock`. This tracing overhead across many page table entries leads to CPU starvation and the watchdog soft lockup.\n\nThe tested patch series (\"bpf: Defer freeing a struct_ops map until its progs are done\") only modifies `kernel/bpf/bpf_struct_ops.c` (and selftests under `tools/testing/selftests/bpf/`) to defer freeing a struct_ops map via `call_rcu_tasks_trace` and a workqueue. It does not touch `copy_pmd_range`, `page_table_check`, `pfn_valid`, lockdep, perf tracing, or general process management. None of the functions or structures modified by the patch series are present in the call trace.\n\nTherefore, the soft lockup is unrelated to the patch series and was not introduced by it."
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|