| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/07/22 21:39 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"PERF_EVENTS"
],
"FocusSymbols": [
"stack_map_get_build_id_offset",
"bpf_find_vma",
"do_mmap_read_unlock"
],
"Reasoning": "The patch fixes a concurrency issue in BPF's handling of mmap_read_trylock when IRQs are disabled by introducing an atomic_t active flag to reserve the per-cpu mmap_unlock_irq_work slot. This is a functional change in core BPF logic that affects stack maps and task iterators.",
"WorthFuzzing": true
} |
| 1/1 | 2026/07/22 21:39 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit d2e4b0fbe9a07417cf96df93daea3e4aacbbc129\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Jul 22 21:39:52 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/kernel/bpf/mmap_unlock_work.h b/kernel/bpf/mmap_unlock_work.h\nindex 5d18d7d85bef96..d416e4337635fe 100644\n--- a/kernel/bpf/mmap_unlock_work.h\n+++ b/kernel/bpf/mmap_unlock_work.h\n@@ -4,12 +4,14 @@\n \n #ifndef __MMAP_UNLOCK_WORK_H__\n #define __MMAP_UNLOCK_WORK_H__\n+#include \u003clinux/atomic.h\u003e\n #include \u003clinux/irq_work.h\u003e\n \n /* irq_work to run mmap_read_unlock() in irq_work */\n struct mmap_unlock_irq_work {\n \tstruct irq_work irq_work;\n \tstruct mm_struct *mm;\n+\tatomic_t active;\n };\n \n DECLARE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);\n@@ -18,8 +20,8 @@ DECLARE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);\n * We cannot do mmap_read_unlock() when the irq is disabled, because of\n * risk to deadlock with rq_lock. To look up vma when the irqs are\n * disabled, we need to run mmap_read_unlock() in irq_work. We use a\n- * percpu variable to do the irq_work. If the irq_work is already used\n- * by another lookup, we fall over.\n+ * percpu variable to do the irq_work. The active flag reserves the slot\n+ * before mmap_read_trylock() and until the irq_work callback consumes mm.\n */\n static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **work_ptr)\n {\n@@ -29,9 +31,10 @@ static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **wo\n \tif (irqs_disabled()) {\n \t\tif (!IS_ENABLED(CONFIG_PREEMPT_RT)) {\n \t\t\twork = this_cpu_ptr(\u0026mmap_unlock_work);\n-\t\t\tif (irq_work_is_busy(\u0026work-\u003eirq_work)) {\n-\t\t\t\t/* cannot queue more up_read, fallback */\n+\t\t\tif (irq_work_is_busy(\u0026work-\u003eirq_work) ||\n+\t\t\t atomic_cmpxchg_acquire(\u0026work-\u003eactive, 0, 1)) {\n \t\t\t\tirq_work_busy = true;\n+\t\t\t\twork = NULL;\n \t\t\t}\n \t\t} else {\n \t\t\t/*\n@@ -46,6 +49,32 @@ static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **wo\n \treturn irq_work_busy;\n }\n \n+static inline void bpf_mmap_unlock_put_irq_work(struct mmap_unlock_irq_work *work)\n+{\n+\tif (work)\n+\t\tatomic_set_release(\u0026work-\u003eactive, 0);\n+}\n+\n+/*\n+ * Try to take mm-\u003emmap_lock for reading on behalf of a BPF helper that may\n+ * run with IRQs disabled. On success, *work is the slot to hand to\n+ * bpf_mmap_unlock_mm() (NULL when the unlock can be done inline); on failure\n+ * no slot stays reserved and the caller must fall back.\n+ */\n+static inline bool bpf_mmap_read_trylock(struct mm_struct *mm,\n+\t\t\t\t\t struct mmap_unlock_irq_work **work)\n+{\n+\tif (bpf_mmap_unlock_get_irq_work(work))\n+\t\treturn false;\n+\n+\tif (!mmap_read_trylock(mm)) {\n+\t\tbpf_mmap_unlock_put_irq_work(*work);\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n static inline void bpf_mmap_unlock_mm(struct mmap_unlock_irq_work *work, struct mm_struct *mm)\n {\n \tif (!work) {\ndiff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c\nindex 41fe87d7302f22..166fc8efab8b21 100644\n--- a/kernel/bpf/stackmap.c\n+++ b/kernel/bpf/stackmap.c\n@@ -415,7 +415,6 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,\n \t\t\t\t\t u32 trace_nr, bool user, bool may_fault)\n {\n \tstruct mmap_unlock_irq_work *work = NULL;\n-\tbool irq_work_busy = bpf_mmap_unlock_get_irq_work(\u0026work);\n \tbool has_user_ctx = user \u0026\u0026 current \u0026\u0026 current-\u003emm;\n \tstruct stack_map_build_id_cache cache = {};\n \tstruct vm_area_struct *vma;\n@@ -430,7 +429,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,\n \t * fallback is used for kernel stack (!user) on a stackmap with\n \t * build_id.\n \t */\n-\tif (!has_user_ctx || irq_work_busy || !mmap_read_trylock(current-\u003emm)) {\n+\tif (!has_user_ctx || !bpf_mmap_read_trylock(current-\u003emm, \u0026work)) {\n \t\t/* cannot access current-\u003emm, fall back to ips */\n \t\tfor (i = 0; i \u003c trace_nr; i++)\n \t\t\tstack_map_build_id_set_ip(\u0026id_offs[i]);\ndiff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c\nindex b256fb9c1214e4..e66e3484f923dc 100644\n--- a/kernel/bpf/task_iter.c\n+++ b/kernel/bpf/task_iter.c\n@@ -755,7 +755,6 @@ BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,\n {\n \tstruct mmap_unlock_irq_work *work = NULL;\n \tstruct vm_area_struct *vma;\n-\tbool irq_work_busy = false;\n \tbool __maybe_unused mmput_needed = false;\n \tstruct mm_struct *mm;\n \tint ret = -ENOENT;\n@@ -792,9 +791,7 @@ BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,\n \tif (!mm)\n \t\treturn -ENOENT;\n \n-\tirq_work_busy = bpf_mmap_unlock_get_irq_work(\u0026work);\n-\n-\tif (irq_work_busy || !mmap_read_trylock(mm)) {\n+\tif (!bpf_mmap_read_trylock(mm, \u0026work)) {\n \t\tret = -EBUSY;\n \t\tgoto out;\n \t}\n@@ -1191,6 +1188,8 @@ static void do_mmap_read_unlock(struct irq_work *entry)\n \n \twork = container_of(entry, struct mmap_unlock_irq_work, irq_work);\n \tmmap_read_unlock_non_owner(work-\u003emm);\n+\twork-\u003emm = NULL;\n+\tbpf_mmap_unlock_put_irq_work(work);\n }\n \n static int __init task_iter_init(void)\n"
} |
| 2/1 | 2026/07/22 21:39 | agent | patch-evaluator |
0mModel:best-expensive Args: null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"PERF_EVENTS"
],
"FocusSymbols": [
"stack_map_get_build_id_offset",
"bpf_find_vma",
"do_mmap_read_unlock"
],
"Reasoning": "The patch fixes a concurrency issue in BPF's handling of mmap_read_trylock when IRQs are disabled by introducing an atomic_t active flag to reserve the per-cpu mmap_unlock_irq_work slot. This is a functional change in core BPF logic that affects stack maps and task iterators.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Do not list too generic configs (we already have them enabled). Only list those that specifically cover the modified code. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit d2e4b0fbe9a07417cf96df93daea3e4aacbbc129
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Jul 22 21:39:52 2026 +0000
syz-cluster: applied patch under review
diff --git a/kernel/bpf/mmap_unlock_work.h b/kernel/bpf/mmap_unlock_work.h
index 5d18d7d85bef96..d416e4337635fe 100644
--- a/kernel/bpf/mmap_unlock_work.h
+++ b/kernel/bpf/mmap_unlock_work.h
@@ -4,12 +4,14 @@
#ifndef __MMAP_UNLOCK_WORK_H__
#define __MMAP_UNLOCK_WORK_H__
+#include <linux/atomic.h>
#include <linux/irq_work.h>
/* irq_work to run mmap_read_unlock() in irq_work */
struct mmap_unlock_irq_work {
struct irq_work irq_work;
struct mm_struct *mm;
+ atomic_t active;
};
DECLARE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);
@@ -18,8 +20,8 @@ DECLARE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);
* We cannot do mmap_read_unlock() when the irq is disabled, because of
* risk to deadlock with rq_lock. To look up vma when the irqs are
* disabled, we need to run mmap_read_unlock() in irq_work. We use a
- * percpu variable to do the irq_work. If the irq_work is already used
- * by another lookup, we fall over.
+ * percpu variable to do the irq_work. The active flag reserves the slot
+ * before mmap_read_trylock() and until the irq_work callback consumes mm.
*/
static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **work_ptr)
{
@@ -29,9 +31,10 @@ static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **wo
if (irqs_disabled()) {
if (!IS_ENABLED(CONFIG_PREEMPT_RT)) {
work = this_cpu_ptr(&mmap_unlock_work);
- if (irq_work_is_busy(&work->irq_work)) {
- /* cannot queue more up_read, fallback */
+ if (irq_work_is_busy(&work->irq_work) ||
+ atomic_cmpxchg_acquire(&work->active, 0, 1)) {
irq_work_busy = true;
+ work = NULL;
}
} else {
/*
@@ -46,6 +49,32 @@ static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **wo
return irq_work_busy;
}
+static inline void bpf_mmap_unlock_put_irq_work(struct mmap_unlock_irq_work *work)
+{
+ if (work)
+ atomic_set_release(&work->active, 0);
+}
+
+/*
+ * Try to take mm->mmap_lock for reading on behalf of a BPF helper that may
+ * run with IRQs disabled. On success, *work is the slot to hand to
+ * bpf_mmap_unlock_mm() (NULL when the unlock can be done inline); on failure
+ * no slot stays reserved and the caller must fall back.
+ */
+static inline bool bpf_mmap_read_trylock(struct mm_struct *mm,
+ struct mmap_unlock_irq_work **work)
+{
+ if (bpf_mmap_unlock_get_irq_work(work))
+ return false;
+
+ if (!mmap_read_trylock(mm)) {
+ bpf_mmap_unlock_put_irq_work(*work);
+ return false;
+ }
+
+ return true;
+}
+
static inline void bpf_mmap_unlock_mm(struct mmap_unlock_irq_work *work, struct mm_struct *mm)
{
if (!work) {
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 41fe87d7302f22..166fc8efab8b21 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -415,7 +415,6 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
u32 trace_nr, bool user, bool may_fault)
{
struct mmap_unlock_irq_work *work = NULL;
- bool irq_work_busy = bpf_mmap_unlock_get_irq_work(&work);
bool has_user_ctx = user && current && current->mm;
struct stack_map_build_id_cache cache = {};
struct vm_area_struct *vma;
@@ -430,7 +429,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
* fallback is used for kernel stack (!user) on a stackmap with
* build_id.
*/
- if (!has_user_ctx || irq_work_busy || !mmap_read_trylock(current->mm)) {
+ if (!has_user_ctx || !bpf_mmap_read_trylock(current->mm, &work)) {
/* cannot access current->mm, fall back to ips */
for (i = 0; i < trace_nr; i++)
stack_map_build_id_set_ip(&id_offs[i]);
diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c
index b256fb9c1214e4..e66e3484f923dc 100644
--- a/kernel/bpf/task_iter.c
+++ b/kernel/bpf/task_iter.c
@@ -755,7 +755,6 @@ BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,
{
struct mmap_unlock_irq_work *work = NULL;
struct vm_area_struct *vma;
- bool irq_work_busy = false;
bool __maybe_unused mmput_needed = false;
struct mm_struct *mm;
int ret = -ENOENT;
@@ -792,9 +791,7 @@ BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,
if (!mm)
return -ENOENT;
- irq_work_busy = bpf_mmap_unlock_get_irq_work(&work);
-
- if (irq_work_busy || !mmap_read_trylock(mm)) {
+ if (!bpf_mmap_read_trylock(mm, &work)) {
ret = -EBUSY;
goto out;
}
@@ -1191,6 +1188,8 @@ static void do_mmap_read_unlock(struct irq_work *entry)
work = container_of(entry, struct mmap_unlock_irq_work, irq_work);
mmap_read_unlock_non_owner(work->mm);
+ work->mm = NULL;
+ bpf_mmap_unlock_put_irq_work(work);
}
static int __init task_iter_init(void)
|
| 3/2 | 2026/07/22 21:39 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 3687 output: 36 thoughts: 1080 Thoughts: **Analyzing a BPF Patch for Concurrency Issues** Okay, so I'm looking at this patch. It seems we're modifying how `mmap_read_trylock` is handled in BPF helpers, specifically in `kernel/bpf/mmap_unlock_work.h`, `kernel/bpf/stackmap.c`, and `kernel/bpf/task_iter.c`. The main thrust of this seems to be the introduction of `bpf_mmap_read_trylock`, `bpf_mmap_unlock_put_irq_work`, and an `atomic_t active` field within the `mmap_unlock_irq_work` structure. First, let's break down the code changes. In `mmap_unlock_work.h`, the `active` atomic flag is added to the `mmap_unlock_irq_work` structure. The old logic used `irq_work_is_busy` to check if a work item was busy. Now, there's a more robust check: `irq_work_is_busy` is still checked, but there's also an `atomic_cmpxchg_acquire` check on the `active` flag. This flag seems to be the key to the fix. We also have `bpf_mmap_unlock_put_irq_work`, which, if the work slot has been reserved by this cpu, sets the `active` flag back to 0. And then the new function `bpf_mmap_read_trylock` that is the core of this whole thing, as it calls `bpf_mmap_unlock_get_irq_work` and attempts the `mmap_read_trylock`. This is all about improving the concurrency safety when dealing with mmap reads in BPF, especially when IRQs might be disabled. The original check using only `irq_work_is_busy` looks like it had a race condition. It's likely that if `mmap_read_trylock` failed, the original check left the work slot in an inconsistent state, possibly leading to a concurrency issue. It looks like the fix is to reserve the slot with `atomic_cmpxchg_acquire` on the `active` flag *before* we even attempt `mmap_read_trylock`. This prevents another context from grabbing the work item if `mmap_read_trylock` fails. The use of an atomic flag confirms this is a functional change. It seems the problem was that a context could be interrupted, say, by an NMI, between getting a work item, and actually queueing it for unlock. Then another CPU might try to use the same work item. The new `active` flag essentially serializes access to the work item, ensuring that only one context uses a work item at a time, even if NMIs are enabled. Now, where are these new functions used? `stack_map_get_build_id_offset` and `bpf_find_vma`, both in `kernel/bpf`, are using this new logic. `do_mmap_read_unlock` is being modified too, and it clears the work item's `mm` field and calls `bpf_mmap_unlock_put_irq_work` to release the work item. I'll need to remember to focus fuzzing on those three functions: `stack_map_get_build_id_offset`, `bpf_find_vma`, and `do_mmap_read_unlock`. I know BPF is enabled by `CONFIG_BPF_SYSCALL` so I'll double check that this change doesn't depend on any other specific config options. A quick grep should confirm that. This definitely seems like a functional change to core BPF logic. WorthFuzzing = true. |
| 4/2 | 2026/07/22 21:40 | tool | grepper |
0mArgs:{
"Expression": "stack_map_get_build_id_offset",
"PathPrefix": "kernel/bpf/"
}Results: {
"Output": "kernel/bpf/stackmap.c=183=struct stack_map_cached_vma {\n--\nkernel/bpf/stackmap.c-191-/*\nkernel/bpf/stackmap.c:192: * Per stack_map_get_build_id_offset() call cache of the last VMA with a build ID\nkernel/bpf/stackmap.c-193- * resolved and the last VMA with no usable build ID. Adjacent stack frames tend\n--\nkernel/bpf/stackmap.c=323=static void stack_map_unlock_vma(struct stack_map_vma_lock *lock)\n--\nkernel/bpf/stackmap.c-332-\nkernel/bpf/stackmap.c:333:static void stack_map_get_build_id_offset_sleepable(struct bpf_stack_build_id *id_offs,\nkernel/bpf/stackmap.c-334-\t\t\t\t\t\t u32 trace_nr)\n--\nkernel/bpf/stackmap.c-413- */\nkernel/bpf/stackmap.c:414:static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,\nkernel/bpf/stackmap.c-415-\t\t\t\t\t u32 trace_nr, bool user, bool may_fault)\n--\nkernel/bpf/stackmap.c-423-\tif (may_fault \u0026\u0026 has_user_ctx) {\nkernel/bpf/stackmap.c:424:\t\tstack_map_get_build_id_offset_sleepable(id_offs, trace_nr);\nkernel/bpf/stackmap.c-425-\t\treturn;\n--\nkernel/bpf/stackmap.c=506=static long __bpf_get_stackid(struct bpf_map *map,\n--\nkernel/bpf/stackmap.c-545-\t\t\tid_offs[i].ip = ips[i];\nkernel/bpf/stackmap.c:546:\t\tstack_map_get_build_id_offset(id_offs, trace_nr, user, false /* !may_fault */);\nkernel/bpf/stackmap.c-547-\t\ttrace_len = trace_nr * sizeof(struct bpf_stack_build_id);\n--\nkernel/bpf/stackmap.c=682=static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,\n--\nkernel/bpf/stackmap.c-757-\tif (user_build_id)\nkernel/bpf/stackmap.c:758:\t\tstack_map_get_build_id_offset(buf, trace_nr, user, may_fault);\nkernel/bpf/stackmap.c-759-\n"
} |
| 5/2 | 2026/07/22 21:40 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 6346 output: 32 thoughts: 79 Thoughts: Here's my take on the thought process, as if it were my own: **Investigating BPF Stack Tracing and VMAs** Okay, so `stack_map_get_build_id_offset` is a key function, getting used in both `__bpf_get_stackid` and `__bpf_get_stack`. Got it. And I see that `bpf_find_vma` is actually a BPF helper function. Right, makes sense – we need to find the virtual memory area. Let's dig into that `bpf_find_vma` call and how it's used within the broader BPF context. I'll take a look at `kernel/bpf/task_iter.c` to see how it's implemented and where it is being used. That's probably where all the interesting interactions are happening. |
| 6/2 | 2026/07/22 21:40 | tool | grepper |
0mArgs:{
"Expression": "bpf_find_vma",
"PathPrefix": "kernel/bpf/"
}Results: {
"Output": "kernel/bpf/helpers.c=2067=bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)\n--\nkernel/bpf/helpers.c-2239-\tcase BPF_FUNC_find_vma:\nkernel/bpf/helpers.c:2240:\t\treturn \u0026bpf_find_vma_proto;\nkernel/bpf/helpers.c-2241-\tdefault:\n--\nkernel/bpf/task_iter.c=737=static struct bpf_iter_reg task_vma_reg_info = {\n--\nkernel/bpf/task_iter.c-752-\nkernel/bpf/task_iter.c:753:BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,\nkernel/bpf/task_iter.c-754-\t bpf_callback_t, callback_fn, void *, callback_ctx, u64, flags)\n--\nkernel/bpf/task_iter.c-814-\nkernel/bpf/task_iter.c:815:const struct bpf_func_proto bpf_find_vma_proto = {\nkernel/bpf/task_iter.c:816:\t.func\t\t= bpf_find_vma,\nkernel/bpf/task_iter.c-817-\t.ret_type\t= RET_INTEGER,\n--\nkernel/bpf/verifier.c=9634=static int set_find_vma_callback_state(struct bpf_verifier_env *env,\n--\nkernel/bpf/verifier.c-9638-{\nkernel/bpf/verifier.c:9639:\t/* bpf_find_vma(struct task_struct *task, u64 addr,\nkernel/bpf/verifier.c-9640-\t * void *callback_fn, void *callback_ctx, u64 flags)\n"
} |
| 7/2 | 2026/07/22 21:40 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 7154 output: 59 thoughts: 105 Thoughts: **Kernel BPF Configuration: A Quick Audit** Okay, so I'm diving into this BPF setup and my immediate concern is ensuring everything is properly configured at compile time. The big one, of course, is `CONFIG_BPF_SYSCALL` – that's the foundational building block. But are there *any* other config options I need to be aware of to ensure full functionality? I need to meticulously verify this. My first thought is to check the relevant Kconfig files. I'll need to look in `kernel/bpf/Kconfig` and possibly even `init/Kconfig` to be absolutely certain I haven’t missed any critical dependencies related to `BPF_SYSCALL`. Then there’s the potential for dependencies. I seem to recall that stack maps might rely on `CONFIG_PERF_EVENTS`. I need to confirm that. Finally, I'll need to scrutinize the `kernel/bpf/Makefile`. I want to understand exactly how crucial objects like `stackmap.o` and `task_iter.o` are being compiled. That will probably give me some insight to the potential configuration requirements. |
| 8/2 | 2026/07/22 21:40 | tool | grepper |
0mArgs:{
"Expression": "stackmap.o",
"PathPrefix": "kernel/bpf/"
}Results: {
"Output": "kernel/bpf/Makefile=30=ifeq ($(CONFIG_PERF_EVENTS),y)\nkernel/bpf/Makefile:31:obj-$(CONFIG_BPF_SYSCALL) += stackmap.o\nkernel/bpf/Makefile-32-endif\n"
} |
| 9/2 | 2026/07/22 21:40 | tool | grepper |
0mArgs:{
"Expression": "task_iter.o",
"PathPrefix": "kernel/bpf/"
}Results: {
"Output": "kernel/bpf/Makefile=9=obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o cnum.o log.o token.o liveness.o const_fold.o\nkernel/bpf/Makefile:10:obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o\nkernel/bpf/Makefile-11-obj-$(CONFIG_BPF_SYSCALL) += hashtab.o arraymap.o percpu_freelist.o bpf_lru_list.o lpm_trie.o map_in_map.o bloom_filter.o\n"
} |
| 10/2 | 2026/07/22 21:40 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 7824 output: 31 thoughts: 52 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Kernel Configuration Dependencies for BPF and Perf Events** Right, so I'm thinking, based on the context, I'm pretty certain we're going to need both `CONFIG_BPF_SYSCALL` and `CONFIG_PERF_EVENTS` enabled. That seems like a no-brainer for this area. It's a foundational setup. Now, before I proceed with any deeper analysis, I want to take a quick peek at `kernel/bpf/mmap_unlock_work.h`. I'm guessing there might be some *other* configuration dependencies, potentially subtle ones, defined or hinted at in that specific header file. Better to cover all the bases upfront and be aware of any interrelated configurations than stumble upon a gotcha later. I need to be sure I understand all of the configuration requirements. |
| 11/2 | 2026/07/22 21:40 | tool | grepper |
0mArgs:{
"Expression": "mmap_unlock_work",
"PathPrefix": "kernel/bpf/"
}Results: {
"Output": "kernel/bpf/mmap_unlock_work.h=11=struct mmap_unlock_irq_work {\n--\nkernel/bpf/mmap_unlock_work.h-16-\nkernel/bpf/mmap_unlock_work.h:17:DECLARE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);\nkernel/bpf/mmap_unlock_work.h-18-\n--\nkernel/bpf/mmap_unlock_work.h=26=static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **work_ptr)\n--\nkernel/bpf/mmap_unlock_work.h-32-\t\tif (!IS_ENABLED(CONFIG_PREEMPT_RT)) {\nkernel/bpf/mmap_unlock_work.h:33:\t\t\twork = this_cpu_ptr(\u0026mmap_unlock_work);\nkernel/bpf/mmap_unlock_work.h-34-\t\t\tif (irq_work_is_busy(\u0026work-\u003eirq_work) ||\n--\nkernel/bpf/stackmap.c-13-#include \"percpu_freelist.h\"\nkernel/bpf/stackmap.c:14:#include \"mmap_unlock_work.h\"\nkernel/bpf/stackmap.c-15-\n--\nkernel/bpf/task_iter.c-13-#include \u003clinux/sched/mm.h\u003e\nkernel/bpf/task_iter.c:14:#include \"mmap_unlock_work.h\"\nkernel/bpf/task_iter.c-15-\n--\nkernel/bpf/task_iter.c=1178=__bpf_kfunc_end_defs();\nkernel/bpf/task_iter.c-1179-\nkernel/bpf/task_iter.c:1180:DEFINE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);\nkernel/bpf/task_iter.c-1181-\n--\nkernel/bpf/task_iter.c=1195=static int __init task_iter_init(void)\n--\nkernel/bpf/task_iter.c-1200-\tfor_each_possible_cpu(cpu) {\nkernel/bpf/task_iter.c:1201:\t\twork = per_cpu_ptr(\u0026mmap_unlock_work, cpu);\nkernel/bpf/task_iter.c-1202-\t\tinit_irq_work(\u0026work-\u003eirq_work, do_mmap_read_unlock);\n"
} |
| 12/2 | 2026/07/22 21:40 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8755 output: 149 thoughts: 405 Thoughts: **Fuzzing Target Identification** Okay, so this patch looks like it's addressing a critical concurrency issue within BPF's `mmap_read_trylock` handling, specifically when IRQs are disabled. This definitely warrants fuzzing. The functional changes here impact core BPF logic, especially how stack maps and task iterators operate, so this is a prime target for vulnerability discovery. My focus should be on functions that are directly or indirectly involved in the fix. Let's start with `stack_map_get_build_id_offset`, `bpf_find_vma`, `do_mmap_read_unlock`, and `bpf_mmap_read_trylock`. While `bpf_mmap_read_trylock` might be inlined, Syzkaller doesn't seem to have a problem with that so I'll include it and the callers. Looking at the code, it seems the callers of `bpf_mmap_read_trylock` are `stack_map_get_build_id_offset` and `bpf_find_vma`. The callers of `bpf_mmap_unlock_put_irq_work` are `bpf_mmap_read_trylock` and `do_mmap_read_unlock`. I'll keep `BPF_SYSCALL` and `PERF_EVENTS` enabled in my fuzzing config. I've confirmed that `bpf_find_vma` is the correct name, and that `stack_map_get_build_id_offset` and `do_mmap_read_unlock` are static functions in the relevant files. Time to set up the fuzzing environment. |
| 13/2 | 2026/07/22 21:40 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"BPF_SYSCALL",
"PERF_EVENTS"
],
"FocusSymbols": [
"stack_map_get_build_id_offset",
"bpf_find_vma",
"do_mmap_read_unlock"
],
"Reasoning": "The patch fixes a concurrency issue in BPF's handling of mmap_read_trylock when IRQs are disabled by introducing an atomic_t active flag to reserve the per-cpu mmap_unlock_irq_work slot. This is a functional change in core BPF logic that affects stack maps and task iterators.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"PERF_EVENTS"
],
"FocusSymbols": [
"stack_map_get_build_id_offset",
"bpf_find_vma",
"do_mmap_read_unlock"
],
"Reasoning": "The patch fixes a concurrency issue in BPF's handling of mmap_read_trylock when IRQs are disabled by introducing an atomic_t active flag to reserve the per-cpu mmap_unlock_irq_work slot. This is a functional change in core BPF logic that affects stack maps and task iterators.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|