| 0/0 |
2026/09/13 00:07 |
flow |
assessment-security |
49m
Results: map[DenialOfService:true Explanation:**Analysis of the Bug and its Security Impact**
**1. Root Cause and Exploitability**
The bug is a data race and missing synchronization issue on the `sk_buff_head`
doubly-linked list (`cell->napi_skbs`) used by `gro_cells`.
When threaded NAPI is enabled on a network device using `gro_cells` (such as
`gre`, `vxlan`, or `geneve` tunnels), the NAPI polling function
(`gro_cell_poll`) is executed in a dedicated kernel thread. Crucially, this
kthread is unbound and can be scheduled on any CPU.
The synchronization mechanism used to protect the `napi_skbs` list is
`local_lock_t` (`cell->bh_lock`). However, `local_lock_t` only disables
preemption and softirqs on the *local* CPU; it provides absolutely no cross-CPU
mutual exclusion.
As a result, if the NAPI kthread runs on CPU B while ingress packets are being
received and queued on CPU A, `__skb_queue_tail` (in `gro_cells_receive`) and
`__skb_dequeue` (in `gro_cell_poll`) will execute concurrently on the same list
without any locking. This leads to classic doubly-linked list corruption
(corrupting `next`/`prev` pointers of `sk_buff` structures), which results in
use-after-free and memory corruption. This is highly **Exploitable**.
**2. Denial of Service**
The list corruption will inevitably lead to kernel panics (e.g., wild pointer
dereferences, "unable to handle kernel paging request") or infinite loops/soft
lockups when traversing the corrupted list. This allows for a reliable **Denial
of Service**.
**3. Reachability and Capabilities**
To trigger the bug, an attacker needs to enable threaded NAPI on a device that
uses `gro_cells`.
Threaded NAPI can be enabled via Netlink (`NETDEV_CMD_NAPI_SET`) or via sysfs
(`/sys/class/net/<dev>/threaded`).
- The Netlink interface requires `CAP_NET_ADMIN` in the initial user namespace
(`netlink_capable(skb, CAP_NET_ADMIN)`).
- However, the sysfs interface (`threaded_store` -> `netdev_lock_store`) only
checks `ns_capable(net->user_ns, CAP_NET_ADMIN)`.
This means an unprivileged user cannot trigger the bug directly from the initial
namespace. But they can unshare their user and network namespaces, gaining
`CAP_NET_ADMIN` over the new network namespace. Inside this namespace, they can
create a tunnel device (like `vxlan`), enable threaded NAPI via the sysfs
attribute, and then send traffic through the tunnel (e.g., via a local veth pair
or loopback) to trigger the concurrent list operations. Therefore, the bug is
**Accessible From User Namespaces**.
**4. Network Trigger**
The vulnerability is triggered by processing ingress network packets on the
affected tunnel device, making it an **Ethernet Network Trigger**.
**Conclusion**
- **Exploitable**: Yes (Memory corruption via doubly-linked list data race).
- **Denial Of Service**: Yes (Kernel crash or soft lockup).
- **Accessible From Unprivileged Processes**: No (Requires `CAP_NET_ADMIN`).
- **Accessible From User Namespaces**: Yes (Sysfs interface allows enabling
threaded NAPI with namespace-local `CAP_NET_ADMIN`).
- **Ethernet Network Trigger**: Yes (Triggered by packet reception).
- **Other Triggers**: No. Exploitable:true FilesystemTrigger:false NetworkTrigger:true PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/09/13 00:07 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/09/13 00:07 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/d1a9da4e1cf9f1ceb3b2172000dc99b0949b917e]
|
| 3/1 |
2026/09/13 00:09 |
action |
kernel-builder |
25m
Results: map[KernelObj:/app/workdir/cache/build/dd7101de4340691991d9687361f0386d2a458b3c]
|
| 4/1 |
2026/09/13 00:34 |
action |
codesearch-prepare |
14m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/09/13 00:49 |
agent |
expert |
7m
Model:
Results: map[DenialOfService:true Exploitable:true FilesystemTrigger:false NetworkTrigger:true PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
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:
The kernel bug report is:
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(l->owner)
WARNING: ./include/linux/local_lock_internal.h:47 at local_lock_acquire include/linux/local_lock_internal.h:47 [inline], CPU#1: napi/gre0-0/11827
WARNING: ./include/linux/local_lock_internal.h:47 at gro_cell_poll+0x5aa/0x6c0 net/core/gro_cells.c:66, CPU#1: napi/gre0-0/11827
Modules linked in:
CPU: 1 UID: 0 PID: 11827 Comm: napi/gre0-0 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/05/2026
RIP: 0010:local_lock_acquire include/linux/local_lock_internal.h:47 [inline]
RIP: 0010:gro_cell_poll+0x5b1/0x6c0 net/core/gro_cells.c:66
Code: 8d 3d f3 aa 9a 07 48 c7 c6 40 c7 3c 8d 67 48 0f b9 3a e9 59 fe ff ff e8 dd 5e 52 f8 48 8d 3d e6 aa 9a 07 48 c7 c6 00 c7 3c 8d <67> 48 0f b9 3a eb be 31 db e9 88 fd ff ff 48 8b 7c 24 20 e8 97 a2
RSP: 0018:ffffc900033c7b70 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000200
RDX: ffff8880284e0000 RSI: ffffffff8d3cc700 RDI: ffffffff91544100
RBP: ffffe8ffffc37198 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: dffffc0000000000
R13: ffffffff9b99e5c0 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff888123c59000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b32617ff8 CR3: 000000005d244000 CR4: 0000000000350ef0
Call Trace:
<TASK>
__napi_poll.constprop.0+0xaf/0x450 net/core/dev.c:7787
napi_threaded_poll_loop+0x52f/0x870 net/core/dev.c:7907
napi_threaded_poll+0x3a8/0x4b0 net/core/dev.c:7962
kthread+0x373/0x450 kernel/kthread.c:436
ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
----------------
Code disassembly (best guess):
0: 8d 3d f3 aa 9a 07 lea 0x79aaaf3(%rip),%edi # 0x79aaaf9
6: 48 c7 c6 40 c7 3c 8d mov $0xffffffff8d3cc740,%rsi
d: 67 48 0f b9 3a ud1 (%edx),%rdi
12: e9 59 fe ff ff jmp 0xfffffe70
17: e8 dd 5e 52 f8 call 0xf8525ef9
1c: 48 8d 3d e6 aa 9a 07 lea 0x79aaae6(%rip),%rdi # 0x79aab09
23: 48 c7 c6 00 c7 3c 8d mov $0xffffffff8d3cc700,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: eb be jmp 0xffffffef
31: 31 db xor %ebx,%ebx
33: e9 88 fd ff ff jmp 0xfffffdc0
38: 48 8b 7c 24 20 mov 0x20(%rsp),%rdi
3d: e8 .byte 0xe8
3e: 97 xchg %eax,%edi
3f: a2 .byte 0xa2
Reply: **Analysis of the Bug and its Security Impact**
**1. Root Cause and Exploitability**
The bug is a data race and missing synchronization issue on the `sk_buff_head` doubly-linked list (`cell->napi_skbs`) used by `gro_cells`.
When threaded NAPI is enabled on a network device using `gro_cells` (such as `gre`, `vxlan`, or `geneve` tunnels), the NAPI polling function (`gro_cell_poll`) is executed in a dedicated kernel thread. Crucially, this kthread is unbound and can be scheduled on any CPU.
The synchronization mechanism used to protect the `napi_skbs` list is `local_lock_t` (`cell->bh_lock`). However, `local_lock_t` only disables preemption and softirqs on the *local* CPU; it provides absolutely no cross-CPU mutual exclusion.
As a result, if the NAPI kthread runs on CPU B while ingress packets are being received and queued on CPU A, `__skb_queue_tail` (in `gro_cells_receive`) and `__skb_dequeue` (in `gro_cell_poll`) will execute concurrently on the same list without any locking. This leads to classic doubly-linked list corruption (corrupting `next`/`prev` pointers of `sk_buff` structures), which results in use-after-free and memory corruption. This is highly **Exploitable**.
**2. Denial of Service**
The list corruption will inevitably lead to kernel panics (e.g., wild pointer dereferences, "unable to handle kernel paging request") or infinite loops/soft lockups when traversing the corrupted list. This allows for a reliable **Denial of Service**.
**3. Reachability and Capabilities**
To trigger the bug, an attacker needs to enable threaded NAPI on a device that uses `gro_cells`.
Threaded NAPI can be enabled via Netlink (`NETDEV_CMD_NAPI_SET`) or via sysfs (`/sys/class/net/<dev>/threaded`).
- The Netlink interface requires `CAP_NET_ADMIN` in the initial user namespace (`netlink_capable(skb, CAP_NET_ADMIN)`).
- However, the sysfs interface (`threaded_store` -> `netdev_lock_store`) only checks `ns_capable(net->user_ns, CAP_NET_ADMIN)`.
This means an unprivileged user cannot trigger the bug directly from the initial namespace. But they can unshare their user and network namespaces, gaining `CAP_NET_ADMIN` over the new network namespace. Inside this namespace, they can create a tunnel device (like `vxlan`), enable threaded NAPI via the sysfs attribute, and then send traffic through the tunnel (e.g., via a local veth pair or loopback) to trigger the concurrent list operations. Therefore, the bug is **Accessible From User Namespaces**.
**4. Network Trigger**
The vulnerability is triggered by processing ingress network packets on the affected tunnel device, making it an **Ethernet Network Trigger**.
**Conclusion**
- **Exploitable**: Yes (Memory corruption via doubly-linked list data race).
- **Denial Of Service**: Yes (Kernel crash or soft lockup).
- **Accessible From Unprivileged Processes**: No (Requires `CAP_NET_ADMIN`).
- **Accessible From User Namespaces**: Yes (Sysfs interface allows enabling threaded NAPI with namespace-local `CAP_NET_ADMIN`).
- **Ethernet Network Trigger**: Yes (Triggered by packet reception).
- **Other Triggers**: No.
|
| 6/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 7549
output: 36
thoughts: 300
Thoughts: **Analyzing a Kernel Lock Deprecation Warning**
Okay, so I've got this kernel bug report flashing a `DEBUG_LOCKS_WARN_ON(l->owner)` issue. I immediately recognize this as a potential locking problem, specifically a warning about a local lock. The report flags an issue at `include/linux/local_lock_internal.h:47`, which isn't unusual as that's where the core local lock mechanics are implemented. It seems this warning is triggered when CPU #1 is running `napi/gre0-0/11827`. The crucial thing here is seeing it pop up within the `gro_cell_poll` function.
I see that `gro_cell_poll` is being called from the call trace, specifically as `gro_cell_poll+0x5aa/0x6c0`, and it's getting triggered during NAPI polling, more specifically, within a threaded poll loop. This points me directly to `net/core/gro_cells.c:66`. My instincts tell me that this line in `gro_cell_poll` is the source of the deprecation warning. I'll need to examine that line carefully, along with the surrounding code, to understand how a local lock is being acquired or released incorrectly within the GRO (Generic Receive Offload) context. I need to figure out the exact locking sequence and identify the potential race condition causing this. This could be a complex interaction, given NAPI's asynchronous nature.
|
| 7/2 |
2026/09/13 00:49 |
tool |
read-file |
0m
Args: map[File:net/core/gro_cells.c FirstLine:50 LineCount:50]
Results: map[Contents: 50: unlock:
51: if (have_bh_lock)
52: local_unlock_nested_bh(&gcells->cells->bh_lock);
53: rcu_read_unlock();
54: return res;
55: }
56: EXPORT_SYMBOL(gro_cells_receive);
57:
58: /* called under BH context */
59: static int gro_cell_poll(struct napi_struct *napi, int budget)
60: {
61: struct gro_cell *cell = container_of(napi, struct gro_cell, napi);
62: struct sk_buff *skb;
63: int work_done = 0;
64:
65: while (work_done < budget) {
66: __local_lock_nested_bh(&cell->bh_lock);
67: skb = __skb_dequeue(&cell->napi_skbs);
68: __local_unlock_nested_bh(&cell->bh_lock);
69: if (!skb)
70: break;
71: napi_gro_receive(napi, skb);
72: work_done++;
73: }
74:
75: if (work_done < budget)
76: napi_complete_done(napi, work_done);
77: return work_done;
78: }
79:
80: int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
81: {
82: int i;
83:
84: gcells->cells = alloc_percpu(struct gro_cell);
85: if (!gcells->cells)
86: return -ENOMEM;
87:
88: for_each_possible_cpu(i) {
89: struct gro_cell *cell = per_cpu_ptr(gcells->cells, i);
90:
91: __skb_queue_head_init(&cell->napi_skbs);
92: local_lock_init(&cell->bh_lock);
93:
94: set_bit(NAPI_STATE_NO_BUSY_POLL, &cell->napi.state);
95:
96: netif_napi_add(dev, &cell->napi, gro_cell_poll);
97: napi_enable(&cell->napi);
98: }
99: return 0;
]
|
| 8/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 8914
output: 38
thoughts: 158
Thoughts: **Analyzing a Lock Contention Warning**
Okay, so the warning popped up right here, at `gro_cell_poll`, specifically at the `__local_lock_nested_bh(&cell->bh_lock);` line. My initial reaction is, "Hang on, `__local_lock_nested_bh` is being used here?" That raises a flag. I immediately remember that `DEBUG_LOCKS_WARN_ON(l->owner)` is involved. This tells me that the lock owner is already set, meaning the lock is already held somewhere else. That's not supposed to happen with a nested lock call... it's a critical point to note.
Then I paused... Wait, `__local_lock_nested_bh`... doesn't that variant presume that the BH (Bottom Half) is already disabled? It's a special version of `local_lock` that *doesn't* disable BH but *asserts* that BH is *already* disabled, making it a "nested" lock. We're getting a warning because our assumption is incorrect here!
Alright, time to go double check my assumptions. I'll need to confirm that understanding in `include/linux/local_lock_internal.h`. I'm starting to get a sense of where the problem might lie.
|
| 9/2 |
2026/09/13 00:49 |
tool |
read-file |
0m
Args: map[File:include/linux/local_lock_internal.h FirstLine:30 LineCount:50]
Results: map[Contents: 30: typedef struct local_trylock local_trylock_t;
31:
32: #ifdef CONFIG_DEBUG_LOCK_ALLOC
33: # define LOCAL_LOCK_DEBUG_INIT(lockname) \
34: .dep_map = { \
35: .name = #lockname, \
36: .wait_type_inner = LD_WAIT_CONFIG, \
37: .lock_type = LD_LOCK_PERCPU, \
38: }, \
39: .owner = NULL,
40:
41: # define LOCAL_TRYLOCK_DEBUG_INIT(lockname) \
42: LOCAL_LOCK_DEBUG_INIT(lockname)
43:
44: static inline void local_lock_acquire(local_lock_t *l)
45: {
46: lock_map_acquire(&l->dep_map);
47: DEBUG_LOCKS_WARN_ON(l->owner);
48: l->owner = current;
49: }
50:
51: static inline void local_trylock_acquire(local_lock_t *l)
52: {
53: lock_map_acquire_try(&l->dep_map);
54: DEBUG_LOCKS_WARN_ON(l->owner);
55: l->owner = current;
56: }
57:
58: static inline void local_lock_release(local_lock_t *l)
59: {
60: DEBUG_LOCKS_WARN_ON(l->owner != current);
61: l->owner = NULL;
62: lock_map_release(&l->dep_map);
63: }
64:
65: static inline void local_lock_debug_init(local_lock_t *l)
66: {
67: l->owner = NULL;
68: }
69: #else /* CONFIG_DEBUG_LOCK_ALLOC */
70: # define LOCAL_LOCK_DEBUG_INIT(lockname)
71: # define LOCAL_TRYLOCK_DEBUG_INIT(lockname)
72: static inline void local_lock_acquire(local_lock_t *l) { }
73: static inline void local_trylock_acquire(local_lock_t *l) { }
74: static inline void local_lock_release(local_lock_t *l) { }
75: static inline void local_lock_debug_init(local_lock_t *l) { }
76: #endif /* !CONFIG_DEBUG_LOCK_ALLOC */
77:
78: #define INIT_LOCAL_LOCK(lockname) { LOCAL_LOCK_DEBUG_INIT(lockname) }
79: #define INIT_LOCAL_TRYLOCK(lockname) { LOCAL_TRYLOCK_DEBUG_INIT(lockname) }
]
|
| 10/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 10183
output: 23
thoughts: 37
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into the Low-Level Locking Mechanism**
Okay, hold on a second. I just saw something that makes me think. It looks like the `__local_lock_nested_bh` function actually calls `local_lock_acquire`. That's interesting. I need to understand that relationship. Let me immediately jump over to the definition of `__local_lock_nested_bh`. I'm going to quickly review its implementation to see how the latter is used within the context of the former. Time to dig in!
|
| 11/2 |
2026/09/13 00:49 |
tool |
grepper |
0m
Args: map[Expression:define __local_lock_nested_bh]
Results: map[Output:include/linux/local_lock_internal.h=98=do { \
--
include/linux/local_lock_internal.h-218-
include/linux/local_lock_internal.h:219:#define __local_lock_nested_bh(lock) \
include/linux/local_lock_internal.h-220- do { \
--
include/linux/local_lock_internal.h=242=typedef spinlock_t local_trylock_t;
--
include/linux/local_lock_internal.h-278-
include/linux/local_lock_internal.h:279:#define __local_lock_nested_bh(lock) \
include/linux/local_lock_internal.h-280-do { \
]
|
| 12/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 10578
output: 38
thoughts: 23
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `local_lock_internal.h`**
Alright, let's get down to brass tacks. I'm going to take a look at the `local_lock_internal.h` header file. Specifically, I need to focus on the code around line 98. I need to understand what's happening there to figure out the behavior of the locking mechanism. There's some subtle detail I'm after, probably related to the low-level locking primitives. Let's see if this gives me the context I need.
|
| 13/2 |
2026/09/13 00:49 |
tool |
read-file |
0m
Args: map[File:include/linux/local_lock_internal.h FirstLine:80 LineCount:50]
Results: map[Contents: 80:
81: #define __local_lock_init(lock) \
82: do { \
83: static struct lock_class_key __key; \
84: \
85: debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
86: lockdep_init_map_type(&(lock)->dep_map, #lock, &__key, \
87: 0, LD_WAIT_CONFIG, LD_WAIT_INV, \
88: LD_LOCK_PERCPU); \
89: local_lock_debug_init(lock); \
90: } while (0)
91:
92: #define __local_trylock_init(lock) \
93: do { \
94: __local_lock_init((local_lock_t *)lock); \
95: } while (0)
96:
97: #define __spinlock_nested_bh_init(lock) \
98: do { \
99: static struct lock_class_key __key; \
100: \
101: debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
102: lockdep_init_map_type(&(lock)->dep_map, #lock, &__key, \
103: 0, LD_WAIT_CONFIG, LD_WAIT_INV, \
104: LD_LOCK_NORMAL); \
105: local_lock_debug_init(lock); \
106: } while (0)
107:
108: #define __local_lock_acquire(lock) \
109: do { \
110: local_trylock_t *__tl; \
111: local_lock_t *__l; \
112: \
113: __l = (local_lock_t *)(lock); \
114: __tl = (local_trylock_t *)__l; \
115: _Generic((lock), \
116: local_trylock_t *: ({ \
117: lockdep_assert(__tl->acquired == 0); \
118: WRITE_ONCE(__tl->acquired, 1); \
119: }), \
120: local_lock_t *: (void)0); \
121: local_lock_acquire(__l); \
122: } while (0)
123:
124: #define __local_lock(lock) \
125: do { \
126: preempt_disable(); \
127: __local_lock_acquire(lock); \
128: __acquire(lock); \
129: } while (0)
]
|
| 14/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 11585
output: 39
thoughts: 12
Thoughts: Okay, here's my attempt at summarizing the thought process, as if it were my own, presented for an expert audience:
**Line 219 Checkpoint**
Alright, I was deep in this analysis, making good progress, but I have a nagging feeling. Before I go any further, I *need* to circle back. That particular point I raised in line 219... yeah, that one. I have a hunch it might be the linchpin, or at least a significant variable, for the conclusion I'm working towards. It would be a catastrophic waste of time if I continued down this path only to find out that a small oversight at line 219 invalidated everything. So, pause. Time to double-check that specific section. Got to make sure all my assumptions were correct, that all data was in order. I need that data validated. It could be nothing, but I can't afford to take the chance. Better safe than sorry, especially given the implications. This is important stuff. Let's make sure it's correct.
|
| 15/2 |
2026/09/13 00:49 |
tool |
read-file |
0m
Args: map[File:include/linux/local_lock_internal.h FirstLine:210 LineCount:50]
Results: map[Contents: 210: } while (0)
211:
212: #define __local_unlock_irqrestore(lock, flags) \
213: do { \
214: __release(lock); \
215: __local_lock_release(lock); \
216: local_irq_restore(flags); \
217: } while (0)
218:
219: #define __local_lock_nested_bh(lock) \
220: do { \
221: lockdep_assert_in_softirq(); \
222: local_lock_acquire((lock)); \
223: __acquire(lock); \
224: } while (0)
225:
226: #define __local_unlock_nested_bh(lock) \
227: do { \
228: __release(lock); \
229: local_lock_release((lock)); \
230: } while (0)
231:
232: #else /* !CONFIG_PREEMPT_RT */
233:
234: #include <linux/sched.h>
235: #include <linux/spinlock.h>
236:
237: /*
238: * On PREEMPT_RT local_lock maps to a per CPU spinlock, which protects the
239: * critical section while staying preemptible.
240: */
241: typedef spinlock_t local_lock_t;
242: typedef spinlock_t local_trylock_t;
243:
244: #define INIT_LOCAL_LOCK(lockname) __LOCAL_SPIN_LOCK_UNLOCKED((lockname))
245: #define INIT_LOCAL_TRYLOCK(lockname) __LOCAL_SPIN_LOCK_UNLOCKED((lockname))
246:
247: #define __local_lock_init(__l) \
248: do { \
249: local_spin_lock_init((__l)); \
250: } while (0)
251:
252: #define __local_trylock_init(__l) __local_lock_init(__l)
253:
254: #define __local_lock(__lock) \
255: do { \
256: migrate_disable(); \
257: spin_lock((__lock)); \
258: } while (0)
259:
]
|
| 16/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 12606
output: 36
thoughts: 351
Thoughts: **Analyzing a Potential Locking Issue in the Network Stack**
Okay, so `__local_lock_nested_bh` is calling `local_lock_acquire(lock)`. Right, that's straightforward. Looking at `local_lock_acquire`, I see it calls `lock_map_acquire` (standard, so far), but then that `DEBUG_LOCKS_WARN_ON(l->owner)`... that's the interesting bit. It flags a warning if `l->owner` isn't NULL. Makes sense, that indicates the lock is already held. This is a `local_lock`, so it's a per-CPU lock. If `l->owner` is non-NULL, that means the lock was *already* acquired on this CPU and not released, or another task *on the same CPU* grabbed it. That latter scenario shouldn't happen with a `local_lock` unless there's preemption, and we'd be in serious trouble, right? But this is `nested_bh` so `in_softirq()` is asserted. Okay, this is looking like a softirq context, which helps limit some of the possible scenarios.
Now, where is this `__local_lock_nested_bh` used? Ah, it's in `gro_cell_poll`. And `gro_cell_poll` is called from `napi_threaded_poll`. Hold on a second... `napi_threaded_poll` runs in a kernel thread (`kthread`). A *thread*? But wait, what context is `napi_threaded_poll` running in? Is it running in softirq context? I need to check the code for `napi_threaded_poll` to be sure. This is potentially a threading issue interacting with softirqs and locking.
|
| 17/2 |
2026/09/13 00:49 |
tool |
read-file |
0m
Args: map[File:net/core/dev.c FirstLine:7900 LineCount:50]
Results: map[Contents:7900: local_bh_disable();
7901: bpf_net_ctx = bpf_net_ctx_set(&__bpf_net_ctx);
7902:
7903: sd = this_cpu_ptr(&softnet_data);
7904: sd->in_napi_threaded_poll = true;
7905:
7906: have = netpoll_poll_lock(napi);
7907: __napi_poll(napi, &repoll);
7908: netpoll_poll_unlock(have);
7909:
7910: sd->in_napi_threaded_poll = false;
7911: barrier();
7912:
7913: if (sd_has_rps_ipi_waiting(sd)) {
7914: local_irq_disable();
7915: net_rps_action_and_irq_enable(sd);
7916: }
7917: skb_defer_free_flush();
7918: bpf_net_ctx_clear(bpf_net_ctx);
7919:
7920: /* When busy poll is enabled, the old packets are not flushed in
7921: * napi_complete_done. So flush them here.
7922: */
7923: if (busy_poll_last_qs)
7924: gro_flush_normal(&napi->gro, HZ >= 1000);
7925: local_bh_enable();
7926:
7927: /* Call cond_resched here to avoid watchdog warnings. */
7928: if (repoll || busy_poll_last_qs) {
7929: rcu_softirq_qs_periodic(last_qs);
7930: cond_resched();
7931: }
7932:
7933: if (!repoll)
7934: break;
7935: }
7936:
7937: if (busy_poll_last_qs)
7938: *busy_poll_last_qs = last_qs;
7939: }
7940:
7941: static int napi_threaded_poll(void *data)
7942: {
7943: struct napi_struct *napi = data;
7944: unsigned long last_qs = jiffies;
7945: bool want_busy_poll;
7946: bool in_busy_poll;
7947: unsigned long val;
7948:
7949: while (!napi_thread_wait(napi)) {
]
|
| 18/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 14125
output: 36
thoughts: 352
Thoughts: **My Initial Thoughts on `napi_threaded_poll` and GRO Cell Polling**
Okay, so I'm looking at this `napi_threaded_poll` call sequence, and I'm seeing `local_bh_disable()` followed by `__napi_poll()`, which then calls the `napi->poll()` function. In this specific scenario, that `napi->poll` is `gro_cell_poll`. I'm going through the code and seeing the following happening in `gro_cell_poll`:
```c
while (work_done < budget) {
__local_lock_nested_bh(&cell->bh_lock);
skb = __skb_dequeue(&cell->napi_skbs);
__local_unlock_nested_bh(&cell->bh_lock);
```
Immediately, something is bothering me. We're calling `__local_lock_nested_bh`, which means it's trying to acquire `cell->bh_lock`. The thing is, why would `cell->bh_lock.owner` *already* be non-NULL? Is it because the lock was acquired and *not* released? Or is it because another task on the *same* CPU already acquired it?
Then it hits me: `cell->bh_lock` is a `local_lock_t`. And a `local_lock_t` is a *per-CPU* lock. Now the pieces are coming together...But, wait! The `cell` is a `struct gro_cell`, and that's allocated using `alloc_percpu(struct gro_cell)`. So, `cell` is a per-CPU variable. Makes sense.
Okay, so `gro_cell_poll` is getting `cell` through `container_of(napi, struct gro_cell, napi)`. Okay. The problem, though, it's making me wonder: Is `napi_threaded_poll` *guaranteed* to run on the CPU that owns this specific `napi`? Because, `napi_threaded_poll` is a kthread. And that implies concurrency! So, is this kthread pinned to a specific CPU? We have to ensure we're accessing the correct per-CPU variable! If not, we have a major concurrency issue, which could be the source of my problem.
|
| 19/2 |
2026/09/13 00:49 |
tool |
read-file |
0m
Args: map[File:net/core/dev.c FirstLine:7950 LineCount:50]
Results: map[Contents:7950: val = READ_ONCE(napi->state);
7951:
7952: want_busy_poll = val & NAPIF_STATE_THREADED_BUSY_POLL;
7953: in_busy_poll = val & NAPIF_STATE_IN_BUSY_POLL;
7954:
7955: if (unlikely(val & NAPIF_STATE_DISABLE))
7956: want_busy_poll = false;
7957:
7958: if (want_busy_poll != in_busy_poll)
7959: assign_bit(NAPI_STATE_IN_BUSY_POLL, &napi->state,
7960: want_busy_poll);
7961:
7962: napi_threaded_poll_loop(napi, want_busy_poll ? &last_qs : NULL);
7963: }
7964:
7965: return 0;
7966: }
7967:
7968: static __latent_entropy void net_rx_action(void)
7969: {
7970: struct softnet_data *sd = this_cpu_ptr(&softnet_data);
7971: unsigned long time_limit = jiffies +
7972: usecs_to_jiffies(READ_ONCE(net_hotdata.netdev_budget_usecs));
7973: struct bpf_net_context __bpf_net_ctx, *bpf_net_ctx;
7974: int budget = READ_ONCE(net_hotdata.netdev_budget);
7975: LIST_HEAD(list);
7976: LIST_HEAD(repoll);
7977:
7978: bpf_net_ctx = bpf_net_ctx_set(&__bpf_net_ctx);
7979: start:
7980: sd->in_net_rx_action = true;
7981: local_irq_disable();
7982: list_splice_init(&sd->poll_list, &list);
7983: local_irq_enable();
7984:
7985: for (;;) {
7986: struct napi_struct *n;
7987:
7988: skb_defer_free_flush();
7989:
7990: if (list_empty(&list)) {
7991: if (list_empty(&repoll)) {
7992: sd->in_net_rx_action = false;
7993: barrier();
7994: /* We need to check if ____napi_schedule()
7995: * had refilled poll_list while
7996: * sd->in_net_rx_action was true.
7997: */
7998: if (!list_empty(&sd->poll_list))
7999: goto start;
]
|
| 20/2 |
2026/09/13 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 15831
output: 19
thoughts: 31
Thoughts: Here's my attempt at summarizing the thought process, as if I were an expert:
**Investigating the `napi_threaded_poll` Initialization**
Okay, hold on a second. I need to trace the creation of that `napi_threaded_poll` object. It's coming to me that it's probably being set up within `dev_set_threaded`. Let's confirm that. I'm going to jump into `dev_set_threaded` and see what's happening there. I need to understand the exact context and ensure everything is initialized correctly in that function. It's crucial for understanding how the threading is set up within this particular NAPI context. Let's see if my hunch is right, and if so, what other related initializations are taking place in that function.
|
| 21/2 |
2026/09/13 00:50 |
tool |
grepper |
0m
Args: map[Expression:dev_set_threaded]
Results: map[Output:drivers/net/wireless/mediatek/mt76/debugfs.c=29=mt76_napi_threaded_set(void *data, u64 val)
--
drivers/net/wireless/mediatek/mt76/debugfs.c-36- if (dev->napi_dev->threaded != val)
drivers/net/wireless/mediatek/mt76/debugfs.c:37: return dev_set_threaded(dev->napi_dev, val);
drivers/net/wireless/mediatek/mt76/debugfs.c-38-
--
include/linux/netdevice.h=599=void netif_threaded_enable(struct net_device *dev);
include/linux/netdevice.h:600:int dev_set_threaded(struct net_device *dev,
include/linux/netdevice.h-601- enum netdev_napi_threaded threaded);
--
net/core/dev_api.c=372=EXPORT_SYMBOL(netdev_state_change);
net/core/dev_api.c-373-
net/core/dev_api.c:374:int dev_set_threaded(struct net_device *dev,
net/core/dev_api.c-375- enum netdev_napi_threaded threaded)
--
net/core/dev_api.c-384-}
net/core/dev_api.c:385:EXPORT_SYMBOL(dev_set_threaded);
--
tools/testing/selftests/net/nl_netdev.py=51=def napi_set_threaded(nf) -> None:
--
tools/testing/selftests/net/nl_netdev.py-135-
tools/testing/selftests/net/nl_netdev.py:136:def dev_set_threaded(nf) -> None:
tools/testing/selftests/net/nl_netdev.py-137- """
--
tools/testing/selftests/net/nl_netdev.py=369=def main() -> None:
--
tools/testing/selftests/net/nl_netdev.py-376- napi_set_threaded,
tools/testing/selftests/net/nl_netdev.py:377: dev_set_threaded,
tools/testing/selftests/net/nl_netdev.py-378- nsim_rxq_reset_down,
]
|
| 22/2 |
2026/09/13 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 16673
output: 21
thoughts: 13
Thoughts: Here's a summary of my thought process, as requested:
**Diving into `napi_kthread_create`**
Alright, time to dig into `napi_kthread_create`. My intuition is immediately pinging me to look at its purpose within the N-API framework. I'm assuming it's related to spawning or managing kernel threads, but I want to be certain. Given my background, I know I need to quickly establish *exactly* how it fits within the context of JavaScript interoperability with native code. Specifically, I need to know how itβs used to bridge the gap between user-space JavaScript and kernel-space operations, considering the potential security implications and performance trade-offs.
I'll be looking for details on how the thread's lifecycle is managed, including initialization, synchronization primitives, and resource cleanup. I'm also curious about the specific ABI/API considerations β Does it abstract certain kernel-level thread functions? What are the restrictions and constraints on what can be done within this kernel thread from the JavaScript side? Are there specific error handling or exception propagation mechanisms?
My immediate goal is to understand the intended use case, the underlying mechanisms, and any potential pitfalls. Understanding this function's characteristics is crucial for assessing its implications in a wider context - application performance, cross-platform compatibility, and of course, security. I need to understand it from both a conceptual and a practical standpoint.
|
| 23/2 |
2026/09/13 00:50 |
tool |
grepper |
0m
Args: map[Expression:napi_kthread_create]
Results: map[Output:net/core/dev.c=1668=static int napi_threaded_poll(void *data);
net/core/dev.c-1669-
net/core/dev.c:1670:static int napi_kthread_create(struct napi_struct *n)
net/core/dev.c-1671-{
--
net/core/dev.c=7257=int napi_set_threaded(struct napi_struct *napi,
--
net/core/dev.c-7261- if (!napi->thread) {
net/core/dev.c:7262: int err = napi_kthread_create(napi);
net/core/dev.c-7263-
--
net/core/dev.c=7289=int netif_set_threaded(struct net_device *dev,
--
net/core/dev.c-7299- if (!napi->thread) {
net/core/dev.c:7300: err = napi_kthread_create(napi);
net/core/dev.c-7301- if (err) {
--
net/core/dev.c=7612=void netif_napi_add_weight_locked(struct net_device *dev,
--
net/core/dev.c-7651- if (napi_get_threaded_config(dev, napi))
net/core/dev.c:7652: if (napi_kthread_create(napi))
net/core/dev.c-7653- dev->threaded = NETDEV_NAPI_THREADED_DISABLED;
]
|
| 24/2 |
2026/09/13 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 17428
output: 36
thoughts: 23
Thoughts: Here's my take on those thoughts, tailored for an expert audience:
**Diving into `napi_kthread_create` in `net/core/dev.c`**
Alright, let's pull up the source code for `napi_kthread_create` specifically within `net/core/dev.c`. I'm curious to see how the NAPI (Network Interface Controller Polling) mechanism is being integrated with kernel threads. I'm expecting to see the standard thread creation process, but I want to understand how it's being linked back to the NAPI poll context. This includes looking for the initialization of task structures, any specific scheduling priorities or CPU affinity settings that are applied for NAPI threads, and, critically, how the kthread's execution loop interacts with the NAPI poll function. I want to see how the wake-up mechanism is wired up, potentially involving `wake_up`, `wake_up_process` or similar functions, and how interrupts are potentially masked or managed within the thread's context. Furthermore, I'll be searching for any error handling related to thread creation and management within the context of NAPI, as well as how this thread might interact with the device's RX/TX queues. I'll need to confirm that this design is optimal for the typical performance constraints of NAPI interfaces. I'm also hoping to spot any potential concurrency issues or race conditions that may arise from the interaction between the kthread and the driver.
|
| 25/2 |
2026/09/13 00:50 |
tool |
read-file |
0m
Args: map[File:net/core/dev.c FirstLine:1660 LineCount:50]
Results: map[Contents:1660: void netdev_notify_peers(struct net_device *dev)
1661: {
1662: rtnl_lock();
1663: __netdev_notify_peers(dev);
1664: rtnl_unlock();
1665: }
1666: EXPORT_SYMBOL(netdev_notify_peers);
1667:
1668: static int napi_threaded_poll(void *data);
1669:
1670: static int napi_kthread_create(struct napi_struct *n)
1671: {
1672: int err = 0;
1673:
1674: /* Create and wake up the kthread once to put it in
1675: * TASK_INTERRUPTIBLE mode to avoid the blocked task
1676: * warning and work with loadavg.
1677: */
1678: n->thread = kthread_run(napi_threaded_poll, n, "napi/%s-%d",
1679: n->dev->name, n->napi_id);
1680: if (IS_ERR(n->thread)) {
1681: err = PTR_ERR(n->thread);
1682: pr_err("kthread_run failed with err %d\n", err);
1683: n->thread = NULL;
1684: }
1685:
1686: return err;
1687: }
1688:
1689: static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
1690: {
1691: const struct net_device_ops *ops = dev->netdev_ops;
1692: int ret;
1693:
1694: ASSERT_RTNL();
1695: dev_addr_check(dev);
1696:
1697: if (!netif_device_present(dev)) {
1698: /* may be detached because parent is runtime-suspended */
1699: if (dev->dev.parent)
1700: pm_runtime_resume(dev->dev.parent);
1701: if (!netif_device_present(dev))
1702: return -ENODEV;
1703: }
1704:
1705: /* Block netpoll from trying to do any rx path servicing.
1706: * If we don't do this there is a chance ndo_poll_controller
1707: * or ndo_poll may be running while we open the device
1708: */
1709: netpoll_poll_disable(dev);
]
|
| 26/2 |
2026/09/13 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 18545
output: 35
thoughts: 774
Thoughts: **Per-CPU Locks and Threaded NAPI: A Concurrency Conundrum**
Okay, so I'm digging into this threaded NAPI implementation, specifically how it interacts with per-CPU data structures. The `n->thread` is kicked off using `kthread_run`, meaning it's not pinned to any specific CPU core. That's the starting point. I'm seeing that the `gro_cell_poll` function, which is the core workhorse for handling incoming packets in this threaded NAPI context, accesses `cell->bh_lock`. And that `cell` is obtained using the `container_of` macro, tracking back to a `gro_cell` instance that's per-CPU, allocated by `alloc_percpu`.
Okay, stepping back and running through the initialization again, specifically in `gro_cells_init`. I see it loops through each possible CPU. For *each* CPU, it allocates a `gro_cell`, initializes the associated NAPI structure, and sets up a `local_lock_t` called `bh_lock`. Crucially, this setup uses `per_cpu_ptr` to ensure each CPU has its own independent `gro_cell`. It then initializes the associated NAPI and enables it. So far, so good. There's one NAPI instance and one associated `gro_cell` instance *per* CPU.
Now, with threaded NAPI enabled, each NAPI instance gets its own dedicated kernel thread. This thread, let's say it's the NAPI instance for CPU X, might actually be scheduled and run on CPU Y. Thatβs the crux. If the NAPI thread for CPU X is running on CPU Y, itβs going to attempt to access `cell->bh_lock` which is associated with CPU X!
And that `bh_lock` is a `local_lock_t`. *Aha!* Thatβs a potential problem because `local_lock_t` suggests it's a per-CPU lock! Can a thread running on one CPU safely acquire and release a `local_lock_t` that belongs to a *different* CPU? This is where my alarm bells are starting to ring.
Letβs re-examine `local_lock_acquire`. It uses `lock_map_acquire` and then, critically, it checks `DEBUG_LOCKS_WARN_ON(l->owner)`. In its base state, if `CONFIG_PREEMPT_RT` is *not* enabled, `local_lock_t` is empty. The problem occurs if `CONFIG_DEBUG_LOCK_ALLOC` is set, and it includes `owner`. In this scenario, running `napi_threaded_poll` on CPU Y will call `__local_lock_nested_bh(&cell->bh_lock)`.
That expands to `local_lock_acquire((lock))` and, as the `DEBUG_LOCKS_WARN_ON` suggests, that's where the potential race lives. The `napi_threaded_poll` running on CPU Y sets `l->owner = current`. Then, the lock is released, and `l->owner` is reset to `NULL`. The concern I have is: why would `l->owner` ever be non-NULL? Why would the `DEBUG_LOCKS_WARN_ON` trigger at all? The answer, I suspect, is that `gro_cells_receive` might be running concurrently *on CPU X*. That's the likely point of contention and it warrants a close look. I need to understand the concurrency model of `gro_cells_receive` next.
|
| 27/2 |
2026/09/13 00:50 |
tool |
read-file |
0m
Args: map[File:net/core/gro_cells.c FirstLine:1 LineCount:50]
Results: map[Contents: 1: // SPDX-License-Identifier: GPL-2.0
2: #include <linux/skbuff.h>
3: #include <linux/slab.h>
4: #include <linux/netdevice.h>
5: #include <net/gro_cells.h>
6: #include <net/hotdata.h>
7:
8: struct gro_cell {
9: struct sk_buff_head napi_skbs;
10: struct napi_struct napi;
11: local_lock_t bh_lock;
12: };
13:
14: int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
15: {
16: struct net_device *dev = skb->dev;
17: bool have_bh_lock = false;
18: struct gro_cell *cell;
19: int res;
20:
21: rcu_read_lock();
22: if (unlikely(!(dev->flags & IFF_UP)))
23: goto drop;
24:
25: skb_unset_transport_header(skb);
26:
27: if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) {
28: res = netif_rx(skb);
29: goto unlock;
30: }
31:
32: local_lock_nested_bh(&gcells->cells->bh_lock);
33: have_bh_lock = true;
34: cell = this_cpu_ptr(gcells->cells);
35:
36: if (skb_queue_len(&cell->napi_skbs) > READ_ONCE(net_hotdata.max_backlog)) {
37: drop:
38: dev_core_stats_rx_dropped_inc(dev);
39: kfree_skb(skb);
40: res = NET_RX_DROP;
41: goto unlock;
42: }
43:
44: __skb_queue_tail(&cell->napi_skbs, skb);
45: if (skb_queue_len(&cell->napi_skbs) == 1)
46: napi_schedule(&cell->napi);
47:
48: res = NET_RX_SUCCESS;
49:
50: unlock:
]
|
| 28/2 |
2026/09/13 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 20829
output: 22
thoughts: 90
Thoughts: Here's my summary, as though I'm thinking through this code:
**Analyzing `gro_cells_receive`**
Okay, so I'm looking at `gro_cells_receive` and it starts by grabbing a lock, specifically with `local_lock_nested_bh(&gcells->cells->bh_lock)`. That looks like a spinlock, probably a nested one given the "nested" in the name, so I'm likely dealing with some locking hierarchy here. It sets `have_bh_lock` to true, confirming it got the lock, and then grabs the per-CPU data structure `cell` with `this_cpu_ptr(gcells->cells)`. Seems pretty standard for per-CPU allocation.
Wait a second... `local_lock_nested_bh`... that's a macro! Right. I need to see what that macro *actually* expands to. Gotta dig into that definition before I proceed; it could be doing something non-obvious. Let's look up `local_lock_nested_bh`.
|
| 29/2 |
2026/09/13 00:50 |
tool |
grepper |
0m
Args: map[Expression:define local_lock_nested_bh]
Results: map[Output:include/linux/local_lock.h=92=DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_lock_t __percpu,
--
include/linux/local_lock.h-96-
include/linux/local_lock.h:97:#define local_lock_nested_bh(_lock) \
include/linux/local_lock.h-98- __local_lock_nested_bh(__this_cpu_local_lock(_lock))
]
|
| 30/2 |
2026/09/13 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 21296
output: 36
thoughts: 109
Thoughts: **Analyzing the Locking Mechanism**
Okay, so I'm looking at this `local_lock_nested_bh(&gcells->cells->bh_lock)` call, and my first thought is that it's acquiring the `bh_lock` for the *current* CPU. But wait, what exactly does "BH" mean here? It's disabling something... but is it disabling it outright, or just asserting that it's already disabled? The naming convention suggests there might be some nuance here, especially with the relationship between `local_lock_nested_bh` and `__local_lock_nested_bh`. Time to consult the source. Let's dig into `include/linux/local_lock.h` to clarify what's going on with these BH states and how `local_lock_nested_bh` is truly implemented. I need to understand this BH disabling behavior completely before I can proceed.
|
| 31/2 |
2026/09/13 00:50 |
tool |
read-file |
0m
Args: map[File:include/linux/local_lock.h FirstLine:80 LineCount:50]
Results: map[Contents: 80: * locking constrains it will _always_ fail to acquire the lock in NMI or
81: * HARDIRQ context on PREEMPT_RT.
82: */
83: #define local_trylock_irqsave(lock, flags) \
84: __local_trylock_irqsave(__this_cpu_local_lock(lock), flags)
85:
86: DEFINE_LOCK_GUARD_1(local_lock, local_lock_t __percpu,
87: local_lock(_T->lock),
88: local_unlock(_T->lock))
89: DEFINE_LOCK_GUARD_1(local_lock_irq, local_lock_t __percpu,
90: local_lock_irq(_T->lock),
91: local_unlock_irq(_T->lock))
92: DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_lock_t __percpu,
93: local_lock_irqsave(_T->lock, _T->flags),
94: local_unlock_irqrestore(_T->lock, _T->flags),
95: unsigned long flags)
96:
97: #define local_lock_nested_bh(_lock) \
98: __local_lock_nested_bh(__this_cpu_local_lock(_lock))
99:
100: #define local_unlock_nested_bh(_lock) \
101: __local_unlock_nested_bh(__this_cpu_local_lock(_lock))
102:
103: DEFINE_LOCK_GUARD_1(local_lock_nested_bh, local_lock_t __percpu,
104: local_lock_nested_bh(_T->lock),
105: local_unlock_nested_bh(_T->lock))
106:
107: DEFINE_LOCK_GUARD_1(local_lock_init, local_lock_t, local_lock_init(_T->lock), /* */)
108:
109: DECLARE_LOCK_GUARD_1_ATTRS(local_lock, __acquires(_T), __releases(*(local_lock_t __percpu **)_T))
110: #define class_local_lock_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(local_lock, _T)
111: DECLARE_LOCK_GUARD_1_ATTRS(local_lock_irq, __acquires(_T), __releases(*(local_lock_t __percpu **)_T))
112: #define class_local_lock_irq_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(local_lock_irq, _T)
113: DECLARE_LOCK_GUARD_1_ATTRS(local_lock_irqsave, __acquires(_T), __releases(*(local_lock_t __percpu **)_T))
114: #define class_local_lock_irqsave_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(local_lock_irqsave, _T)
115: DECLARE_LOCK_GUARD_1_ATTRS(local_lock_nested_bh, __acquires(_T), __releases(*(local_lock_t __percpu **)_T))
116: #define class_local_lock_nested_bh_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(local_lock_nested_bh, _T)
117: DECLARE_LOCK_GUARD_1_ATTRS(local_lock_init, __acquires(_T), __releases(*(local_lock_t **)_T))
118: #define class_local_lock_init_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(local_lock_init, _T)
119:
120: DEFINE_LOCK_GUARD_1(local_trylock_init, local_trylock_t, local_trylock_init(_T->lock), /* */)
121: DECLARE_LOCK_GUARD_1_ATTRS(local_trylock_init, __acquires(_T), __releases(*(local_trylock_t **)_T))
122: #define class_local_trylock_init_constructor(_T) WITH_LOCK_GUARD_1_ATTRS(local_trylock_init, _T)
123:
124: #endif
]
|
| 32/2 |
2026/09/13 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 22791
output: 18
thoughts: 1231
Thoughts: **Analysis of a Potential Data Race in GRO Implementation**
Okay, let's break this down. My initial observation is that `local_lock_nested_bh` seems straightforward β it just asserts we're in softirq, then acquires a local lock. Nothing too exciting... or so I thought. The critical detail appears in the implementation of `gro_cell_poll`, specifically where it uses `__local_lock_nested_bh` to protect access to `cell->napi_skbs`. I have to keep my eyes peeled here, as I know that `local_lock_nested_bh` *doesn't* disable bottom halves.
The interesting part is that this function isn't using the per-CPU version of the lock, the `__local_lock_nested_bh` variant is used, taking a direct pointer to the lock. This means we're dealing with the `cell->bh_lock` which is shared. `cell` itself is associated with a specific CPU via the `napi` structure.
Now, a key point to me is that `local_lock_acquire` *does* modify the lock's `owner` field. This seems like a lockdep mechanism to track the current owner, but it's crucial here. If `napi_threaded_poll` is running on a different CPU (let's say CPU Y) than the one the `cell` belongs to (CPU X), it will acquire `cell->bh_lock`. Then `gro_cells_receive` (potentially on CPU X) also attempts to acquire the *same* `local_lock_t`, which should be a per-CPU lock, but it isn't, so there's a problem, and the lockdep code complains about the `l->owner` field. This is because lockdep is tracking ownership, and detects the lock is held by another context. But this is just for lockdep!
Here's the problem: On non-RT kernels, `local_lock_t` is essentially empty, acting only for lockdep. But, *even* if it's just lockdep, the `owner` field is getting modified. A kthread on CPU Y is setting it, and another thread on CPU X is seeing the `l->owner != NULL` which triggers the warning. This highlights the core issue.
Because it is a non-RT kernel and `local_lock_t` is not a real lock, the important stuff being protected is `cell->napi_skbs`. But if `napi_threaded_poll` on CPU Y and `gro_cells_receive` on CPU X are racing, they're not protected by the supposed locking semantics. We have `__skb_queue_tail` and `__skb_dequeue` being used concurrently *without* any atomic operations!
We're looking at a blatant data race and likely memory corruption. The problem exists because threaded NAPI, created using `kthread_run`, doesn't guarantee the kthread will run on the same CPU. Normally, NAPI runs within the softirq context, which *is* CPU-bound. However, with threaded NAPI, the polling happens in an unbound kthread. This allows concurrent access to `cell->napi_skbs` without any synchronization. We've got a classic data race situation here. It's a concurrency nightmare waiting to happen.
|
| 33/2 |
2026/09/13 00:50 |
tool |
grepper |
0m
Args: map[Expression:kthread_bind]
Results: map[Output:include/linux/kthread.h=103=void free_kthread_struct(struct task_struct *k);
include/linux/kthread.h:104:void kthread_bind(struct task_struct *k, unsigned int cpu);
include/linux/kthread.h:105:void kthread_bind_mask(struct task_struct *k, const struct cpumask *mask);
include/linux/kthread.h-106-int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask);
--
kernel/bpf/cpumap.c=435=__cpu_map_entry_alloc(struct bpf_map *map, struct bpf_cpumap_val *value,
--
kernel/bpf/cpumap.c-493- /* Make sure kthread runs on a single CPU */
kernel/bpf/cpumap.c:494: kthread_bind(rcpu->kthread, cpu);
kernel/bpf/cpumap.c-495- wake_up_process(rcpu->kthread);
--
kernel/dma/map_benchmark.c=305=static int do_map_benchmark(struct map_benchmark_data *map)
--
kernel/dma/map_benchmark.c-331- if (node != NUMA_NO_NODE)
kernel/dma/map_benchmark.c:332: kthread_bind_mask(tsk[i], cpumask_of_node(node));
kernel/dma/map_benchmark.c-333- }
--
kernel/irq/manage.c=1403=setup_irq_thread(struct irqaction *new, unsigned int irq, bool secondary)
--
kernel/irq/manage.c-1432- */
kernel/irq/manage.c:1433: kthread_bind_mask(t, cpu_possible_mask);
kernel/irq/manage.c-1434-
--
kernel/kthread.c=380=static int kthread(void *_create)
--
kernel/kthread.c-425- /*
kernel/kthread.c:426: * Apply default node affinity if no call to kthread_bind[_mask]() nor
kernel/kthread.c-427- * kthread_affine_preferred() was issued before the first wake-up.
--
kernel/kthread.c=564=EXPORT_SYMBOL(kthread_create_on_node);
kernel/kthread.c-565-
kernel/kthread.c:566:static void __kthread_bind_mask(struct task_struct *p, const struct cpumask *mask, unsigned int state)
kernel/kthread.c-567-{
--
kernel/kthread.c-579-
kernel/kthread.c:580:static void __kthread_bind(struct task_struct *p, unsigned int cpu, unsigned int state)
kernel/kthread.c-581-{
kernel/kthread.c:582: __kthread_bind_mask(p, cpumask_of(cpu), state);
kernel/kthread.c-583-}
kernel/kthread.c-584-
kernel/kthread.c:585:void kthread_bind_mask(struct task_struct *p, const struct cpumask *mask)
kernel/kthread.c-586-{
kernel/kthread.c-587- struct kthread *kthread = to_kthread(p);
kernel/kthread.c:588: __kthread_bind_mask(p, mask, TASK_UNINTERRUPTIBLE);
kernel/kthread.c-589- WARN_ON_ONCE(kthread->started);
--
kernel/kthread.c-592-/**
kernel/kthread.c:593: * kthread_bind - bind a just-created kthread to a cpu.
kernel/kthread.c-594- * @p: thread created by kthread_create().
--
kernel/kthread.c-600- */
kernel/kthread.c:601:void kthread_bind(struct task_struct *p, unsigned int cpu)
kernel/kthread.c-602-{
kernel/kthread.c-603- struct kthread *kthread = to_kthread(p);
kernel/kthread.c:604: __kthread_bind(p, cpu, TASK_UNINTERRUPTIBLE);
kernel/kthread.c-605- WARN_ON_ONCE(kthread->started);
kernel/kthread.c-606-}
kernel/kthread.c:607:EXPORT_SYMBOL(kthread_bind);
kernel/kthread.c-608-
--
kernel/kthread.c=619=struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data),
--
kernel/kthread.c-628- return p;
kernel/kthread.c:629: kthread_bind(p, cpu);
kernel/kthread.c-630- /* CPU hotplug need to bind once again when unparking the thread. */
--
kernel/kthread.c=670=void kthread_unpark(struct task_struct *k)
--
kernel/kthread.c-680- if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags))
kernel/kthread.c:681: __kthread_bind(k, kthread->cpu, TASK_PARKED);
kernel/kthread.c-682-
--
kernel/kthread.c=787=int kthreadd(void *unused)
--
kernel/kthread.c-832- *
kernel/kthread.c:833: * Similar to kthread_bind_mask() except that the affinity is not a requirement
kernel/kthread.c-834- * but rather a preference that can be constrained by CPU isolation or CPU hotplug.
--
kernel/kthread.c=1137=kthread_create_worker_on_cpu(int cpu, unsigned int flags,
--
kernel/kthread.c-1143- if (!IS_ERR(worker))
kernel/kthread.c:1144: kthread_bind(worker->task, cpu);
kernel/kthread.c-1145-
--
kernel/sched/core.c=2803=do_set_cpus_allowed(struct task_struct *p, struct affinity_context *ctx)
--
kernel/sched/core.c-2809-/*
kernel/sched/core.c:2810: * Used for kthread_bind() and select_fallback_rq(), in both cases the user
kernel/sched/core.c-2811- * affinity (if any) should be destroyed too.
--
kernel/sched/core.c=3122=static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
--
kernel/sched/core.c-3153- /*
kernel/sched/core.c:3154: * Must re-check here, to close a race against __kthread_bind(),
kernel/sched/core.c-3155- * sched_setaffinity() is not guaranteed to observe the flag.
--
kernel/sched/cpufreq_schedutil.c=670=static int sugov_kthread_create(struct sugov_policy *sg_policy)
--
kernel/sched/cpufreq_schedutil.c-714- else
kernel/sched/cpufreq_schedutil.c:715: kthread_bind_mask(thread, policy->related_cpus);
kernel/sched/cpufreq_schedutil.c-716-
--
kernel/workqueue.c=2885=static struct worker *create_worker(struct worker_pool *pool)
--
kernel/workqueue.c-2923- set_user_nice(worker->task, pool->attrs->nice);
kernel/workqueue.c:2924: kthread_bind_mask(worker->task, pool_allowed_cpus(pool));
kernel/workqueue.c-2925- }
--
kernel/workqueue.c=5784=static int init_rescuer(struct workqueue_struct *wq)
--
kernel/workqueue.c-5817- if (cpumask_intersects(wq_unbound_cpumask, cpu_active_mask))
kernel/workqueue.c:5818: kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
kernel/workqueue.c-5819- else
kernel/workqueue.c:5820: kthread_bind_mask(rescuer->task, cpu_possible_mask);
kernel/workqueue.c-5821-
--
lib/test_workqueue.c=138=static int __init run_bench(int n_threads, const char *scope, const char *label)
--
lib/test_workqueue.c-210-
lib/test_workqueue.c:211: kthread_bind(tasks[i], cpu);
lib/test_workqueue.c-212- wake_up_process(tasks[i]);
--
tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c=240=static int bpf_test_rqspinlock_init(void)
--
tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c-289- }
tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c:290: kthread_bind(t, i);
tools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c-291- rqsl_threads[i] = t;
]
|
| 34/2 |
2026/09/13 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 27257
output: 22
thoughts: 624
Thoughts: **My Analysis of NAPI Threaded Polling and Concurrency**
Okay, so I'm looking at how `napi_kthread_create` works. It's important to realize that it *doesn't* call `kthread_bind`. Instead, it just uses `kthread_run` to start `napi_threaded_poll`. This means the NAPI kthread isn't bound to any specific CPU β it can run on *any* CPU. That's the crux of the issue here.
If the NAPI thread can run on any CPU, and it's calling `gro_cell_poll`, then it will be accessing `cell->bh_lock` and `cell->napi_skbs` for the CPU where the `napi` was originally registered. Now, `gro_cells_receive` also accesses `cell->bh_lock` and `cell->napi_skbs`, but *for the current CPU* that's executing the function.
This is a problem. Imagine `gro_cells_receive` running on CPU X. It would be accessing `cell_X`. Now, the `napi_threaded_poll` function for CPU X is running on CPU Y. It's also trying to access `cell_X`. This means they're *both* accessing `cell_X` concurrently.
The code uses `local_lock_t` for synchronization here. That raises an immediate red flag. On non-RT kernels, `local_lock_t` is *not* a true mutual exclusion lock. It's really just for lockdep tracking, as I recall. It doesn't actually provide any protection. This is a huge problem.
Now, `local_lock_t` is *intended* to be used for per-CPU variables that are accessed *only* from their respective CPU. If a task from one CPU tries to access a per-CPU variable of *another* CPU using `local_lock_t`, that lock *won't* protect it! It's supposed to map to `preempt_disable()` or `local_bh_disable()`. I need to confirm this...
Okay, I'm checking the definition of `__local_lock_nested_bh`. It looks like it does absolutely nothing but lockdep and sparse annotations. It doesn't disable BH either. It assumes that BH is already disabled because it's "nested_bh."
But, wait. `napi_threaded_poll` disables BH! It does `local_bh_disable()` before calling `__napi_poll` and then re-enables it. So, BH is disabled on CPU Y. I need to make sure I am thinking this through correctly and not missing something.
But `gro_cells_receive` calls `local_lock_nested_bh(&gcells->cells->bh_lock)`. Did it disable BH? Let me look at the definition of `local_lock_nested_bh` in `include/linux/local_lock.h` and confirm how this is supposed to work. This could be where the concurrency issue stems from.
|
| 35/2 |
2026/09/13 00:51 |
tool |
grepper |
0m
Args: map[Expression:define local_lock_nested_bh]
Results: map[Output:include/linux/local_lock.h=92=DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_lock_t __percpu,
--
include/linux/local_lock.h-96-
include/linux/local_lock.h:97:#define local_lock_nested_bh(_lock) \
include/linux/local_lock.h-98- __local_lock_nested_bh(__this_cpu_local_lock(_lock))
]
|
| 36/2 |
2026/09/13 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 28699
output: 21
thoughts: 359
Thoughts: **My Analysis of the `local_lock_nested_bh` Function**
Okay, let me break this down. First, `local_lock_nested_bh` is just a wrapper for `__local_lock_nested_bh`. So, that tells me neither of them are actually disabling bottom halves (BHs) explicitly. That's the first important point. If they aren't disabling BHs, then *how* is BH protection ensured? My initial thought is that it must be assumed that the caller *already* has BHs disabled.
Ah, right, `gro_cells_receive` is invoked from functions like `netif_rx`, or similar functions. `netif_rx` runs in the softirq context (BH context), so the assumption holds.
Now, wait, it also calls from things like `ip_tunnel_rcv`. Is that *guaranteed* to be in BH context too? Yes, normally the packet receive path is in softirq context, so that tracks.
But hold on, this is where it gets tricky. If `local_lock_nested_bh` *doesn't* disable BHs and neither does `__local_lock_nested_bh`, then we're not actually providing any *cross-CPU* mutual exclusion! It's only guarding against preemption or interrupts on the *same* CPU. But, because it's specifically `nested_bh`, it's *assuming* BH is already disabled. It's essentially just documenting the context and checking it with lockdep, nothing more.
So if `napi_threaded_poll` is running on CPU Y, and `gro_cells_receive` is running on CPU X, and they both touch `cell_X`, this is a data race on `cell_X->napi_skbs`. We have a serious problem. This is a critical flaw.
Now, wait...is `napi_threaded_poll` even *allowed* to run on CPU Y? Hmm, `kthread_run` doesn't bind the thread to a specific CPU, so it *could* be running on a different CPU. Wait, isn't NAPI threaded poll supposed to be bound to the CPU? I need to go look for any binding code now.
|
| 37/2 |
2026/09/13 00:51 |
tool |
grepper |
0m
Error:
Args: map[Expression:kthread_bind.*napi]
Results:
|
| 38/2 |
2026/09/13 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 29589
output: 19
thoughts: 599
Thoughts: **My Analysis of a Potential Memory Corruption Bug**
Okay, so I'm looking at this code, and initially, I'm not seeing any immediate red flags. But then I have to think about the interaction of different components, and I have a question. How can NAPI kthreads safely access per-CPU NAPI structures? It doesn't seem right. Normally, NAPI structures are per-device or per-queue, not per-CPU. Each RX queue on a network card, for example, has its own NAPI structure protected by the `NAPI_STATE_SCHED` bit. Only one thread should poll a NAPI at any given time. And, since the NAPI kthread runs on a specific CPU, that CPU should be the *only* one polling that particular NAPI. This is generally safe because the RX queue isn't per-CPU, it's just a data structure.
But `gro_cells`... that's where things get interesting, and concerning. It *does* create a NAPI per CPU. The code I'm looking at clearly shows this: a loop iterates through each possible CPU, allocating a `gro_cell` for each, and associating a NAPI with it. And then, in `gro_cells_receive`, it accesses the `gro_cell` *of the current CPU* using `this_cpu_ptr(gcells->cells)`. This function is trying to use `__skb_queue_tail` and protects it with `local_lock_nested_bh`. This assumes that the `cell->napi_skbs` queue is only accessed by the current CPU!
Now, the problem arises when threaded NAPI is enabled for this device. If the polling for `cell_X` is running in a kthread, which is scheduled on CPU Y, it will call `gro_cell_poll` on CPU Y. `gro_cell_poll` then uses `__skb_dequeue(&cell->napi_skbs)`. But now you've got a concurrency conflict. The queue `cell_X->napi_skbs` is being concurrently modified; by CPU Y via `__skb_dequeue` AND by CPU X via `__skb_queue_tail`. Without the use of atomics. This is a clear recipe for corrupting the skb queue, which, as an expert, I know manifests as a corrupted doubly linked list `sk_buff_head`.
Essentially, enabling threaded NAPI on a device that uses `gro_cells` is the root cause of this memory corruption bug. So, my next logical step is to figure out which devices actually *use* `gro_cells` and check what to do.
|
| 39/2 |
2026/09/13 00:51 |
tool |
grepper |
0m
Args: map[Expression:gro_cells_init]
Results: map[Output:drivers/net/amt.c=3115=static int amt_dev_init(struct net_device *dev)
--
drivers/net/amt.c-3121-
drivers/net/amt.c:3122: err = gro_cells_init(&amt->gro_cells, dev);
drivers/net/amt.c-3123- if (err)
--
drivers/net/bareudp.c=213=static int bareudp_init(struct net_device *dev)
--
drivers/net/bareudp.c-217-
drivers/net/bareudp.c:218: err = gro_cells_init(&bareudp->gro_cells, dev);
drivers/net/bareudp.c-219- if (err)
--
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c=104=static int rmnet_vnd_init(struct net_device *dev)
--
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-112-
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:113: err = gro_cells_init(&priv->gro_cells, dev);
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-114- if (err) {
--
drivers/net/geneve.c=394=static int geneve_init(struct net_device *dev)
--
drivers/net/geneve.c-398-
drivers/net/geneve.c:399: err = gro_cells_init(&geneve->gro_cells, dev);
drivers/net/geneve.c-400- if (err)
--
drivers/net/macsec.c=3532=static int macsec_dev_init(struct net_device *dev)
--
drivers/net/macsec.c-3537-
drivers/net/macsec.c:3538: err = gro_cells_init(&macsec->gro_cells, dev);
drivers/net/macsec.c-3539- if (err)
--
drivers/net/ovpn/main.c=64=static int ovpn_net_init(struct net_device *dev)
--
drivers/net/ovpn/main.c-66- struct ovpn_priv *ovpn = netdev_priv(dev);
drivers/net/ovpn/main.c:67: int err = gro_cells_init(&ovpn->gro_cells, dev);
drivers/net/ovpn/main.c-68-
--
drivers/net/pfcp.c=120=static int pfcp_dev_init(struct net_device *dev)
--
drivers/net/pfcp.c-125-
drivers/net/pfcp.c:126: return gro_cells_init(&pfcp->gro_cells, dev);
drivers/net/pfcp.c-127-}
--
drivers/net/vxlan/vxlan_core.c=2929=static int vxlan_init(struct net_device *dev)
--
drivers/net/vxlan/vxlan_core.c-2943-
drivers/net/vxlan/vxlan_core.c:2944: err = gro_cells_init(&vxlan->gro_cells, dev);
drivers/net/vxlan/vxlan_core.c-2945- if (err)
--
include/net/gro_cells.h=15=int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb);
include/net/gro_cells.h:16:int gro_cells_init(struct gro_cells *gcells, struct net_device *dev);
include/net/gro_cells.h-17-void gro_cells_destroy(struct gro_cells *gcells);
--
net/core/gro_cells.c=59=static int gro_cell_poll(struct napi_struct *napi, int budget)
--
net/core/gro_cells.c-79-
net/core/gro_cells.c:80:int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
net/core/gro_cells.c-81-{
--
net/core/gro_cells.c-100-}
net/core/gro_cells.c:101:EXPORT_SYMBOL(gro_cells_init);
net/core/gro_cells.c-102-
--
net/dsa/user.c=2758=int dsa_user_create(struct dsa_port *port)
--
net/dsa/user.c-2809-
net/dsa/user.c:2810: ret = gro_cells_init(&p->gcells, user_dev);
net/dsa/user.c-2811- if (ret)
--
net/ipv4/ip_tunnel.c=1274=int __ip_tunnel_init(struct net_device *dev)
--
net/ipv4/ip_tunnel.c-1287-
net/ipv4/ip_tunnel.c:1288: err = gro_cells_init(&tunnel->gro_cells, dev);
net/ipv4/ip_tunnel.c-1289- if (err) {
--
net/ipv6/ip6_gre.c=1474=static int ip6gre_tunnel_init_common(struct net_device *dev)
--
net/ipv6/ip6_gre.c-1488-
net/ipv6/ip6_gre.c:1489: ret = gro_cells_init(&tunnel->gro_cells, dev);
net/ipv6/ip6_gre.c-1490- if (ret)
--
net/ipv6/ip6_gre.c=1847=static int ip6erspan_tap_init(struct net_device *dev)
--
net/ipv6/ip6_gre.c-1861-
net/ipv6/ip6_gre.c:1862: ret = gro_cells_init(&tunnel->gro_cells, dev);
net/ipv6/ip6_gre.c-1863- if (ret)
--
net/ipv6/ip6_tunnel.c=1937=ip6_tnl_dev_init_gen(struct net_device *dev)
--
net/ipv6/ip6_tunnel.c-1948-
net/ipv6/ip6_tunnel.c:1949: ret = gro_cells_init(&t->gro_cells, dev);
net/ipv6/ip6_tunnel.c-1950- if (ret)
--
net/xfrm/xfrm_input.c=848=void __init xfrm_input_init(void)
--
net/xfrm/xfrm_input.c-856-
net/xfrm/xfrm_input.c:857: err = gro_cells_init(&gro_cells, xfrm_napi_dev);
net/xfrm/xfrm_input.c-858- if (err)
--
net/xfrm/xfrm_interface_core.c=761=static int xfrmi_dev_init(struct net_device *dev)
--
net/xfrm/xfrm_interface_core.c-766-
net/xfrm/xfrm_interface_core.c:767: err = gro_cells_init(&xi->gro_cells, dev);
net/xfrm/xfrm_interface_core.c-768- if (err)
]
|
| 40/2 |
2026/09/13 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 32713
output: 19
thoughts: 154
Thoughts: **Analyzing a Potentially Widespread Network Vulnerability**
Okay, so I'm looking at this code and immediately see that `gro_cells` is a key element, utilized across a *huge* range of tunnel devices. We're talking `vxlan`, `geneve`, `macsec`, the whole lot β all the way down to the more basic protocols like GRE, IPIP, and SIT. It's a broad spectrum. My initial concern is that a bug is triggered when `dev_set_threaded` is called on these tunnel devices. That's a very specific function call.
The real question I need to answer is: can an unprivileged user even *call* `dev_set_threaded`? That's the crux of whether this is exploitable. It seems `dev_set_threaded` is invoked through netlink, which is an important clue, of course. I need to dig into the relevant netlink code to trace the permission path. Let's see...I'll start by checking `net/core/dev_api.c` and `net/core/rtnetlink.c` and search for that function. From there, I'll assess the security implications.
|
| 41/2 |
2026/09/13 00:51 |
tool |
grepper |
0m
Args: map[Expression:dev_set_threaded]
Results: map[Output:drivers/net/wireless/mediatek/mt76/debugfs.c=29=mt76_napi_threaded_set(void *data, u64 val)
--
drivers/net/wireless/mediatek/mt76/debugfs.c-36- if (dev->napi_dev->threaded != val)
drivers/net/wireless/mediatek/mt76/debugfs.c:37: return dev_set_threaded(dev->napi_dev, val);
drivers/net/wireless/mediatek/mt76/debugfs.c-38-
--
include/linux/netdevice.h=599=void netif_threaded_enable(struct net_device *dev);
include/linux/netdevice.h:600:int dev_set_threaded(struct net_device *dev,
include/linux/netdevice.h-601- enum netdev_napi_threaded threaded);
--
net/core/dev_api.c=372=EXPORT_SYMBOL(netdev_state_change);
net/core/dev_api.c-373-
net/core/dev_api.c:374:int dev_set_threaded(struct net_device *dev,
net/core/dev_api.c-375- enum netdev_napi_threaded threaded)
--
net/core/dev_api.c-384-}
net/core/dev_api.c:385:EXPORT_SYMBOL(dev_set_threaded);
--
tools/testing/selftests/net/nl_netdev.py=51=def napi_set_threaded(nf) -> None:
--
tools/testing/selftests/net/nl_netdev.py-135-
tools/testing/selftests/net/nl_netdev.py:136:def dev_set_threaded(nf) -> None:
tools/testing/selftests/net/nl_netdev.py-137- """
--
tools/testing/selftests/net/nl_netdev.py=369=def main() -> None:
--
tools/testing/selftests/net/nl_netdev.py-376- napi_set_threaded,
tools/testing/selftests/net/nl_netdev.py:377: dev_set_threaded,
tools/testing/selftests/net/nl_netdev.py-378- nsim_rxq_reset_down,
]
|
| 42/2 |
2026/09/13 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 33762
output: 19
thoughts: 73
Thoughts: **Investigating the `dev_set_threaded` Function Call**
Okay, hold on a second. It's dawning on me that `dev_set_threaded` isn't *directly* invoked from the Netlink code path, is it? I was so focused on that assumption. I need to rethink this. Where is this function actually being called from? Perhaps it's not directly in the core Netlink handling, but integrated within another module?
Let's seeβ¦ I have a hunch it might be nestled within the network device family handling β that's often where these sorts of things live. Okay, let's target `net/core/netdev-genl.c` and `net/core/rtnetlink.c`. I'm going to scan those files, searching for any instances where `threaded` is referenced. Hopefully that reveals the call chain that eventually leads to `dev_set_threaded`. I bet I'll find it there.
|
| 43/2 |
2026/09/13 00:51 |
tool |
grepper |
0m
Args: map[Expression:dev_set_threaded]
Results: map[Output:drivers/net/wireless/mediatek/mt76/debugfs.c=29=mt76_napi_threaded_set(void *data, u64 val)
--
drivers/net/wireless/mediatek/mt76/debugfs.c-36- if (dev->napi_dev->threaded != val)
drivers/net/wireless/mediatek/mt76/debugfs.c:37: return dev_set_threaded(dev->napi_dev, val);
drivers/net/wireless/mediatek/mt76/debugfs.c-38-
--
include/linux/netdevice.h=599=void netif_threaded_enable(struct net_device *dev);
include/linux/netdevice.h:600:int dev_set_threaded(struct net_device *dev,
include/linux/netdevice.h-601- enum netdev_napi_threaded threaded);
--
net/core/dev_api.c=372=EXPORT_SYMBOL(netdev_state_change);
net/core/dev_api.c-373-
net/core/dev_api.c:374:int dev_set_threaded(struct net_device *dev,
net/core/dev_api.c-375- enum netdev_napi_threaded threaded)
--
net/core/dev_api.c-384-}
net/core/dev_api.c:385:EXPORT_SYMBOL(dev_set_threaded);
--
tools/testing/selftests/net/nl_netdev.py=51=def napi_set_threaded(nf) -> None:
--
tools/testing/selftests/net/nl_netdev.py-135-
tools/testing/selftests/net/nl_netdev.py:136:def dev_set_threaded(nf) -> None:
tools/testing/selftests/net/nl_netdev.py-137- """
--
tools/testing/selftests/net/nl_netdev.py=369=def main() -> None:
--
tools/testing/selftests/net/nl_netdev.py-376- napi_set_threaded,
tools/testing/selftests/net/nl_netdev.py:377: dev_set_threaded,
tools/testing/selftests/net/nl_netdev.py-378- nsim_rxq_reset_down,
]
|
| 44/2 |
2026/09/13 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 34680
output: 32
thoughts: 39
Thoughts: Okay, here's my take on those thoughts, framed as my own:
**Investigating a Potentially Exported, But Unclear Function**
Hmm, `dev_set_threaded` is exported, is it? That's interesting. I need to figure out where it's actually being *used*. Just seeing it exported doesn't tell me anything about its significance or how critical it might be. Given the name, I'd bet it has to do with threading within the network device context. Let's start by looking in `net/core/netdev-genl.c`, specifically for calls related to "threaded". That feels like a logical place to begin the hunt; Genl tends to handle some lower-level network device interactions. Hopefully, the name is a good hint, and there will be references there.
|
| 45/2 |
2026/09/13 00:51 |
tool |
grepper |
0m
Args: map[Expression:threaded PathPrefix:net/core/netdev-genl.c]
Results: map[Output:net/core/netdev-genl.c=163=netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi,
--
net/core/netdev-genl.c-188- if (nla_put_uint(rsp, NETDEV_A_NAPI_THREADED,
net/core/netdev-genl.c:189: napi_get_threaded(napi)))
net/core/netdev-genl.c-190- goto nla_put_failure;
--
net/core/netdev-genl.c=327=netdev_nl_napi_set_config(struct napi_struct *napi, struct genl_info *info)
--
net/core/netdev-genl.c-330- u64 gro_flush_timeout = 0;
net/core/netdev-genl.c:331: u8 threaded = 0;
net/core/netdev-genl.c-332- u32 defer = 0;
--
net/core/netdev-genl.c-336-
net/core/netdev-genl.c:337: threaded = nla_get_uint(info->attrs[NETDEV_A_NAPI_THREADED]);
net/core/netdev-genl.c:338: ret = napi_set_threaded(napi, threaded);
net/core/netdev-genl.c-339- if (ret)
]
|
| 46/2 |
2026/09/13 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 35321
output: 39
thoughts: 43
Thoughts: Okay, here's my interpretation of those thoughts, summarized from my perspective as a networking expert:
**Investigating a Threaded NAPI Setup**
Right, so `napi_set_threaded` is being invoked within the netlink subsystem. That immediately flags something interesting. I'll need to dig into how that call is being used and why it's happening, specifically within the `net/core/netdev-genl.c` file. This likely means some form of asynchronous processing or multi-threading is in play for network device interactions, possibly for netlink messages themselves or operations triggered by them. I need to understand the implications for NAPI's core functionality within this context, thinking through potential synchronization issues, interrupt handling differences, and the overall performance impact of this threaded approach to the NAPI interface. I'll focus my investigation on how the threaded setup interacts with the standard NAPI polling and completion mechanisms.
|
| 47/2 |
2026/09/13 00:51 |
tool |
read-file |
0m
Args: map[File:net/core/netdev-genl.c FirstLine:320 LineCount:50]
Results: map[Contents: 320: }
321: }
322:
323: return err;
324: }
325:
326: static int
327: netdev_nl_napi_set_config(struct napi_struct *napi, struct genl_info *info)
328: {
329: u64 irq_suspend_timeout = 0;
330: u64 gro_flush_timeout = 0;
331: u8 threaded = 0;
332: u32 defer = 0;
333:
334: if (info->attrs[NETDEV_A_NAPI_THREADED]) {
335: int ret;
336:
337: threaded = nla_get_uint(info->attrs[NETDEV_A_NAPI_THREADED]);
338: ret = napi_set_threaded(napi, threaded);
339: if (ret)
340: return ret;
341: }
342:
343: if (info->attrs[NETDEV_A_NAPI_DEFER_HARD_IRQS]) {
344: defer = nla_get_u32(info->attrs[NETDEV_A_NAPI_DEFER_HARD_IRQS]);
345: napi_set_defer_hard_irqs(napi, defer);
346: }
347:
348: if (info->attrs[NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT]) {
349: irq_suspend_timeout = nla_get_uint(info->attrs[NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT]);
350: napi_set_irq_suspend_timeout(napi, irq_suspend_timeout);
351: }
352:
353: if (info->attrs[NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT]) {
354: gro_flush_timeout = nla_get_uint(info->attrs[NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT]);
355: napi_set_gro_flush_timeout(napi, gro_flush_timeout);
356: }
357:
358: return 0;
359: }
360:
361: int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info)
362: {
363: struct napi_struct *napi;
364: unsigned int napi_id;
365: int err;
366:
367: if (GENL_REQ_ATTR_CHECK(info, NETDEV_A_NAPI_ID))
368: return -EINVAL;
369:
]
|
| 48/2 |
2026/09/13 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 36412
output: 26
thoughts: 61
Thoughts: Here's my take on those thoughts:
**Analyzing `netdev_nl_napi_set_doit`**
Okay, so `netdev_nl_napi_set_doit` β that's a netlink command, right? Hmm, I'm already thinking about potential security implications with that. Netlink commands can be powerful, and it's essential to understand if this specific one needs any special privileges to function properly. My immediate thought is, does it require certain capabilities? Gotta make sure there's proper authorization there. Let's dive into the kernel source code to verify that. I'm going to jump into `net/core/netdev-genl.c` and hunt for the implementation of `netdev_nl_napi_set_doit`. That's where I expect to find the details on the command and any associated capability checks. I'll need to examine the code to confirm my initial hypothesis on required capabilities.
|
| 49/2 |
2026/09/13 00:52 |
tool |
grepper |
0m
Args: map[Expression:netdev_nl_napi_set_doit]
Results: map[Output:net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {
--
net/core/netdev-genl-gen.c-233- .cmd = NETDEV_CMD_NAPI_SET,
net/core/netdev-genl-gen.c:234: .doit = netdev_nl_napi_set_doit,
net/core/netdev-genl-gen.c-235- .policy = netdev_napi_set_nl_policy,
--
net/core/netdev-genl-gen.h=38=int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info);
net/core/netdev-genl-gen.h:39:int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info);
net/core/netdev-genl-gen.h-40-int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info);
--
net/core/netdev-genl.c=327=netdev_nl_napi_set_config(struct napi_struct *napi, struct genl_info *info)
--
net/core/netdev-genl.c-360-
net/core/netdev-genl.c:361:int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info)
net/core/netdev-genl.c-362-{
]
|
| 50/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 37139
output: 41
thoughts: 26
Thoughts: Here's my take on the thought process, as requested:
**Diving into `netdev-genl-gen.c`**
Okay, time to get to the heart of this. My initial instinct points towards `net/core/netdev-genl-gen.c`. I'm going to start my investigation around line 233. That's usually a good area to begin with for anything related to netlink, given the file's purpose. I'm hoping to find the relevant code block to understand the root cause of the issue I'm looking into.
|
| 51/2 |
2026/09/13 00:52 |
tool |
read-file |
0m
Args: map[File:net/core/netdev-genl-gen.c FirstLine:225 LineCount:50]
Results: map[Contents: 225: {
226: .cmd = NETDEV_CMD_BIND_RX,
227: .doit = netdev_nl_bind_rx_doit,
228: .policy = netdev_bind_rx_nl_policy,
229: .maxattr = NETDEV_A_DMABUF_RX_PAGE_SIZE,
230: .flags = GENL_UNS_ADMIN_PERM | GENL_CMD_CAP_DO,
231: },
232: {
233: .cmd = NETDEV_CMD_NAPI_SET,
234: .doit = netdev_nl_napi_set_doit,
235: .policy = netdev_napi_set_nl_policy,
236: .maxattr = NETDEV_A_NAPI_THREADED,
237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
238: },
239: {
240: .cmd = NETDEV_CMD_BIND_TX,
241: .doit = netdev_nl_bind_tx_doit,
242: .policy = netdev_bind_tx_nl_policy,
243: .maxattr = NETDEV_A_DMABUF_FD,
244: .flags = GENL_CMD_CAP_DO,
245: },
246: {
247: .cmd = NETDEV_CMD_QUEUE_CREATE,
248: .doit = netdev_nl_queue_create_doit,
249: .policy = netdev_queue_create_nl_policy,
250: .maxattr = NETDEV_A_QUEUE_LEASE,
251: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
252: },
253: };
254:
255: static const struct genl_multicast_group netdev_nl_mcgrps[] = {
256: [NETDEV_NLGRP_MGMT] = { "mgmt", },
257: [NETDEV_NLGRP_PAGE_POOL] = { "page-pool", },
258: };
259:
260: static void __netdev_nl_sock_priv_init(void *priv)
261: {
262: netdev_nl_sock_priv_init(priv);
263: }
264:
265: static void __netdev_nl_sock_priv_destroy(void *priv)
266: {
267: netdev_nl_sock_priv_destroy(priv);
268: }
269:
270: struct genl_family netdev_nl_family __ro_after_init = {
271: .name = NETDEV_FAMILY_NAME,
272: .version = NETDEV_FAMILY_VERSION,
273: .netnsok = true,
274: .parallel_ops = true,
]
|
| 52/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 38211
output: 21
thoughts: 112
Thoughts: **Examining the Netlink Permissions for NAPI Configuration**
Okay, so I'm digging into how the `NETDEV_CMD_NAPI_SET` command works, specifically the permission requirements. I see the flags are set to `GENL_ADMIN_PERM | GENL_CMD_CAP_DO`. That `GENL_ADMIN_PERM` flag immediately tells me it needs `CAP_NET_ADMIN` to execute. My mind immediately jumps to how that check is actually implemented. I recall that `GENL_ADMIN_PERM` seems to be shorthand for a call to `netlink_capable(skb, CAP_NET_ADMIN)`. Now I have to make sure that the permission check is made in the correct security context. Itβs crucial to know whether the check is performed within the user namespace or the initial namespace. I should double check the actual definition of `GENL_ADMIN_PERM` just to make certain about the specific implementation and context of this critical capability check.
|
| 53/2 |
2026/09/13 00:52 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM]
Results: map[Output:
Full output is too long, showing 500 out of 1192 lines.
Use more precise expression if possible.
Documentation/driver-api/dpll.rst=360=each device should be registered by its driver.
Documentation/driver-api/dpll.rst-361-
Documentation/driver-api/dpll.rst:362:All netlink commands require ``GENL_ADMIN_PERM``. This is to prevent
Documentation/driver-api/dpll.rst-363-any spamming/DoS from unauthorized userspace applications.
--
drivers/block/drbd/drbd_nl.c=158=static int drbd_adm_prepare(struct drbd_config_context *adm_ctx,
--
drivers/block/drbd/drbd_nl.c-164-
drivers/block/drbd/drbd_nl.c:165: /* genl_rcv_msg only checks for CAP_NET_ADMIN on "GENL_ADMIN_PERM" :( */
drivers/block/drbd/drbd_nl.c-166- if (cmd != DRBD_ADM_GET_STATUS && !capable(CAP_NET_ADMIN))
--
drivers/block/drbd/drbd_nl_gen.c=359=const struct genl_split_ops drbd_nl_ops[32] = {
--
drivers/block/drbd/drbd_nl_gen.c-382- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:383: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-384- },
--
drivers/block/drbd/drbd_nl_gen.c-391- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:392: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-393- },
--
drivers/block/drbd/drbd_nl_gen.c-400- .maxattr = DRBD_NLA_RESOURCE_OPTS,
drivers/block/drbd/drbd_nl_gen.c:401: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-402- },
--
drivers/block/drbd/drbd_nl_gen.c-409- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:410: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-411- },
--
drivers/block/drbd/drbd_nl_gen.c-418- .maxattr = DRBD_NLA_RESOURCE_OPTS,
drivers/block/drbd/drbd_nl_gen.c:419: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-420- },
--
drivers/block/drbd/drbd_nl_gen.c-427- .maxattr = DRBD_NLA_NET_CONF,
drivers/block/drbd/drbd_nl_gen.c:428: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-429- },
--
drivers/block/drbd/drbd_nl_gen.c-436- .maxattr = DRBD_NLA_DISCONNECT_PARMS,
drivers/block/drbd/drbd_nl_gen.c:437: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-438- },
--
drivers/block/drbd/drbd_nl_gen.c-445- .maxattr = DRBD_NLA_DISK_CONF,
drivers/block/drbd/drbd_nl_gen.c:446: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-447- },
--
drivers/block/drbd/drbd_nl_gen.c-454- .maxattr = DRBD_NLA_RESIZE_PARMS,
drivers/block/drbd/drbd_nl_gen.c:455: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-456- },
--
drivers/block/drbd/drbd_nl_gen.c-463- .maxattr = DRBD_NLA_SET_ROLE_PARMS,
drivers/block/drbd/drbd_nl_gen.c:464: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-465- },
--
drivers/block/drbd/drbd_nl_gen.c-472- .maxattr = DRBD_NLA_SET_ROLE_PARMS,
drivers/block/drbd/drbd_nl_gen.c:473: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-474- },
--
drivers/block/drbd/drbd_nl_gen.c-481- .maxattr = DRBD_NLA_NEW_C_UUID_PARMS,
drivers/block/drbd/drbd_nl_gen.c:482: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-483- },
--
drivers/block/drbd/drbd_nl_gen.c-490- .maxattr = DRBD_NLA_START_OV_PARMS,
drivers/block/drbd/drbd_nl_gen.c:491: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-492- },
--
drivers/block/drbd/drbd_nl_gen.c-499- .maxattr = DRBD_NLA_DETACH_PARMS,
drivers/block/drbd/drbd_nl_gen.c:500: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-501- },
--
drivers/block/drbd/drbd_nl_gen.c-508- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:509: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-510- },
--
drivers/block/drbd/drbd_nl_gen.c-517- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:518: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-519- },
--
drivers/block/drbd/drbd_nl_gen.c-526- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:527: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-528- },
--
drivers/block/drbd/drbd_nl_gen.c-535- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:536: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-537- },
--
drivers/block/drbd/drbd_nl_gen.c-544- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:545: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-546- },
--
drivers/block/drbd/drbd_nl_gen.c-553- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:554: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-555- },
--
drivers/block/drbd/drbd_nl_gen.c-562- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:563: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-564- },
--
drivers/block/drbd/drbd_nl_gen.c-571- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:572: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-573- },
--
drivers/block/drbd/drbd_nl_gen.c-580- .maxattr = DRBD_NLA_CFG_CONTEXT,
drivers/block/drbd/drbd_nl_gen.c:581: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-582- },
--
drivers/block/drbd/drbd_nl_gen.c-589- .maxattr = DRBD_NLA_DISK_CONF,
drivers/block/drbd/drbd_nl_gen.c:590: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-591- },
--
drivers/block/drbd/drbd_nl_gen.c-598- .maxattr = DRBD_NLA_NET_CONF,
drivers/block/drbd/drbd_nl_gen.c:599: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/block/drbd/drbd_nl_gen.c-600- },
--
drivers/dpll/dpll_nl.c=92=static const struct genl_split_ops dpll_nl_ops[] = {
--
drivers/dpll/dpll_nl.c-99- .maxattr = DPLL_A_TYPE,
drivers/dpll/dpll_nl.c:100: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/dpll/dpll_nl.c-101- },
--
drivers/dpll/dpll_nl.c-108- .maxattr = DPLL_A_ID,
drivers/dpll/dpll_nl.c:109: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/dpll/dpll_nl.c-110- },
--
drivers/dpll/dpll_nl.c-113- .dumpit = dpll_nl_device_get_dumpit,
drivers/dpll/dpll_nl.c:114: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
drivers/dpll/dpll_nl.c-115- },
--
drivers/dpll/dpll_nl.c-122- .maxattr = DPLL_A_FREQUENCY_MONITOR,
drivers/dpll/dpll_nl.c:123: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/dpll/dpll_nl.c-124- },
--
drivers/dpll/dpll_nl.c-131- .maxattr = DPLL_A_PIN_TYPE,
drivers/dpll/dpll_nl.c:132: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/dpll/dpll_nl.c-133- },
--
drivers/dpll/dpll_nl.c-140- .maxattr = DPLL_A_PIN_ID,
drivers/dpll/dpll_nl.c:141: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/dpll/dpll_nl.c-142- },
--
drivers/dpll/dpll_nl.c-147- .maxattr = DPLL_A_PIN_ID,
drivers/dpll/dpll_nl.c:148: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
drivers/dpll/dpll_nl.c-149- },
--
drivers/dpll/dpll_nl.c-156- .maxattr = DPLL_A_PIN_REFERENCE_SYNC,
drivers/dpll/dpll_nl.c:157: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/dpll/dpll_nl.c-158- },
--
drivers/gpu/drm/drm_ras_nl.c=32=static const struct genl_split_ops drm_ras_nl_ops[] = {
--
drivers/gpu/drm/drm_ras_nl.c-35- .dumpit = drm_ras_nl_list_nodes_dumpit,
drivers/gpu/drm/drm_ras_nl.c:36: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
drivers/gpu/drm/drm_ras_nl.c-37- },
--
drivers/gpu/drm/drm_ras_nl.c-42- .maxattr = DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_ID,
drivers/gpu/drm/drm_ras_nl.c:43: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/gpu/drm/drm_ras_nl.c-44- },
--
drivers/gpu/drm/drm_ras_nl.c-49- .maxattr = DRM_RAS_A_ERROR_COUNTER_ATTRS_NODE_ID,
drivers/gpu/drm/drm_ras_nl.c:50: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
drivers/gpu/drm/drm_ras_nl.c-51- },
--
drivers/gpu/drm/drm_ras_nl.c-56- .maxattr = DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_ID,
drivers/gpu/drm/drm_ras_nl.c:57: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/gpu/drm/drm_ras_nl.c-58- },
--
drivers/net/gtp.c=2453=static const struct genl_small_ops gtp_genl_ops[] = {
--
drivers/net/gtp.c-2457- .doit = gtp_genl_new_pdp,
drivers/net/gtp.c:2458: .flags = GENL_ADMIN_PERM,
drivers/net/gtp.c-2459- },
--
drivers/net/gtp.c-2463- .doit = gtp_genl_del_pdp,
drivers/net/gtp.c:2464: .flags = GENL_ADMIN_PERM,
drivers/net/gtp.c-2465- },
--
drivers/net/gtp.c-2470- .dumpit = gtp_genl_dump_pdp,
drivers/net/gtp.c:2471: .flags = GENL_ADMIN_PERM,
drivers/net/gtp.c-2472- },
--
drivers/net/gtp.c-2476- .doit = gtp_genl_send_echo_req,
drivers/net/gtp.c:2477: .flags = GENL_ADMIN_PERM,
drivers/net/gtp.c-2478- },
--
drivers/net/macsec.c=3347=static const struct genl_small_ops macsec_genl_ops[] = {
--
drivers/net/macsec.c-3356- .doit = macsec_add_rxsc,
drivers/net/macsec.c:3357: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3358- },
--
drivers/net/macsec.c-3362- .doit = macsec_del_rxsc,
drivers/net/macsec.c:3363: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3364- },
--
drivers/net/macsec.c-3368- .doit = macsec_upd_rxsc,
drivers/net/macsec.c:3369: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3370- },
--
drivers/net/macsec.c-3374- .doit = macsec_add_txsa,
drivers/net/macsec.c:3375: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3376- },
--
drivers/net/macsec.c-3380- .doit = macsec_del_txsa,
drivers/net/macsec.c:3381: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3382- },
--
drivers/net/macsec.c-3386- .doit = macsec_upd_txsa,
drivers/net/macsec.c:3387: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3388- },
--
drivers/net/macsec.c-3392- .doit = macsec_add_rxsa,
drivers/net/macsec.c:3393: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3394- },
--
drivers/net/macsec.c-3398- .doit = macsec_del_rxsa,
drivers/net/macsec.c:3399: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3400- },
--
drivers/net/macsec.c-3404- .doit = macsec_upd_rxsa,
drivers/net/macsec.c:3405: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3406- },
--
drivers/net/macsec.c-3410- .doit = macsec_upd_offload,
drivers/net/macsec.c:3411: .flags = GENL_ADMIN_PERM,
drivers/net/macsec.c-3412- },
--
drivers/net/ovpn/netlink-gen.c=182=static const struct genl_split_ops ovpn_nl_ops[] = {
--
drivers/net/ovpn/netlink-gen.c-189- .maxattr = OVPN_A_PEER,
drivers/net/ovpn/netlink-gen.c:190: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-191- },
--
drivers/net/ovpn/netlink-gen.c-198- .maxattr = OVPN_A_PEER,
drivers/net/ovpn/netlink-gen.c:199: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-200- },
--
drivers/net/ovpn/netlink-gen.c-207- .maxattr = OVPN_A_PEER,
drivers/net/ovpn/netlink-gen.c:208: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-209- },
--
drivers/net/ovpn/netlink-gen.c-214- .maxattr = OVPN_A_IFINDEX,
drivers/net/ovpn/netlink-gen.c:215: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
drivers/net/ovpn/netlink-gen.c-216- },
--
drivers/net/ovpn/netlink-gen.c-223- .maxattr = OVPN_A_PEER,
drivers/net/ovpn/netlink-gen.c:224: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-225- },
--
drivers/net/ovpn/netlink-gen.c-232- .maxattr = OVPN_A_KEYCONF,
drivers/net/ovpn/netlink-gen.c:233: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-234- },
--
drivers/net/ovpn/netlink-gen.c-241- .maxattr = OVPN_A_KEYCONF,
drivers/net/ovpn/netlink-gen.c:242: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-243- },
--
drivers/net/ovpn/netlink-gen.c-250- .maxattr = OVPN_A_KEYCONF,
drivers/net/ovpn/netlink-gen.c:251: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-252- },
--
drivers/net/ovpn/netlink-gen.c-259- .maxattr = OVPN_A_KEYCONF,
drivers/net/ovpn/netlink-gen.c:260: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
drivers/net/ovpn/netlink-gen.c-261- },
--
drivers/net/team/team_nl.c=36=const struct genl_small_ops team_nl_ops[4] = {
--
drivers/net/team/team_nl.c-45- .doit = team_nl_options_set_doit,
drivers/net/team/team_nl.c:46: .flags = GENL_ADMIN_PERM,
drivers/net/team/team_nl.c-47- },
--
drivers/net/team/team_nl.c-51- .doit = team_nl_options_get_doit,
drivers/net/team/team_nl.c:52: .flags = GENL_ADMIN_PERM,
drivers/net/team/team_nl.c-53- },
--
drivers/net/team/team_nl.c-57- .doit = team_nl_port_list_get_doit,
drivers/net/team/team_nl.c:58: .flags = GENL_ADMIN_PERM,
drivers/net/team/team_nl.c-59- },
--
drivers/target/target_core_user.c=449=static const struct genl_small_ops tcmu_genl_ops[] = {
--
drivers/target/target_core_user.c-452- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
drivers/target/target_core_user.c:453: .flags = GENL_ADMIN_PERM,
drivers/target/target_core_user.c-454- .doit = tcmu_genl_set_features,
--
drivers/target/target_core_user.c-458- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
drivers/target/target_core_user.c:459: .flags = GENL_ADMIN_PERM,
drivers/target/target_core_user.c-460- .doit = tcmu_genl_add_dev_done,
--
drivers/target/target_core_user.c-464- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
drivers/target/target_core_user.c:465: .flags = GENL_ADMIN_PERM,
drivers/target/target_core_user.c-466- .doit = tcmu_genl_rm_dev_done,
--
drivers/target/target_core_user.c-470- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
drivers/target/target_core_user.c:471: .flags = GENL_ADMIN_PERM,
drivers/target/target_core_user.c-472- .doit = tcmu_genl_reconfig_dev_done,
--
drivers/vdpa/vdpa.c=1507=static const struct genl_ops vdpa_nl_ops[] = {
--
drivers/vdpa/vdpa.c-1515- .doit = vdpa_nl_cmd_dev_add_set_doit,
drivers/vdpa/vdpa.c:1516: .flags = GENL_ADMIN_PERM,
drivers/vdpa/vdpa.c-1517- },
--
drivers/vdpa/vdpa.c-1520- .doit = vdpa_nl_cmd_dev_del_set_doit,
drivers/vdpa/vdpa.c:1521: .flags = GENL_ADMIN_PERM,
drivers/vdpa/vdpa.c-1522- },
--
drivers/vdpa/vdpa.c-1535- .doit = vdpa_nl_cmd_dev_stats_get_doit,
drivers/vdpa/vdpa.c:1536: .flags = GENL_ADMIN_PERM,
drivers/vdpa/vdpa.c-1537- },
--
drivers/vdpa/vdpa.c-1540- .doit = vdpa_nl_cmd_dev_attr_set_doit,
drivers/vdpa/vdpa.c:1541: .flags = GENL_ADMIN_PERM,
drivers/vdpa/vdpa.c-1542- },
--
fs/lockd/netlink.c=22=static const struct genl_split_ops lockd_nl_ops[] = {
--
fs/lockd/netlink.c-27- .maxattr = LOCKD_A_SERVER_UDP_PORT,
fs/lockd/netlink.c:28: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/lockd/netlink.c-29- },
--
fs/nfsd/netlink.c=122=static const struct genl_split_ops nfsd_nl_ops[] = {
--
fs/nfsd/netlink.c-132- .maxattr = NFSD_A_SERVER_FH_KEY,
fs/nfsd/netlink.c:133: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-134- },
--
fs/nfsd/netlink.c-144- .maxattr = NFSD_A_SERVER_PROTO_VERSION,
fs/nfsd/netlink.c:145: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-146- },
--
fs/nfsd/netlink.c-156- .maxattr = NFSD_A_SERVER_SOCK_ADDR,
fs/nfsd/netlink.c:157: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-158- },
--
fs/nfsd/netlink.c-168- .maxattr = NFSD_A_POOL_MODE_MODE,
fs/nfsd/netlink.c:169: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-170- },
--
fs/nfsd/netlink.c-178- .dumpit = nfsd_nl_svc_export_get_reqs_dumpit,
fs/nfsd/netlink.c:179: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
fs/nfsd/netlink.c-180- },
--
fs/nfsd/netlink.c-185- .maxattr = NFSD_A_SVC_EXPORT_REQS_REQUESTS,
fs/nfsd/netlink.c:186: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-187- },
--
fs/nfsd/netlink.c-190- .dumpit = nfsd_nl_expkey_get_reqs_dumpit,
fs/nfsd/netlink.c:191: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
fs/nfsd/netlink.c-192- },
--
fs/nfsd/netlink.c-197- .maxattr = NFSD_A_EXPKEY_REQS_REQUESTS,
fs/nfsd/netlink.c:198: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-199- },
--
fs/nfsd/netlink.c-204- .maxattr = NFSD_A_CACHE_FLUSH_MASK,
fs/nfsd/netlink.c:205: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-206- },
--
fs/nfsd/netlink.c-211- .maxattr = NFSD_A_UNLOCK_IP_ADDRESS,
fs/nfsd/netlink.c:212: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-213- },
--
fs/nfsd/netlink.c-218- .maxattr = NFSD_A_UNLOCK_FILESYSTEM_PATH,
fs/nfsd/netlink.c:219: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-220- },
--
fs/nfsd/netlink.c-225- .maxattr = NFSD_A_UNLOCK_EXPORT_PATH,
fs/nfsd/netlink.c:226: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
fs/nfsd/netlink.c-227- },
--
fs/smb/client/netlink.c=33=static const struct genl_ops cifs_genl_ops[] = {
--
fs/smb/client/netlink.c-35- .cmd = CIFS_GENL_CMD_SWN_NOTIFY,
fs/smb/client/netlink.c:36: .flags = GENL_ADMIN_PERM,
fs/smb/client/netlink.c-37- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
--
include/net/genetlink.h=173=enum genl_validate_flags {
--
include/net/genetlink.h-182- * @internal_flags: flags used by the family
include/net/genetlink.h:183: * @flags: GENL_* flags (%GENL_ADMIN_PERM or %GENL_UNS_ADMIN_PERM)
include/net/genetlink.h-184- * @validate: validation flags from enum genl_validate_flags
--
include/net/genetlink.h=191=struct genl_small_ops {
--
include/net/genetlink.h-203- * @internal_flags: flags used by the family
include/net/genetlink.h:204: * @flags: GENL_* flags (%GENL_ADMIN_PERM or %GENL_UNS_ADMIN_PERM)
include/net/genetlink.h-205- * @maxattr: maximum number of attributes supported
--
include/net/genetlink.h=213=struct genl_ops {
--
include/net/genetlink.h-231- * @internal_flags: flags used by the family
include/net/genetlink.h:232: * @flags: GENL_* flags (%GENL_ADMIN_PERM or %GENL_UNS_ADMIN_PERM)
include/net/genetlink.h-233- * @validate: validation flags from enum genl_validate_flags
--
include/uapi/linux/genetlink.h=13=struct genlmsghdr {
--
include/uapi/linux/genetlink.h-20-
include/uapi/linux/genetlink.h:21:#define GENL_ADMIN_PERM 0x01
include/uapi/linux/genetlink.h-22-#define GENL_CMD_CAP_DO 0x02
--
kernel/taskstats.c=648=static const struct genl_ops taskstats_ops[] = {
--
kernel/taskstats.c-654- .maxattr = ARRAY_SIZE(taskstats_cmd_get_policy) - 1,
kernel/taskstats.c:655: .flags = GENL_ADMIN_PERM,
kernel/taskstats.c-656- },
--
net/core/drop_monitor.c=1609=static const struct genl_small_ops dropmon_ops[] = {
--
net/core/drop_monitor.c-1613- .doit = net_dm_cmd_config,
net/core/drop_monitor.c:1614: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1615- },
--
net/core/drop_monitor.c-1619- .doit = net_dm_cmd_trace,
net/core/drop_monitor.c:1620: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1621- },
--
net/core/drop_monitor.c-1625- .doit = net_dm_cmd_trace,
net/core/drop_monitor.c:1626: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1627- },
--
net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {
--
net/core/netdev-genl-gen.c-236- .maxattr = NETDEV_A_NAPI_THREADED,
net/core/netdev-genl-gen.c:237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-238- },
--
net/core/netdev-genl-gen.c-250- .maxattr = NETDEV_A_QUEUE_LEASE,
net/core/netdev-genl-gen.c:251: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-252- },
--
net/devlink/netlink_gen.c=702=const struct genl_split_ops devlink_nl_ops[75] = {
--
net/devlink/netlink_gen.c-743- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:744: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-745- },
--
net/devlink/netlink_gen.c-753- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:754: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-755- },
--
net/devlink/netlink_gen.c-763- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:764: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-765- },
--
net/devlink/netlink_gen.c-773- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:774: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-775- },
--
net/devlink/netlink_gen.c-783- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:784: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-785- },
--
net/devlink/netlink_gen.c-827- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:828: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-829- },
--
net/devlink/netlink_gen.c-854- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:855: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-856- },
--
net/devlink/netlink_gen.c-881- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:882: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-883- },
--
net/devlink/netlink_gen.c-891- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:892: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-893- },
--
net/devlink/netlink_gen.c-901- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:902: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-903- },
--
net/devlink/netlink_gen.c-911- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:912: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-913- },
--
net/devlink/netlink_gen.c-921- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:922: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-923- },
--
net/devlink/netlink_gen.c-961- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:962: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-963- },
--
net/devlink/netlink_gen.c-971- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:972: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-973- },
--
net/devlink/netlink_gen.c-998- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:999: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1000- },
--
net/devlink/netlink_gen.c-1025- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1026: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1027- },
--
net/devlink/netlink_gen.c-1052- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1053: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1054- },
--
net/devlink/netlink_gen.c-1062- .maxattr = DEVLINK_ATTR_INDEX,
]
|
| 54/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 50116
output: 37
thoughts: 65
Thoughts: Here's my thinking process:
**Diving into the GENL_ADMIN_PERM Check**
Okay, so I'm digging into this code and my immediate thought is, "Hang on, `GENL_ADMIN_PERM` directly relies on `netlink_capable(skb, CAP_NET_ADMIN)`." That's the key. I need to understand that connection, and quickly. I'm going to look at the implementation of `netlink_capable`, because that's what seems important here. Or maybe this is handled directly in `net/netlink/genetlink.c`. I have to confirm the overall process. I need to see how the code *actually* handles `GENL_ADMIN_PERM` within the `genetlink` context. Understanding the interplay is paramount.
|
| 55/2 |
2026/09/13 00:52 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM PathPrefix:net/netlink/genetlink.c]
Results: map[Output:net/netlink/genetlink.c=1155=static int genl_family_rcv_msg(const struct genl_family *family,
--
net/netlink/genetlink.c-1181-
net/netlink/genetlink.c:1182: if ((op.flags & GENL_ADMIN_PERM) &&
net/netlink/genetlink.c-1183- !netlink_capable(skb, CAP_NET_ADMIN))
]
|
| 56/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 50529
output: 18
thoughts: 48
Thoughts: Okay, here's my interpretation of those thoughts, summarized from my perspective as a networking expert:
**Investigating Network Namespace Capability Checks**
Hmm, `netlink_capable`... right, that's the function that determines whether a process has the privileges required to perform Netlink operations. I'm wondering exactly how it's implemented. Does it simply check if the process has `CAP_NET_ADMIN` capability in the current namespace, or is it more sophisticated? It feels like it would need to consider network namespaces and potentially delegate the check to `ns_capable` depending on what's going on.
Okay, best to double-check the definition of `netlink_capable` itself. Time to dive into the source code and see exactly what that function is doing. I need to be sure.
|
| 57/2 |
2026/09/13 00:52 |
tool |
grepper |
0m
Args: map[Expression:netlink_capable]
Results: map[Output:crypto/crypto_user.c=240=static int crypto_update_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
--
crypto/crypto_user.c-247-
crypto/crypto_user.c:248: if (!netlink_capable(skb, CAP_NET_ADMIN))
crypto/crypto_user.c-249- return -EPERM;
--
crypto/crypto_user.c=276=static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
--
crypto/crypto_user.c-282-
crypto/crypto_user.c:283: if (!netlink_capable(skb, CAP_NET_ADMIN))
crypto/crypto_user.c-284- return -EPERM;
--
crypto/crypto_user.c=314=static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
--
crypto/crypto_user.c-322-
crypto/crypto_user.c:323: if (!netlink_capable(skb, CAP_NET_ADMIN))
crypto/crypto_user.c-324- return -EPERM;
--
crypto/crypto_user.c=362=static int crypto_del_rng(struct sk_buff *skb, struct nlmsghdr *nlh,
--
crypto/crypto_user.c-364-{
crypto/crypto_user.c:365: if (!netlink_capable(skb, CAP_NET_ADMIN))
crypto/crypto_user.c-366- return -EPERM;
--
drivers/block/nbd.c=2167=static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
--
drivers/block/nbd.c-2174-
drivers/block/nbd.c:2175: if (!netlink_capable(skb, CAP_SYS_ADMIN))
drivers/block/nbd.c-2176- return -EPERM;
--
drivers/block/nbd.c=2346=static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
--
drivers/block/nbd.c-2350-
drivers/block/nbd.c:2351: if (!netlink_capable(skb, CAP_SYS_ADMIN))
drivers/block/nbd.c-2352- return -EPERM;
--
drivers/block/nbd.c=2381=static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
--
drivers/block/nbd.c-2388-
drivers/block/nbd.c:2389: if (!netlink_capable(skb, CAP_SYS_ADMIN))
drivers/block/nbd.c-2390- return -EPERM;
--
drivers/infiniband/core/netlink.c=152=static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
--
drivers/infiniband/core/netlink.c-169- if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
drivers/infiniband/core/netlink.c:170: !netlink_capable(skb, CAP_NET_ADMIN)) {
drivers/infiniband/core/netlink.c-171- err = -EPERM;
--
drivers/infiniband/core/nldev.c=1534=res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
--
drivers/infiniband/core/nldev.c-1594-
drivers/infiniband/core/nldev.c:1595: has_cap_net_admin = netlink_capable(skb, CAP_NET_ADMIN);
drivers/infiniband/core/nldev.c-1596-
--
drivers/infiniband/core/nldev.c=1615=static int res_get_common_dumpit(struct sk_buff *skb,
--
drivers/infiniband/core/nldev.c-1683-
drivers/infiniband/core/nldev.c:1684: has_cap_net_admin = netlink_capable(cb->skb, CAP_NET_ADMIN);
drivers/infiniband/core/nldev.c-1685-
--
drivers/scsi/scsi_netlink.c=32=scsi_nl_rcv_msg(struct sk_buff *skb)
--
drivers/scsi/scsi_netlink.c-65-
drivers/scsi/scsi_netlink.c:66: if (!netlink_capable(skb, CAP_SYS_ADMIN)) {
drivers/scsi/scsi_netlink.c-67- err = -EPERM;
--
drivers/scsi/scsi_transport_iscsi.c=3883=iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
--
drivers/scsi/scsi_transport_iscsi.c-3893-
drivers/scsi/scsi_transport_iscsi.c:3894: if (!netlink_capable(skb, CAP_SYS_ADMIN))
drivers/scsi/scsi_transport_iscsi.c-3895- return -EPERM;
--
drivers/vdpa/vdpa.c=559=static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *info)
--
drivers/vdpa/vdpa.c-624- if ((config.mask & VDPA_DEV_NET_ATTRS_MASK) &&
drivers/vdpa/vdpa.c:625: !netlink_capable(skb, CAP_NET_ADMIN))
drivers/vdpa/vdpa.c-626- return -EPERM;
--
fs/smb/server/transport_ipc.c=386=static int handle_startup_event(struct sk_buff *skb, struct genl_info *info)
--
fs/smb/server/transport_ipc.c-390-#ifdef CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN
fs/smb/server/transport_ipc.c:391: if (!netlink_capable(skb, CAP_NET_ADMIN))
fs/smb/server/transport_ipc.c-392- return -EPERM;
--
fs/smb/server/transport_ipc.c=439=static int handle_generic_event(struct sk_buff *skb, struct genl_info *info)
--
fs/smb/server/transport_ipc.c-445-#ifdef CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN
fs/smb/server/transport_ipc.c:446: if (!netlink_capable(skb, CAP_NET_ADMIN))
fs/smb/server/transport_ipc.c-447- return -EPERM;
--
include/linux/netlink.h=355=bool netlink_ns_capable(const struct sk_buff *skb,
include/linux/netlink.h-356- struct user_namespace *ns, int cap);
include/linux/netlink.h:357:bool netlink_capable(const struct sk_buff *skb, int cap);
include/linux/netlink.h-358-bool netlink_net_capable(const struct sk_buff *skb, int cap);
--
kernel/audit.c=1072=static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
--
kernel/audit.c-1111-
kernel/audit.c:1112: if (!netlink_capable(skb, CAP_AUDIT_CONTROL))
kernel/audit.c-1113- err = -EPERM;
--
kernel/audit.c-1117- case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
kernel/audit.c:1118: if (!netlink_capable(skb, CAP_AUDIT_WRITE))
kernel/audit.c-1119- err = -EPERM;
--
net/can/gw.c=1077=static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/can/gw.c-1087-
net/can/gw.c:1088: if (!netlink_capable(skb, CAP_NET_ADMIN))
net/can/gw.c-1089- return -EPERM;
--
net/can/gw.c=1209=static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/can/gw.c-1220-
net/can/gw.c:1221: if (!netlink_capable(skb, CAP_NET_ADMIN))
net/can/gw.c-1222- return -EPERM;
--
net/dcb/dcbnl.c=1910=static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/dcb/dcbnl.c-1922-
net/dcb/dcbnl.c:1923: if ((nlh->nlmsg_type == RTM_SETDCB) && !netlink_capable(skb, CAP_NET_ADMIN))
net/dcb/dcbnl.c-1924- return -EPERM;
--
net/dcb/dcbnl.c-1937- return -EOPNOTSUPP;
net/dcb/dcbnl.c:1938: if (fn->type == RTM_SETDCB && !netlink_capable(skb, CAP_NET_ADMIN))
net/dcb/dcbnl.c-1939- return -EPERM;
--
net/netlink/af_netlink.c=872=EXPORT_SYMBOL(netlink_ns_capable);
--
net/netlink/af_netlink.c-874-/**
net/netlink/af_netlink.c:875: * netlink_capable - Netlink global message capability test
net/netlink/af_netlink.c-876- * @skb: socket buffer holding a netlink command from userspace
--
net/netlink/af_netlink.c-882- */
net/netlink/af_netlink.c:883:bool netlink_capable(const struct sk_buff *skb, int cap)
net/netlink/af_netlink.c-884-{
--
net/netlink/af_netlink.c-886-}
net/netlink/af_netlink.c:887:EXPORT_SYMBOL(netlink_capable);
net/netlink/af_netlink.c-888-
--
net/netlink/genetlink.c=1155=static int genl_family_rcv_msg(const struct genl_family *family,
--
net/netlink/genetlink.c-1182- if ((op.flags & GENL_ADMIN_PERM) &&
net/netlink/genetlink.c:1183: !netlink_capable(skb, CAP_NET_ADMIN))
net/netlink/genetlink.c-1184- return -EPERM;
--
net/phonet/pn_netlink.c=52=static int addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/phonet/pn_netlink.c-61-
net/phonet/pn_netlink.c:62: if (!netlink_capable(skb, CAP_NET_ADMIN))
net/phonet/pn_netlink.c-63- return -EPERM;
net/phonet/pn_netlink.c-64-
net/phonet/pn_netlink.c:65: if (!netlink_capable(skb, CAP_SYS_ADMIN))
net/phonet/pn_netlink.c-66- return -EPERM;
--
net/phonet/pn_netlink.c=231=static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/phonet/pn_netlink.c-242-
net/phonet/pn_netlink.c:243: if (!netlink_capable(skb, CAP_NET_ADMIN))
net/phonet/pn_netlink.c-244- return -EPERM;
net/phonet/pn_netlink.c-245-
net/phonet/pn_netlink.c:246: if (!netlink_capable(skb, CAP_SYS_ADMIN))
net/phonet/pn_netlink.c-247- return -EPERM;
--
net/sched/act_api.c=2142=static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n,
--
net/sched/act_api.c-2151- if ((n->nlmsg_type != RTM_GETACTION) &&
net/sched/act_api.c:2152: !netlink_capable(skb, CAP_NET_ADMIN))
net/sched/act_api.c-2153- return -EPERM;
]
|
| 58/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 54312
output: 39
thoughts: 28
Thoughts: Here's my attempt at summarizing the thought process in the first person, assuming the user is an expert:
**Investigating `netlink_capable`**
Okay, so I need to understand `netlink_capable`. I recall seeing that function name floating around, and I've got a decent hunch where it lives, but let's confirm. Right, the most likely spot, given the context, is in `net/netlink/af_netlink.c`. Let me just double-check that file and make sure I'm remembering correctly and refresh my memory on the implementation. Let's see what's in there.
|
| 59/2 |
2026/09/13 00:52 |
tool |
read-file |
0m
Args: map[File:net/netlink/af_netlink.c FirstLine:870 LineCount:50]
Results: map[Contents: 870: return __netlink_ns_capable(&NETLINK_CB(skb), user_ns, cap);
871: }
872: EXPORT_SYMBOL(netlink_ns_capable);
873:
874: /**
875: * netlink_capable - Netlink global message capability test
876: * @skb: socket buffer holding a netlink command from userspace
877: * @cap: The capability to use
878: *
879: * Test to see if the opener of the socket we received the message
880: * from had when the netlink socket was created and the sender of the
881: * message has the capability @cap in all user namespaces.
882: */
883: bool netlink_capable(const struct sk_buff *skb, int cap)
884: {
885: return netlink_ns_capable(skb, &init_user_ns, cap);
886: }
887: EXPORT_SYMBOL(netlink_capable);
888:
889: /**
890: * netlink_net_capable - Netlink network namespace message capability test
891: * @skb: socket buffer holding a netlink command from userspace
892: * @cap: The capability to use
893: *
894: * Test to see if the opener of the socket we received the message
895: * from had when the netlink socket was created and the sender of the
896: * message has the capability @cap over the network namespace of
897: * the socket we received the message from.
898: */
899: bool netlink_net_capable(const struct sk_buff *skb, int cap)
900: {
901: return netlink_ns_capable(skb, sock_net(skb->sk)->user_ns, cap);
902: }
903: EXPORT_SYMBOL(netlink_net_capable);
904:
905: static inline int netlink_allowed(const struct socket *sock, unsigned int flag)
906: {
907: return (nl_table[sock->sk->sk_protocol].flags & flag) ||
908: ns_capable(sock_net(sock->sk)->user_ns, CAP_NET_ADMIN);
909: }
910:
911: static void
912: netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
913: {
914: struct netlink_sock *nlk = nlk_sk(sk);
915:
916: if (nlk->subscriptions && !subscriptions)
917: __sk_del_bind_node(sk);
918: else if (!nlk->subscriptions && subscriptions)
919: sk_add_bind_node(sk, &nl_table[sk->sk_protocol].mc_list);
]
|
| 60/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 55342
output: 40
thoughts: 93
Thoughts: Okay, here's my take on those thoughts, framed as my own mental processing:
**Delving into Netlink Capabilities**
Right, so `netlink_capable` is the gatekeeper. It calls `netlink_ns_capable` on the `skb` and checks it against `&init_user_ns` with a `cap`. Aha! That means itβs looking for `CAP_NET_ADMIN` *specifically* in the `init_user_ns`. Interesting. Now, hold on a secondβ¦ doesn't `GENL_ADMIN_PERM` also require `CAP_NET_ADMIN` in the init namespace? This sounds familiar. I really should double-check that. Let me just quickly see what's going on with `GENL_UNS_ADMIN_PERM`, just to be absolutely sure I haven't missed a subtle difference. I want to make sure I completely understand the permission model here.
|
| 61/2 |
2026/09/13 00:52 |
tool |
grepper |
0m
Args: map[Expression:GENL_UNS_ADMIN_PERM PathPrefix:net/netlink/genetlink.c]
Results: map[Output:net/netlink/genetlink.c=1155=static int genl_family_rcv_msg(const struct genl_family *family,
--
net/netlink/genetlink.c-1185-
net/netlink/genetlink.c:1186: if ((op.flags & GENL_UNS_ADMIN_PERM) &&
net/netlink/genetlink.c-1187- !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
]
|
| 62/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 55823
output: 41
thoughts: 117
Thoughts: **Checking Network Capability Requirements**
Okay, so I've been digging into this and it's confirmed: `GENL_ADMIN_PERM` absolutely relies on `CAP_NET_ADMIN` being present within `init_user_ns`. This makes sense, that's what I was expecting. Now, looking at `GENL_UNS_ADMIN_PERM`, the requirement shifts, and we need `CAP_NET_ADMIN` within the *network namespace's* user namespace. Right, got it.
So, here's the kicker: `NETDEV_CMD_NAPI_SET` utilizes `GENL_ADMIN_PERM`. This means, to execute that command, we are going to need `CAP_NET_ADMIN` in the init namespace.
Just to be absolutely certain, before I continue, I think I will double-check that source code file, `net/core/netdev-genl-gen.c`, just to eliminate the possibility of a mistake in my logic.
|
| 63/2 |
2026/09/13 00:52 |
tool |
read-file |
0m
Args: map[File:net/core/netdev-genl-gen.c FirstLine:230 LineCount:15]
Results: map[Contents: 230: .flags = GENL_UNS_ADMIN_PERM | GENL_CMD_CAP_DO,
231: },
232: {
233: .cmd = NETDEV_CMD_NAPI_SET,
234: .doit = netdev_nl_napi_set_doit,
235: .policy = netdev_napi_set_nl_policy,
236: .maxattr = NETDEV_A_NAPI_THREADED,
237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
238: },
239: {
240: .cmd = NETDEV_CMD_BIND_TX,
241: .doit = netdev_nl_bind_tx_doit,
242: .policy = netdev_bind_tx_nl_policy,
243: .maxattr = NETDEV_A_DMABUF_FD,
244: .flags = GENL_CMD_CAP_DO,
]
|
| 64/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 56502
output: 31
thoughts: 53
Thoughts: **My Line of Inquiry: Threaded NAPI Configuration**
Okay, so I'm pretty sure `NETDEV_CMD_NAPI_SET` utilizes `GENL_ADMIN_PERM`, as expected. Standard stuff. But hold on, let's not jump to conclusions. I need to be absolutely certain I've covered all the bases for configuring threaded NAPI. Is there *any* other mechanism, besides the standard `NETDEV_CMD_NAPI_SET` command, that allows setting this up? My intuition tells me to investigate whether sysfs offers an alternative path. Let me check if I can configure threaded NAPI through sysfs. It would be a significant oversight if I neglected this possibility. Gotta be thorough.
|
| 65/2 |
2026/09/13 00:52 |
tool |
grepper |
0m
Args: map[Expression:threaded PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=723=static const struct attribute_group netdev_phys_group = {
--
net/core/net-sysfs.c-727-
net/core/net-sysfs.c:728:static ssize_t threaded_show(struct device *dev,
net/core/net-sysfs.c-729- struct device_attribute *attr, char *buf)
--
net/core/net-sysfs.c-736- if (dev_isalive(netdev))
net/core/net-sysfs.c:737: ret = sysfs_emit(buf, fmt_dec, READ_ONCE(netdev->threaded));
net/core/net-sysfs.c-738-
--
net/core/net-sysfs.c-743-
net/core/net-sysfs.c:744:static int modify_napi_threaded(struct net_device *dev, unsigned long val)
net/core/net-sysfs.c-745-{
--
net/core/net-sysfs.c-753-
net/core/net-sysfs.c:754: ret = netif_set_threaded(dev, val);
net/core/net-sysfs.c-755-
--
net/core/net-sysfs.c-758-
net/core/net-sysfs.c:759:static ssize_t threaded_store(struct device *dev,
net/core/net-sysfs.c-760- struct device_attribute *attr,
--
net/core/net-sysfs.c-762-{
net/core/net-sysfs.c:763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
net/core/net-sysfs.c-764-}
net/core/net-sysfs.c:765:static DEVICE_ATTR_RW(threaded);
net/core/net-sysfs.c-766-
net/core/net-sysfs.c=767=static struct attribute *net_class_attrs[] __ro_after_init = {
--
net/core/net-sysfs.c-795- &dev_attr_carrier_down_count.attr,
net/core/net-sysfs.c:796: &dev_attr_threaded.attr,
net/core/net-sysfs.c-797- NULL,
]
|
| 66/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 57375
output: 38
thoughts: 31
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person:
**Investigating the "threaded" Sysfs Attribute**
Right, so "threaded" is exposed through sysfs. Specifically, I see it's registered with `DEVICE_ATTR_RW(threaded)`. Excellent. This immediately tells me we have read-write access, which is what I'd expect given the nature of managing threading-related parameters. Now, my next logical step is to dive right into examining `threaded_store`. Understanding how the store function is implemented is absolutely crucial. That's where all the magic β or potential headaches β will be. I need to figure out exactly how it validates any input, how it modifies the underlying state, and, most importantly, if any race conditions or concurrency issues might be lurking in the shadows. Is there any proper locking being done, or are we just hoping for the best?
|
| 67/2 |
2026/09/13 00:52 |
tool |
read-file |
0m
Args: map[File:net/core/net-sysfs.c FirstLine:740 LineCount:30]
Results: map[Contents: 740:
741: return ret;
742: }
743:
744: static int modify_napi_threaded(struct net_device *dev, unsigned long val)
745: {
746: int ret;
747:
748: if (list_empty(&dev->napi_list))
749: return -EOPNOTSUPP;
750:
751: if (val != 0 && val != 1)
752: return -EOPNOTSUPP;
753:
754: ret = netif_set_threaded(dev, val);
755:
756: return ret;
757: }
758:
759: static ssize_t threaded_store(struct device *dev,
760: struct device_attribute *attr,
761: const char *buf, size_t len)
762: {
763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
764: }
765: static DEVICE_ATTR_RW(threaded);
766:
767: static struct attribute *net_class_attrs[] __ro_after_init = {
768: &dev_attr_netdev_group.attr,
769: &dev_attr_type.attr,
]
|
| 68/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 58054
output: 35
thoughts: 138
Thoughts: **My Sysfs Permissions Conundrum**
Okay, so I'm thinking about these sysfs attributes. Generally, root owns them, right? Let me specifically focus on this `threaded` attribute. I seem to recall that the `DEVICE_ATTR_RW` macro sets the mode to `0644`. Which means root can write to it, obviously.
But here's where it gets interesting... When you start messing around with network namespaces, does the user who *created* that namespace effectively get root-level control over those network device sysfs entries *inside* the namespace? The network device sysfs entries, as I recall, are all nicely organized under `/sys/class/net/`.
I believe the creation of a network namespace means that `/sys/class/net/` becomes virtualized. I'll need to confirm this. I suspect that the owner of those sysfs entries is changed to the user namespace owner.
|
| 69/2 |
2026/09/13 00:52 |
tool |
grepper |
0m
Args: map[Expression:net_class_attrs PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=765=static DEVICE_ATTR_RW(threaded);
net/core/net-sysfs.c-766-
net/core/net-sysfs.c:767:static struct attribute *net_class_attrs[] __ro_after_init = {
net/core/net-sysfs.c-768- &dev_attr_netdev_group.attr,
]
|
| 70/2 |
2026/09/13 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 58540
output: 31
thoughts: 123
Thoughts: **Analyzing Network Device Ownership in User Namespaces**
Okay, so I'm looking at these `net_class_attrs` and it's hitting me β these are just standard attributes, right? Nothing special in their definition. The question then becomes: can the owner of the namespace actually *write* to them? My intuition says no, and that's usually the case with sysfs files. Generally, those files are owned by the root user and group (UID/GID 0) by default, unless there's a specific function called like `sysfs_set_mac_address` which allows setting those attributes or the device is explicitly chown'd.
But wait a minuteβ¦ network devices created *within* a user namespace β don't those inherit the ownership of the namespace? It makes sense they would. To be absolutely sure, I should verify this detail. The `net/core/net-sysfs.c` file is probably the best place to find the truth of it. I'll need to check for any calls to `chown` or any specific handling of UID/GID when these devices are created within a user namespace.
|
| 71/2 |
2026/09/13 00:53 |
tool |
grepper |
0m
Args: map[Expression:uid PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=1174=static void rx_queue_get_ownership(const struct kobject *kobj,
net/core/net-sysfs.c:1175: kuid_t *uid, kgid_t *gid)
net/core/net-sysfs.c-1176-{
--
net/core/net-sysfs.c-1179- net_ns_get_ownership(ns ? container_of(ns, struct net, ns) : NULL,
net/core/net-sysfs.c:1180: uid, gid);
net/core/net-sysfs.c-1181-}
--
net/core/net-sysfs.c=1211=static int rx_queue_add_kobject(struct net_device *dev, int index)
--
net/core/net-sysfs.c-1269-
net/core/net-sysfs.c:1270:static int rx_queue_change_owner(struct net_device *dev, int index, kuid_t kuid,
net/core/net-sysfs.c-1271- kgid_t kgid)
--
net/core/net-sysfs.c-1276-
net/core/net-sysfs.c:1277: error = sysfs_change_owner(kobj, kuid, kgid);
net/core/net-sysfs.c-1278- if (error)
--
net/core/net-sysfs.c-1282- error = sysfs_group_change_owner(
net/core/net-sysfs.c:1283: kobj, dev->sysfs_rx_queue_group, kuid, kgid);
net/core/net-sysfs.c-1284-
--
net/core/net-sysfs.c=1326=static int net_rx_queue_change_owner(struct net_device *dev, int num,
net/core/net-sysfs.c:1327: kuid_t kuid, kgid_t kgid)
net/core/net-sysfs.c-1328-{
--
net/core/net-sysfs.c-1337- for (i = 0; i < num; i++) {
net/core/net-sysfs.c:1338: error = rx_queue_change_owner(dev, i, kuid, kgid);
net/core/net-sysfs.c-1339- if (error)
--
net/core/net-sysfs.c=1924=static void netdev_queue_get_ownership(const struct kobject *kobj,
net/core/net-sysfs.c:1925: kuid_t *uid, kgid_t *gid)
net/core/net-sysfs.c-1926-{
--
net/core/net-sysfs.c-1929- net_ns_get_ownership(ns ? container_of(ns, struct net, ns) : NULL,
net/core/net-sysfs.c:1930: uid, gid);
net/core/net-sysfs.c-1931-}
--
net/core/net-sysfs.c=2002=static int tx_queue_change_owner(struct net_device *ndev, int index,
net/core/net-sysfs.c:2003: kuid_t kuid, kgid_t kgid)
net/core/net-sysfs.c-2004-{
--
net/core/net-sysfs.c-2008-
net/core/net-sysfs.c:2009: error = sysfs_change_owner(kobj, kuid, kgid);
net/core/net-sysfs.c-2010- if (error)
--
net/core/net-sysfs.c-2013- if (netdev_uses_bql(ndev))
net/core/net-sysfs.c:2014: error = sysfs_group_change_owner(kobj, &dql_group, kuid, kgid);
net/core/net-sysfs.c-2015-
--
net/core/net-sysfs.c=2061=static int net_tx_queue_change_owner(struct net_device *dev, int num,
net/core/net-sysfs.c:2062: kuid_t kuid, kgid_t kgid)
net/core/net-sysfs.c-2063-{
--
net/core/net-sysfs.c-2068- for (i = 0; i < num; i++) {
net/core/net-sysfs.c:2069: error = tx_queue_change_owner(dev, i, kuid, kgid);
net/core/net-sysfs.c-2070- if (error)
--
net/core/net-sysfs.c=2080=static int register_queue_kobjects(struct net_device *dev)
--
net/core/net-sysfs.c-2113-
net/core/net-sysfs.c:2114:static int queue_change_owner(struct net_device *ndev, kuid_t kuid, kgid_t kgid)
net/core/net-sysfs.c-2115-{
--
net/core/net-sysfs.c-2119- if (ndev->queues_kset) {
net/core/net-sysfs.c:2120: error = sysfs_change_owner(&ndev->queues_kset->kobj, kuid, kgid);
net/core/net-sysfs.c-2121- if (error)
--
net/core/net-sysfs.c-2127-
net/core/net-sysfs.c:2128: error = net_rx_queue_change_owner(ndev, real_rx, kuid, kgid);
net/core/net-sysfs.c-2129- if (error)
--
net/core/net-sysfs.c-2131-
net/core/net-sysfs.c:2132: error = net_tx_queue_change_owner(ndev, real_tx, kuid, kgid);
net/core/net-sysfs.c-2133- if (error)
--
net/core/net-sysfs.c=2234=static const struct ns_common *net_namespace(const struct device *d)
--
net/core/net-sysfs.c-2240-
net/core/net-sysfs.c:2241:static void net_get_ownership(const struct device *d, kuid_t *uid, kgid_t *gid)
net/core/net-sysfs.c-2242-{
--
net/core/net-sysfs.c-2245-
net/core/net-sysfs.c:2246: net_ns_get_ownership(net, uid, gid);
net/core/net-sysfs.c-2247-}
--
net/core/net-sysfs.c=2369=int netdev_change_owner(struct net_device *ndev, const struct net *net_old,
--
net/core/net-sysfs.c-2371-{
net/core/net-sysfs.c:2372: kuid_t old_uid = GLOBAL_ROOT_UID, new_uid = GLOBAL_ROOT_UID;
net/core/net-sysfs.c-2373- kgid_t old_gid = GLOBAL_ROOT_GID, new_gid = GLOBAL_ROOT_GID;
--
net/core/net-sysfs.c-2376-
net/core/net-sysfs.c:2377: net_ns_get_ownership(net_old, &old_uid, &old_gid);
net/core/net-sysfs.c:2378: net_ns_get_ownership(net_new, &new_uid, &new_gid);
net/core/net-sysfs.c-2379-
--
net/core/net-sysfs.c-2382- */
net/core/net-sysfs.c:2383: if (uid_eq(old_uid, new_uid) && gid_eq(old_gid, new_gid))
net/core/net-sysfs.c-2384- return 0;
net/core/net-sysfs.c-2385-
net/core/net-sysfs.c:2386: error = device_change_owner(dev, new_uid, new_gid);
net/core/net-sysfs.c-2387- if (error)
--
net/core/net-sysfs.c-2389-
net/core/net-sysfs.c:2390: error = queue_change_owner(ndev, new_uid, new_gid);
net/core/net-sysfs.c-2391- if (error)
]
|
| 72/2 |
2026/09/13 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 61265
output: 21
thoughts: 77
Thoughts: Okay, here's my interpretation of that code snippet, presented as my own thought process:
**Diving into Network Namespace Ownership Changes**
Right, so I see `netdev_change_owner` there. That function is clearly the entry point for changing ownership of a network device, which is important to understand. And, as expected, it calls the lower-level function `device_change_owner(dev, new_uid, new_gid)`. Classic layered architecture, makes perfect sense. Now, where do those `new_uid` and `new_gid` values come from? Ah, looking at it, `net_ns_get_ownership(net_new, &new_uid, &new_gid)` is where the action is. I need to understand that `net_ns_get_ownership` function, since *that* is the source of the new credentials. Let's dig into that next. Time to trace the rabbit hole.
|
| 73/2 |
2026/09/13 00:53 |
tool |
grepper |
0m
Args: map[Expression:net_ns_get_ownership]
Results: map[Output:include/net/net_namespace.h=215=struct net *copy_net_ns(u64 flags, struct user_namespace *user_ns,
--
include/net/net_namespace.h-217-
include/net/net_namespace.h:218:void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid);
include/net/net_namespace.h-219-
--
include/net/net_namespace.h=229=static inline struct net *copy_net_ns(u64 flags,
--
include/net/net_namespace.h-236-
include/net/net_namespace.h:237:static inline void net_ns_get_ownership(const struct net *net,
include/net/net_namespace.h-238- kuid_t *uid, kgid_t *gid)
--
net/bridge/br_if.c=267=static void brport_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid)
--
net/bridge/br_if.c-270-
net/bridge/br_if.c:271: net_ns_get_ownership(dev_net(p->dev), uid, gid);
net/bridge/br_if.c-272-}
--
net/core/net-sysfs.c=1174=static void rx_queue_get_ownership(const struct kobject *kobj,
--
net/core/net-sysfs.c-1178-
net/core/net-sysfs.c:1179: net_ns_get_ownership(ns ? container_of(ns, struct net, ns) : NULL,
net/core/net-sysfs.c-1180- uid, gid);
--
net/core/net-sysfs.c=1924=static void netdev_queue_get_ownership(const struct kobject *kobj,
--
net/core/net-sysfs.c-1928-
net/core/net-sysfs.c:1929: net_ns_get_ownership(ns ? container_of(ns, struct net, ns) : NULL,
net/core/net-sysfs.c-1930- uid, gid);
--
net/core/net-sysfs.c=2241=static void net_get_ownership(const struct device *d, kuid_t *uid, kgid_t *gid)
--
net/core/net-sysfs.c-2245-
net/core/net-sysfs.c:2246: net_ns_get_ownership(net, uid, gid);
net/core/net-sysfs.c-2247-}
--
net/core/net-sysfs.c=2369=int netdev_change_owner(struct net_device *ndev, const struct net *net_old,
--
net/core/net-sysfs.c-2376-
net/core/net-sysfs.c:2377: net_ns_get_ownership(net_old, &old_uid, &old_gid);
net/core/net-sysfs.c:2378: net_ns_get_ownership(net_new, &new_uid, &new_gid);
net/core/net-sysfs.c-2379-
--
net/core/net_namespace.c=550=struct net *copy_net_ns(u64 flags,
--
net/core/net_namespace.c-602-/**
net/core/net_namespace.c:603: * net_ns_get_ownership - get sysfs ownership data for @net
net/core/net_namespace.c-604- * @net: network namespace in question (can be NULL)
--
net/core/net_namespace.c-610- */
net/core/net_namespace.c:611:void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid)
net/core/net_namespace.c-612-{
--
net/core/net_namespace.c-626-}
net/core/net_namespace.c:627:EXPORT_SYMBOL_GPL(net_ns_get_ownership);
net/core/net_namespace.c-628-
]
|
| 74/2 |
2026/09/13 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 62681
output: 37
thoughts: 25
Thoughts: Here's my take on those thoughts, tailored for an expert audience:
**Diving into `net_ns_get_ownership`**
Alright, time to dig into `net_ns_get_ownership`. It's critical I understand the ownership semantics here, especially in the context of network namespaces. Given my understanding of the kernel's network stack, I need to verify how this function specifically handles object lifetime and prevents race conditions when dealing with network namespace lifecycles. I'm going to head over to `net/core/net_namespace.c` to see how they've implemented the `net_ns_get_ownership` function to confirm how network namespaces are protected from use-after-free and related issues. This is a critical area, particularly in a multi-threaded or containerized environment. Let's see what they've come up with.
|
| 75/2 |
2026/09/13 00:53 |
tool |
read-file |
0m
Args: map[File:net/core/net_namespace.c FirstLine:600 LineCount:30]
Results: map[Contents: 600: }
601:
602: /**
603: * net_ns_get_ownership - get sysfs ownership data for @net
604: * @net: network namespace in question (can be NULL)
605: * @uid: kernel user ID for sysfs objects
606: * @gid: kernel group ID for sysfs objects
607: *
608: * Returns the uid/gid pair of root in the user namespace associated with the
609: * given network namespace.
610: */
611: void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid)
612: {
613: if (net) {
614: kuid_t ns_root_uid = make_kuid(net->user_ns, 0);
615: kgid_t ns_root_gid = make_kgid(net->user_ns, 0);
616:
617: if (uid_valid(ns_root_uid))
618: *uid = ns_root_uid;
619:
620: if (gid_valid(ns_root_gid))
621: *gid = ns_root_gid;
622: } else {
623: *uid = GLOBAL_ROOT_UID;
624: *gid = GLOBAL_ROOT_GID;
625: }
626: }
627: EXPORT_SYMBOL_GPL(net_ns_get_ownership);
628:
629: static void unhash_nsid(struct net *last)
]
|
| 76/2 |
2026/09/13 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 63402
output: 33
thoughts: 540
Thoughts: **Vulnerability Uncovered: Threaded NAPI Control Through User and Network Namespaces**
Okay, so here's what I'm thinking: `net_ns_get_ownership` returns the root UID/GID within the user namespace associated with the network namespace. That means if a user creates both a new user namespace and a new network namespace, they effectively become root within that user namespace. This also means any network devices created in the *new* network namespace will have sysfs entries owned by their UID, which translates to a UID of 0 β effectively "root" within that namespaced environment.
Crucially, this implies write access to `/sys/class/net/<dev>/threaded` is now granted. So, the question is, does writing to `/sys/class/net/<dev>/threaded` require any capabilities to be set? Let's check the code: the `threaded_store` function calls `netdev_lock_store`, which in turn calls the callback `modify_napi_threaded`. And after examining the code, *there's no capability check in `modify_napi_threaded`*!
This is a huge deal. An unprivileged user, by creating a user and network namespace, can create a tunnel device (like `vxlan`, `geneve`, `ip_tunnel`, or similar), and then just write `1` to `/sys/class/net/<dev>/threaded`. This would enable threaded NAPI. Now, the next question is can an unprivileged user create a tunnel device in a user and network namespace? Yes! The `rtnl_link_ops` for many tunnel types don't require `CAP_NET_ADMIN` in the *initial* namespace, only in the network namespace.
So, I think an unprivileged user can create a tunnel device, like `vxlan`, and then modify the `threaded` attribute!
|
| 77/2 |
2026/09/13 00:53 |
tool |
grepper |
0m
Args: map[Expression:rtnl_link_register PathPrefix:drivers/net/vxlan/]
Results: map[Output:drivers/net/vxlan/vxlan_core.c=4969=static int __init vxlan_init_module(void)
--
drivers/net/vxlan/vxlan_core.c-4984-
drivers/net/vxlan/vxlan_core.c:4985: rc = rtnl_link_register(&vxlan_link_ops);
drivers/net/vxlan/vxlan_core.c-4986- if (rc)
]
|
| 78/2 |
2026/09/13 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 64501
output: 32
thoughts: 328
Thoughts: **My Analysis of a Potential Privilege Escalation Vulnerability**
Okay, so `vxlan_link_ops` is definitely registered, good. The question that immediately jumps to mind is, can an unprivileged user create a `vxlan` device? The answer, as I recall, is yes, as long as they have `CAP_NET_ADMIN` within the relevant network namespace; they can just use netlink to do it, like `ip link add type vxlan ...`.
Now, if they have that much control, they can then write `1` to `/sys/class/net/vxlan0/threaded`. Bingo! That activates threaded NAPI for the `vxlan` device. This is where things get interesting. The `vxlan` device utilizes `gro_cells`, which I'm very familiar with. This means that when packets come in on the `vxlan` device, `gro_cells_receive` is called.
Since we've enabled threaded NAPI, that NAPI polling is now happening in a kthread. And this is the crux of the problem. We have a race condition! I know this setup. This race corrupts the `sk_buff_head` doubly linked list. Specifically, we're seeing a data race on `cell->napi_skbs` between `gro_cells_receive` (running in a softirq on one CPU, let's say X) and `gro_cell_poll` (running in the NAPI kthread, which could be on a completely different CPU, Y).
That corruption of the `sk_buff` doubly linked listβ¦ oh, that's bad. That can lead to a *lot* of problems. Use-after-free, arbitrary write via unlinkingβ¦ itβs a recipe for arbitrary memory corruption. This is looking *highly* exploitable. I see a local privilege escalation here, no question about it.
Wait, let me just quickly double-check that `gro_cells_receive` is indeed called for `vxlan`. Let me quickly look at `vxlan_rcv` to be certain. I am *almost* certain, but best to be safe...
|
| 79/2 |
2026/09/13 00:53 |
tool |
grepper |
0m
Args: map[Expression:gro_cells_receive PathPrefix:drivers/net/vxlan/]
Results: map[Output:drivers/net/vxlan/vxlan_core.c=1657=static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
--
drivers/net/vxlan/vxlan_core.c-1812- vxlan_vnifilter_count(vxlan, vni, vninode, VXLAN_VNI_STATS_RX, skb->len);
drivers/net/vxlan/vxlan_core.c:1813: gro_cells_receive(&vxlan->gro_cells, skb);
drivers/net/vxlan/vxlan_core.c-1814-
]
|
| 80/2 |
2026/09/13 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 65489
output: 36
thoughts: 302
Thoughts: **My Analysis of a Potential Race Condition in VXLAN Handling**
Okay, so `vxlan_rcv` *does* call `gro_cells_receive`, which is the key point. Now, the big question is, how does an unprivileged user trigger `vxlan_rcv`? Ah, I remember, they can create a `vxlan` device, bind it to a UDP port, and then just blast UDP packets to that port using the loopback interface or a veth pair, all within the same network namespace. Simple enough to set up.
So, the user sends a UDP packet, it hits the `vxlan` device, which then calls `vxlan_rcv`, and in turn, that calls `gro_cells_receive`. Concurrently, the NAPI kthread is going to poll the `gro_cells` NAPI and dequeue the packets.
The real interesting bit is the concurrency aspect. Since the user can pin sending threads to different CPUs, they can potentially trigger a race condition pretty easily. The code's using `this_cpu_ptr(gcells->cells)` in `gro_cells_receive`. So if a packet comes in from CPU X, `gro_cells_receive` runs on CPU X and accesses `cell_X`.
And that's where the NAPI kthread gets created. It looks like the NAPI kthread for `cell_X` is created when the `vxlan` is created, specifically when threaded NAPI is enabled. Wait, let's confirm, `gro_cells_init` is the function that creates a NAPI per CPU. That's right! When `threaded` is set to 1, `netif_set_threaded` iterates over all the NAPIs of the device and creates a kthread for each one. Alright, time to check `netif_set_threaded` and see what's actually happening there.
|
| 81/2 |
2026/09/13 00:53 |
tool |
read-file |
0m
Args: map[File:net/core/dev.c FirstLine:7280 LineCount:30]
Results: map[Contents:7280: } else {
7281: /* Make sure kthread is created before THREADED bit is set. */
7282: smp_mb__before_atomic();
7283: napi_set_threaded_state(napi, threaded);
7284: }
7285:
7286: return 0;
7287: }
7288:
7289: int netif_set_threaded(struct net_device *dev,
7290: enum netdev_napi_threaded threaded)
7291: {
7292: struct napi_struct *napi;
7293: int i, err = 0;
7294:
7295: netdev_assert_locked_or_invisible(dev);
7296:
7297: if (threaded) {
7298: list_for_each_entry(napi, &dev->napi_list, dev_list) {
7299: if (!napi->thread) {
7300: err = napi_kthread_create(napi);
7301: if (err) {
7302: threaded = NETDEV_NAPI_THREADED_DISABLED;
7303: break;
7304: }
7305: }
7306: }
7307: }
7308:
7309: WRITE_ONCE(dev->threaded, threaded);
]
|
| 82/2 |
2026/09/13 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 66643
output: 18
thoughts: 1774
Thoughts: **Data Race in Threaded NAPI with GRO Cells: A Critical Vulnerability**
Okay, so here's the breakdown of this issue. It seems like the `netif_set_threaded` function is iterating through `dev->napi_list`, which for something like `vxlan` includes a NAPI instance for each CPU. This means multiple kernel threads are created, each calling `napi_threaded_poll` which then ends up calling `gro_cell_poll`. Because `kthread_run` doesn't bind these threads to CPUs, the Linux scheduler can place them anywhere. This is where the problem starts.
If a packet arrives on CPU X, `gro_cells_receive` runs on CPU X, accessing a `cell_X`. Meanwhile, the NAPI kthread for `cell_X` might be running on CPU Y. This introduces a data race on `cell_X->napi_skbs`, a doubly linked list used to queue `sk_buff` structures between CPU X and CPU Y. It's a textbook race condition, easily reproducible and guaranteed to corrupt the `sk_buff_head` list.
Now, I was looking for protection against this. My initial thought was perhaps some CPU binding or something. I checked if `napi_threaded_poll` was somehow bound to the CPU but there is nothing to that effect. Both `gro_cells_receive` and `napi_threaded_poll` disable BH (Bottom Halves/Softirqs) so I thought this would prevent the race. While this would prevent softirqs on the *same* CPU from running concurrently with the kthread, it does nothing to prevent the kthread on CPU Y from racing with a softirq on CPU X. Without an actual spinlock, this means no mutual exclusion. The code uses `local_lock_nested_bh(&cell->bh_lock)` but this is just lockdep tracking that does not provide any actual mutual exclusion across CPUs. This is a severe bug.
In terms of exploitability, this data race on the `sk_buff_head` list could lead to arbitrary memory read/write or a use-after-free scenario involving `sk_buff` structures. This type of memory corruption in the kernel is often a stepping stone to local privilege escalation.
Now, can an unprivileged user exploit this? Creating a user namespace and a network namespace is the key. Inside that namespace, the user creates a `vxlan` device (or similar). By writing `1` to `/sys/class/net/<dev>/threaded`, the user enables threaded NAPI. Then, by sending packets to the device, `gro_cells_receive` is triggered concurrently with the NAPI kthreads. However, the prompt says user namespaces aren't accessible.
The vulnerability is accessible to a user within a user namespace because the user has all capabilities within that namespace. However, without user namespaces, an unprivileged user cannot trigger the bug because they don't have `CAP_NET_ADMIN` to create a `vxlan` device or enable threaded NAPI. Unless, of course, a device is already configured with threaded NAPI by root. In that case, an unprivileged user can trigger the race by sending packets.
I looked into other device types. Physical devices don't use `gro_cells`; `gro_cells` is for software devices, so they are not affected.
Regarding denial of service (DoS), memory corruption easily leads to kernel panics. So, yes. It's a DoS.
This is exploitable.
Can a remote attacker trigger this? Yes, if the target system has a tunnel device (e.g., `vxlan`, `gre`) and the administrator has enabled threaded NAPI on it. Then, a remote attacker can send packets to the tunnel port. Those packets will flow through `gro_cells_receive` and the NAPI kthread, triggering the race condition and memory corruption. The critical requirement is that the administrator has configured the system in this way. I wonder if threaded NAPI is enabled by default anywhere. That's something I need to check.
|
| 83/2 |
2026/09/13 00:54 |
tool |
grepper |
0m
Args: map[Expression:dev->threaded =]
Results: map[Output:drivers/net/ethernet/airoha/airoha_eth.c=3589=static int airoha_probe(struct platform_device *pdev)
--
drivers/net/ethernet/airoha/airoha_eth.c-3650- /* Enable threaded NAPI by default */
drivers/net/ethernet/airoha/airoha_eth.c:3651: eth->napi_dev->threaded = true;
drivers/net/ethernet/airoha/airoha_eth.c-3652- strscpy(eth->napi_dev->name, "qdma_eth", sizeof(eth->napi_dev->name));
--
drivers/net/wireless/mediatek/mt76/dma.c=1136=mt76_dma_init(struct mt76_dev *dev,
--
drivers/net/wireless/mediatek/mt76/dma.c-1161- wiphy_name(dev->hw->wiphy));
drivers/net/wireless/mediatek/mt76/dma.c:1162: dev->napi_dev->threaded = 1;
drivers/net/wireless/mediatek/mt76/dma.c-1163- init_completion(&dev->mmio.wed_reset);
--
drivers/net/wireless/mediatek/mt76/usb.c=1122=int __mt76u_init(struct mt76_dev *dev, struct usb_interface *intf,
--
drivers/net/wireless/mediatek/mt76/usb.c-1174- strscpy(dev->napi_dev->name, "mt76u-rx", sizeof(dev->napi_dev->name));
drivers/net/wireless/mediatek/mt76/usb.c:1175: dev->napi_dev->threaded = 1;
drivers/net/wireless/mediatek/mt76/usb.c-1176- netif_napi_add(dev->napi_dev, &dev->napi[MT_RXQ_MAIN], mt76u_napi_poll);
--
net/core/dev.c=7612=void netif_napi_add_weight_locked(struct net_device *dev,
--
net/core/dev.c-7652- if (napi_kthread_create(napi))
net/core/dev.c:7653: dev->threaded = NETDEV_NAPI_THREADED_DISABLED;
net/core/dev.c-7654- netif_napi_set_irq_locked(napi, -1);
]
|
| 84/2 |
2026/09/13 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 69973
output: 36
thoughts: 1704
Thoughts: **Analysis of a Kernel Memory Corruption Vulnerability**
Okay, so here's what I've got. Threaded NAPI isn't enabled by default on tunnel devices. That's good. But, if an administrator *does* enable it, then it becomes remotely triggerable. My gut says that's a network trigger, even though it requires a non-default configuration. That's usually the case. The question is, can an attacker trigger this remotely *without* an administrator enabling threaded NAPI? No, that's not possible. The root cause is the interplay between threaded NAPI's kthreads and softirq execution.
Essentially, without threaded NAPI, `gro_cell_poll` runs within the `NET_RX_SOFTIRQ`. `NET_RX_SOFTIRQ` executes on the CPU that scheduled the NAPI. The key part is that `gro_cells_receive` schedules the NAPI on the *current* CPU. Therefore, `gro_cell_poll` is guaranteed to run on the same CPU as `gro_cells_receive`. `gro_cells_receive` disables BH (or is called in BH context) which prevents preemption; hence, there is no data race. This eliminates the race condition if threaded NAPI is disabled! The bug is *strictly* tied to threaded NAPI being enabled on `gro_cells`.
But wait. Could `gro_cell_poll` still run on a different CPU under any other circumstances? CPU hotplug is rare. Could RPS (Receive Packet Steering) be involved? No, because `gro_cells_receive` is called *before* RPS processing, the data still stays on the same CPU. The tunnel driver, e.g. `vxlan_rcv`, calls `gro_cells_receive`, which schedules the NAPI on the same CPU that ran the tunnel driver's `gro_cells_receive` function. That still means we're safe.
What about busy polling? Could a user-space process poll the NAPI directly from `recvmsg`? Let me check. Yep, `gro_cells_init` has explicitly disabled busy polling via `NAPI_STATE_NO_BUSY_POLL`. Good. So, that's off the table.
Therefore, the only way `gro_cell_poll` can run on a different CPU is through threaded NAPI, and that requires explicit enablement. Since an unprivileged user can enable threaded NAPI within a user namespace, it's exploitable via user namespaces.
Alright, so the dimensions of the bug are:
* Exploitable: Yes, this is a memory corruption vulnerability (list corruption), therefore highly exploitable.
* Denial of Service: Yes.
* Unprivileged Access: No, requires `CAP_NET_ADMIN` to create a tunnel and enable threaded NAPI.
* User Namespaces: Yes.
* VM Guest/Host Trigger: No.
* Ethernet Network Trigger: Yes, assuming the administrator enabled threaded NAPI on a tunnel.
* Other Remote/Peripheral/Malicious Filesystem Triggers: No.
Hold on, could `dev_set_threaded` be called automatically for *any* devices? I checked and found it used for a few physical devices, but they don't use `gro_cells`.
Let's quickly verify that `local_lock_nested_bh` provides actual mutual exclusion. Nope, if `CONFIG_DEBUG_LOCK_ALLOC` is disabled (which it is for production), it's basically an empty function. The protection comes from running the routines on the *same* CPU without preemption, which threaded NAPI breaks.
So, fixes? I see a few options:
1. Prevent threaded NAPI enablement on `gro_cells` devices.
2. Bind the NAPI kthreads to their originating CPU.
3. Use a real spinlock instead of the `local_lock` in `gro_cells`.
Wait a second... NAPI kthreads are *not* CPU-bound by design? Let me think. Normal drivers have one NAPI per RX queue. The queue is protected via the NAPI state machine (`NAPI_STATE_SCHED`). Only one thread polls a NAPI at a time. The interrupt handler *schedules* the NAPI. It doesn't touch the RX queue directly! The NAPI poll function *is* the one that accesses the queue. There's no concurrent access. But `gro_cells` is different. `gro_cells_receive` *does* access the queue to add packets, and `gro_cell_poll` *removes* packets. It's concurrent access. `gro_cells` relies on running the routines on the same CPU to protect against data races. But threaded
|
| 85/2 |
2026/09/13 00:54 |
tool |
read-file |
0m
Args: map[File:net/core/dev.c FirstLine:1665 LineCount:25]
Results: map[Contents:1665: }
1666: EXPORT_SYMBOL(netdev_notify_peers);
1667:
1668: static int napi_threaded_poll(void *data);
1669:
1670: static int napi_kthread_create(struct napi_struct *n)
1671: {
1672: int err = 0;
1673:
1674: /* Create and wake up the kthread once to put it in
1675: * TASK_INTERRUPTIBLE mode to avoid the blocked task
1676: * warning and work with loadavg.
1677: */
1678: n->thread = kthread_run(napi_threaded_poll, n, "napi/%s-%d",
1679: n->dev->name, n->napi_id);
1680: if (IS_ERR(n->thread)) {
1681: err = PTR_ERR(n->thread);
1682: pr_err("kthread_run failed with err %d\n", err);
1683: n->thread = NULL;
1684: }
1685:
1686: return err;
1687: }
1688:
1689: static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
]
|
| 86/2 |
2026/09/13 00:54 |
llm |
expert-compressor |
0m
Model:
Reply: ### 1. Approaches Tried and Results
- **Analyzed Bug Report**:
- Report: `DEBUG_LOCKS_WARN_ON(l->owner)` at `include/linux/local_lock_internal.h:47` called from `local_lock_acquire` in `gro_cell_poll+0x5aa/0x6c0 net/core/gro_cells.c:66`.
- Process: `CPU#1: napi/gre0-0/11827`, softlockup tainted.
- Call trace: `ret_from_fork` -> `kthread` -> `napi_threaded_poll` -> `napi_threaded_poll_loop` -> `__napi_poll` -> `gro_cell_poll`.
- **Source Code Investigation**:
- `net/core/gro_cells.c`:
- In `gro_cells_init`, per-CPU `struct gro_cell` structures are allocated (`cells = alloc_percpu(struct gro_cell)`). For each CPU, `cell->bh_lock` (`local_lock_t`) is initialized, `netif_napi_add(dev, &cell->napi, gro_cell_poll)` is called, and `napi_enable(&cell->napi)` is called.
- In `gro_cells_receive`:
```c
local_lock_nested_bh(&gcells->cells->bh_lock);
have_bh_lock = true;
cell = this_cpu_ptr(gcells->cells);
...
__skb_queue_tail(&cell->napi_skbs, skb);
if (skb_queue_len(&cell->napi_skbs) == 1)
napi_schedule(&cell->napi);
...
unlock:
if (have_bh_lock)
local_unlock_nested_bh(&gcells->cells->bh_lock);
```
- In `gro_cell_poll`:
```c
struct gro_cell *cell = container_of(napi, struct gro_cell, napi);
...
while (work_done < budget) {
__local_lock_nested_bh(&cell->bh_lock);
skb = __skb_dequeue(&cell->napi_skbs);
__local_unlock_nested_bh(&cell->bh_lock);
if (!skb)
break;
napi_gro_receive(napi, skb);
work_done++;
}
```
- `include/linux/local_lock_internal.h` and `include/linux/local_lock.h`:
- On `!CONFIG_PREEMPT_RT`, `local_lock_t` is only a lockdep struct (`struct { ... } local_lock_t;`), NOT a mutual exclusion lock. In release/production builds without `CONFIG_DEBUG_LOCK_ALLOC`, it expands to nothing (empty functions/macros).
- `__local_lock_nested_bh` only calls `lockdep_assert_in_softirq()` and `local_lock_acquire(lock)`. It performs NO preemption disable, NO spinlock, and NO BH disable.
- When `DEBUG_LOCKS_WARN_ON(l->owner)` triggers, `l->owner` was already non-NULL because another thread/context already held the lock according to lockdep tracking.
- **Threading and CPU Affinity Analysis**:
- `napi_threaded_poll` is run as a kthread (`napi_kthread_create` calls `kthread_run(napi_threaded_poll, ...)`).
- Crucially: `kthread_run` creates an **unbound** kernel thread (does not call `kthread_bind` or set CPU affinity to the CPU of that NAPI instance).
- Therefore, the NAPI kthread for CPU $X$'s `gro_cell` can be scheduled and executed on CPU $Y$.
- When running on CPU $Y$, `gro_cell_poll` accesses CPU $X$'s `cell->bh_lock` and dequeues from CPU $X$'s `cell->napi_skbs` (`__skb_dequeue`).
- Concurrently, ingress traffic on CPU $X$ in `gro_cells_receive` accesses CPU $X$'s `cell->napi_skbs` (`__skb_queue_tail`).
- Because `local_lock_t` is a per-CPU construct meant only for synchronization against local BH/preemption on the *same* CPU, it provides ZERO cross-CPU mutual exclusion.
- Furthermore, `gro_cell_poll` acquiring CPU $X$'s `bh_lock` on CPU $Y$ while CPU $X$ acquires it causes lockdep tracking corruption (`l->owner` collision).
- **Impact on Production Build**:
- In production (`!CONFIG_DEBUG_LOCK_ALLOC` / `!CONFIG_PREEMPT_RT`):
- `__skb_dequeue` and `__skb_queue_tail` manipulate the doubly-linked list `cell->napi_skbs` simultaneously from multiple CPUs without any locking/atomics.
- Results in list corruption (`sk_buff` pointers `next`/`prev` corrupted), leading to use-after-free, memory corruption, or kernel panic/crash.
- **Trigger Mechanisms & Privileges**:
- Looked for how threaded NAPI is enabled on `gre0` or tunnel devices:
- Threaded NAPI can be set via Netlink: `NETDEV_CMD_NAPI_SET` (`netdev_nl_napi_set_doit`).
- Checked `net/core/netdev-genl-gen.c`:
```c
.cmd = NETDEV_CMD_NAPI_SET,
.doit = netdev_nl_napi_set_doit,
.policy = netdev_napi_set_nl_policy,
.maxattr = NETDEV_A_NAPI_THREADED,
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
```
- Also checked sysfs / netlink device settings (e.g. `threaded` attribute on netdev, or per-napi sysfs).
### 2. Hypotheses & Active Lines of Investigation
- **Hypothesis 1: Memory Corruption / Exploitability**:
- The bug is a genuine data race on the `sk_buff_head` list `cell->napi_skbs`.
- Concurrent `__skb_dequeue` and `__skb_queue_tail` without locks leads to corrupting `sk_buff` pointers (`next`/`prev`).
- Doubly-linked list corruption on kernel packet buffers (`sk_buff`) causes memory corruption / use-after-free.
- This makes the issue **Exploitable** and definitely a **Denial of Service**.
- **Hypothesis 2: Reachability & Capabilities**:
- `gre0` device is an IP tunnel (`ip_tunnel.c` calls `gro_cells_init(&tunnel->gro_cells, dev)`).
- Can threaded NAPI be enabled by an unprivileged user or inside a user namespace?
- Need to check how `GENL_ADMIN_PERM` is checked in generic netlink: does it check `capable(CAP_NET_ADMIN)` or `ns_capable(net->user_ns, CAP_NET_ADMIN)`?
- Note: In generic netlink, `GENL_ADMIN_PERM` typically does `netlink_capable(skb, CAP_NET_ADMIN)`, which checks the user namespace associated with the socket or the initial user namespace. Need to check `genl_op_from_full` or generic netlink permission verification logic in `net/netlink/genetlink.c`.
- Also, can `dev_set_threaded` be set via sysfs (`/sys/class/net/<dev>/threaded`) or rtnetlink?
- Can tunnel devices (`gre`, `vxlan`, etc.) be created in a user namespace? Yes, with `CAP_NET_ADMIN` in a user namespace (`ns_capable`).
- Can unprivileged users reach threaded NAPI without root/capabilities? Unlikely, but need to check sysfs permissions or socket options.
- What about remote triggers (Ethernet, etc.)?
- Once threaded NAPI is enabled on a tunnel or device, ingress traffic on that tunnel (packets arriving over Ethernet or tunnel) triggers `gro_cells_receive` and `gro_cell_poll`. But enabling threaded NAPI is a prerequisite.
### 3. Critical Files, Code Snippets, and Structures
- `net/core/gro_cells.c`:
```c
struct gro_cell {
struct sk_buff_head napi_skbs;
struct napi_struct napi;
local_lock_t bh_lock;
};
```
`gro_cell_poll` (line 59): uses `__local_lock_nested_bh(&cell->bh_lock)` and `__skb_dequeue(&cell->napi_skbs)`.
`gro_cells_receive` (line 14): uses `local_lock_nested_bh(&gcells->cells->bh_lock)` and `__skb_queue_tail(&cell->napi_skbs, skb)`.
- `net/core/dev.c`:
`napi_kthread_create` (line 1670):
```c
n->thread = kthread_run(napi_threaded_poll, n, "napi/%s-%d", n->dev->name, n->napi_id);
```
Note absence of `kthread_bind(n->thread, cpu)`.
- `include/linux/local_lock_internal.h`:
Line 44:
```c
static inline void local_lock_acquire(local_lock_t *l)
{
lock_map_acquire(&l->dep_map);
DEBUG_LOCKS_WARN_ON(l->owner);
l->owner = current;
}
```
- `net/core/netdev-genl-gen.c`:
Line 233:
```c
.cmd = NETDEV_CMD_NAPI_SET,
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
```
### 4. Watch-outs & Next Steps
- **Watch-outs**:
- Do not repeatedly grep `GENL_ADMIN_PERM` across the entire kernel tree (over 1000 matches).
- Target specifically:
1. Check how `GENL_ADMIN_PERM` evaluates capabilities in `net/netlink/genetlink.c`.
2. Check if sysfs `/sys/class/net/<dev>/threaded` exists and what permissions it has (or `grep -rn "dev_set_threaded" net/`).
3. Determine whether an unprivileged user or user namespace (`CAP_NET_ADMIN` in user_ns) can enable threaded NAPI or create tunnels with threaded NAPI.
4. Conclude on the standard dimensions before calling `set-results`.
Tokens:
input: 44514
output: 2584
thoughts: 0
|
| 87/2 |
2026/09/13 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 27705
output: 31
thoughts: 0
|
| 88/2 |
2026/09/13 00:54 |
tool |
grepper |
0m
Error:
Args: map[Expression:kthread_bind PathPrefix:net/core/dev.c]
Results:
|
| 89/2 |
2026/09/13 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 27750
output: 84
thoughts: 0
|
| 90/2 |
2026/09/13 00:54 |
tool |
codeexpert |
1m
Error:
Args: map[Question:Can an unprivileged user (without CAP_NET_ADMIN in the initial namespace) create a tunnel device (like gre, vxlan, etc) inside a user namespace where they have CAP_NET_ADMIN, and then enable threaded NAPI on that device via sysfs (/sys/class/net/<dev>/threaded) or netlink?]
|
| 91/3 |
2026/09/13 00:54 |
agent |
codeexpert |
1m
Model:
Error:
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Research the question using targeted, efficient tool calls. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code. Keep your tool calls focused and limited to the
scope of the question. Do not explore tangential code paths or perform unbounded searches.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
- git commits descriptions, git blame
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
4. Be concise and targeted. Answer the question as directly and concisely as possible
once you have located the relevant code or definitions. If a symbol or function cannot
be found after targeted searches, conclude with the best available information rather
than continuing repetitive searches.
Do NOT use git-log to search for the presence or existence of files in the
repository. git-log is only for tracing commit history of files that are
already present in the current checkout. If a file does not exist in the
current checkout, it cannot be used for reproduction.
Avoid running broad git-log queries (such as searches on the entire repo)
without a specific 'PathPrefix' to restrict the scope, as these are very
expensive and will time out.
If a git-log tool call times out, do not retry the query with the same broad
scope. You must specify a tighter, narrower 'PathPrefix' for subsequent queries.
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: Can an unprivileged user (without CAP_NET_ADMIN in the initial namespace) create a tunnel device (like gre, vxlan, etc) inside a user namespace where they have CAP_NET_ADMIN, and then enable threaded NAPI on that device via sysfs (/sys/class/net/<dev>/threaded) or netlink?
|
| 92/4 |
2026/09/13 00:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 4216
output: 31
thoughts: 646
Thoughts: **My Initial Thoughts on Tunnel Device Creation and Threaded NAPI**
Okay, so the core question is whether an unprivileged user can pull off a specific set of network operations within a user namespace. Let's break this down. Can they create a tunnel device (GRE, VXLAN, etc.) within a user namespace where they have `CAP_NET_ADMIN`, and then enable threaded NAPI on that device either through the `/sys/class/net/<dev>/threaded` sysfs entry or via netlink?
First, I need to understand the fundamental restrictions. Does tunnel device creation itself require `CAP_NET_ADMIN` in the initial user namespace (`init_user_ns`) or just in the current user/network namespace? Are tunnel devices generally restricted in user namespaces? What's the actual mechanism: `rtnl`, `ip link`, or something specific to tunnel creation? Does `rtnl` use `netlink_ns_capable` or just plain `capable(CAP_NET_ADMIN)`?
Next, I need to figure out the specifics of tunnel device implementations. Do they use `rtnl_link_ops` or something else? Do tunnel devices even *use* threaded NAPI? Does threaded NAPI even exist on tunnel devices? That's a crucial question!
If threaded NAPI is supported, then enabling it is another layer of complexity. Does enabling threaded NAPI through sysfs or netlink require `CAP_NET_ADMIN` in the initial user namespace, or just the current one? Does writing to `/sys/class/net/<dev>/threaded` have some specific permission checks? What about netlink?
To recap my two key questions:
1. Can an unprivileged user create a tunnel device (GRE, VXLAN, etc.) in a user namespace?
2. Can they enable threaded NAPI on that device via sysfs or netlink?
Alright, time to dive into the kernel source. I'm going to look for:
* The `/sys/class/net/<dev>/threaded` sysfs attribute and how it's handled.
* Netlink attributes or functions related to "threaded" NAPI (e.g., `IFLA_*`, `napi_set_threaded`, or just "threaded").
* The `rtnl_link_ops` implementations for GRE, VXLAN, and other tunnel devices to understand if there are any restrictions when running within a user namespace.
I'll use grepper to search through `net/sysfs` and `net/core` for the "threaded" string. I need to understand what permissions sysfs's `/sys/class/net/<dev>/threaded` actually requires, whether netlink checks `init_user_ns` or `net->user_ns`, and most importantly, if any of these operations are even relevant or supported on tunnel devices. Is NAPI even used on these types of devices?
|
| 93/4 |
2026/09/13 00:54 |
tool |
grepper |
0m
Args: map[Expression:threaded PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=723=static const struct attribute_group netdev_phys_group = {
--
net/core/net-sysfs.c-727-
net/core/net-sysfs.c:728:static ssize_t threaded_show(struct device *dev,
net/core/net-sysfs.c-729- struct device_attribute *attr, char *buf)
--
net/core/net-sysfs.c-736- if (dev_isalive(netdev))
net/core/net-sysfs.c:737: ret = sysfs_emit(buf, fmt_dec, READ_ONCE(netdev->threaded));
net/core/net-sysfs.c-738-
--
net/core/net-sysfs.c-743-
net/core/net-sysfs.c:744:static int modify_napi_threaded(struct net_device *dev, unsigned long val)
net/core/net-sysfs.c-745-{
--
net/core/net-sysfs.c-753-
net/core/net-sysfs.c:754: ret = netif_set_threaded(dev, val);
net/core/net-sysfs.c-755-
--
net/core/net-sysfs.c-758-
net/core/net-sysfs.c:759:static ssize_t threaded_store(struct device *dev,
net/core/net-sysfs.c-760- struct device_attribute *attr,
--
net/core/net-sysfs.c-762-{
net/core/net-sysfs.c:763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
net/core/net-sysfs.c-764-}
net/core/net-sysfs.c:765:static DEVICE_ATTR_RW(threaded);
net/core/net-sysfs.c-766-
net/core/net-sysfs.c=767=static struct attribute *net_class_attrs[] __ro_after_init = {
--
net/core/net-sysfs.c-795- &dev_attr_carrier_down_count.attr,
net/core/net-sysfs.c:796: &dev_attr_threaded.attr,
net/core/net-sysfs.c-797- NULL,
]
|
| 94/4 |
2026/09/13 00:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 6145
output: 28
thoughts: 62
Thoughts: **Investigating Netdev Locking and Threading Configuration**
Okay, so I'm thinking I need to delve into `net/core/net-sysfs.c`, specifically around lines 728-765. That area should contain the logic for handling `netdev_lock_store`, which is where I expect to find the relevant locking behavior when configuring network devices through sysfs. I need to be sure I understand the interaction between the lock and any threading configurations.
Beyond that, I'm going to scan for instances of `IFLA_` attributes related to threading. I expect to use `netif_set_threaded` so I will be searching for that as well. I need to ensure I can see how these threaded configurations are set and handled within the kernel's network device management. I need to see if it is used, and how it is. This investigation should clarify any dependencies or conflicts between threaded operation and the device's locking mechanisms.
|
| 95/4 |
2026/09/13 00:54 |
tool |
grepper |
0m
Args: map[Expression:netif_set_threaded PathPrefix:net/]
Results: map[Output:net/core/dev.c=5013=static inline void ____napi_schedule(struct softnet_data *sd,
--
net/core/dev.c-5021- /* Paired with smp_mb__before_atomic() in
net/core/dev.c:5022: * napi_enable()/netif_set_threaded().
net/core/dev.c-5023- * Use READ_ONCE() to guarantee a complete
--
net/core/dev.c=7257=int napi_set_threaded(struct napi_struct *napi,
--
net/core/dev.c-7288-
net/core/dev.c:7289:int netif_set_threaded(struct net_device *dev,
net/core/dev.c-7290- enum netdev_napi_threaded threaded)
--
net/core/dev.c=7333=void netif_threaded_enable(struct net_device *dev)
net/core/dev.c-7334-{
net/core/dev.c:7335: WARN_ON_ONCE(netif_set_threaded(dev, NETDEV_NAPI_THREADED_ENABLED));
net/core/dev.c-7336-}
--
net/core/dev.h=376=int napi_set_threaded(struct napi_struct *n,
--
net/core/dev.h-378-
net/core/dev.h:379:int netif_set_threaded(struct net_device *dev,
net/core/dev.h-380- enum netdev_napi_threaded threaded);
--
net/core/dev_api.c=374=int dev_set_threaded(struct net_device *dev,
--
net/core/dev_api.c-379- netdev_lock(dev);
net/core/dev_api.c:380: ret = netif_set_threaded(dev, threaded);
net/core/dev_api.c-381- netdev_unlock(dev);
--
net/core/net-sysfs.c=744=static int modify_napi_threaded(struct net_device *dev, unsigned long val)
--
net/core/net-sysfs.c-753-
net/core/net-sysfs.c:754: ret = netif_set_threaded(dev, val);
net/core/net-sysfs.c-755-
]
|
| 96/4 |
2026/09/13 00:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 7075
output: 44
thoughts: 34
Thoughts: Here's my take on those thoughts:
**Analyzing `dev_set_threaded` Usage**
Okay, so I need to understand the implications of `dev_set_threaded`. My first step, as always, is to follow the breadcrumbs. Where is this `dev_set_threaded` function being invoked? The quickest way to get a handle on its impact is to meticulously trace the calls. I'm going to scan for every single reference to `dev_set_threaded`, and also any occurrences of the related keyword "threaded," just to be thorough and ensure I catch any indirect interactions that might be at play. I need a clear picture of its role within the system. Let's dig in.
|
| 97/4 |
2026/09/13 00:54 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/core/dev_api.c IncludeSnippetLines:5 Name:dev_set_threaded]
Results: map[References:[map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_dev_set_threaded_1301 SourceFile:net/core/dev_api.c SourceLine:385 SourceSnippet: 385: EXPORT_SYMBOL(dev_set_threaded);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_dev_set_threaded SourceFile:net/core/dev_api.c SourceLine:385 SourceSnippet: 385: EXPORT_SYMBOL(dev_set_threaded);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_dev_set_threaded SourceFile:net/core/dev_api.c SourceLine:385 SourceSnippet: 385: EXPORT_SYMBOL(dev_set_threaded);
]] TruncatedOutput:false]
|
| 98/4 |
2026/09/13 00:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 7593
output: 19
thoughts: 29
Thoughts: Here's my attempt at summarizing the thought process, as if I were having them:
**Debugging Threading Issues in Network Drivers**
Okay, hold on a second. Something's nagging at me about this threading configuration. The code's behavior suggests we're dealing with threading issues, and I need to pinpoint the culprits. Specifically, I need to know exactly *who* is calling `dev_set_threaded` or `netif_set_threaded` in this situation. It's time to dig deeper. I'm going to run a quick `grepper` search right now to see where those functions are being invoked. That should give me the call sites I need to understand the control flow and identify the root cause of this threading behavior. Let's see what the grep results reveal.
|
| 99/4 |
2026/09/13 00:54 |
tool |
grepper |
0m
Args: map[Expression:dev_set_threaded]
Results: map[Output:drivers/net/wireless/mediatek/mt76/debugfs.c=29=mt76_napi_threaded_set(void *data, u64 val)
--
drivers/net/wireless/mediatek/mt76/debugfs.c-36- if (dev->napi_dev->threaded != val)
drivers/net/wireless/mediatek/mt76/debugfs.c:37: return dev_set_threaded(dev->napi_dev, val);
drivers/net/wireless/mediatek/mt76/debugfs.c-38-
--
include/linux/netdevice.h=599=void netif_threaded_enable(struct net_device *dev);
include/linux/netdevice.h:600:int dev_set_threaded(struct net_device *dev,
include/linux/netdevice.h-601- enum netdev_napi_threaded threaded);
--
net/core/dev_api.c=372=EXPORT_SYMBOL(netdev_state_change);
net/core/dev_api.c-373-
net/core/dev_api.c:374:int dev_set_threaded(struct net_device *dev,
net/core/dev_api.c-375- enum netdev_napi_threaded threaded)
--
net/core/dev_api.c-384-}
net/core/dev_api.c:385:EXPORT_SYMBOL(dev_set_threaded);
--
tools/testing/selftests/net/nl_netdev.py=51=def napi_set_threaded(nf) -> None:
--
tools/testing/selftests/net/nl_netdev.py-135-
tools/testing/selftests/net/nl_netdev.py:136:def dev_set_threaded(nf) -> None:
tools/testing/selftests/net/nl_netdev.py-137- """
--
tools/testing/selftests/net/nl_netdev.py=369=def main() -> None:
--
tools/testing/selftests/net/nl_netdev.py-376- napi_set_threaded,
tools/testing/selftests/net/nl_netdev.py:377: dev_set_threaded,
tools/testing/selftests/net/nl_netdev.py-378- nsim_rxq_reset_down,
]
|
| 100/4 |
2026/09/13 00:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 8429
output: 44
thoughts: 79
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into Netlink Netdev Self-Tests**
Okay, time to get my hands dirty. I need to take a look at the Netlink Netdev self-tests, specifically the `tools/testing/selftests/net/nl_netdev.py` script. My focus, right now, is on understanding how this test suite interacts with the netlink netdev family, particularly the genetlink netdev functionality. This looks like a promising avenue for investigating some odd behavior I've been observing.
Let's jump right in. I'm going to scan lines 50 through 150 of `nl_netdev.py`. This should give me a good initial grasp of the test's structure, the key netlink messages being exchanged, the expected device interactions, and hopefully, how the tests validate those interactions. That section should contain the core logic I'm after, the initial setup, and the critical assertions. Hopefully, this section will quickly illuminate the test's strategy and where I should focus further investigation.
|
| 101/4 |
2026/09/13 00:54 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/nl_netdev.py FirstLine:50 LineCount:100]
Results: map[Contents: 50:
51: def napi_set_threaded(nf) -> None:
52: """
53: Test that verifies various cases of napi threaded
54: set and unset at napi and device level.
55: """
56: with NetdevSimDev(queue_count=2) as nsimdev:
57: nsim = nsimdev.nsims[0]
58:
59: ip(f"link set dev {nsim.ifname} up")
60:
61: napis = nf.napi_get({'ifindex': nsim.ifindex}, dump=True)
62: ksft_eq(len(napis), 2)
63:
64: napi0_id = napis[0]['id']
65: napi1_id = napis[1]['id']
66:
67: # set napi threaded and verify
68: nf.napi_set({'id': napi0_id, 'threaded': "enabled"})
69: napi0 = nf.napi_get({'id': napi0_id})
70: ksft_eq(napi0['threaded'], "enabled")
71: ksft_ne(napi0.get('pid'), None)
72:
73: # check it is not set for napi1
74: napi1 = nf.napi_get({'id': napi1_id})
75: ksft_eq(napi1['threaded'], "disabled")
76: ksft_eq(napi1.get('pid'), None)
77:
78: ip(f"link set dev {nsim.ifname} down")
79: ip(f"link set dev {nsim.ifname} up")
80:
81: # verify if napi threaded is still set
82: napi0 = nf.napi_get({'id': napi0_id})
83: ksft_eq(napi0['threaded'], "enabled")
84: ksft_ne(napi0.get('pid'), None)
85:
86: # check it is still not set for napi1
87: napi1 = nf.napi_get({'id': napi1_id})
88: ksft_eq(napi1['threaded'], "disabled")
89: ksft_eq(napi1.get('pid'), None)
90:
91: # unset napi threaded and verify
92: nf.napi_set({'id': napi0_id, 'threaded': "disabled"})
93: napi0 = nf.napi_get({'id': napi0_id})
94: ksft_eq(napi0['threaded'], "disabled")
95: ksft_eq(napi0.get('pid'), None)
96:
97: # set threaded at device level
98: system(f"echo 1 > /sys/class/net/{nsim.ifname}/threaded")
99:
100: # check napi threaded is set for both napis
101: napi0 = nf.napi_get({'id': napi0_id})
102: ksft_eq(napi0['threaded'], "enabled")
103: ksft_ne(napi0.get('pid'), None)
104: napi1 = nf.napi_get({'id': napi1_id})
105: ksft_eq(napi1['threaded'], "enabled")
106: ksft_ne(napi1.get('pid'), None)
107:
108: # unset threaded at device level
109: system(f"echo 0 > /sys/class/net/{nsim.ifname}/threaded")
110:
111: # check napi threaded is unset for both napis
112: napi0 = nf.napi_get({'id': napi0_id})
113: ksft_eq(napi0['threaded'], "disabled")
114: ksft_eq(napi0.get('pid'), None)
115: napi1 = nf.napi_get({'id': napi1_id})
116: ksft_eq(napi1['threaded'], "disabled")
117: ksft_eq(napi1.get('pid'), None)
118:
119: # set napi threaded for napi0
120: nf.napi_set({'id': napi0_id, 'threaded': 1})
121: napi0 = nf.napi_get({'id': napi0_id})
122: ksft_eq(napi0['threaded'], "enabled")
123: ksft_ne(napi0.get('pid'), None)
124:
125: # unset threaded at device level
126: system(f"echo 0 > /sys/class/net/{nsim.ifname}/threaded")
127:
128: # check napi threaded is unset for both napis
129: napi0 = nf.napi_get({'id': napi0_id})
130: ksft_eq(napi0['threaded'], "disabled")
131: ksft_eq(napi0.get('pid'), None)
132: napi1 = nf.napi_get({'id': napi1_id})
133: ksft_eq(napi1['threaded'], "disabled")
134: ksft_eq(napi1.get('pid'), None)
135:
136: def dev_set_threaded(nf) -> None:
137: """
138: Test that verifies various cases of napi threaded
139: set and unset at device level using sysfs.
140: """
141: with NetdevSimDev(queue_count=2) as nsimdev:
142: nsim = nsimdev.nsims[0]
143:
144: ip(f"link set dev {nsim.ifname} up")
145:
146: napis = nf.napi_get({'ifindex': nsim.ifindex}, dump=True)
147: ksft_eq(len(napis), 2)
148:
149: napi0_id = napis[0]['id']
]
|
| 102/4 |
2026/09/13 00:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 10605
output: 31
thoughts: 68
Thoughts: **Kernel NAPI Configuration: A Quick Hunt**
Okay, so I'm looking at this `nf.napi_set({'id': napi0_id, 'threaded': ...})` call and my initial thought is: Where does this `napi_set` function actually *live* in the kernel? I need to understand its behavior to fully grasp this code. Is it in the core NAPI framework? Is it specific to a driver? I need to track it down.
My next step is to start searching. I'll be looking for the function name, of course: `napi_set`. But, knowing how these things often work, and given the mention of 'threaded', I'll also try variations, like `napi_set_threaded` just in case. And, thinking about how kernel interfaces might be defined, I'll also look for references to `NETDEV_CMD_NAPI_SET`, in case this operation is handled via a netdev control command. This should give me a good start to pinpoint where the actual configuration magic is happening. Then, once I see where it is implemented, I can check how it is used.
|
| 103/4 |
2026/09/13 00:54 |
tool |
grepper |
0m
Args: map[Expression:NETDEV_CMD_NAPI_SET PathPrefix:net/]
Results: map[Output:net/core/netdev-genl-gen.c=115=static const struct nla_policy netdev_bind_rx_nl_policy[NETDEV_A_DMABUF_RX_PAGE_SIZE + 1] = {
--
net/core/netdev-genl-gen.c-121-
net/core/netdev-genl-gen.c:122:/* NETDEV_CMD_NAPI_SET - do */
net/core/netdev-genl-gen.c-123-static const struct nla_policy netdev_napi_set_nl_policy[NETDEV_A_NAPI_THREADED + 1] = {
--
net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {
--
net/core/netdev-genl-gen.c-232- {
net/core/netdev-genl-gen.c:233: .cmd = NETDEV_CMD_NAPI_SET,
net/core/netdev-genl-gen.c-234- .doit = netdev_nl_napi_set_doit,
]
|
| 104/4 |
2026/09/13 00:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 11259
output: 41
thoughts: 36
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into netdev_nl_ops**
Okay, time to dig in. The problem likely lies somewhere in the Netlink interaction for network device management. Let's start by zeroing in on `netdev_nl_ops`. Specifically, I'm going to navigate to line 232 within `net/core/netdev-genl-gen.c`. That's where the core operations for this Netlink family are defined, and usually where you'll find the handlers for requests, like creating, deleting, or configuring network devices, and probably the meat of the issue I'm dealing with. From there I'll start tracing the data flow to try and find the point of failure.
|
| 105/4 |
2026/09/13 00:55 |
tool |
read-file |
0m
Args: map[File:net/core/netdev-genl-gen.c FirstLine:225 LineCount:25]
Results: map[Contents: 225: {
226: .cmd = NETDEV_CMD_BIND_RX,
227: .doit = netdev_nl_bind_rx_doit,
228: .policy = netdev_bind_rx_nl_policy,
229: .maxattr = NETDEV_A_DMABUF_RX_PAGE_SIZE,
230: .flags = GENL_UNS_ADMIN_PERM | GENL_CMD_CAP_DO,
231: },
232: {
233: .cmd = NETDEV_CMD_NAPI_SET,
234: .doit = netdev_nl_napi_set_doit,
235: .policy = netdev_napi_set_nl_policy,
236: .maxattr = NETDEV_A_NAPI_THREADED,
237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
238: },
239: {
240: .cmd = NETDEV_CMD_BIND_TX,
241: .doit = netdev_nl_bind_tx_doit,
242: .policy = netdev_bind_tx_nl_policy,
243: .maxattr = NETDEV_A_DMABUF_FD,
244: .flags = GENL_CMD_CAP_DO,
245: },
246: {
247: .cmd = NETDEV_CMD_QUEUE_CREATE,
248: .doit = netdev_nl_queue_create_doit,
249: .policy = netdev_queue_create_nl_policy,
]
|
| 106/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 11993
output: 29
thoughts: 78
Thoughts: **Diving into Line 237: Flags and Permissions**
Alright, let's zoom in on line 237 β specifically that `flags` assignment: `flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,`. My immediate thought is, "Hold on a minute, what's the nuance between `GENL_ADMIN_PERM` and potentially a `GENL_UNS_ADMIN_PERM` that might exist?" I need to refresh my memory on the exact definition and usage of `GENL_ADMIN_PERM`. Time to dig deeper and understand the intricacies of its implementation! This is where the devil's in the details, so let's get into it.
|
| 107/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM PathPrefix:net/]
Results: map[Output:
Full output is too long, showing 500 out of 781 lines.
Use more precise expression if possible.
net/core/drop_monitor.c=1609=static const struct genl_small_ops dropmon_ops[] = {
--
net/core/drop_monitor.c-1613- .doit = net_dm_cmd_config,
net/core/drop_monitor.c:1614: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1615- },
--
net/core/drop_monitor.c-1619- .doit = net_dm_cmd_trace,
net/core/drop_monitor.c:1620: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1621- },
--
net/core/drop_monitor.c-1625- .doit = net_dm_cmd_trace,
net/core/drop_monitor.c:1626: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1627- },
--
net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {
--
net/core/netdev-genl-gen.c-236- .maxattr = NETDEV_A_NAPI_THREADED,
net/core/netdev-genl-gen.c:237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-238- },
--
net/core/netdev-genl-gen.c-250- .maxattr = NETDEV_A_QUEUE_LEASE,
net/core/netdev-genl-gen.c:251: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-252- },
--
net/devlink/netlink_gen.c=702=const struct genl_split_ops devlink_nl_ops[75] = {
--
net/devlink/netlink_gen.c-743- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:744: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-745- },
--
net/devlink/netlink_gen.c-753- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:754: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-755- },
--
net/devlink/netlink_gen.c-763- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:764: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-765- },
--
net/devlink/netlink_gen.c-773- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:774: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-775- },
--
net/devlink/netlink_gen.c-783- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:784: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-785- },
--
net/devlink/netlink_gen.c-827- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:828: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-829- },
--
net/devlink/netlink_gen.c-854- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:855: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-856- },
--
net/devlink/netlink_gen.c-881- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:882: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-883- },
--
net/devlink/netlink_gen.c-891- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:892: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-893- },
--
net/devlink/netlink_gen.c-901- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:902: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-903- },
--
net/devlink/netlink_gen.c-911- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:912: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-913- },
--
net/devlink/netlink_gen.c-921- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:922: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-923- },
--
net/devlink/netlink_gen.c-961- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:962: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-963- },
--
net/devlink/netlink_gen.c-971- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:972: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-973- },
--
net/devlink/netlink_gen.c-998- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:999: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1000- },
--
net/devlink/netlink_gen.c-1025- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1026: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1027- },
--
net/devlink/netlink_gen.c-1052- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1053: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1054- },
--
net/devlink/netlink_gen.c-1062- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1063: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1064- },
--
net/devlink/netlink_gen.c-1070- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1071: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
net/devlink/netlink_gen.c-1072- },
--
net/devlink/netlink_gen.c-1096- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1097: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1098- },
--
net/devlink/netlink_gen.c-1139- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1140: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1141- },
--
net/devlink/netlink_gen.c-1149- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1150: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1151- },
--
net/devlink/netlink_gen.c-1159- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1160: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1161- },
--
net/devlink/netlink_gen.c-1167- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1168: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
net/devlink/netlink_gen.c-1169- },
--
net/devlink/netlink_gen.c-1177- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1178: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1179- },
--
net/devlink/netlink_gen.c-1187- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1188: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1189- },
--
net/devlink/netlink_gen.c-1214- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1215: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1216- },
--
net/devlink/netlink_gen.c-1241- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1242: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1243- },
--
net/devlink/netlink_gen.c-1268- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1269: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1270- },
--
net/devlink/netlink_gen.c-1278- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1279: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1280- },
--
net/devlink/netlink_gen.c-1305- .maxattr = DEVLINK_ATTR_PARENT_DEV,
net/devlink/netlink_gen.c:1306: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1307- },
--
net/devlink/netlink_gen.c-1315- .maxattr = DEVLINK_ATTR_PARENT_DEV,
net/devlink/netlink_gen.c:1316: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1317- },
--
net/devlink/netlink_gen.c-1325- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1326: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1327- },
--
net/devlink/netlink_gen.c-1352- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1353: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1354- },
--
net/devlink/netlink_gen.c-1378- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1379: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1380- },
--
net/handshake/genl.c=28=static const struct genl_split_ops handshake_nl_ops[] = {
--
net/handshake/genl.c-33- .maxattr = HANDSHAKE_A_ACCEPT_HANDLER_CLASS,
net/handshake/genl.c:34: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/handshake/genl.c-35- },
--
net/handshake/genl.c-40- .maxattr = HANDSHAKE_A_DONE_REMOTE_AUTH,
net/handshake/genl.c:41: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/handshake/genl.c-42- },
--
net/ieee802154/ieee802154.h=9=void ieee802154_nl_exit(void);
--
net/ieee802154/ieee802154.h-15- .dumpit = NULL, \
net/ieee802154/ieee802154.h:16: .flags = GENL_ADMIN_PERM, \
net/ieee802154/ieee802154.h-17- }
--
net/ieee802154/ieee802154.h-23- .dumpit = NULL, \
net/ieee802154/ieee802154.h:24: .flags = GENL_ADMIN_PERM, \
net/ieee802154/ieee802154.h-25- .validate = GENL_DONT_VALIDATE_STRICT,\
--
net/ieee802154/ieee802154.h-39- .dumpit = _dump, \
net/ieee802154/ieee802154.h:40: .flags = GENL_ADMIN_PERM, \
net/ieee802154/ieee802154.h-41- }
--
net/ieee802154/nl802154.c=2770=static const struct genl_ops nl802154_ops[] = {
--
net/ieee802154/nl802154.c-2794- .doit = nl802154_new_interface,
net/ieee802154/nl802154.c:2795: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2796- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2802- .doit = nl802154_del_interface,
net/ieee802154/nl802154.c:2803: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2804- .internal_flags = NL802154_FLAG_NEED_WPAN_DEV |
--
net/ieee802154/nl802154.c-2810- .doit = nl802154_set_channel,
net/ieee802154/nl802154.c:2811: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2812- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2818- .doit = nl802154_set_cca_mode,
net/ieee802154/nl802154.c:2819: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2820- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2826- .doit = nl802154_set_cca_ed_level,
net/ieee802154/nl802154.c:2827: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2828- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2834- .doit = nl802154_set_tx_power,
net/ieee802154/nl802154.c:2835: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2836- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2842- .doit = nl802154_wpan_phy_netns,
net/ieee802154/nl802154.c:2843: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2844- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2850- .doit = nl802154_set_pan_id,
net/ieee802154/nl802154.c:2851: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2852- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2858- .doit = nl802154_set_short_addr,
net/ieee802154/nl802154.c:2859: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2860- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2866- .doit = nl802154_set_backoff_exponent,
net/ieee802154/nl802154.c:2867: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2868- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2874- .doit = nl802154_set_max_csma_backoffs,
net/ieee802154/nl802154.c:2875: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2876- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2882- .doit = nl802154_set_max_frame_retries,
net/ieee802154/nl802154.c:2883: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2884- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2890- .doit = nl802154_set_lbt_mode,
net/ieee802154/nl802154.c:2891: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2892- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2898- .doit = nl802154_set_ackreq_default,
net/ieee802154/nl802154.c:2899: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2900- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2905- .doit = nl802154_trigger_scan,
net/ieee802154/nl802154.c:2906: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2907- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2913- .doit = nl802154_abort_scan,
net/ieee802154/nl802154.c:2914: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2915- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2921- .doit = nl802154_send_beacons,
net/ieee802154/nl802154.c:2922: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2923- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2929- .doit = nl802154_stop_beacons,
net/ieee802154/nl802154.c:2930: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2931- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2937- .doit = nl802154_associate,
net/ieee802154/nl802154.c:2938: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2939- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2945- .doit = nl802154_disassociate,
net/ieee802154/nl802154.c:2946: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2947- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2953- .doit = nl802154_set_max_associations,
net/ieee802154/nl802154.c:2954: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2955- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2967- .doit = nl802154_set_llsec_params,
net/ieee802154/nl802154.c:2968: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2969- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2977- .dumpit = nl802154_dump_llsec_key,
net/ieee802154/nl802154.c:2978: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2979- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2985- .doit = nl802154_add_llsec_key,
net/ieee802154/nl802154.c:2986: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2987- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2993- .doit = nl802154_del_llsec_key,
net/ieee802154/nl802154.c:2994: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2995- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3004- .dumpit = nl802154_dump_llsec_dev,
net/ieee802154/nl802154.c:3005: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3006- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3012- .doit = nl802154_add_llsec_dev,
net/ieee802154/nl802154.c:3013: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3014- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3020- .doit = nl802154_del_llsec_dev,
net/ieee802154/nl802154.c:3021: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3022- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3031- .dumpit = nl802154_dump_llsec_devkey,
net/ieee802154/nl802154.c:3032: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3033- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3039- .doit = nl802154_add_llsec_devkey,
net/ieee802154/nl802154.c:3040: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3041- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3047- .doit = nl802154_del_llsec_devkey,
net/ieee802154/nl802154.c:3048: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3049- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3057- .dumpit = nl802154_dump_llsec_seclevel,
net/ieee802154/nl802154.c:3058: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3059- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3065- .doit = nl802154_add_llsec_seclevel,
net/ieee802154/nl802154.c:3066: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3067- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3074- .doit = nl802154_del_llsec_seclevel,
net/ieee802154/nl802154.c:3075: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3076- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ipv4/fou_nl.c=30=const struct genl_small_ops fou_nl_ops[3] = {
--
net/ipv4/fou_nl.c-34- .doit = fou_nl_add_doit,
net/ipv4/fou_nl.c:35: .flags = GENL_ADMIN_PERM,
net/ipv4/fou_nl.c-36- },
--
net/ipv4/fou_nl.c-40- .doit = fou_nl_del_doit,
net/ipv4/fou_nl.c:41: .flags = GENL_ADMIN_PERM,
net/ipv4/fou_nl.c-42- },
--
net/ipv4/tcp_metrics.c=972=static const struct genl_small_ops tcp_metrics_nl_ops[] = {
--
net/ipv4/tcp_metrics.c-982- .doit = tcp_metrics_nl_cmd_del,
net/ipv4/tcp_metrics.c:983: .flags = GENL_ADMIN_PERM,
net/ipv4/tcp_metrics.c-984- },
--
net/ipv6/ila/ila_main.c=15=static const struct genl_ops ila_nl_ops[] = {
--
net/ipv6/ila/ila_main.c-19- .doit = ila_xlat_nl_cmd_add_mapping,
net/ipv6/ila/ila_main.c:20: .flags = GENL_ADMIN_PERM,
net/ipv6/ila/ila_main.c-21- },
--
net/ipv6/ila/ila_main.c-25- .doit = ila_xlat_nl_cmd_del_mapping,
net/ipv6/ila/ila_main.c:26: .flags = GENL_ADMIN_PERM,
net/ipv6/ila/ila_main.c-27- },
--
net/ipv6/ila/ila_main.c-31- .doit = ila_xlat_nl_cmd_flush,
net/ipv6/ila/ila_main.c:32: .flags = GENL_ADMIN_PERM,
net/ipv6/ila/ila_main.c-33- },
--
net/ipv6/ioam6.c=552=static const struct genl_ops ioam6_genl_ops[] = {
--
net/ipv6/ioam6.c-556- .doit = ioam6_genl_addns,
net/ipv6/ioam6.c:557: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-558- .policy = ioam6_genl_policy_addns,
--
net/ipv6/ioam6.c-564- .doit = ioam6_genl_delns,
net/ipv6/ioam6.c:565: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-566- .policy = ioam6_genl_policy_delns,
--
net/ipv6/ioam6.c-574- .done = ioam6_genl_dumpns_done,
net/ipv6/ioam6.c:575: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-576- },
--
net/ipv6/ioam6.c-580- .doit = ioam6_genl_addsc,
net/ipv6/ioam6.c:581: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-582- .policy = ioam6_genl_policy_addsc,
--
net/ipv6/ioam6.c-588- .doit = ioam6_genl_delsc,
net/ipv6/ioam6.c:589: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-590- .policy = ioam6_genl_policy_delsc,
--
net/ipv6/ioam6.c-598- .done = ioam6_genl_dumpsc_done,
net/ipv6/ioam6.c:599: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-600- },
--
net/ipv6/ioam6.c-604- .doit = ioam6_genl_ns_set_schema,
net/ipv6/ioam6.c:605: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-606- .policy = ioam6_genl_policy_ns_sc,
--
net/ipv6/seg6.c=465=static const struct genl_ops seg6_genl_ops[] = {
--
net/ipv6/seg6.c-469- .doit = seg6_genl_sethmac,
net/ipv6/seg6.c:470: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-471- },
--
net/ipv6/seg6.c-477- .done = seg6_genl_dumphmac_done,
net/ipv6/seg6.c:478: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-479- },
--
net/ipv6/seg6.c-483- .doit = seg6_genl_set_tunsrc,
net/ipv6/seg6.c:484: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-485- },
--
net/ipv6/seg6.c-489- .doit = seg6_genl_get_tunsrc,
net/ipv6/seg6.c:490: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-491- },
--
net/ncsi/ncsi-netlink.c=727=static const struct genl_small_ops ncsi_ops[] = {
--
net/ncsi/ncsi-netlink.c-738- .doit = ncsi_set_interface_nl,
net/ncsi/ncsi-netlink.c:739: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-740- },
--
net/ncsi/ncsi-netlink.c-744- .doit = ncsi_clear_interface_nl,
net/ncsi/ncsi-netlink.c:745: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-746- },
--
net/ncsi/ncsi-netlink.c-750- .doit = ncsi_send_cmd_nl,
net/ncsi/ncsi-netlink.c:751: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-752- },
--
net/ncsi/ncsi-netlink.c-756- .doit = ncsi_set_package_mask_nl,
net/ncsi/ncsi-netlink.c:757: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-758- },
--
net/ncsi/ncsi-netlink.c-762- .doit = ncsi_set_channel_mask_nl,
net/ncsi/ncsi-netlink.c:763: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-764- },
--
net/netfilter/ipvs/ip_vs_ctl.c=4916=static const struct genl_small_ops ip_vs_genl_ops[] = {
--
net/netfilter/ipvs/ip_vs_ctl.c-4919- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4920: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4921- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4925- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4926: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4927- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4931- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4932: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4933- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4937- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4938: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4939- .doit = ip_vs_genl_get_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4944- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4945: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4946- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4950- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4951: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4952- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4956- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4957: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4958- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4962- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4963: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4964- .dumpit = ip_vs_genl_dump_dests,
--
net/netfilter/ipvs/ip_vs_ctl.c-4968- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4969: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4970- .doit = ip_vs_genl_set_daemon,
--
net/netfilter/ipvs/ip_vs_ctl.c-4974- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4975: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4976- .doit = ip_vs_genl_set_daemon,
--
net/netfilter/ipvs/ip_vs_ctl.c-4980- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4981: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4982- .dumpit = ip_vs_genl_dump_daemons,
--
net/netfilter/ipvs/ip_vs_ctl.c-4986- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4987: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4988- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4992- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4993: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4994- .doit = ip_vs_genl_get_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4998- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4999: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-5000- .doit = ip_vs_genl_get_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-5004- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:5005: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-5006- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-5010- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:5011: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-5012- .doit = ip_vs_genl_set_cmd,
--
net/netlabel/netlabel_calipso.c=332=static const struct genl_small_ops netlbl_calipso_ops[] = {
--
net/netlabel/netlabel_calipso.c-335- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netlabel/netlabel_calipso.c:336: .flags = GENL_ADMIN_PERM,
net/netlabel/netlabel_calipso.c-337- .doit = netlbl_calipso_add,
--
]
|
| 108/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 25608
output: 37
thoughts: 47
Thoughts: Okay, here's the summary, rendered as if it's my own thought process:
**Diving into Genetlink Permissions**
Alright, time to understand how these generic netlink permissions are being handled. I need to figure out where `GENL_ADMIN_PERM` and `GENL_UNS_ADMIN_PERM` are actually *checked* within the kernel. Let's see... the most likely starting point is the generic netlink implementation itself. So, I'm going to head directly into `net/netlink/genetlink.c`. That seems like the logical place to start digging. Grep time! Let's get cracking.
|
| 109/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM PathPrefix:net/netlink/genetlink.c]
Results: map[Output:net/netlink/genetlink.c=1155=static int genl_family_rcv_msg(const struct genl_family *family,
--
net/netlink/genetlink.c-1181-
net/netlink/genetlink.c:1182: if ((op.flags & GENL_ADMIN_PERM) &&
net/netlink/genetlink.c-1183- !netlink_capable(skb, CAP_NET_ADMIN))
]
|
| 110/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 25970
output: 39
thoughts: 88
Thoughts: Here's my summary, as though I were thinking through the code:
**Diving into Genetlink Permissions**
Okay, so I'm digging into `net/netlink/genetlink.c` again. I want to understand how GENL_ADMIN_PERM permissions are being handled. Specifically, let's zoom in on line 1182, because it seems crucial:
```c
if ((op.flags & GENL_ADMIN_PERM) &&
!netlink_capable(skb, CAP_NET_ADMIN))
```
That conditional logic is pretty telling. It looks like it's checking if a specific operation has the `GENL_ADMIN_PERM` flag set *and* if the netlink message isn't coming from a socket with `CAP_NET_ADMIN` capability. My immediate assumption is that this implies that admin-level genetlink operations are contingent on this capability check.
To get the complete picture and not make assumptions, I need the context. Let me read the surrounding lines, say from 1175 to 1205. That should give me a good handle on what `op.flags` is, how it's being set, what the overall flow of execution looks like, and what consequences the conditional on line 1182 has. I want to see how these checks relate to authorization and access control within the GENL framework. Knowing this particular check is critical, as it likely defines whether an admin can use the network interface, potentially to reconfigure the interfaces. Time to parse the surrounding code and ensure my initial assumptions are correct.
|
| 111/4 |
2026/09/13 00:55 |
tool |
read-file |
0m
Args: map[File:net/netlink/genetlink.c FirstLine:1175 LineCount:30]
Results: map[Contents:1175: return -EINVAL;
1176:
1177: flags = (nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP ?
1178: GENL_CMD_CAP_DUMP : GENL_CMD_CAP_DO;
1179: if (genl_get_cmd(hdr->cmd, flags, family, &op))
1180: return -EOPNOTSUPP;
1181:
1182: if ((op.flags & GENL_ADMIN_PERM) &&
1183: !netlink_capable(skb, CAP_NET_ADMIN))
1184: return -EPERM;
1185:
1186: if ((op.flags & GENL_UNS_ADMIN_PERM) &&
1187: !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
1188: return -EPERM;
1189:
1190: if (flags & GENL_CMD_CAP_DUMP)
1191: return genl_family_rcv_msg_dumpit(family, skb, nlh, extack,
1192: &op, hdrlen, net);
1193: else
1194: return genl_family_rcv_msg_doit(family, skb, nlh, extack,
1195: &op, hdrlen, net);
1196: }
1197:
1198: static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
1199: struct netlink_ext_ack *extack)
1200: {
1201: const struct genl_family *family;
1202: int err;
1203:
1204: family = genl_family_find_byid(nlh->nlmsg_type);
]
|
| 112/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26983
output: 38
thoughts: 142
Thoughts: **Analyzing Netlink Permission Checks**
Okay, here's what I'm seeing: there's this `netlink_capable` call, and it's being used to enforce some admin permissions. The code specifically checks for `GENL_ADMIN_PERM` and `GENL_UNS_ADMIN_PERM` flags. My gut says this is about controlling access to certain Netlink operations.
The first `if` statement checks `GENL_ADMIN_PERM` and uses `netlink_capable` to see if the socket buffer `skb` has `CAP_NET_ADMIN` privileges. Pretty standard for a system that needs high-level network control. The second one, with `GENL_UNS_ADMIN_PERM`, is particularly interesting because it's using `netlink_ns_capable` and checking permissions in a user namespace. That `net->user_ns` variable is key - it tells us we're operating within a specific user namespace context. This is what I expect to see.
Now, the interesting bit here is `netlink_capable`, so I need to check its definition. This is where it gets interesting... this likely means the check involves the `init_user_ns`. I'll have to delve deeper to find out exactly how it determines the capability, especially how it handles the user namespace aspect. Knowing how this check is implemented is crucial for understanding the security model and any potential vulnerabilities or bypasses. I'll need to dig into the kernel source to get a complete picture.
|
| 113/4 |
2026/09/13 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netlink/genetlink.c Name:netlink_capable]
Results: map[SourceCode: 874: /**
875: * netlink_capable - Netlink global message capability test
876: * @skb: socket buffer holding a netlink command from userspace
877: * @cap: The capability to use
878: *
879: * Test to see if the opener of the socket we received the message
880: * from had when the netlink socket was created and the sender of the
881: * message has the capability @cap in all user namespaces.
882: */
883: bool netlink_capable(const struct sk_buff *skb, int cap)
884: {
885: return netlink_ns_capable(skb, &init_user_ns, cap);
886: }
SourceFile:net/netlink/af_netlink.c]
|
| 114/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 27733
output: 28
thoughts: 200
Thoughts: **Investigating the NAPI Threading Capability in Netlink**
Okay, so `netlink_capable` is the gatekeeper here, calling `netlink_ns_capable` with `skb`, `&init_user_ns`, and the capability we're checking. This means `NETDEV_CMD_NAPI_SET` needing `GENL_ADMIN_PERM | GENL_CMD_CAP_DO` flags and requiring `netlink_capable(skb, CAP_NET_ADMIN)` ultimately ties back to the `init_user_ns`. But I need to verify, is there some other netlink command or RTNL attribute that is related to threaded NAPI, that would provide another access path or configuration option? Let's dive into the RTNL world.
I'm specifically thinking about RTNL attributes, like `IFLA_...`. Is there anything related to 'threaded' NAPI there? Let's do a more thorough search across the codebase. I need to make sure I haven't missed a more direct attribute for enabling or disabling threaded NAPI. I'll search for `netif_set_threaded`, `dev_set_threaded`, or even `napi_set_threaded`, and see what the results bring up. This should tell me what I am missing or confirm that everything is as expected.
|
| 115/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Args: map[Expression:napi_set_threaded PathPrefix:net/]
Results: map[Output:net/core/dev.c=7209=static void napi_stop_kthread(struct napi_struct *napi)
--
net/core/dev.c-7246-
net/core/dev.c:7247:static void napi_set_threaded_state(struct napi_struct *napi,
net/core/dev.c-7248- enum netdev_napi_threaded threaded_mode)
--
net/core/dev.c-7256-
net/core/dev.c:7257:int napi_set_threaded(struct napi_struct *napi,
net/core/dev.c-7258- enum netdev_napi_threaded threaded)
--
net/core/dev.c-7282- smp_mb__before_atomic();
net/core/dev.c:7283: napi_set_threaded_state(napi, threaded);
net/core/dev.c-7284- }
--
net/core/dev.c=7289=int netif_set_threaded(struct net_device *dev,
--
net/core/dev.c-7312- list_for_each_entry(napi, &dev->napi_list, dev_list)
net/core/dev.c:7313: WARN_ON_ONCE(napi_set_threaded(napi, threaded));
net/core/dev.c-7314-
--
net/core/dev.c=7534=static void napi_restore_config(struct napi_struct *n)
--
net/core/dev.c-7553-
net/core/dev.c:7554: WARN_ON_ONCE(napi_set_threaded(n, n->config->threaded));
net/core/dev.c-7555-}
--
net/core/dev.h=369=napi_get_threaded_config(struct net_device *dev, struct napi_struct *n)
--
net/core/dev.h-375-
net/core/dev.h:376:int napi_set_threaded(struct napi_struct *n,
net/core/dev.h-377- enum netdev_napi_threaded threaded);
--
net/core/netdev-genl.c=327=netdev_nl_napi_set_config(struct napi_struct *napi, struct genl_info *info)
--
net/core/netdev-genl.c-337- threaded = nla_get_uint(info->attrs[NETDEV_A_NAPI_THREADED]);
net/core/netdev-genl.c:338: ret = napi_set_threaded(napi, threaded);
net/core/netdev-genl.c-339- if (ret)
]
|
| 116/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 28973
output: 38
thoughts: 135
Thoughts: **Investigating Threaded Network Device Configuration**
Okay, so I've been digging into the network device threading configuration. It seems `napi_set_threaded` is only called from a specific set of functions: `netif_set_threaded`, `napi_restore_config`, and `netdev_nl_napi_set_config`. That's a limited set. I need to understand the complete picture, though.
Now, I'm wondering about the interaction with `netdev_lock_store` and how it relates to that sysfs `/sys/class/net/<dev>/threaded` file. That's a crucial piece. I need to see how the user-space configuration interacts with the kernel's threading state.
I'll start by examining `threaded_store` within `net/core/net-sysfs.c`. This is where the magic happens, where the sysfs file writes are handled. I need to understand exactly what that function does. I'll need to review `modify_napi_threaded` which is part of that too. And finally, to be thorough, I should also look at `netdev_lock_store` in the same file. That should give me a good understanding of the entire flow.
|
| 117/4 |
2026/09/13 00:55 |
tool |
read-file |
0m
Args: map[File:net/core/net-sysfs.c FirstLine:725 LineCount:45]
Results: map[Contents: 725: .is_visible = netdev_phys_is_visible,
726: };
727:
728: static ssize_t threaded_show(struct device *dev,
729: struct device_attribute *attr, char *buf)
730: {
731: struct net_device *netdev = to_net_dev(dev);
732: ssize_t ret = -EINVAL;
733:
734: rcu_read_lock();
735:
736: if (dev_isalive(netdev))
737: ret = sysfs_emit(buf, fmt_dec, READ_ONCE(netdev->threaded));
738:
739: rcu_read_unlock();
740:
741: return ret;
742: }
743:
744: static int modify_napi_threaded(struct net_device *dev, unsigned long val)
745: {
746: int ret;
747:
748: if (list_empty(&dev->napi_list))
749: return -EOPNOTSUPP;
750:
751: if (val != 0 && val != 1)
752: return -EOPNOTSUPP;
753:
754: ret = netif_set_threaded(dev, val);
755:
756: return ret;
757: }
758:
759: static ssize_t threaded_store(struct device *dev,
760: struct device_attribute *attr,
761: const char *buf, size_t len)
762: {
763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
764: }
765: static DEVICE_ATTR_RW(threaded);
766:
767: static struct attribute *net_class_attrs[] __ro_after_init = {
768: &dev_attr_netdev_group.attr,
769: &dev_attr_type.attr,
]
|
| 118/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30047
output: 36
thoughts: 36
Thoughts: Here's my attempt at summarizing the thought process, as if I were an expert:
**Investigating Network Device Lock Management**
Alright, let's dive in. The core question I have here is, what's the functionality of `netdev_lock_store`? This clearly seems like a critical piece of the network device locking puzzle. To understand its role fully, I need to contrast it directly with `netdev_store`. Comparing these two functions should quickly illuminate the specific responsibilities of `netdev_lock_store` within the broader context of device configuration and management. Let's see what the code reveals.
|
| 119/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Args: map[Expression:netdev_lock_store PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=188=static ssize_t
net/core/net-sysfs.c:189:netdev_lock_store(struct device *dev, struct device_attribute *attr,
net/core/net-sysfs.c-190- const char *buf, size_t len,
--
net/core/net-sysfs.c=528=static ssize_t gro_flush_timeout_store(struct device *dev,
--
net/core/net-sysfs.c-534-
net/core/net-sysfs.c:535: return netdev_lock_store(dev, attr, buf, len, change_gro_flush_timeout);
net/core/net-sysfs.c-536-}
--
net/core/net-sysfs.c=548=static ssize_t napi_defer_hard_irqs_store(struct device *dev,
--
net/core/net-sysfs.c-554-
net/core/net-sysfs.c:555: return netdev_lock_store(dev, attr, buf, len,
net/core/net-sysfs.c-556- change_napi_defer_hard_irqs);
--
net/core/net-sysfs.c=759=static ssize_t threaded_store(struct device *dev,
--
net/core/net-sysfs.c-762-{
net/core/net-sysfs.c:763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
net/core/net-sysfs.c-764-}
]
|
| 120/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30679
output: 38
thoughts: 26
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `netdev_lock_store`**
Okay, time to dig into `netdev_lock_store`. Right, it's in `net/core/net-sysfs.c`, which makes sense. This function must be the write handler for the "lock" attribute exposed in the net device sysfs entry. It's probably the mechanism for, well, locking a network device, likely for exclusive configuration changes or something similar. I need to see how it handles concurrency and what resources it protects. Is it just a simple spinlock, or something more sophisticated? What about error handling? And how does it interact with other locking primitives in the networking stack? Understanding the implications of this lock is key to preventing race conditions. Let's see how it's implemented.
|
| 121/4 |
2026/09/13 00:55 |
tool |
read-file |
0m
Args: map[File:net/core/net-sysfs.c FirstLine:185 LineCount:40]
Results: map[Contents: 185: }
186:
187: /* Same as netdev_store() but takes netdev_lock() instead of rtnl_lock() */
188: static ssize_t
189: netdev_lock_store(struct device *dev, struct device_attribute *attr,
190: const char *buf, size_t len,
191: int (*set)(struct net_device *, unsigned long))
192: {
193: struct net_device *netdev = to_net_dev(dev);
194: struct net *net = dev_net(netdev);
195: unsigned long new;
196: int ret;
197:
198: if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
199: return -EPERM;
200:
201: ret = kstrtoul(buf, 0, &new);
202: if (ret)
203: return ret;
204:
205: netdev_lock(netdev);
206:
207: if (dev_isalive(netdev)) {
208: ret = (*set)(netdev, new);
209: if (ret == 0)
210: ret = len;
211: }
212: netdev_unlock(netdev);
213:
214: return ret;
215: }
216:
217: NETDEVICE_SHOW_RO(dev_id, fmt_hex);
218: NETDEVICE_SHOW_RO(dev_port, fmt_dec);
219: NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec);
220: NETDEVICE_SHOW_RO(addr_len, fmt_dec);
221: NETDEVICE_SHOW_RO(ifindex, fmt_dec);
222: NETDEVICE_SHOW_RO(type, fmt_dec);
223: NETDEVICE_SHOW_RO(link_mode, fmt_dec);
224:
]
|
| 122/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 31530
output: 35
thoughts: 571
Thoughts: **Analyzing Potential Privilege Escalation via Tunnel Device Creation**
Okay, so I'm looking at `netdev_lock_store`. It's pretty straightforward: it takes a value, performs some operations on a network device, and importantly, checks for `CAP_NET_ADMIN` in the network namespace using `ns_capable`. Good, that's what I'd expect.
Now, I'm thinking about `modify_napi_threaded`. It checks if the `napi_list` is empty on a device. If it *is* empty, it returns `EOPNOTSUPP`. That's line 748, right? This is where it gets interesting...
Can a tunnel device, like GRE, VXLAN, or something similar, have an *empty* `napi_list`? That's the key. And, more importantly, can an *unprivileged* user create one of these tunnel devices inside a user namespace where they *do* have `CAP_NET_ADMIN`? If they can create a tunnel device, they can presumably modify its NAPI state. Hmmm...
If they *can* create a tunnel device, does `netdev_lock_store` then provide an escalation path by allowing them to potentially modify NAPI state? This would bypass the checks that prevent NAPI from being disabled.
Okay, so how *are* tunnel devices created? Is it via `rtnl_link_ops` or with `ioctl` calls? I need to check how `ip link add` works for various tunnel types: GRE, VXLAN, GENEVE, IPIP, SIT, WireGuard, MacVLAN, VETH, etc. I need to see if `rtnl` checks the necessary privileges when creating these links. I'm going to look at `rtnl_newlink`, `rtnl_create_link`, or where the `rtnl_link_ops` are called in order to determine what checks are made and if this is a viable attack vector.
|
| 123/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Args: map[Expression:rtnl_create_link PathPrefix:net/core/rtnetlink.c]
Results: map[Output:net/core/rtnetlink.c=3743=EXPORT_SYMBOL(rtnl_configure_link);
net/core/rtnetlink.c-3744-
net/core/rtnetlink.c:3745:struct net_device *rtnl_create_link(struct net *net, const char *ifname,
net/core/rtnetlink.c-3746- unsigned char name_assign_type,
--
net/core/rtnetlink.c-3838-}
net/core/rtnetlink.c:3839:EXPORT_SYMBOL(rtnl_create_link);
net/core/rtnetlink.c-3840-
--
net/core/rtnetlink.c=3933=static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
--
net/core/rtnetlink.c-3963-
net/core/rtnetlink.c:3964: dev = rtnl_create_link(tgt_net, ifname, name_assign_type, ops, tb,
net/core/rtnetlink.c-3965- extack);
]
|
| 124/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 32871
output: 38
thoughts: 34
Thoughts: Here's my take:
**Diving into the Link Creation Process**
Okay, time to get my hands dirty. I need to understand the nitty-gritty of link creation in the networking stack. Let's start with `rtnl_create_link` and `rtnl_newlink`. I'm specifically interested in lines 3745 and 3933, as those seem like good entry points to see what's really happening under the hood. Hopefully, this will shed some light on the control flow and data structures involved when a new link is brought up. I'm eager to dissect the interaction between these two functions and see how they work together, and I'll keep an eye out for any potential optimizations or areas for future investigation.
|
| 125/4 |
2026/09/13 00:55 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:3745 LineCount:60]
Results: map[Contents:3745: struct net_device *rtnl_create_link(struct net *net, const char *ifname,
3746: unsigned char name_assign_type,
3747: const struct rtnl_link_ops *ops,
3748: struct nlattr *tb[],
3749: struct netlink_ext_ack *extack)
3750: {
3751: struct net_device *dev;
3752: unsigned int num_tx_queues = 1;
3753: unsigned int num_rx_queues = 1;
3754: int err;
3755:
3756: if (tb[IFLA_NUM_TX_QUEUES])
3757: num_tx_queues = nla_get_u32(tb[IFLA_NUM_TX_QUEUES]);
3758: else if (ops->get_num_tx_queues)
3759: num_tx_queues = ops->get_num_tx_queues();
3760:
3761: if (tb[IFLA_NUM_RX_QUEUES])
3762: num_rx_queues = nla_get_u32(tb[IFLA_NUM_RX_QUEUES]);
3763: else if (ops->get_num_rx_queues)
3764: num_rx_queues = ops->get_num_rx_queues();
3765:
3766: if (num_tx_queues < 1 || num_tx_queues > 4096) {
3767: NL_SET_ERR_MSG(extack, "Invalid number of transmit queues");
3768: return ERR_PTR(-EINVAL);
3769: }
3770:
3771: if (num_rx_queues < 1 || num_rx_queues > 4096) {
3772: NL_SET_ERR_MSG(extack, "Invalid number of receive queues");
3773: return ERR_PTR(-EINVAL);
3774: }
3775:
3776: if (ops->alloc) {
3777: dev = ops->alloc(tb, ifname, name_assign_type,
3778: num_tx_queues, num_rx_queues);
3779: if (IS_ERR(dev))
3780: return dev;
3781: } else {
3782: dev = alloc_netdev_mqs(ops->priv_size, ifname,
3783: name_assign_type, ops->setup,
3784: num_tx_queues, num_rx_queues);
3785: }
3786:
3787: if (!dev)
3788: return ERR_PTR(-ENOMEM);
3789:
3790: err = validate_linkmsg(dev, tb, extack);
3791: if (err < 0) {
3792: free_netdev(dev);
3793: return ERR_PTR(err);
3794: }
3795:
3796: dev_net_set(dev, net);
3797: dev->rtnl_link_ops = ops;
3798: dev->rtnl_link_initializing = true;
3799:
3800: if (tb[IFLA_MTU]) {
3801: u32 mtu = nla_get_u32(tb[IFLA_MTU]);
3802:
3803: err = dev_validate_mtu(dev, mtu, extack);
3804: if (err) {
]
|
| 126/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 34125
output: 34
thoughts: 41
Thoughts: Okay, let's break this down.
**Investigating Network Link Creation Permissions**
Right, so I need to figure out the permissions that are being evaluated during the creation of a new network link, especially within the context of the Linux kernel. Where does the check actually *happen*? My initial thought is to dive into the `rtnl_newlink` function itself. That's the obvious place to start, right? But I also need to be thorough. I should expand my search to include functions that *call* `rtnl_newlink` or, better yet, `rtnl_newlink_create`, just in case the check is handled upstream and propagated down. I need a comprehensive view of the code flow to be sure I'm not missing anything. This should give me a complete picture of the authorization process involved in adding new links. Time to start digging through the source...
|
| 127/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Args: map[Expression:rtnl_newlink PathPrefix:net/core/rtnetlink.c]
Results: map[Output:net/core/rtnetlink.c=3839=EXPORT_SYMBOL(rtnl_create_link);
net/core/rtnetlink.c-3840-
net/core/rtnetlink.c:3841:struct rtnl_newlink_tbs {
net/core/rtnetlink.c-3842- struct nlattr *tb[IFLA_MAX + 1];
--
net/core/rtnetlink.c=3848=static int rtnl_changelink(const struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/core/rtnetlink.c-3850- struct net_device *dev, struct net *tgt_net,
net/core/rtnetlink.c:3851: struct rtnl_newlink_tbs *tbs,
net/core/rtnetlink.c-3852- struct nlattr **data,
--
net/core/rtnetlink.c=3913=static int rtnl_group_changelink(const struct sk_buff *skb,
--
net/core/rtnetlink.c-3932-
net/core/rtnetlink.c:3933:static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
net/core/rtnetlink.c-3934- const struct rtnl_link_ops *ops,
--
net/core/rtnetlink.c-3941- unsigned char name_assign_type = NET_NAME_USER;
net/core/rtnetlink.c:3942: struct rtnl_newlink_params params = {
net/core/rtnetlink.c-3943- .src_net = sock_net(skb->sk),
--
net/core/rtnetlink.c=4007=static struct net *rtnl_get_peer_net(struct sk_buff *skb,
--
net/core/rtnetlink.c-4044-
net/core/rtnetlink.c:4045:static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/rtnetlink.c-4046- const struct rtnl_link_ops *ops,
--
net/core/rtnetlink.c-4048- struct net *peer_net,
net/core/rtnetlink.c:4049: struct rtnl_newlink_tbs *tbs,
net/core/rtnetlink.c-4050- struct nlattr **data,
--
net/core/rtnetlink.c-4102-
net/core/rtnetlink.c:4103: return rtnl_newlink_create(skb, ifm, ops, tgt_net, link_net, peer_net, nlh,
net/core/rtnetlink.c-4104- tb, data, extack);
--
net/core/rtnetlink.c-4106-
net/core/rtnetlink.c:4107:static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/rtnetlink.c-4108- struct netlink_ext_ack *extack)
--
net/core/rtnetlink.c-4112- struct rtnl_link_ops *ops = NULL;
net/core/rtnetlink.c:4113: struct rtnl_newlink_tbs *tbs;
net/core/rtnetlink.c-4114- struct rtnl_nets rtnl_nets;
--
net/core/rtnetlink.c-4219- rtnl_nets_lock(&rtnl_nets);
net/core/rtnetlink.c:4220: ret = __rtnl_newlink(skb, nlh, ops, tgt_net, link_net, peer_net, tbs, data, extack);
net/core/rtnetlink.c-4221- rtnl_nets_unlock(&rtnl_nets);
--
net/core/rtnetlink.c=4427=static int rtnl_linkprop(int cmd, struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/core/rtnetlink.c-4474-
net/core/rtnetlink.c:4475:static int rtnl_newlinkprop(struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/rtnetlink.c-4476- struct netlink_ext_ack *extack)
--
net/core/rtnetlink.c=7239=static const struct rtnl_msg_handler rtnetlink_rtnl_msg_handlers[] __initconst = {
net/core/rtnetlink.c:7240: {.msgtype = RTM_NEWLINK, .doit = rtnl_newlink,
net/core/rtnetlink.c-7241- .flags = RTNL_FLAG_DOIT_PERNET},
--
net/core/rtnetlink.c-7256- {.msgtype = RTM_SETSTATS, .doit = rtnl_stats_set},
net/core/rtnetlink.c:7257: {.msgtype = RTM_NEWLINKPROP, .doit = rtnl_newlinkprop},
net/core/rtnetlink.c-7258- {.msgtype = RTM_DELLINKPROP, .doit = rtnl_dellinkprop},
]
|
| 128/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 35808
output: 38
thoughts: 50
Thoughts: Here's my thinking process:
**Diving into `rtnl_newlink` Permission Checks**
Okay, so I need to understand the permission checks within `rtnl_newlink`. I'm starting at line 4107 in `net/core/rtnetlink.c`, as that's where I believe the relevant code begins. I need to figure out what criteria are being evaluated to determine if a user has the authority to create a new network link. Itβs likely a combination of CAP_NET_ADMIN capabilities and potentially some more fine-grained checks based on the specific parameters of the request. Let's see how granular these checks are.
|
| 129/4 |
2026/09/13 00:55 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:4107 LineCount:70]
Results: map[Contents:4107: static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
4108: struct netlink_ext_ack *extack)
4109: {
4110: struct net *tgt_net, *link_net = NULL, *peer_net = NULL;
4111: struct nlattr **tb, **linkinfo, **data = NULL;
4112: struct rtnl_link_ops *ops = NULL;
4113: struct rtnl_newlink_tbs *tbs;
4114: struct rtnl_nets rtnl_nets;
4115: int ops_srcu_index;
4116: int ret;
4117:
4118: tbs = kmalloc_obj(*tbs);
4119: if (!tbs)
4120: return -ENOMEM;
4121:
4122: tb = tbs->tb;
4123: ret = nlmsg_parse_deprecated(nlh, sizeof(struct ifinfomsg), tb,
4124: IFLA_MAX, ifla_policy, extack);
4125: if (ret < 0)
4126: goto free;
4127:
4128: ret = rtnl_ensure_unique_netns(tb, extack, false);
4129: if (ret < 0)
4130: goto free;
4131:
4132: linkinfo = tbs->linkinfo;
4133: if (tb[IFLA_LINKINFO]) {
4134: ret = nla_parse_nested_deprecated(linkinfo, IFLA_INFO_MAX,
4135: tb[IFLA_LINKINFO],
4136: ifla_info_policy, NULL);
4137: if (ret < 0)
4138: goto free;
4139: } else {
4140: memset(linkinfo, 0, sizeof(tbs->linkinfo));
4141: }
4142:
4143: if (linkinfo[IFLA_INFO_KIND]) {
4144: char kind[MODULE_NAME_LEN];
4145:
4146: nla_strscpy(kind, linkinfo[IFLA_INFO_KIND], sizeof(kind));
4147: ops = rtnl_link_ops_get(kind, &ops_srcu_index);
4148: #ifdef CONFIG_MODULES
4149: if (!ops) {
4150: request_module("rtnl-link-%s", kind);
4151: ops = rtnl_link_ops_get(kind, &ops_srcu_index);
4152: }
4153: #endif
4154: }
4155:
4156: rtnl_nets_init(&rtnl_nets);
4157:
4158: if (ops) {
4159: if (ops->maxtype > RTNL_MAX_TYPE) {
4160: ret = -EINVAL;
4161: goto put_ops;
4162: }
4163:
4164: if (ops->maxtype && linkinfo[IFLA_INFO_DATA]) {
4165: ret = nla_parse_nested_deprecated(tbs->attr, ops->maxtype,
4166: linkinfo[IFLA_INFO_DATA],
4167: ops->policy, extack);
4168: if (ret < 0)
4169: goto put_ops;
4170:
4171: data = tbs->attr;
4172: }
4173:
4174: if (ops->validate) {
4175: ret = ops->validate(tb, data, extack);
4176: if (ret < 0)
]
|
| 130/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 37124
output: 38
thoughts: 33
Thoughts: Here's my take on the thought process, as requested:
**Diving Deeper into Link Creation**
Okay, so I've got a good grasp of the high-level network interface creation process, but to really understand the nitty-gritty, I need to get into the heart of it. Let's trace this logic out: I need to look at the implementations of `rtnl_newlink`, `__rtnl_newlink`, and `rtnl_newlink_create`. Seeing how these functions interact is crucial. I want to understand exactly how the new link is constructed, configured, and integrated into the system, and these function calls are the keys to unlocking that knowledge. Time to get my hands dirty and examine the actual code! I'm expecting to see things like attribute handling, device registration, and the fundamental steps of bringing a network interface online. Let's see what's really happening under the hood.
|
| 131/4 |
2026/09/13 00:55 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:4177 LineCount:60]
Results: map[Contents:4177: goto put_ops;
4178: }
4179:
4180: if (ops->peer_type) {
4181: peer_net = rtnl_get_peer_net(skb, ops, tb, data, extack);
4182: if (IS_ERR(peer_net)) {
4183: ret = PTR_ERR(peer_net);
4184: goto put_ops;
4185: }
4186: if (peer_net)
4187: rtnl_nets_add(&rtnl_nets, peer_net);
4188: }
4189: }
4190:
4191: tgt_net = rtnl_link_get_net_capable(skb, sock_net(skb->sk), tb, CAP_NET_ADMIN);
4192: if (IS_ERR(tgt_net)) {
4193: ret = PTR_ERR(tgt_net);
4194: goto put_net;
4195: }
4196:
4197: rtnl_nets_add(&rtnl_nets, tgt_net);
4198:
4199: if (tb[IFLA_LINK_NETNSID]) {
4200: int id = nla_get_s32(tb[IFLA_LINK_NETNSID]);
4201:
4202: link_net = get_net_ns_by_id(tgt_net, id);
4203: if (!link_net) {
4204: NL_SET_ERR_MSG(extack, "Unknown network namespace id");
4205: ret = -EINVAL;
4206: goto put_net;
4207: }
4208:
4209: rtnl_nets_add(&rtnl_nets, link_net);
4210:
4211: if (!netlink_ns_capable(skb, link_net->user_ns, CAP_NET_ADMIN)) {
4212: ret = -EPERM;
4213: goto put_net;
4214: }
4215: }
4216:
4217: rtnl_nets_add(&rtnl_nets, get_net(sock_net(skb->sk)));
4218:
4219: rtnl_nets_lock(&rtnl_nets);
4220: ret = __rtnl_newlink(skb, nlh, ops, tgt_net, link_net, peer_net, tbs, data, extack);
4221: rtnl_nets_unlock(&rtnl_nets);
4222:
4223: put_net:
4224: rtnl_nets_destroy(&rtnl_nets);
4225: put_ops:
4226: if (ops)
4227: rtnl_link_ops_put(ops, ops_srcu_index);
4228: free:
4229: kfree(tbs);
4230: return ret;
4231: }
4232:
4233: static int rtnl_valid_getlink_req(struct sk_buff *skb,
4234: const struct nlmsghdr *nlh,
4235: struct nlattr **tb,
4236: struct netlink_ext_ack *extack)
]
|
| 132/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 38335
output: 43
thoughts: 71
Thoughts: **Analyzing Network Capability Checks**
Okay, so I'm looking at this line: `tgt_net = rtnl_link_get_net_capable(skb, sock_net(skb->sk), tb, CAP_NET_ADMIN);` and immediately my brain jumps to: "What's `rtnl_link_get_net_capable` actually *doing* here?". I see the arguments: `skb`, `sock_net(skb->sk)`, `tb`, and `CAP_NET_ADMIN`. Seems like some sort of socket buffer and associated network namespace information, and then something related to a table and admin capability checks. This definitely looks like a crucial point where network capabilities are being assessed, probably to determine access or permissions. Since I'm debugging this, I need a complete understanding. Time to dive into the implementation of `rtnl_link_get_net_capable` itself. Let's trace that function call.
|
| 133/4 |
2026/09/13 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/rtnetlink.c Name:rtnl_link_get_net_capable]
Results: map[SourceCode:2723: static struct net *rtnl_link_get_net_capable(const struct sk_buff *skb,
2724: struct net *src_net,
2725: struct nlattr *tb[], int cap)
2726: {
2727: struct net *net;
2728:
2729: net = rtnl_link_get_net_by_nlattr(src_net, tb);
2730: if (IS_ERR(net))
2731: return net;
2732:
2733: if (!netlink_ns_capable(skb, net->user_ns, cap)) {
2734: put_net(net);
2735: return ERR_PTR(-EPERM);
2736: }
2737:
2738: return net;
2739: }
SourceFile:net/core/rtnetlink.c]
|
| 134/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 38928
output: 35
thoughts: 164
Thoughts: **My Line of Inquiry: Tunnel Device Creation in User Namespaces**
Okay, so I'm looking at this `netlink_ns_capable` check with `skb` and `net->user_ns`, and I'm immediately thinking, "Can an *unprivileged* user actually create a tunnel device?". That's the core question here. My gut feeling is "No," but I need to be absolutely certain.
My mind immediately jumps to `ops->newlink`, because that's the usual entry point for `gre`, `vxlan`, and other tunnel types. I need to understand if these operations have the proper checks in place.
So, let's dive deeper: does the code for `gre`, `vxlan`, or any of the other tunnel devices perform any kind of namespace validation? Are they checking for `init_user_ns` or something similar? Are there any explicit restrictions against creating these devices within user namespaces? That's the key: are the right authorization checks being enforced?
I'm going to start by examining the core implementations - `ip_gre`, `vxlan`, and `geneve` specifically. I need to trace the creation flow and the checks performed.
To get a better handle on the netlink interfaces, I'll need to look at `ipgre_netlink_ops`, `vxlan_link_ops`, `ipgre_newlink`, and `vxlan_newlink` specifically. I need to trace the interactions to be absolutely sure whether these operations allow this, or block it. I need to be certain about the security posture here.
|
| 135/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Args: map[Expression:\.newlink\b PathPrefix:net/ipv4/ip_gre.c]
Results: map[Output:net/ipv4/ip_gre.c=1678=static struct rtnl_link_ops ipgre_link_ops __read_mostly = {
--
net/ipv4/ip_gre.c-1684- .validate = ipgre_tunnel_validate,
net/ipv4/ip_gre.c:1685: .newlink = ipgre_newlink,
net/ipv4/ip_gre.c-1686- .changelink = ipgre_changelink,
--
net/ipv4/ip_gre.c=1693=static struct rtnl_link_ops ipgre_tap_ops __read_mostly = {
--
net/ipv4/ip_gre.c-1699- .validate = ipgre_tap_validate,
net/ipv4/ip_gre.c:1700: .newlink = ipgre_newlink,
net/ipv4/ip_gre.c-1701- .changelink = ipgre_changelink,
--
net/ipv4/ip_gre.c=1708=static struct rtnl_link_ops erspan_link_ops __read_mostly = {
--
net/ipv4/ip_gre.c-1714- .validate = erspan_validate,
net/ipv4/ip_gre.c:1715: .newlink = erspan_newlink,
net/ipv4/ip_gre.c-1716- .changelink = erspan_changelink,
]
|
| 136/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 39858
output: 39
thoughts: 19
Thoughts: Here's my summary, as though I'm thinking it:
**Digging into Network Device Creation**
Okay, time to get my hands dirty. I need to refresh my understanding of the network device creation process, particularly focusing on the differences in how we're handling new tunnels. Let's start by digging into `ipgre_newlink` and `vxlan_newlink`. These two functions are likely where the rubber meets the road in terms of setting up GRE and VXLAN interfaces. I want to see exactly what parameters are being passed, how the device is configured within the kernel, and, crucially, how these differ. Are we managing the associated underlying network interfaces correctly in each case? Is there any potential for inconsistencies or overlooked configurations between these two? This is where I'll get a good grasp on our device-creation processes. I suspect a careful look at this code will uncover our root cause.
|
| 137/4 |
2026/09/13 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv4/ip_gre.c Name:ipgre_newlink]
Results: map[SourceCode:1413: static int ipgre_newlink(struct net_device *dev,
1414: struct rtnl_newlink_params *params,
1415: struct netlink_ext_ack *extack)
1416: {
1417: struct nlattr **data = params->data;
1418: struct nlattr **tb = params->tb;
1419: struct ip_tunnel_parm_kern p;
1420: __u32 fwmark = 0;
1421: int err;
1422:
1423: err = ipgre_newlink_encap_setup(dev, data);
1424: if (err)
1425: return err;
1426:
1427: err = ipgre_netlink_parms(dev, data, tb, &p, &fwmark);
1428: if (err < 0)
1429: return err;
1430: return ip_tunnel_newlink(params->link_net ? : dev_net(dev), dev, tb, &p,
1431: fwmark);
1432: }
SourceFile:net/ipv4/ip_gre.c]
|
| 138/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 40451
output: 40
thoughts: 15
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Investigating Potential Weak Points**
Right, let's not jump to conclusions just yet. While `ip_tunnel_init` looks like a likely candidate for investigation, it's prudent to broaden the scope. My experience tells me that these types of issues can often manifest in unexpected places. Therefore, I need to make sure that I don't miss a subtly related function. Let me also investigate `ip_tunnel_newlink`. Checking that function seems like a good move, to make sure it is not the culprit.
|
| 139/4 |
2026/09/13 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv4/ip_tunnel.c Name:ip_tunnel_newlink]
Results: map[SourceCode:1182: int ip_tunnel_newlink(struct net *net, struct net_device *dev,
1183: struct nlattr *tb[], struct ip_tunnel_parm_kern *p,
1184: __u32 fwmark)
1185: {
1186: struct ip_tunnel *nt;
1187: struct ip_tunnel_net *itn;
1188: int mtu;
1189: int err;
1190:
1191: nt = netdev_priv(dev);
1192: itn = net_generic(net, nt->ip_tnl_net_id);
1193:
1194: if (nt->collect_md) {
1195: if (rtnl_dereference(itn->collect_md_tun))
1196: return -EEXIST;
1197: } else {
1198: if (ip_tunnel_find(itn, p, dev->type))
1199: return -EEXIST;
1200: }
1201:
1202: nt->net = net;
1203: nt->parms = *p;
1204: nt->fwmark = fwmark;
1205: err = register_netdevice(dev);
1206: if (err)
1207: goto err_register_netdevice;
1208:
1209: if (dev->type == ARPHRD_ETHER && !tb[IFLA_ADDRESS])
1210: eth_hw_addr_random(dev);
1211:
1212: mtu = ip_tunnel_bind_dev(dev);
1213: if (tb[IFLA_MTU]) {
1214: unsigned int max = IP_MAX_MTU - (nt->hlen + sizeof(struct iphdr));
1215:
1216: if (dev->type == ARPHRD_ETHER)
1217: max -= dev->hard_header_len;
1218:
1219: mtu = clamp(dev->mtu, (unsigned int)ETH_MIN_MTU, max);
1220: }
1221:
1222: err = dev_set_mtu(dev, mtu);
1223: if (err)
1224: goto err_dev_set_mtu;
1225:
1226: ip_tunnel_add(itn, nt);
1227: return 0;
1228:
1229: err_dev_set_mtu:
1230: unregister_netdevice(dev);
1231: err_register_netdevice:
1232: return err;
1233: }
SourceFile:net/ipv4/ip_tunnel.c]
|
| 140/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 41421
output: 37
thoughts: 241
Thoughts: **My Line of Thinking**
Okay, here's what's running through my mind. Can I create an `ip_gre` or `ip_tunnel` device *within* a user namespace? And, assuming the module is already loaded, can an unprivileged user, given `CAP_NET_ADMIN` in their namespace, actually create one via rtnetlink? The answer is YES, assuming the module is already loaded or built-in, this seems possible!
But wait, can an unprivileged user *load* the kernel module in the first place? No, the module auto-loading mechanism, specifically the `request_module("rtnl-link-%s", kind);` function, performs a check for `capable(CAP_SYS_MODULE)`. That's a no-go for an unprivileged user. BUT, if it's *already* loaded or built-in, they're good to go.
A further question arises! Do these tunnel devices, `ip_tunnel`, `vxlan`, `gre`, etc., support NAPI (Network Interface Polling)? Are they designed with Network Interface Polling in mind? Do these tunnel devices support NAPI?
Let's do some digging. Time to search for `netif_napi_add`, `netif_threaded_enable`, or even `gro_cells` throughout the kernel source in the `drivers/net/` and `net/` directories. This should reveal the answer!
|
| 141/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Error:
Args: map[Expression:netif_napi_add PathPrefix:net/ipv4/ip_tunnel.c]
Results:
|
| 142/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42023
output: 34
thoughts: 48
Thoughts: Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts:
**Investigating Network Interface NAPI Registration**
Alright, I need to understand something about how network interfaces are being handled, specifically the integration with NAPI. Given the context, my initial hunch is that I should check the implementation of `netif_napi_add` to see where it is being called and how it's used within the context of VxLAN, GRE, and Geneve tunnels. These are all tunneling protocols, and NAPI (New API) is going to be relevant for the efficient handling of their traffic. I'm going to start by examining the drivers associated with these tunneling protocols: `drivers/net/vxlan/`, `net/ipv4/ip_gre.c`, and `drivers/net/geneve.c`. I expect to find `netif_napi_add` calls within these drivers, as this function is key to enabling NAPI processing for incoming packets on those specific interfaces. I'll be looking for how the NAPI structures are initialized, how the `poll` function is set up, and how these tunnels handle packet ingress and egress within the NAPI framework.
|
| 143/4 |
2026/09/13 00:55 |
tool |
grepper |
0m
Error:
Args: map[Expression:netif_napi_add PathPrefix:drivers/net/vxlan/]
Results:
|
| 144/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42381
output: 38
thoughts: 35
Thoughts: Okay, here's the summary, rendered as if I'm the one thinking it:
**Digging into `gro_cells`**
Wait a minute, I almost glossed over something crucial here! What's the deal with `gro_cells`? I need to understand its functionality better. How exactly does this mechanism work under the hood? Time to get my hands dirty and dive into the source code. Let's head straight to `net/core/gro_cells.c` and see what secrets it holds. I'm sure the implementation will reveal a lot. This will likely provide essential insight into network performance optimization.
|
| 145/4 |
2026/09/13 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/gro_cells.c Name:gro_cells_init]
Results: map[SourceCode: 80: int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
81: {
82: int i;
83:
84: gcells->cells = alloc_percpu(struct gro_cell);
85: if (!gcells->cells)
86: return -ENOMEM;
87:
88: for_each_possible_cpu(i) {
89: struct gro_cell *cell = per_cpu_ptr(gcells->cells, i);
90:
91: __skb_queue_head_init(&cell->napi_skbs);
92: local_lock_init(&cell->bh_lock);
93:
94: set_bit(NAPI_STATE_NO_BUSY_POLL, &cell->napi.state);
95:
96: netif_napi_add(dev, &cell->napi, gro_cell_poll);
97: napi_enable(&cell->napi);
98: }
99: return 0;
100: }
SourceFile:net/core/gro_cells.c]
|
| 146/4 |
2026/09/13 00:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42925
output: 44
thoughts: 79
Thoughts: Here's my take on those thoughts:
**Analyzing GRO Cell Initialization**
Okay, here we go... *LOOK AT THAT!* I'm looking at this `gro_cells_init` function and specifically these lines:
```c
netif_napi_add(dev, &cell->napi, gro_cell_poll);
napi_enable(&cell->napi);
```
Hmm... I see it's setting up NAPI for GRO on a device. Standard stuff, but... *Wait!* Before I get too deep into the nitty-gritty of GRO cell polling, I need to know the bigger picture. *Who calls `gro_cells_init`?!* I need to understand the context of *when* this initialization happens. Let's trace back and find those call sites. That's the key to understanding the full picture here.
|
| 147/4 |
2026/09/13 00:55 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/core/gro_cells.c IncludeSnippetLines:5 Name:gro_cells_init]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__ip_tunnel_init SourceFile:net/ipv4/ip_tunnel.c SourceLine:1288 SourceSnippet:1283:
1284: err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1285: if (err)
1286: return err;
1287:
1288: err = gro_cells_init(&tunnel->gro_cells, dev);
1289: if (err) {
1290: dst_cache_destroy(&tunnel->dst_cache);
1291: return err;
1292: }
1293:
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:bareudp_init SourceFile:drivers/net/bareudp.c SourceLine:218 SourceSnippet: 213: static int bareudp_init(struct net_device *dev)
214: {
215: struct bareudp_dev *bareudp = netdev_priv(dev);
216: int err;
217:
218: err = gro_cells_init(&bareudp->gro_cells, dev);
219: if (err)
220: return err;
221:
222: return 0;
223: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dsa_user_create SourceFile:net/dsa/user.c SourceLine:2810 SourceSnippet:2805: user_dev->vlan_features = conduit->vlan_features;
2806:
2807: p = netdev_priv(user_dev);
2808: user_dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
2809:
2810: ret = gro_cells_init(&p->gcells, user_dev);
2811: if (ret)
2812: goto out_free;
2813:
2814: p->dp = port;
2815: INIT_LIST_HEAD(&p->mall_tc_list);
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:geneve_init SourceFile:drivers/net/geneve.c SourceLine:399 SourceSnippet: 394: static int geneve_init(struct net_device *dev)
395: {
396: struct geneve_dev *geneve = netdev_priv(dev);
397: int err;
398:
399: err = gro_cells_init(&geneve->gro_cells, dev);
400: if (err)
401: return err;
402:
403: netdev_lockdep_set_classes(dev);
404: return 0;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ip6_tnl_dev_init_gen SourceFile:net/ipv6/ip6_tunnel.c SourceLine:1949 SourceSnippet:1944:
1945: ret = dst_cache_init(&t->dst_cache, GFP_KERNEL);
1946: if (ret)
1947: return ret;
1948:
1949: ret = gro_cells_init(&t->gro_cells, dev);
1950: if (ret)
1951: goto destroy_dst;
1952:
1953: t->tun_hlen = 0;
1954: t->hlen = t->encap_hlen + t->tun_hlen;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ip6erspan_tap_init SourceFile:net/ipv6/ip6_gre.c SourceLine:1862 SourceSnippet:1857:
1858: ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1859: if (ret)
1860: return ret;
1861:
1862: ret = gro_cells_init(&tunnel->gro_cells, dev);
1863: if (ret)
1864: goto cleanup_dst_cache_init;
1865:
1866: t_hlen = ip6erspan_calc_hlen(tunnel);
1867: dev->mtu = ETH_DATA_LEN - t_hlen;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ip6gre_tunnel_init_common SourceFile:net/ipv6/ip6_gre.c SourceLine:1489 SourceSnippet:1484:
1485: ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1486: if (ret)
1487: return ret;
1488:
1489: ret = gro_cells_init(&tunnel->gro_cells, dev);
1490: if (ret)
1491: goto cleanup_dst_cache_init;
1492:
1493: t_hlen = ip6gre_calc_hlen(tunnel);
1494: dev->mtu = ETH_DATA_LEN - t_hlen;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:macsec_dev_init SourceFile:drivers/net/macsec.c SourceLine:3538 SourceSnippet:3533: {
3534: struct macsec_dev *macsec = macsec_priv(dev);
3535: struct net_device *real_dev = macsec->real_dev;
3536: int err;
3537:
3538: err = gro_cells_init(&macsec->gro_cells, dev);
3539: if (err)
3540: return err;
3541:
3542: macsec_inherit_tso_max(dev);
3543:
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:vxlan_init SourceFile:drivers/net/vxlan/vxlan_core.c SourceLine:2944 SourceSnippet:2939: err = vxlan_vnigroup_init(vxlan);
2940: if (err)
2941: goto err_rhashtable_destroy;
2942: }
2943:
2944: err = gro_cells_init(&vxlan->gro_cells, dev);
2945: if (err)
2946: goto err_vnigroup_uninit;
2947:
2948: err = vxlan_mdb_init(vxlan);
2949: if (err)
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:xfrm_input_init SourceFile:net/xfrm/xfrm_input.c SourceLine:857 SourceSnippet: 852:
853: xfrm_napi_dev = alloc_netdev_dummy(0);
854: if (!xfrm_napi_dev)
855: panic("Failed to allocate XFRM dummy netdev\n");
856:
857: err = gro_cells_init(&gro_cells, xfrm_napi_dev);
858: if (err)
859: gro_cells.cells = NULL;
860:
861: for_each_possible_cpu(i) {
862: struct xfrm_trans_tasklet *trans;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:xfrmi_dev_init SourceFile:net/xfrm/xfrm_interface_core.c SourceLine:767 SourceSnippet: 762: {
763: struct xfrm_if *xi = netdev_priv(dev);
764: struct net_device *phydev = __dev_get_by_index(xi->net, xi->p.link);
765: int err;
766:
767: err = gro_cells_init(&xi->gro_cells, dev);
768: if (err)
769: return err;
770:
771: dev->lltx = true;
772: dev->features |= XFRMI_FEATURES;
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_gro_cells_init_1489 SourceFile:net/core/gro_cells.c SourceLine:101 SourceSnippet: 101: EXPORT_SYMBOL(gro_cells_init);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_gro_cells_init SourceFile:net/core/gro_cells.c SourceLine:101 SourceSnippet: 101: EXPORT_SYMBOL(gro_cells_init);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_gro_cells_init SourceFile:net/core/gro_cells.c SourceLine:101 SourceSnippet: 101: EXPORT_SYMBOL(gro_cells_init);
]] TruncatedOutput:false]
|
| 148/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 45900
output: 32
thoughts: 319
Thoughts: **My Gro Cells Revelation**
Okay, here's what's running through my mind as I dig into this kernel code. It's becoming increasingly clear how widespread the `gro_cells_init` function is. I'm seeing it called from nearly every conceivable tunneling and encapsulation module. `__ip_tunnel_init`, the VXLAN, GENEVE, and bare UDP initializations, the IPv6 tunnel variantsβbasically, everything I'd expect to see, and a few I didn't even think about immediately. They all jump right to `gro_cells_init(&...->gro_cells, dev)`.
And the code *inside* `gro_cells_init` is the key. For each possible CPU, it iterates and initializes a `gro_cell`. It initializes a `napi_skbs` queue, a lock, and sets the `NAPI_STATE_NO_BUSY_POLL` bit. Then, critically, it calls `netif_napi_add(dev, &cell->napi, gro_cell_poll)` and enables the NAPI instance.
That `netif_napi_add` call is where things get really interesting. It adds `cell->napi` to `dev->napi_list`. Now, *that* structure is a central part of any network device and its packet processing workflow. It's the central place where the NAPI instances are kept, and I need to double-check my understanding of the implications here.
Okay, time to pull up `netif_napi_add` and `netif_napi_add_locked` in `net/core/dev.c`. This is where the core of the NAPI interaction is defined, and it seems like the `gro_cells` setup is absolutely critical for the NAPI flow in these tunneling devices.
|
| 149/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:netif_napi_add\( PathPrefix:net/core/]
Results: map[Output:net/core/gro_cells.c=80=int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
--
net/core/gro_cells.c-95-
net/core/gro_cells.c:96: netif_napi_add(dev, &cell->napi, gro_cell_poll);
net/core/gro_cells.c-97- napi_enable(&cell->napi);
]
|
| 150/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 46772
output: 38
thoughts: 25
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `netif_napi_add`**
Okay, so I'm looking at `netif_napi_add`. Time to refresh my memory and pinpoint exactly what this function is doing at a low level. Let's dig into the definition to see what's actually happening. I'm especially interested in the core mechanics of how it links a device with the NAPI poll context. I'm going to pay close attention to the data structures it's manipulating and any spinlocks or concurrency mechanisms it's employing. My initial thought is to identify this function's relation to interrupt handling in the network stack. I anticipate there's some setup here for the NAPI context that will enable the polling and receive path optimization. I'm keen to trace any calls related to registering the device and its associated queue with the NAPI mechanism.
|
| 151/4 |
2026/09/13 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/dev.c Name:netif_napi_add]
Results: map[SourceCode:2898: /**
2899: * netif_napi_add() - initialize a NAPI context
2900: * @dev: network device
2901: * @napi: NAPI context
2902: * @poll: polling function
2903: *
2904: * netif_napi_add() must be used to initialize a NAPI context prior to calling
2905: * *any* of the other NAPI-related functions.
2906: */
2907: static inline void
2908: netif_napi_add(struct net_device *dev, struct napi_struct *napi,
2909: int (*poll)(struct napi_struct *, int))
2910: {
2911: netif_napi_add_weight(dev, napi, poll, NAPI_POLL_WEIGHT);
2912: }
SourceFile:include/linux/netdevice.h]
|
| 152/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 43817
output: 142
thoughts: 1765
Thoughts: **Analysis of Threaded NAPI with Unprivileged Users and Tunnel Devices**
Alright, let's break this down systematically. The core question is whether a non-root user, but one with `CAP_NET_ADMIN` *within* a user namespace, can effectively leverage threaded NAPI on tunnel devices.
First, let's establish if we can even *create* these tunnels. The analysis highlights that, yes, if the tunnel modules (gre, vxlan, etc.) are loaded or built-in, and we are within a user namespace where we've mapped ourselves to a user ID that gives us `CAP_NET_ADMIN` (via `unshare -U -n -r` or similar), then creating the tunnel devices themselves (e.g., using `ip link add type gre`) is permitted. This aligns with what I'd expect given that `rtnl_link_get_net_capable` checks for that capability in the target network namespace, and we do indeed have it there.
Next, do these tunnel devices actually *support* NAPI? The answer is a clear yes. Functions such as `__ip_tunnel_init`, `vxlan_init`, and similar, leverage `gro_cells_init()` which in turn uses `netif_napi_add` and `napi_enable` for per-CPU NAPI instances. So `dev->napi_list` is populated as expected.
Now, the crucial part: can we *control* threaded NAPI on these devices? Let's start with sysfs. The `/sys/class/net/<dev>/threaded` interface is key. The code confirms that when we write to this file, `netdev_lock_store()` is called. The crucial check here is `ns_capable(net->user_ns, CAP_NET_ADMIN)`. Since we're *inside* the user namespace that has `CAP_NET_ADMIN`, this check will *pass*. The subsequent calls to `modify_napi_threaded` which in turn calls `netif_set_threaded` will thus also succeed, *provided* that the device has NAPI instances (which our tunnel devices do). Hence enabling threaded NAPI via sysfs is perfectly viable.
Finally, the Netlink path. This is where things get interesting. The code reveals that `NETDEV_CMD_NAPI_SET` utilizes Generic Netlink (Genl). This command uses the `GENL_ADMIN_PERM` flag. The implication of this is that the kernel checks `netlink_capable(skb, CAP_NET_ADMIN)`, which in turn checks the capability against the *initial* user namespace (`&init_user_ns`), *not* the user namespace where we have `CAP_NET_ADMIN`. Since our user is *unprivileged* in the initial namespace, we get `-EPERM`. We are *unable* to enable threaded NAPI through Netlink.
In summary, we can *create* the tunnel devices and they *do* have NAPI instances, so that is not an issue. We *can* enable threaded NAPI through the sysfs interface. However, using netlink will fail because we do not have CAP_NET_ADMIN in the initial user namespace. This makes sense.
|
| 153/4 |
2026/09/13 00:56 |
tool |
set-results |
0m
Error:
Args: map[results:Can create tunnel device: Yes (if module is loaded/built-in, rtnl requires net->user_ns CAP_NET_ADMIN).
Can enable threaded NAPI via sysfs: Yes (/sys/class/net/<dev>/threaded checks ns_capable(net->user_ns, CAP_NET_ADMIN) and tunnel devices instantiate per-CPU NAPIs via gro_cells_init).
Can enable threaded NAPI via netlink: No (NETDEV_CMD_NAPI_SET has GENL_ADMIN_PERM which checks netlink_capable against &init_user_ns).]
|
| 154/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 27855
output: 84
thoughts: 0
|
| 155/2 |
2026/09/13 00:56 |
tool |
codeexpert |
0m
Error:
Args: map[Question:Can an unprivileged user (without CAP_NET_ADMIN in the initial namespace) create a tunnel device (like gre, vxlan, etc) inside a user namespace where they have CAP_NET_ADMIN, and then enable threaded NAPI on that device via sysfs (/sys/class/net/<dev>/threaded) or netlink?]
|
| 156/3 |
2026/09/13 00:56 |
agent |
codeexpert |
0m
Model:
Error:
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Research the question using targeted, efficient tool calls. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code. Keep your tool calls focused and limited to the
scope of the question. Do not explore tangential code paths or perform unbounded searches.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
- git commits descriptions, git blame
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
4. Be concise and targeted. Answer the question as directly and concisely as possible
once you have located the relevant code or definitions. If a symbol or function cannot
be found after targeted searches, conclude with the best available information rather
than continuing repetitive searches.
Do NOT use git-log to search for the presence or existence of files in the
repository. git-log is only for tracing commit history of files that are
already present in the current checkout. If a file does not exist in the
current checkout, it cannot be used for reproduction.
Avoid running broad git-log queries (such as searches on the entire repo)
without a specific 'PathPrefix' to restrict the scope, as these are very
expensive and will time out.
If a git-log tool call times out, do not retry the query with the same broad
scope. You must specify a tighter, narrower 'PathPrefix' for subsequent queries.
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: Can an unprivileged user (without CAP_NET_ADMIN in the initial namespace) create a tunnel device (like gre, vxlan, etc) inside a user namespace where they have CAP_NET_ADMIN, and then enable threaded NAPI on that device via sysfs (/sys/class/net/<dev>/threaded) or netlink?
|
| 157/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 4216
output: 31
thoughts: 646
Thoughts: **My Initial Thoughts on Tunnel Device Creation and Threaded NAPI**
Okay, so the core question is whether an unprivileged user can pull off a specific set of network operations within a user namespace. Let's break this down. Can they create a tunnel device (GRE, VXLAN, etc.) within a user namespace where they have `CAP_NET_ADMIN`, and then enable threaded NAPI on that device either through the `/sys/class/net/<dev>/threaded` sysfs entry or via netlink?
First, I need to understand the fundamental restrictions. Does tunnel device creation itself require `CAP_NET_ADMIN` in the initial user namespace (`init_user_ns`) or just in the current user/network namespace? Are tunnel devices generally restricted in user namespaces? What's the actual mechanism: `rtnl`, `ip link`, or something specific to tunnel creation? Does `rtnl` use `netlink_ns_capable` or just plain `capable(CAP_NET_ADMIN)`?
Next, I need to figure out the specifics of tunnel device implementations. Do they use `rtnl_link_ops` or something else? Do tunnel devices even *use* threaded NAPI? Does threaded NAPI even exist on tunnel devices? That's a crucial question!
If threaded NAPI is supported, then enabling it is another layer of complexity. Does enabling threaded NAPI through sysfs or netlink require `CAP_NET_ADMIN` in the initial user namespace, or just the current one? Does writing to `/sys/class/net/<dev>/threaded` have some specific permission checks? What about netlink?
To recap my two key questions:
1. Can an unprivileged user create a tunnel device (GRE, VXLAN, etc.) in a user namespace?
2. Can they enable threaded NAPI on that device via sysfs or netlink?
Alright, time to dive into the kernel source. I'm going to look for:
* The `/sys/class/net/<dev>/threaded` sysfs attribute and how it's handled.
* Netlink attributes or functions related to "threaded" NAPI (e.g., `IFLA_*`, `napi_set_threaded`, or just "threaded").
* The `rtnl_link_ops` implementations for GRE, VXLAN, and other tunnel devices to understand if there are any restrictions when running within a user namespace.
I'll use grepper to search through `net/sysfs` and `net/core` for the "threaded" string. I need to understand what permissions sysfs's `/sys/class/net/<dev>/threaded` actually requires, whether netlink checks `init_user_ns` or `net->user_ns`, and most importantly, if any of these operations are even relevant or supported on tunnel devices. Is NAPI even used on these types of devices?
|
| 158/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:threaded PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=723=static const struct attribute_group netdev_phys_group = {
--
net/core/net-sysfs.c-727-
net/core/net-sysfs.c:728:static ssize_t threaded_show(struct device *dev,
net/core/net-sysfs.c-729- struct device_attribute *attr, char *buf)
--
net/core/net-sysfs.c-736- if (dev_isalive(netdev))
net/core/net-sysfs.c:737: ret = sysfs_emit(buf, fmt_dec, READ_ONCE(netdev->threaded));
net/core/net-sysfs.c-738-
--
net/core/net-sysfs.c-743-
net/core/net-sysfs.c:744:static int modify_napi_threaded(struct net_device *dev, unsigned long val)
net/core/net-sysfs.c-745-{
--
net/core/net-sysfs.c-753-
net/core/net-sysfs.c:754: ret = netif_set_threaded(dev, val);
net/core/net-sysfs.c-755-
--
net/core/net-sysfs.c-758-
net/core/net-sysfs.c:759:static ssize_t threaded_store(struct device *dev,
net/core/net-sysfs.c-760- struct device_attribute *attr,
--
net/core/net-sysfs.c-762-{
net/core/net-sysfs.c:763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
net/core/net-sysfs.c-764-}
net/core/net-sysfs.c:765:static DEVICE_ATTR_RW(threaded);
net/core/net-sysfs.c-766-
net/core/net-sysfs.c=767=static struct attribute *net_class_attrs[] __ro_after_init = {
--
net/core/net-sysfs.c-795- &dev_attr_carrier_down_count.attr,
net/core/net-sysfs.c:796: &dev_attr_threaded.attr,
net/core/net-sysfs.c-797- NULL,
]
|
| 159/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 6145
output: 28
thoughts: 62
Thoughts: **Investigating Netdev Locking and Threading Configuration**
Okay, so I'm thinking I need to delve into `net/core/net-sysfs.c`, specifically around lines 728-765. That area should contain the logic for handling `netdev_lock_store`, which is where I expect to find the relevant locking behavior when configuring network devices through sysfs. I need to be sure I understand the interaction between the lock and any threading configurations.
Beyond that, I'm going to scan for instances of `IFLA_` attributes related to threading. I expect to use `netif_set_threaded` so I will be searching for that as well. I need to ensure I can see how these threaded configurations are set and handled within the kernel's network device management. I need to see if it is used, and how it is. This investigation should clarify any dependencies or conflicts between threaded operation and the device's locking mechanisms.
|
| 160/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:netif_set_threaded PathPrefix:net/]
Results: map[Output:net/core/dev.c=5013=static inline void ____napi_schedule(struct softnet_data *sd,
--
net/core/dev.c-5021- /* Paired with smp_mb__before_atomic() in
net/core/dev.c:5022: * napi_enable()/netif_set_threaded().
net/core/dev.c-5023- * Use READ_ONCE() to guarantee a complete
--
net/core/dev.c=7257=int napi_set_threaded(struct napi_struct *napi,
--
net/core/dev.c-7288-
net/core/dev.c:7289:int netif_set_threaded(struct net_device *dev,
net/core/dev.c-7290- enum netdev_napi_threaded threaded)
--
net/core/dev.c=7333=void netif_threaded_enable(struct net_device *dev)
net/core/dev.c-7334-{
net/core/dev.c:7335: WARN_ON_ONCE(netif_set_threaded(dev, NETDEV_NAPI_THREADED_ENABLED));
net/core/dev.c-7336-}
--
net/core/dev.h=376=int napi_set_threaded(struct napi_struct *n,
--
net/core/dev.h-378-
net/core/dev.h:379:int netif_set_threaded(struct net_device *dev,
net/core/dev.h-380- enum netdev_napi_threaded threaded);
--
net/core/dev_api.c=374=int dev_set_threaded(struct net_device *dev,
--
net/core/dev_api.c-379- netdev_lock(dev);
net/core/dev_api.c:380: ret = netif_set_threaded(dev, threaded);
net/core/dev_api.c-381- netdev_unlock(dev);
--
net/core/net-sysfs.c=744=static int modify_napi_threaded(struct net_device *dev, unsigned long val)
--
net/core/net-sysfs.c-753-
net/core/net-sysfs.c:754: ret = netif_set_threaded(dev, val);
net/core/net-sysfs.c-755-
]
|
| 161/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 7075
output: 44
thoughts: 34
Thoughts: Here's my take on those thoughts:
**Analyzing `dev_set_threaded` Usage**
Okay, so I need to understand the implications of `dev_set_threaded`. My first step, as always, is to follow the breadcrumbs. Where is this `dev_set_threaded` function being invoked? The quickest way to get a handle on its impact is to meticulously trace the calls. I'm going to scan for every single reference to `dev_set_threaded`, and also any occurrences of the related keyword "threaded," just to be thorough and ensure I catch any indirect interactions that might be at play. I need a clear picture of its role within the system. Let's dig in.
|
| 162/4 |
2026/09/13 00:56 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/core/dev_api.c IncludeSnippetLines:5 Name:dev_set_threaded]
Results: map[References:[map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_dev_set_threaded_1301 SourceFile:net/core/dev_api.c SourceLine:385 SourceSnippet: 385: EXPORT_SYMBOL(dev_set_threaded);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_dev_set_threaded SourceFile:net/core/dev_api.c SourceLine:385 SourceSnippet: 385: EXPORT_SYMBOL(dev_set_threaded);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_dev_set_threaded SourceFile:net/core/dev_api.c SourceLine:385 SourceSnippet: 385: EXPORT_SYMBOL(dev_set_threaded);
]] TruncatedOutput:false]
|
| 163/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 7593
output: 19
thoughts: 29
Thoughts: Here's my attempt at summarizing the thought process, as if I were having them:
**Debugging Threading Issues in Network Drivers**
Okay, hold on a second. Something's nagging at me about this threading configuration. The code's behavior suggests we're dealing with threading issues, and I need to pinpoint the culprits. Specifically, I need to know exactly *who* is calling `dev_set_threaded` or `netif_set_threaded` in this situation. It's time to dig deeper. I'm going to run a quick `grepper` search right now to see where those functions are being invoked. That should give me the call sites I need to understand the control flow and identify the root cause of this threading behavior. Let's see what the grep results reveal.
|
| 164/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:dev_set_threaded]
Results: map[Output:drivers/net/wireless/mediatek/mt76/debugfs.c=29=mt76_napi_threaded_set(void *data, u64 val)
--
drivers/net/wireless/mediatek/mt76/debugfs.c-36- if (dev->napi_dev->threaded != val)
drivers/net/wireless/mediatek/mt76/debugfs.c:37: return dev_set_threaded(dev->napi_dev, val);
drivers/net/wireless/mediatek/mt76/debugfs.c-38-
--
include/linux/netdevice.h=599=void netif_threaded_enable(struct net_device *dev);
include/linux/netdevice.h:600:int dev_set_threaded(struct net_device *dev,
include/linux/netdevice.h-601- enum netdev_napi_threaded threaded);
--
net/core/dev_api.c=372=EXPORT_SYMBOL(netdev_state_change);
net/core/dev_api.c-373-
net/core/dev_api.c:374:int dev_set_threaded(struct net_device *dev,
net/core/dev_api.c-375- enum netdev_napi_threaded threaded)
--
net/core/dev_api.c-384-}
net/core/dev_api.c:385:EXPORT_SYMBOL(dev_set_threaded);
--
tools/testing/selftests/net/nl_netdev.py=51=def napi_set_threaded(nf) -> None:
--
tools/testing/selftests/net/nl_netdev.py-135-
tools/testing/selftests/net/nl_netdev.py:136:def dev_set_threaded(nf) -> None:
tools/testing/selftests/net/nl_netdev.py-137- """
--
tools/testing/selftests/net/nl_netdev.py=369=def main() -> None:
--
tools/testing/selftests/net/nl_netdev.py-376- napi_set_threaded,
tools/testing/selftests/net/nl_netdev.py:377: dev_set_threaded,
tools/testing/selftests/net/nl_netdev.py-378- nsim_rxq_reset_down,
]
|
| 165/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 8429
output: 44
thoughts: 79
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into Netlink Netdev Self-Tests**
Okay, time to get my hands dirty. I need to take a look at the Netlink Netdev self-tests, specifically the `tools/testing/selftests/net/nl_netdev.py` script. My focus, right now, is on understanding how this test suite interacts with the netlink netdev family, particularly the genetlink netdev functionality. This looks like a promising avenue for investigating some odd behavior I've been observing.
Let's jump right in. I'm going to scan lines 50 through 150 of `nl_netdev.py`. This should give me a good initial grasp of the test's structure, the key netlink messages being exchanged, the expected device interactions, and hopefully, how the tests validate those interactions. That section should contain the core logic I'm after, the initial setup, and the critical assertions. Hopefully, this section will quickly illuminate the test's strategy and where I should focus further investigation.
|
| 166/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/nl_netdev.py FirstLine:50 LineCount:100]
Results: map[Contents: 50:
51: def napi_set_threaded(nf) -> None:
52: """
53: Test that verifies various cases of napi threaded
54: set and unset at napi and device level.
55: """
56: with NetdevSimDev(queue_count=2) as nsimdev:
57: nsim = nsimdev.nsims[0]
58:
59: ip(f"link set dev {nsim.ifname} up")
60:
61: napis = nf.napi_get({'ifindex': nsim.ifindex}, dump=True)
62: ksft_eq(len(napis), 2)
63:
64: napi0_id = napis[0]['id']
65: napi1_id = napis[1]['id']
66:
67: # set napi threaded and verify
68: nf.napi_set({'id': napi0_id, 'threaded': "enabled"})
69: napi0 = nf.napi_get({'id': napi0_id})
70: ksft_eq(napi0['threaded'], "enabled")
71: ksft_ne(napi0.get('pid'), None)
72:
73: # check it is not set for napi1
74: napi1 = nf.napi_get({'id': napi1_id})
75: ksft_eq(napi1['threaded'], "disabled")
76: ksft_eq(napi1.get('pid'), None)
77:
78: ip(f"link set dev {nsim.ifname} down")
79: ip(f"link set dev {nsim.ifname} up")
80:
81: # verify if napi threaded is still set
82: napi0 = nf.napi_get({'id': napi0_id})
83: ksft_eq(napi0['threaded'], "enabled")
84: ksft_ne(napi0.get('pid'), None)
85:
86: # check it is still not set for napi1
87: napi1 = nf.napi_get({'id': napi1_id})
88: ksft_eq(napi1['threaded'], "disabled")
89: ksft_eq(napi1.get('pid'), None)
90:
91: # unset napi threaded and verify
92: nf.napi_set({'id': napi0_id, 'threaded': "disabled"})
93: napi0 = nf.napi_get({'id': napi0_id})
94: ksft_eq(napi0['threaded'], "disabled")
95: ksft_eq(napi0.get('pid'), None)
96:
97: # set threaded at device level
98: system(f"echo 1 > /sys/class/net/{nsim.ifname}/threaded")
99:
100: # check napi threaded is set for both napis
101: napi0 = nf.napi_get({'id': napi0_id})
102: ksft_eq(napi0['threaded'], "enabled")
103: ksft_ne(napi0.get('pid'), None)
104: napi1 = nf.napi_get({'id': napi1_id})
105: ksft_eq(napi1['threaded'], "enabled")
106: ksft_ne(napi1.get('pid'), None)
107:
108: # unset threaded at device level
109: system(f"echo 0 > /sys/class/net/{nsim.ifname}/threaded")
110:
111: # check napi threaded is unset for both napis
112: napi0 = nf.napi_get({'id': napi0_id})
113: ksft_eq(napi0['threaded'], "disabled")
114: ksft_eq(napi0.get('pid'), None)
115: napi1 = nf.napi_get({'id': napi1_id})
116: ksft_eq(napi1['threaded'], "disabled")
117: ksft_eq(napi1.get('pid'), None)
118:
119: # set napi threaded for napi0
120: nf.napi_set({'id': napi0_id, 'threaded': 1})
121: napi0 = nf.napi_get({'id': napi0_id})
122: ksft_eq(napi0['threaded'], "enabled")
123: ksft_ne(napi0.get('pid'), None)
124:
125: # unset threaded at device level
126: system(f"echo 0 > /sys/class/net/{nsim.ifname}/threaded")
127:
128: # check napi threaded is unset for both napis
129: napi0 = nf.napi_get({'id': napi0_id})
130: ksft_eq(napi0['threaded'], "disabled")
131: ksft_eq(napi0.get('pid'), None)
132: napi1 = nf.napi_get({'id': napi1_id})
133: ksft_eq(napi1['threaded'], "disabled")
134: ksft_eq(napi1.get('pid'), None)
135:
136: def dev_set_threaded(nf) -> None:
137: """
138: Test that verifies various cases of napi threaded
139: set and unset at device level using sysfs.
140: """
141: with NetdevSimDev(queue_count=2) as nsimdev:
142: nsim = nsimdev.nsims[0]
143:
144: ip(f"link set dev {nsim.ifname} up")
145:
146: napis = nf.napi_get({'ifindex': nsim.ifindex}, dump=True)
147: ksft_eq(len(napis), 2)
148:
149: napi0_id = napis[0]['id']
]
|
| 167/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 10605
output: 31
thoughts: 68
Thoughts: **Kernel NAPI Configuration: A Quick Hunt**
Okay, so I'm looking at this `nf.napi_set({'id': napi0_id, 'threaded': ...})` call and my initial thought is: Where does this `napi_set` function actually *live* in the kernel? I need to understand its behavior to fully grasp this code. Is it in the core NAPI framework? Is it specific to a driver? I need to track it down.
My next step is to start searching. I'll be looking for the function name, of course: `napi_set`. But, knowing how these things often work, and given the mention of 'threaded', I'll also try variations, like `napi_set_threaded` just in case. And, thinking about how kernel interfaces might be defined, I'll also look for references to `NETDEV_CMD_NAPI_SET`, in case this operation is handled via a netdev control command. This should give me a good start to pinpoint where the actual configuration magic is happening. Then, once I see where it is implemented, I can check how it is used.
|
| 168/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:NETDEV_CMD_NAPI_SET PathPrefix:net/]
Results: map[Output:net/core/netdev-genl-gen.c=115=static const struct nla_policy netdev_bind_rx_nl_policy[NETDEV_A_DMABUF_RX_PAGE_SIZE + 1] = {
--
net/core/netdev-genl-gen.c-121-
net/core/netdev-genl-gen.c:122:/* NETDEV_CMD_NAPI_SET - do */
net/core/netdev-genl-gen.c-123-static const struct nla_policy netdev_napi_set_nl_policy[NETDEV_A_NAPI_THREADED + 1] = {
--
net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {
--
net/core/netdev-genl-gen.c-232- {
net/core/netdev-genl-gen.c:233: .cmd = NETDEV_CMD_NAPI_SET,
net/core/netdev-genl-gen.c-234- .doit = netdev_nl_napi_set_doit,
]
|
| 169/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 11259
output: 41
thoughts: 36
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into netdev_nl_ops**
Okay, time to dig in. The problem likely lies somewhere in the Netlink interaction for network device management. Let's start by zeroing in on `netdev_nl_ops`. Specifically, I'm going to navigate to line 232 within `net/core/netdev-genl-gen.c`. That's where the core operations for this Netlink family are defined, and usually where you'll find the handlers for requests, like creating, deleting, or configuring network devices, and probably the meat of the issue I'm dealing with. From there I'll start tracing the data flow to try and find the point of failure.
|
| 170/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/netdev-genl-gen.c FirstLine:225 LineCount:25]
Results: map[Contents: 225: {
226: .cmd = NETDEV_CMD_BIND_RX,
227: .doit = netdev_nl_bind_rx_doit,
228: .policy = netdev_bind_rx_nl_policy,
229: .maxattr = NETDEV_A_DMABUF_RX_PAGE_SIZE,
230: .flags = GENL_UNS_ADMIN_PERM | GENL_CMD_CAP_DO,
231: },
232: {
233: .cmd = NETDEV_CMD_NAPI_SET,
234: .doit = netdev_nl_napi_set_doit,
235: .policy = netdev_napi_set_nl_policy,
236: .maxattr = NETDEV_A_NAPI_THREADED,
237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
238: },
239: {
240: .cmd = NETDEV_CMD_BIND_TX,
241: .doit = netdev_nl_bind_tx_doit,
242: .policy = netdev_bind_tx_nl_policy,
243: .maxattr = NETDEV_A_DMABUF_FD,
244: .flags = GENL_CMD_CAP_DO,
245: },
246: {
247: .cmd = NETDEV_CMD_QUEUE_CREATE,
248: .doit = netdev_nl_queue_create_doit,
249: .policy = netdev_queue_create_nl_policy,
]
|
| 171/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 11993
output: 29
thoughts: 78
Thoughts: **Diving into Line 237: Flags and Permissions**
Alright, let's zoom in on line 237 β specifically that `flags` assignment: `flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,`. My immediate thought is, "Hold on a minute, what's the nuance between `GENL_ADMIN_PERM` and potentially a `GENL_UNS_ADMIN_PERM` that might exist?" I need to refresh my memory on the exact definition and usage of `GENL_ADMIN_PERM`. Time to dig deeper and understand the intricacies of its implementation! This is where the devil's in the details, so let's get into it.
|
| 172/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM PathPrefix:net/]
Results: map[Output:
Full output is too long, showing 500 out of 781 lines.
Use more precise expression if possible.
net/core/drop_monitor.c=1609=static const struct genl_small_ops dropmon_ops[] = {
--
net/core/drop_monitor.c-1613- .doit = net_dm_cmd_config,
net/core/drop_monitor.c:1614: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1615- },
--
net/core/drop_monitor.c-1619- .doit = net_dm_cmd_trace,
net/core/drop_monitor.c:1620: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1621- },
--
net/core/drop_monitor.c-1625- .doit = net_dm_cmd_trace,
net/core/drop_monitor.c:1626: .flags = GENL_ADMIN_PERM,
net/core/drop_monitor.c-1627- },
--
net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {
--
net/core/netdev-genl-gen.c-236- .maxattr = NETDEV_A_NAPI_THREADED,
net/core/netdev-genl-gen.c:237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-238- },
--
net/core/netdev-genl-gen.c-250- .maxattr = NETDEV_A_QUEUE_LEASE,
net/core/netdev-genl-gen.c:251: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-252- },
--
net/devlink/netlink_gen.c=702=const struct genl_split_ops devlink_nl_ops[75] = {
--
net/devlink/netlink_gen.c-743- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:744: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-745- },
--
net/devlink/netlink_gen.c-753- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:754: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-755- },
--
net/devlink/netlink_gen.c-763- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:764: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-765- },
--
net/devlink/netlink_gen.c-773- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:774: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-775- },
--
net/devlink/netlink_gen.c-783- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:784: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-785- },
--
net/devlink/netlink_gen.c-827- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:828: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-829- },
--
net/devlink/netlink_gen.c-854- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:855: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-856- },
--
net/devlink/netlink_gen.c-881- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:882: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-883- },
--
net/devlink/netlink_gen.c-891- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:892: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-893- },
--
net/devlink/netlink_gen.c-901- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:902: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-903- },
--
net/devlink/netlink_gen.c-911- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:912: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-913- },
--
net/devlink/netlink_gen.c-921- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:922: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-923- },
--
net/devlink/netlink_gen.c-961- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:962: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-963- },
--
net/devlink/netlink_gen.c-971- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:972: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-973- },
--
net/devlink/netlink_gen.c-998- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:999: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1000- },
--
net/devlink/netlink_gen.c-1025- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1026: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1027- },
--
net/devlink/netlink_gen.c-1052- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1053: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1054- },
--
net/devlink/netlink_gen.c-1062- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1063: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1064- },
--
net/devlink/netlink_gen.c-1070- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1071: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
net/devlink/netlink_gen.c-1072- },
--
net/devlink/netlink_gen.c-1096- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1097: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1098- },
--
net/devlink/netlink_gen.c-1139- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1140: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1141- },
--
net/devlink/netlink_gen.c-1149- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1150: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1151- },
--
net/devlink/netlink_gen.c-1159- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1160: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1161- },
--
net/devlink/netlink_gen.c-1167- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1168: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
net/devlink/netlink_gen.c-1169- },
--
net/devlink/netlink_gen.c-1177- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1178: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1179- },
--
net/devlink/netlink_gen.c-1187- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1188: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1189- },
--
net/devlink/netlink_gen.c-1214- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1215: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1216- },
--
net/devlink/netlink_gen.c-1241- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1242: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1243- },
--
net/devlink/netlink_gen.c-1268- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1269: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1270- },
--
net/devlink/netlink_gen.c-1278- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1279: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1280- },
--
net/devlink/netlink_gen.c-1305- .maxattr = DEVLINK_ATTR_PARENT_DEV,
net/devlink/netlink_gen.c:1306: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1307- },
--
net/devlink/netlink_gen.c-1315- .maxattr = DEVLINK_ATTR_PARENT_DEV,
net/devlink/netlink_gen.c:1316: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1317- },
--
net/devlink/netlink_gen.c-1325- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1326: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1327- },
--
net/devlink/netlink_gen.c-1352- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1353: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1354- },
--
net/devlink/netlink_gen.c-1378- .maxattr = DEVLINK_ATTR_INDEX,
net/devlink/netlink_gen.c:1379: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/devlink/netlink_gen.c-1380- },
--
net/handshake/genl.c=28=static const struct genl_split_ops handshake_nl_ops[] = {
--
net/handshake/genl.c-33- .maxattr = HANDSHAKE_A_ACCEPT_HANDLER_CLASS,
net/handshake/genl.c:34: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/handshake/genl.c-35- },
--
net/handshake/genl.c-40- .maxattr = HANDSHAKE_A_DONE_REMOTE_AUTH,
net/handshake/genl.c:41: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/handshake/genl.c-42- },
--
net/ieee802154/ieee802154.h=9=void ieee802154_nl_exit(void);
--
net/ieee802154/ieee802154.h-15- .dumpit = NULL, \
net/ieee802154/ieee802154.h:16: .flags = GENL_ADMIN_PERM, \
net/ieee802154/ieee802154.h-17- }
--
net/ieee802154/ieee802154.h-23- .dumpit = NULL, \
net/ieee802154/ieee802154.h:24: .flags = GENL_ADMIN_PERM, \
net/ieee802154/ieee802154.h-25- .validate = GENL_DONT_VALIDATE_STRICT,\
--
net/ieee802154/ieee802154.h-39- .dumpit = _dump, \
net/ieee802154/ieee802154.h:40: .flags = GENL_ADMIN_PERM, \
net/ieee802154/ieee802154.h-41- }
--
net/ieee802154/nl802154.c=2770=static const struct genl_ops nl802154_ops[] = {
--
net/ieee802154/nl802154.c-2794- .doit = nl802154_new_interface,
net/ieee802154/nl802154.c:2795: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2796- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2802- .doit = nl802154_del_interface,
net/ieee802154/nl802154.c:2803: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2804- .internal_flags = NL802154_FLAG_NEED_WPAN_DEV |
--
net/ieee802154/nl802154.c-2810- .doit = nl802154_set_channel,
net/ieee802154/nl802154.c:2811: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2812- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2818- .doit = nl802154_set_cca_mode,
net/ieee802154/nl802154.c:2819: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2820- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2826- .doit = nl802154_set_cca_ed_level,
net/ieee802154/nl802154.c:2827: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2828- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2834- .doit = nl802154_set_tx_power,
net/ieee802154/nl802154.c:2835: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2836- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2842- .doit = nl802154_wpan_phy_netns,
net/ieee802154/nl802154.c:2843: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2844- .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
--
net/ieee802154/nl802154.c-2850- .doit = nl802154_set_pan_id,
net/ieee802154/nl802154.c:2851: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2852- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2858- .doit = nl802154_set_short_addr,
net/ieee802154/nl802154.c:2859: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2860- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2866- .doit = nl802154_set_backoff_exponent,
net/ieee802154/nl802154.c:2867: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2868- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2874- .doit = nl802154_set_max_csma_backoffs,
net/ieee802154/nl802154.c:2875: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2876- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2882- .doit = nl802154_set_max_frame_retries,
net/ieee802154/nl802154.c:2883: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2884- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2890- .doit = nl802154_set_lbt_mode,
net/ieee802154/nl802154.c:2891: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2892- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2898- .doit = nl802154_set_ackreq_default,
net/ieee802154/nl802154.c:2899: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2900- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2905- .doit = nl802154_trigger_scan,
net/ieee802154/nl802154.c:2906: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2907- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2913- .doit = nl802154_abort_scan,
net/ieee802154/nl802154.c:2914: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2915- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2921- .doit = nl802154_send_beacons,
net/ieee802154/nl802154.c:2922: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2923- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2929- .doit = nl802154_stop_beacons,
net/ieee802154/nl802154.c:2930: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2931- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2937- .doit = nl802154_associate,
net/ieee802154/nl802154.c:2938: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2939- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2945- .doit = nl802154_disassociate,
net/ieee802154/nl802154.c:2946: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2947- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2953- .doit = nl802154_set_max_associations,
net/ieee802154/nl802154.c:2954: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2955- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2967- .doit = nl802154_set_llsec_params,
net/ieee802154/nl802154.c:2968: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2969- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2977- .dumpit = nl802154_dump_llsec_key,
net/ieee802154/nl802154.c:2978: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2979- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2985- .doit = nl802154_add_llsec_key,
net/ieee802154/nl802154.c:2986: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2987- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-2993- .doit = nl802154_del_llsec_key,
net/ieee802154/nl802154.c:2994: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-2995- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3004- .dumpit = nl802154_dump_llsec_dev,
net/ieee802154/nl802154.c:3005: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3006- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3012- .doit = nl802154_add_llsec_dev,
net/ieee802154/nl802154.c:3013: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3014- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3020- .doit = nl802154_del_llsec_dev,
net/ieee802154/nl802154.c:3021: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3022- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3031- .dumpit = nl802154_dump_llsec_devkey,
net/ieee802154/nl802154.c:3032: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3033- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3039- .doit = nl802154_add_llsec_devkey,
net/ieee802154/nl802154.c:3040: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3041- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3047- .doit = nl802154_del_llsec_devkey,
net/ieee802154/nl802154.c:3048: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3049- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3057- .dumpit = nl802154_dump_llsec_seclevel,
net/ieee802154/nl802154.c:3058: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3059- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3065- .doit = nl802154_add_llsec_seclevel,
net/ieee802154/nl802154.c:3066: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3067- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ieee802154/nl802154.c-3074- .doit = nl802154_del_llsec_seclevel,
net/ieee802154/nl802154.c:3075: .flags = GENL_ADMIN_PERM,
net/ieee802154/nl802154.c-3076- .internal_flags = NL802154_FLAG_NEED_NETDEV |
--
net/ipv4/fou_nl.c=30=const struct genl_small_ops fou_nl_ops[3] = {
--
net/ipv4/fou_nl.c-34- .doit = fou_nl_add_doit,
net/ipv4/fou_nl.c:35: .flags = GENL_ADMIN_PERM,
net/ipv4/fou_nl.c-36- },
--
net/ipv4/fou_nl.c-40- .doit = fou_nl_del_doit,
net/ipv4/fou_nl.c:41: .flags = GENL_ADMIN_PERM,
net/ipv4/fou_nl.c-42- },
--
net/ipv4/tcp_metrics.c=972=static const struct genl_small_ops tcp_metrics_nl_ops[] = {
--
net/ipv4/tcp_metrics.c-982- .doit = tcp_metrics_nl_cmd_del,
net/ipv4/tcp_metrics.c:983: .flags = GENL_ADMIN_PERM,
net/ipv4/tcp_metrics.c-984- },
--
net/ipv6/ila/ila_main.c=15=static const struct genl_ops ila_nl_ops[] = {
--
net/ipv6/ila/ila_main.c-19- .doit = ila_xlat_nl_cmd_add_mapping,
net/ipv6/ila/ila_main.c:20: .flags = GENL_ADMIN_PERM,
net/ipv6/ila/ila_main.c-21- },
--
net/ipv6/ila/ila_main.c-25- .doit = ila_xlat_nl_cmd_del_mapping,
net/ipv6/ila/ila_main.c:26: .flags = GENL_ADMIN_PERM,
net/ipv6/ila/ila_main.c-27- },
--
net/ipv6/ila/ila_main.c-31- .doit = ila_xlat_nl_cmd_flush,
net/ipv6/ila/ila_main.c:32: .flags = GENL_ADMIN_PERM,
net/ipv6/ila/ila_main.c-33- },
--
net/ipv6/ioam6.c=552=static const struct genl_ops ioam6_genl_ops[] = {
--
net/ipv6/ioam6.c-556- .doit = ioam6_genl_addns,
net/ipv6/ioam6.c:557: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-558- .policy = ioam6_genl_policy_addns,
--
net/ipv6/ioam6.c-564- .doit = ioam6_genl_delns,
net/ipv6/ioam6.c:565: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-566- .policy = ioam6_genl_policy_delns,
--
net/ipv6/ioam6.c-574- .done = ioam6_genl_dumpns_done,
net/ipv6/ioam6.c:575: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-576- },
--
net/ipv6/ioam6.c-580- .doit = ioam6_genl_addsc,
net/ipv6/ioam6.c:581: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-582- .policy = ioam6_genl_policy_addsc,
--
net/ipv6/ioam6.c-588- .doit = ioam6_genl_delsc,
net/ipv6/ioam6.c:589: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-590- .policy = ioam6_genl_policy_delsc,
--
net/ipv6/ioam6.c-598- .done = ioam6_genl_dumpsc_done,
net/ipv6/ioam6.c:599: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-600- },
--
net/ipv6/ioam6.c-604- .doit = ioam6_genl_ns_set_schema,
net/ipv6/ioam6.c:605: .flags = GENL_ADMIN_PERM,
net/ipv6/ioam6.c-606- .policy = ioam6_genl_policy_ns_sc,
--
net/ipv6/seg6.c=465=static const struct genl_ops seg6_genl_ops[] = {
--
net/ipv6/seg6.c-469- .doit = seg6_genl_sethmac,
net/ipv6/seg6.c:470: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-471- },
--
net/ipv6/seg6.c-477- .done = seg6_genl_dumphmac_done,
net/ipv6/seg6.c:478: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-479- },
--
net/ipv6/seg6.c-483- .doit = seg6_genl_set_tunsrc,
net/ipv6/seg6.c:484: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-485- },
--
net/ipv6/seg6.c-489- .doit = seg6_genl_get_tunsrc,
net/ipv6/seg6.c:490: .flags = GENL_ADMIN_PERM,
net/ipv6/seg6.c-491- },
--
net/ncsi/ncsi-netlink.c=727=static const struct genl_small_ops ncsi_ops[] = {
--
net/ncsi/ncsi-netlink.c-738- .doit = ncsi_set_interface_nl,
net/ncsi/ncsi-netlink.c:739: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-740- },
--
net/ncsi/ncsi-netlink.c-744- .doit = ncsi_clear_interface_nl,
net/ncsi/ncsi-netlink.c:745: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-746- },
--
net/ncsi/ncsi-netlink.c-750- .doit = ncsi_send_cmd_nl,
net/ncsi/ncsi-netlink.c:751: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-752- },
--
net/ncsi/ncsi-netlink.c-756- .doit = ncsi_set_package_mask_nl,
net/ncsi/ncsi-netlink.c:757: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-758- },
--
net/ncsi/ncsi-netlink.c-762- .doit = ncsi_set_channel_mask_nl,
net/ncsi/ncsi-netlink.c:763: .flags = GENL_ADMIN_PERM,
net/ncsi/ncsi-netlink.c-764- },
--
net/netfilter/ipvs/ip_vs_ctl.c=4916=static const struct genl_small_ops ip_vs_genl_ops[] = {
--
net/netfilter/ipvs/ip_vs_ctl.c-4919- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4920: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4921- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4925- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4926: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4927- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4931- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4932: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4933- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4937- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4938: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4939- .doit = ip_vs_genl_get_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4944- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4945: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4946- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4950- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4951: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4952- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4956- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4957: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4958- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4962- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4963: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4964- .dumpit = ip_vs_genl_dump_dests,
--
net/netfilter/ipvs/ip_vs_ctl.c-4968- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4969: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4970- .doit = ip_vs_genl_set_daemon,
--
net/netfilter/ipvs/ip_vs_ctl.c-4974- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4975: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4976- .doit = ip_vs_genl_set_daemon,
--
net/netfilter/ipvs/ip_vs_ctl.c-4980- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4981: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4982- .dumpit = ip_vs_genl_dump_daemons,
--
net/netfilter/ipvs/ip_vs_ctl.c-4986- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4987: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4988- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4992- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4993: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-4994- .doit = ip_vs_genl_get_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-4998- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:4999: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-5000- .doit = ip_vs_genl_get_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-5004- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:5005: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-5006- .doit = ip_vs_genl_set_cmd,
--
net/netfilter/ipvs/ip_vs_ctl.c-5010- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netfilter/ipvs/ip_vs_ctl.c:5011: .flags = GENL_ADMIN_PERM,
net/netfilter/ipvs/ip_vs_ctl.c-5012- .doit = ip_vs_genl_set_cmd,
--
net/netlabel/netlabel_calipso.c=332=static const struct genl_small_ops netlbl_calipso_ops[] = {
--
net/netlabel/netlabel_calipso.c-335- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/netlabel/netlabel_calipso.c:336: .flags = GENL_ADMIN_PERM,
net/netlabel/netlabel_calipso.c-337- .doit = netlbl_calipso_add,
--
]
|
| 173/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 25608
output: 37
thoughts: 47
Thoughts: Okay, here's the summary, rendered as if it's my own thought process:
**Diving into Genetlink Permissions**
Alright, time to understand how these generic netlink permissions are being handled. I need to figure out where `GENL_ADMIN_PERM` and `GENL_UNS_ADMIN_PERM` are actually *checked* within the kernel. Let's see... the most likely starting point is the generic netlink implementation itself. So, I'm going to head directly into `net/netlink/genetlink.c`. That seems like the logical place to start digging. Grep time! Let's get cracking.
|
| 174/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM PathPrefix:net/netlink/genetlink.c]
Results: map[Output:net/netlink/genetlink.c=1155=static int genl_family_rcv_msg(const struct genl_family *family,
--
net/netlink/genetlink.c-1181-
net/netlink/genetlink.c:1182: if ((op.flags & GENL_ADMIN_PERM) &&
net/netlink/genetlink.c-1183- !netlink_capable(skb, CAP_NET_ADMIN))
]
|
| 175/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 25970
output: 39
thoughts: 88
Thoughts: Here's my summary, as though I were thinking through the code:
**Diving into Genetlink Permissions**
Okay, so I'm digging into `net/netlink/genetlink.c` again. I want to understand how GENL_ADMIN_PERM permissions are being handled. Specifically, let's zoom in on line 1182, because it seems crucial:
```c
if ((op.flags & GENL_ADMIN_PERM) &&
!netlink_capable(skb, CAP_NET_ADMIN))
```
That conditional logic is pretty telling. It looks like it's checking if a specific operation has the `GENL_ADMIN_PERM` flag set *and* if the netlink message isn't coming from a socket with `CAP_NET_ADMIN` capability. My immediate assumption is that this implies that admin-level genetlink operations are contingent on this capability check.
To get the complete picture and not make assumptions, I need the context. Let me read the surrounding lines, say from 1175 to 1205. That should give me a good handle on what `op.flags` is, how it's being set, what the overall flow of execution looks like, and what consequences the conditional on line 1182 has. I want to see how these checks relate to authorization and access control within the GENL framework. Knowing this particular check is critical, as it likely defines whether an admin can use the network interface, potentially to reconfigure the interfaces. Time to parse the surrounding code and ensure my initial assumptions are correct.
|
| 176/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/netlink/genetlink.c FirstLine:1175 LineCount:30]
Results: map[Contents:1175: return -EINVAL;
1176:
1177: flags = (nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP ?
1178: GENL_CMD_CAP_DUMP : GENL_CMD_CAP_DO;
1179: if (genl_get_cmd(hdr->cmd, flags, family, &op))
1180: return -EOPNOTSUPP;
1181:
1182: if ((op.flags & GENL_ADMIN_PERM) &&
1183: !netlink_capable(skb, CAP_NET_ADMIN))
1184: return -EPERM;
1185:
1186: if ((op.flags & GENL_UNS_ADMIN_PERM) &&
1187: !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
1188: return -EPERM;
1189:
1190: if (flags & GENL_CMD_CAP_DUMP)
1191: return genl_family_rcv_msg_dumpit(family, skb, nlh, extack,
1192: &op, hdrlen, net);
1193: else
1194: return genl_family_rcv_msg_doit(family, skb, nlh, extack,
1195: &op, hdrlen, net);
1196: }
1197:
1198: static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
1199: struct netlink_ext_ack *extack)
1200: {
1201: const struct genl_family *family;
1202: int err;
1203:
1204: family = genl_family_find_byid(nlh->nlmsg_type);
]
|
| 177/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26983
output: 38
thoughts: 142
Thoughts: **Analyzing Netlink Permission Checks**
Okay, here's what I'm seeing: there's this `netlink_capable` call, and it's being used to enforce some admin permissions. The code specifically checks for `GENL_ADMIN_PERM` and `GENL_UNS_ADMIN_PERM` flags. My gut says this is about controlling access to certain Netlink operations.
The first `if` statement checks `GENL_ADMIN_PERM` and uses `netlink_capable` to see if the socket buffer `skb` has `CAP_NET_ADMIN` privileges. Pretty standard for a system that needs high-level network control. The second one, with `GENL_UNS_ADMIN_PERM`, is particularly interesting because it's using `netlink_ns_capable` and checking permissions in a user namespace. That `net->user_ns` variable is key - it tells us we're operating within a specific user namespace context. This is what I expect to see.
Now, the interesting bit here is `netlink_capable`, so I need to check its definition. This is where it gets interesting... this likely means the check involves the `init_user_ns`. I'll have to delve deeper to find out exactly how it determines the capability, especially how it handles the user namespace aspect. Knowing how this check is implemented is crucial for understanding the security model and any potential vulnerabilities or bypasses. I'll need to dig into the kernel source to get a complete picture.
|
| 178/4 |
2026/09/13 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netlink/genetlink.c Name:netlink_capable]
Results: map[SourceCode: 874: /**
875: * netlink_capable - Netlink global message capability test
876: * @skb: socket buffer holding a netlink command from userspace
877: * @cap: The capability to use
878: *
879: * Test to see if the opener of the socket we received the message
880: * from had when the netlink socket was created and the sender of the
881: * message has the capability @cap in all user namespaces.
882: */
883: bool netlink_capable(const struct sk_buff *skb, int cap)
884: {
885: return netlink_ns_capable(skb, &init_user_ns, cap);
886: }
SourceFile:net/netlink/af_netlink.c]
|
| 179/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 27733
output: 28
thoughts: 200
Thoughts: **Investigating the NAPI Threading Capability in Netlink**
Okay, so `netlink_capable` is the gatekeeper here, calling `netlink_ns_capable` with `skb`, `&init_user_ns`, and the capability we're checking. This means `NETDEV_CMD_NAPI_SET` needing `GENL_ADMIN_PERM | GENL_CMD_CAP_DO` flags and requiring `netlink_capable(skb, CAP_NET_ADMIN)` ultimately ties back to the `init_user_ns`. But I need to verify, is there some other netlink command or RTNL attribute that is related to threaded NAPI, that would provide another access path or configuration option? Let's dive into the RTNL world.
I'm specifically thinking about RTNL attributes, like `IFLA_...`. Is there anything related to 'threaded' NAPI there? Let's do a more thorough search across the codebase. I need to make sure I haven't missed a more direct attribute for enabling or disabling threaded NAPI. I'll search for `netif_set_threaded`, `dev_set_threaded`, or even `napi_set_threaded`, and see what the results bring up. This should tell me what I am missing or confirm that everything is as expected.
|
| 180/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:napi_set_threaded PathPrefix:net/]
Results: map[Output:net/core/dev.c=7209=static void napi_stop_kthread(struct napi_struct *napi)
--
net/core/dev.c-7246-
net/core/dev.c:7247:static void napi_set_threaded_state(struct napi_struct *napi,
net/core/dev.c-7248- enum netdev_napi_threaded threaded_mode)
--
net/core/dev.c-7256-
net/core/dev.c:7257:int napi_set_threaded(struct napi_struct *napi,
net/core/dev.c-7258- enum netdev_napi_threaded threaded)
--
net/core/dev.c-7282- smp_mb__before_atomic();
net/core/dev.c:7283: napi_set_threaded_state(napi, threaded);
net/core/dev.c-7284- }
--
net/core/dev.c=7289=int netif_set_threaded(struct net_device *dev,
--
net/core/dev.c-7312- list_for_each_entry(napi, &dev->napi_list, dev_list)
net/core/dev.c:7313: WARN_ON_ONCE(napi_set_threaded(napi, threaded));
net/core/dev.c-7314-
--
net/core/dev.c=7534=static void napi_restore_config(struct napi_struct *n)
--
net/core/dev.c-7553-
net/core/dev.c:7554: WARN_ON_ONCE(napi_set_threaded(n, n->config->threaded));
net/core/dev.c-7555-}
--
net/core/dev.h=369=napi_get_threaded_config(struct net_device *dev, struct napi_struct *n)
--
net/core/dev.h-375-
net/core/dev.h:376:int napi_set_threaded(struct napi_struct *n,
net/core/dev.h-377- enum netdev_napi_threaded threaded);
--
net/core/netdev-genl.c=327=netdev_nl_napi_set_config(struct napi_struct *napi, struct genl_info *info)
--
net/core/netdev-genl.c-337- threaded = nla_get_uint(info->attrs[NETDEV_A_NAPI_THREADED]);
net/core/netdev-genl.c:338: ret = napi_set_threaded(napi, threaded);
net/core/netdev-genl.c-339- if (ret)
]
|
| 181/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 28973
output: 38
thoughts: 135
Thoughts: **Investigating Threaded Network Device Configuration**
Okay, so I've been digging into the network device threading configuration. It seems `napi_set_threaded` is only called from a specific set of functions: `netif_set_threaded`, `napi_restore_config`, and `netdev_nl_napi_set_config`. That's a limited set. I need to understand the complete picture, though.
Now, I'm wondering about the interaction with `netdev_lock_store` and how it relates to that sysfs `/sys/class/net/<dev>/threaded` file. That's a crucial piece. I need to see how the user-space configuration interacts with the kernel's threading state.
I'll start by examining `threaded_store` within `net/core/net-sysfs.c`. This is where the magic happens, where the sysfs file writes are handled. I need to understand exactly what that function does. I'll need to review `modify_napi_threaded` which is part of that too. And finally, to be thorough, I should also look at `netdev_lock_store` in the same file. That should give me a good understanding of the entire flow.
|
| 182/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/net-sysfs.c FirstLine:725 LineCount:45]
Results: map[Contents: 725: .is_visible = netdev_phys_is_visible,
726: };
727:
728: static ssize_t threaded_show(struct device *dev,
729: struct device_attribute *attr, char *buf)
730: {
731: struct net_device *netdev = to_net_dev(dev);
732: ssize_t ret = -EINVAL;
733:
734: rcu_read_lock();
735:
736: if (dev_isalive(netdev))
737: ret = sysfs_emit(buf, fmt_dec, READ_ONCE(netdev->threaded));
738:
739: rcu_read_unlock();
740:
741: return ret;
742: }
743:
744: static int modify_napi_threaded(struct net_device *dev, unsigned long val)
745: {
746: int ret;
747:
748: if (list_empty(&dev->napi_list))
749: return -EOPNOTSUPP;
750:
751: if (val != 0 && val != 1)
752: return -EOPNOTSUPP;
753:
754: ret = netif_set_threaded(dev, val);
755:
756: return ret;
757: }
758:
759: static ssize_t threaded_store(struct device *dev,
760: struct device_attribute *attr,
761: const char *buf, size_t len)
762: {
763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
764: }
765: static DEVICE_ATTR_RW(threaded);
766:
767: static struct attribute *net_class_attrs[] __ro_after_init = {
768: &dev_attr_netdev_group.attr,
769: &dev_attr_type.attr,
]
|
| 183/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30047
output: 36
thoughts: 36
Thoughts: Here's my attempt at summarizing the thought process, as if I were an expert:
**Investigating Network Device Lock Management**
Alright, let's dive in. The core question I have here is, what's the functionality of `netdev_lock_store`? This clearly seems like a critical piece of the network device locking puzzle. To understand its role fully, I need to contrast it directly with `netdev_store`. Comparing these two functions should quickly illuminate the specific responsibilities of `netdev_lock_store` within the broader context of device configuration and management. Let's see what the code reveals.
|
| 184/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:netdev_lock_store PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=188=static ssize_t
net/core/net-sysfs.c:189:netdev_lock_store(struct device *dev, struct device_attribute *attr,
net/core/net-sysfs.c-190- const char *buf, size_t len,
--
net/core/net-sysfs.c=528=static ssize_t gro_flush_timeout_store(struct device *dev,
--
net/core/net-sysfs.c-534-
net/core/net-sysfs.c:535: return netdev_lock_store(dev, attr, buf, len, change_gro_flush_timeout);
net/core/net-sysfs.c-536-}
--
net/core/net-sysfs.c=548=static ssize_t napi_defer_hard_irqs_store(struct device *dev,
--
net/core/net-sysfs.c-554-
net/core/net-sysfs.c:555: return netdev_lock_store(dev, attr, buf, len,
net/core/net-sysfs.c-556- change_napi_defer_hard_irqs);
--
net/core/net-sysfs.c=759=static ssize_t threaded_store(struct device *dev,
--
net/core/net-sysfs.c-762-{
net/core/net-sysfs.c:763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
net/core/net-sysfs.c-764-}
]
|
| 185/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30679
output: 38
thoughts: 26
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `netdev_lock_store`**
Okay, time to dig into `netdev_lock_store`. Right, it's in `net/core/net-sysfs.c`, which makes sense. This function must be the write handler for the "lock" attribute exposed in the net device sysfs entry. It's probably the mechanism for, well, locking a network device, likely for exclusive configuration changes or something similar. I need to see how it handles concurrency and what resources it protects. Is it just a simple spinlock, or something more sophisticated? What about error handling? And how does it interact with other locking primitives in the networking stack? Understanding the implications of this lock is key to preventing race conditions. Let's see how it's implemented.
|
| 186/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/net-sysfs.c FirstLine:185 LineCount:40]
Results: map[Contents: 185: }
186:
187: /* Same as netdev_store() but takes netdev_lock() instead of rtnl_lock() */
188: static ssize_t
189: netdev_lock_store(struct device *dev, struct device_attribute *attr,
190: const char *buf, size_t len,
191: int (*set)(struct net_device *, unsigned long))
192: {
193: struct net_device *netdev = to_net_dev(dev);
194: struct net *net = dev_net(netdev);
195: unsigned long new;
196: int ret;
197:
198: if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
199: return -EPERM;
200:
201: ret = kstrtoul(buf, 0, &new);
202: if (ret)
203: return ret;
204:
205: netdev_lock(netdev);
206:
207: if (dev_isalive(netdev)) {
208: ret = (*set)(netdev, new);
209: if (ret == 0)
210: ret = len;
211: }
212: netdev_unlock(netdev);
213:
214: return ret;
215: }
216:
217: NETDEVICE_SHOW_RO(dev_id, fmt_hex);
218: NETDEVICE_SHOW_RO(dev_port, fmt_dec);
219: NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec);
220: NETDEVICE_SHOW_RO(addr_len, fmt_dec);
221: NETDEVICE_SHOW_RO(ifindex, fmt_dec);
222: NETDEVICE_SHOW_RO(type, fmt_dec);
223: NETDEVICE_SHOW_RO(link_mode, fmt_dec);
224:
]
|
| 187/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 31530
output: 35
thoughts: 571
Thoughts: **Analyzing Potential Privilege Escalation via Tunnel Device Creation**
Okay, so I'm looking at `netdev_lock_store`. It's pretty straightforward: it takes a value, performs some operations on a network device, and importantly, checks for `CAP_NET_ADMIN` in the network namespace using `ns_capable`. Good, that's what I'd expect.
Now, I'm thinking about `modify_napi_threaded`. It checks if the `napi_list` is empty on a device. If it *is* empty, it returns `EOPNOTSUPP`. That's line 748, right? This is where it gets interesting...
Can a tunnel device, like GRE, VXLAN, or something similar, have an *empty* `napi_list`? That's the key. And, more importantly, can an *unprivileged* user create one of these tunnel devices inside a user namespace where they *do* have `CAP_NET_ADMIN`? If they can create a tunnel device, they can presumably modify its NAPI state. Hmmm...
If they *can* create a tunnel device, does `netdev_lock_store` then provide an escalation path by allowing them to potentially modify NAPI state? This would bypass the checks that prevent NAPI from being disabled.
Okay, so how *are* tunnel devices created? Is it via `rtnl_link_ops` or with `ioctl` calls? I need to check how `ip link add` works for various tunnel types: GRE, VXLAN, GENEVE, IPIP, SIT, WireGuard, MacVLAN, VETH, etc. I need to see if `rtnl` checks the necessary privileges when creating these links. I'm going to look at `rtnl_newlink`, `rtnl_create_link`, or where the `rtnl_link_ops` are called in order to determine what checks are made and if this is a viable attack vector.
|
| 188/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:rtnl_create_link PathPrefix:net/core/rtnetlink.c]
Results: map[Output:net/core/rtnetlink.c=3743=EXPORT_SYMBOL(rtnl_configure_link);
net/core/rtnetlink.c-3744-
net/core/rtnetlink.c:3745:struct net_device *rtnl_create_link(struct net *net, const char *ifname,
net/core/rtnetlink.c-3746- unsigned char name_assign_type,
--
net/core/rtnetlink.c-3838-}
net/core/rtnetlink.c:3839:EXPORT_SYMBOL(rtnl_create_link);
net/core/rtnetlink.c-3840-
--
net/core/rtnetlink.c=3933=static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
--
net/core/rtnetlink.c-3963-
net/core/rtnetlink.c:3964: dev = rtnl_create_link(tgt_net, ifname, name_assign_type, ops, tb,
net/core/rtnetlink.c-3965- extack);
]
|
| 189/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 32871
output: 38
thoughts: 34
Thoughts: Here's my take:
**Diving into the Link Creation Process**
Okay, time to get my hands dirty. I need to understand the nitty-gritty of link creation in the networking stack. Let's start with `rtnl_create_link` and `rtnl_newlink`. I'm specifically interested in lines 3745 and 3933, as those seem like good entry points to see what's really happening under the hood. Hopefully, this will shed some light on the control flow and data structures involved when a new link is brought up. I'm eager to dissect the interaction between these two functions and see how they work together, and I'll keep an eye out for any potential optimizations or areas for future investigation.
|
| 190/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:3745 LineCount:60]
Results: map[Contents:3745: struct net_device *rtnl_create_link(struct net *net, const char *ifname,
3746: unsigned char name_assign_type,
3747: const struct rtnl_link_ops *ops,
3748: struct nlattr *tb[],
3749: struct netlink_ext_ack *extack)
3750: {
3751: struct net_device *dev;
3752: unsigned int num_tx_queues = 1;
3753: unsigned int num_rx_queues = 1;
3754: int err;
3755:
3756: if (tb[IFLA_NUM_TX_QUEUES])
3757: num_tx_queues = nla_get_u32(tb[IFLA_NUM_TX_QUEUES]);
3758: else if (ops->get_num_tx_queues)
3759: num_tx_queues = ops->get_num_tx_queues();
3760:
3761: if (tb[IFLA_NUM_RX_QUEUES])
3762: num_rx_queues = nla_get_u32(tb[IFLA_NUM_RX_QUEUES]);
3763: else if (ops->get_num_rx_queues)
3764: num_rx_queues = ops->get_num_rx_queues();
3765:
3766: if (num_tx_queues < 1 || num_tx_queues > 4096) {
3767: NL_SET_ERR_MSG(extack, "Invalid number of transmit queues");
3768: return ERR_PTR(-EINVAL);
3769: }
3770:
3771: if (num_rx_queues < 1 || num_rx_queues > 4096) {
3772: NL_SET_ERR_MSG(extack, "Invalid number of receive queues");
3773: return ERR_PTR(-EINVAL);
3774: }
3775:
3776: if (ops->alloc) {
3777: dev = ops->alloc(tb, ifname, name_assign_type,
3778: num_tx_queues, num_rx_queues);
3779: if (IS_ERR(dev))
3780: return dev;
3781: } else {
3782: dev = alloc_netdev_mqs(ops->priv_size, ifname,
3783: name_assign_type, ops->setup,
3784: num_tx_queues, num_rx_queues);
3785: }
3786:
3787: if (!dev)
3788: return ERR_PTR(-ENOMEM);
3789:
3790: err = validate_linkmsg(dev, tb, extack);
3791: if (err < 0) {
3792: free_netdev(dev);
3793: return ERR_PTR(err);
3794: }
3795:
3796: dev_net_set(dev, net);
3797: dev->rtnl_link_ops = ops;
3798: dev->rtnl_link_initializing = true;
3799:
3800: if (tb[IFLA_MTU]) {
3801: u32 mtu = nla_get_u32(tb[IFLA_MTU]);
3802:
3803: err = dev_validate_mtu(dev, mtu, extack);
3804: if (err) {
]
|
| 191/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 34125
output: 34
thoughts: 41
Thoughts: Okay, let's break this down.
**Investigating Network Link Creation Permissions**
Right, so I need to figure out the permissions that are being evaluated during the creation of a new network link, especially within the context of the Linux kernel. Where does the check actually *happen*? My initial thought is to dive into the `rtnl_newlink` function itself. That's the obvious place to start, right? But I also need to be thorough. I should expand my search to include functions that *call* `rtnl_newlink` or, better yet, `rtnl_newlink_create`, just in case the check is handled upstream and propagated down. I need a comprehensive view of the code flow to be sure I'm not missing anything. This should give me a complete picture of the authorization process involved in adding new links. Time to start digging through the source...
|
| 192/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:rtnl_newlink PathPrefix:net/core/rtnetlink.c]
Results: map[Output:net/core/rtnetlink.c=3839=EXPORT_SYMBOL(rtnl_create_link);
net/core/rtnetlink.c-3840-
net/core/rtnetlink.c:3841:struct rtnl_newlink_tbs {
net/core/rtnetlink.c-3842- struct nlattr *tb[IFLA_MAX + 1];
--
net/core/rtnetlink.c=3848=static int rtnl_changelink(const struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/core/rtnetlink.c-3850- struct net_device *dev, struct net *tgt_net,
net/core/rtnetlink.c:3851: struct rtnl_newlink_tbs *tbs,
net/core/rtnetlink.c-3852- struct nlattr **data,
--
net/core/rtnetlink.c=3913=static int rtnl_group_changelink(const struct sk_buff *skb,
--
net/core/rtnetlink.c-3932-
net/core/rtnetlink.c:3933:static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
net/core/rtnetlink.c-3934- const struct rtnl_link_ops *ops,
--
net/core/rtnetlink.c-3941- unsigned char name_assign_type = NET_NAME_USER;
net/core/rtnetlink.c:3942: struct rtnl_newlink_params params = {
net/core/rtnetlink.c-3943- .src_net = sock_net(skb->sk),
--
net/core/rtnetlink.c=4007=static struct net *rtnl_get_peer_net(struct sk_buff *skb,
--
net/core/rtnetlink.c-4044-
net/core/rtnetlink.c:4045:static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/rtnetlink.c-4046- const struct rtnl_link_ops *ops,
--
net/core/rtnetlink.c-4048- struct net *peer_net,
net/core/rtnetlink.c:4049: struct rtnl_newlink_tbs *tbs,
net/core/rtnetlink.c-4050- struct nlattr **data,
--
net/core/rtnetlink.c-4102-
net/core/rtnetlink.c:4103: return rtnl_newlink_create(skb, ifm, ops, tgt_net, link_net, peer_net, nlh,
net/core/rtnetlink.c-4104- tb, data, extack);
--
net/core/rtnetlink.c-4106-
net/core/rtnetlink.c:4107:static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/rtnetlink.c-4108- struct netlink_ext_ack *extack)
--
net/core/rtnetlink.c-4112- struct rtnl_link_ops *ops = NULL;
net/core/rtnetlink.c:4113: struct rtnl_newlink_tbs *tbs;
net/core/rtnetlink.c-4114- struct rtnl_nets rtnl_nets;
--
net/core/rtnetlink.c-4219- rtnl_nets_lock(&rtnl_nets);
net/core/rtnetlink.c:4220: ret = __rtnl_newlink(skb, nlh, ops, tgt_net, link_net, peer_net, tbs, data, extack);
net/core/rtnetlink.c-4221- rtnl_nets_unlock(&rtnl_nets);
--
net/core/rtnetlink.c=4427=static int rtnl_linkprop(int cmd, struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/core/rtnetlink.c-4474-
net/core/rtnetlink.c:4475:static int rtnl_newlinkprop(struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/rtnetlink.c-4476- struct netlink_ext_ack *extack)
--
net/core/rtnetlink.c=7239=static const struct rtnl_msg_handler rtnetlink_rtnl_msg_handlers[] __initconst = {
net/core/rtnetlink.c:7240: {.msgtype = RTM_NEWLINK, .doit = rtnl_newlink,
net/core/rtnetlink.c-7241- .flags = RTNL_FLAG_DOIT_PERNET},
--
net/core/rtnetlink.c-7256- {.msgtype = RTM_SETSTATS, .doit = rtnl_stats_set},
net/core/rtnetlink.c:7257: {.msgtype = RTM_NEWLINKPROP, .doit = rtnl_newlinkprop},
net/core/rtnetlink.c-7258- {.msgtype = RTM_DELLINKPROP, .doit = rtnl_dellinkprop},
]
|
| 193/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 35808
output: 38
thoughts: 50
Thoughts: Here's my thinking process:
**Diving into `rtnl_newlink` Permission Checks**
Okay, so I need to understand the permission checks within `rtnl_newlink`. I'm starting at line 4107 in `net/core/rtnetlink.c`, as that's where I believe the relevant code begins. I need to figure out what criteria are being evaluated to determine if a user has the authority to create a new network link. Itβs likely a combination of CAP_NET_ADMIN capabilities and potentially some more fine-grained checks based on the specific parameters of the request. Let's see how granular these checks are.
|
| 194/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:4107 LineCount:70]
Results: map[Contents:4107: static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
4108: struct netlink_ext_ack *extack)
4109: {
4110: struct net *tgt_net, *link_net = NULL, *peer_net = NULL;
4111: struct nlattr **tb, **linkinfo, **data = NULL;
4112: struct rtnl_link_ops *ops = NULL;
4113: struct rtnl_newlink_tbs *tbs;
4114: struct rtnl_nets rtnl_nets;
4115: int ops_srcu_index;
4116: int ret;
4117:
4118: tbs = kmalloc_obj(*tbs);
4119: if (!tbs)
4120: return -ENOMEM;
4121:
4122: tb = tbs->tb;
4123: ret = nlmsg_parse_deprecated(nlh, sizeof(struct ifinfomsg), tb,
4124: IFLA_MAX, ifla_policy, extack);
4125: if (ret < 0)
4126: goto free;
4127:
4128: ret = rtnl_ensure_unique_netns(tb, extack, false);
4129: if (ret < 0)
4130: goto free;
4131:
4132: linkinfo = tbs->linkinfo;
4133: if (tb[IFLA_LINKINFO]) {
4134: ret = nla_parse_nested_deprecated(linkinfo, IFLA_INFO_MAX,
4135: tb[IFLA_LINKINFO],
4136: ifla_info_policy, NULL);
4137: if (ret < 0)
4138: goto free;
4139: } else {
4140: memset(linkinfo, 0, sizeof(tbs->linkinfo));
4141: }
4142:
4143: if (linkinfo[IFLA_INFO_KIND]) {
4144: char kind[MODULE_NAME_LEN];
4145:
4146: nla_strscpy(kind, linkinfo[IFLA_INFO_KIND], sizeof(kind));
4147: ops = rtnl_link_ops_get(kind, &ops_srcu_index);
4148: #ifdef CONFIG_MODULES
4149: if (!ops) {
4150: request_module("rtnl-link-%s", kind);
4151: ops = rtnl_link_ops_get(kind, &ops_srcu_index);
4152: }
4153: #endif
4154: }
4155:
4156: rtnl_nets_init(&rtnl_nets);
4157:
4158: if (ops) {
4159: if (ops->maxtype > RTNL_MAX_TYPE) {
4160: ret = -EINVAL;
4161: goto put_ops;
4162: }
4163:
4164: if (ops->maxtype && linkinfo[IFLA_INFO_DATA]) {
4165: ret = nla_parse_nested_deprecated(tbs->attr, ops->maxtype,
4166: linkinfo[IFLA_INFO_DATA],
4167: ops->policy, extack);
4168: if (ret < 0)
4169: goto put_ops;
4170:
4171: data = tbs->attr;
4172: }
4173:
4174: if (ops->validate) {
4175: ret = ops->validate(tb, data, extack);
4176: if (ret < 0)
]
|
| 195/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 37124
output: 38
thoughts: 33
Thoughts: Here's my take on the thought process, as requested:
**Diving Deeper into Link Creation**
Okay, so I've got a good grasp of the high-level network interface creation process, but to really understand the nitty-gritty, I need to get into the heart of it. Let's trace this logic out: I need to look at the implementations of `rtnl_newlink`, `__rtnl_newlink`, and `rtnl_newlink_create`. Seeing how these functions interact is crucial. I want to understand exactly how the new link is constructed, configured, and integrated into the system, and these function calls are the keys to unlocking that knowledge. Time to get my hands dirty and examine the actual code! I'm expecting to see things like attribute handling, device registration, and the fundamental steps of bringing a network interface online. Let's see what's really happening under the hood.
|
| 196/4 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:4177 LineCount:60]
Results: map[Contents:4177: goto put_ops;
4178: }
4179:
4180: if (ops->peer_type) {
4181: peer_net = rtnl_get_peer_net(skb, ops, tb, data, extack);
4182: if (IS_ERR(peer_net)) {
4183: ret = PTR_ERR(peer_net);
4184: goto put_ops;
4185: }
4186: if (peer_net)
4187: rtnl_nets_add(&rtnl_nets, peer_net);
4188: }
4189: }
4190:
4191: tgt_net = rtnl_link_get_net_capable(skb, sock_net(skb->sk), tb, CAP_NET_ADMIN);
4192: if (IS_ERR(tgt_net)) {
4193: ret = PTR_ERR(tgt_net);
4194: goto put_net;
4195: }
4196:
4197: rtnl_nets_add(&rtnl_nets, tgt_net);
4198:
4199: if (tb[IFLA_LINK_NETNSID]) {
4200: int id = nla_get_s32(tb[IFLA_LINK_NETNSID]);
4201:
4202: link_net = get_net_ns_by_id(tgt_net, id);
4203: if (!link_net) {
4204: NL_SET_ERR_MSG(extack, "Unknown network namespace id");
4205: ret = -EINVAL;
4206: goto put_net;
4207: }
4208:
4209: rtnl_nets_add(&rtnl_nets, link_net);
4210:
4211: if (!netlink_ns_capable(skb, link_net->user_ns, CAP_NET_ADMIN)) {
4212: ret = -EPERM;
4213: goto put_net;
4214: }
4215: }
4216:
4217: rtnl_nets_add(&rtnl_nets, get_net(sock_net(skb->sk)));
4218:
4219: rtnl_nets_lock(&rtnl_nets);
4220: ret = __rtnl_newlink(skb, nlh, ops, tgt_net, link_net, peer_net, tbs, data, extack);
4221: rtnl_nets_unlock(&rtnl_nets);
4222:
4223: put_net:
4224: rtnl_nets_destroy(&rtnl_nets);
4225: put_ops:
4226: if (ops)
4227: rtnl_link_ops_put(ops, ops_srcu_index);
4228: free:
4229: kfree(tbs);
4230: return ret;
4231: }
4232:
4233: static int rtnl_valid_getlink_req(struct sk_buff *skb,
4234: const struct nlmsghdr *nlh,
4235: struct nlattr **tb,
4236: struct netlink_ext_ack *extack)
]
|
| 197/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 38335
output: 43
thoughts: 71
Thoughts: **Analyzing Network Capability Checks**
Okay, so I'm looking at this line: `tgt_net = rtnl_link_get_net_capable(skb, sock_net(skb->sk), tb, CAP_NET_ADMIN);` and immediately my brain jumps to: "What's `rtnl_link_get_net_capable` actually *doing* here?". I see the arguments: `skb`, `sock_net(skb->sk)`, `tb`, and `CAP_NET_ADMIN`. Seems like some sort of socket buffer and associated network namespace information, and then something related to a table and admin capability checks. This definitely looks like a crucial point where network capabilities are being assessed, probably to determine access or permissions. Since I'm debugging this, I need a complete understanding. Time to dive into the implementation of `rtnl_link_get_net_capable` itself. Let's trace that function call.
|
| 198/4 |
2026/09/13 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/rtnetlink.c Name:rtnl_link_get_net_capable]
Results: map[SourceCode:2723: static struct net *rtnl_link_get_net_capable(const struct sk_buff *skb,
2724: struct net *src_net,
2725: struct nlattr *tb[], int cap)
2726: {
2727: struct net *net;
2728:
2729: net = rtnl_link_get_net_by_nlattr(src_net, tb);
2730: if (IS_ERR(net))
2731: return net;
2732:
2733: if (!netlink_ns_capable(skb, net->user_ns, cap)) {
2734: put_net(net);
2735: return ERR_PTR(-EPERM);
2736: }
2737:
2738: return net;
2739: }
SourceFile:net/core/rtnetlink.c]
|
| 199/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 38928
output: 35
thoughts: 164
Thoughts: **My Line of Inquiry: Tunnel Device Creation in User Namespaces**
Okay, so I'm looking at this `netlink_ns_capable` check with `skb` and `net->user_ns`, and I'm immediately thinking, "Can an *unprivileged* user actually create a tunnel device?". That's the core question here. My gut feeling is "No," but I need to be absolutely certain.
My mind immediately jumps to `ops->newlink`, because that's the usual entry point for `gre`, `vxlan`, and other tunnel types. I need to understand if these operations have the proper checks in place.
So, let's dive deeper: does the code for `gre`, `vxlan`, or any of the other tunnel devices perform any kind of namespace validation? Are they checking for `init_user_ns` or something similar? Are there any explicit restrictions against creating these devices within user namespaces? That's the key: are the right authorization checks being enforced?
I'm going to start by examining the core implementations - `ip_gre`, `vxlan`, and `geneve` specifically. I need to trace the creation flow and the checks performed.
To get a better handle on the netlink interfaces, I'll need to look at `ipgre_netlink_ops`, `vxlan_link_ops`, `ipgre_newlink`, and `vxlan_newlink` specifically. I need to trace the interactions to be absolutely sure whether these operations allow this, or block it. I need to be certain about the security posture here.
|
| 200/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:\.newlink\b PathPrefix:net/ipv4/ip_gre.c]
Results: map[Output:net/ipv4/ip_gre.c=1678=static struct rtnl_link_ops ipgre_link_ops __read_mostly = {
--
net/ipv4/ip_gre.c-1684- .validate = ipgre_tunnel_validate,
net/ipv4/ip_gre.c:1685: .newlink = ipgre_newlink,
net/ipv4/ip_gre.c-1686- .changelink = ipgre_changelink,
--
net/ipv4/ip_gre.c=1693=static struct rtnl_link_ops ipgre_tap_ops __read_mostly = {
--
net/ipv4/ip_gre.c-1699- .validate = ipgre_tap_validate,
net/ipv4/ip_gre.c:1700: .newlink = ipgre_newlink,
net/ipv4/ip_gre.c-1701- .changelink = ipgre_changelink,
--
net/ipv4/ip_gre.c=1708=static struct rtnl_link_ops erspan_link_ops __read_mostly = {
--
net/ipv4/ip_gre.c-1714- .validate = erspan_validate,
net/ipv4/ip_gre.c:1715: .newlink = erspan_newlink,
net/ipv4/ip_gre.c-1716- .changelink = erspan_changelink,
]
|
| 201/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 39858
output: 39
thoughts: 19
Thoughts: Here's my summary, as though I'm thinking it:
**Digging into Network Device Creation**
Okay, time to get my hands dirty. I need to refresh my understanding of the network device creation process, particularly focusing on the differences in how we're handling new tunnels. Let's start by digging into `ipgre_newlink` and `vxlan_newlink`. These two functions are likely where the rubber meets the road in terms of setting up GRE and VXLAN interfaces. I want to see exactly what parameters are being passed, how the device is configured within the kernel, and, crucially, how these differ. Are we managing the associated underlying network interfaces correctly in each case? Is there any potential for inconsistencies or overlooked configurations between these two? This is where I'll get a good grasp on our device-creation processes. I suspect a careful look at this code will uncover our root cause.
|
| 202/4 |
2026/09/13 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv4/ip_gre.c Name:ipgre_newlink]
Results: map[SourceCode:1413: static int ipgre_newlink(struct net_device *dev,
1414: struct rtnl_newlink_params *params,
1415: struct netlink_ext_ack *extack)
1416: {
1417: struct nlattr **data = params->data;
1418: struct nlattr **tb = params->tb;
1419: struct ip_tunnel_parm_kern p;
1420: __u32 fwmark = 0;
1421: int err;
1422:
1423: err = ipgre_newlink_encap_setup(dev, data);
1424: if (err)
1425: return err;
1426:
1427: err = ipgre_netlink_parms(dev, data, tb, &p, &fwmark);
1428: if (err < 0)
1429: return err;
1430: return ip_tunnel_newlink(params->link_net ? : dev_net(dev), dev, tb, &p,
1431: fwmark);
1432: }
SourceFile:net/ipv4/ip_gre.c]
|
| 203/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 40451
output: 40
thoughts: 15
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Investigating Potential Weak Points**
Right, let's not jump to conclusions just yet. While `ip_tunnel_init` looks like a likely candidate for investigation, it's prudent to broaden the scope. My experience tells me that these types of issues can often manifest in unexpected places. Therefore, I need to make sure that I don't miss a subtly related function. Let me also investigate `ip_tunnel_newlink`. Checking that function seems like a good move, to make sure it is not the culprit.
|
| 204/4 |
2026/09/13 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv4/ip_tunnel.c Name:ip_tunnel_newlink]
Results: map[SourceCode:1182: int ip_tunnel_newlink(struct net *net, struct net_device *dev,
1183: struct nlattr *tb[], struct ip_tunnel_parm_kern *p,
1184: __u32 fwmark)
1185: {
1186: struct ip_tunnel *nt;
1187: struct ip_tunnel_net *itn;
1188: int mtu;
1189: int err;
1190:
1191: nt = netdev_priv(dev);
1192: itn = net_generic(net, nt->ip_tnl_net_id);
1193:
1194: if (nt->collect_md) {
1195: if (rtnl_dereference(itn->collect_md_tun))
1196: return -EEXIST;
1197: } else {
1198: if (ip_tunnel_find(itn, p, dev->type))
1199: return -EEXIST;
1200: }
1201:
1202: nt->net = net;
1203: nt->parms = *p;
1204: nt->fwmark = fwmark;
1205: err = register_netdevice(dev);
1206: if (err)
1207: goto err_register_netdevice;
1208:
1209: if (dev->type == ARPHRD_ETHER && !tb[IFLA_ADDRESS])
1210: eth_hw_addr_random(dev);
1211:
1212: mtu = ip_tunnel_bind_dev(dev);
1213: if (tb[IFLA_MTU]) {
1214: unsigned int max = IP_MAX_MTU - (nt->hlen + sizeof(struct iphdr));
1215:
1216: if (dev->type == ARPHRD_ETHER)
1217: max -= dev->hard_header_len;
1218:
1219: mtu = clamp(dev->mtu, (unsigned int)ETH_MIN_MTU, max);
1220: }
1221:
1222: err = dev_set_mtu(dev, mtu);
1223: if (err)
1224: goto err_dev_set_mtu;
1225:
1226: ip_tunnel_add(itn, nt);
1227: return 0;
1228:
1229: err_dev_set_mtu:
1230: unregister_netdevice(dev);
1231: err_register_netdevice:
1232: return err;
1233: }
SourceFile:net/ipv4/ip_tunnel.c]
|
| 205/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 41421
output: 37
thoughts: 241
Thoughts: **My Line of Thinking**
Okay, here's what's running through my mind. Can I create an `ip_gre` or `ip_tunnel` device *within* a user namespace? And, assuming the module is already loaded, can an unprivileged user, given `CAP_NET_ADMIN` in their namespace, actually create one via rtnetlink? The answer is YES, assuming the module is already loaded or built-in, this seems possible!
But wait, can an unprivileged user *load* the kernel module in the first place? No, the module auto-loading mechanism, specifically the `request_module("rtnl-link-%s", kind);` function, performs a check for `capable(CAP_SYS_MODULE)`. That's a no-go for an unprivileged user. BUT, if it's *already* loaded or built-in, they're good to go.
A further question arises! Do these tunnel devices, `ip_tunnel`, `vxlan`, `gre`, etc., support NAPI (Network Interface Polling)? Are they designed with Network Interface Polling in mind? Do these tunnel devices support NAPI?
Let's do some digging. Time to search for `netif_napi_add`, `netif_threaded_enable`, or even `gro_cells` throughout the kernel source in the `drivers/net/` and `net/` directories. This should reveal the answer!
|
| 206/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Error:
Args: map[Expression:netif_napi_add PathPrefix:net/ipv4/ip_tunnel.c]
Results:
|
| 207/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42023
output: 34
thoughts: 48
Thoughts: Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts:
**Investigating Network Interface NAPI Registration**
Alright, I need to understand something about how network interfaces are being handled, specifically the integration with NAPI. Given the context, my initial hunch is that I should check the implementation of `netif_napi_add` to see where it is being called and how it's used within the context of VxLAN, GRE, and Geneve tunnels. These are all tunneling protocols, and NAPI (New API) is going to be relevant for the efficient handling of their traffic. I'm going to start by examining the drivers associated with these tunneling protocols: `drivers/net/vxlan/`, `net/ipv4/ip_gre.c`, and `drivers/net/geneve.c`. I expect to find `netif_napi_add` calls within these drivers, as this function is key to enabling NAPI processing for incoming packets on those specific interfaces. I'll be looking for how the NAPI structures are initialized, how the `poll` function is set up, and how these tunnels handle packet ingress and egress within the NAPI framework.
|
| 208/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Error:
Args: map[Expression:netif_napi_add PathPrefix:drivers/net/vxlan/]
Results:
|
| 209/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42381
output: 38
thoughts: 35
Thoughts: Okay, here's the summary, rendered as if I'm the one thinking it:
**Digging into `gro_cells`**
Wait a minute, I almost glossed over something crucial here! What's the deal with `gro_cells`? I need to understand its functionality better. How exactly does this mechanism work under the hood? Time to get my hands dirty and dive into the source code. Let's head straight to `net/core/gro_cells.c` and see what secrets it holds. I'm sure the implementation will reveal a lot. This will likely provide essential insight into network performance optimization.
|
| 210/4 |
2026/09/13 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/gro_cells.c Name:gro_cells_init]
Results: map[SourceCode: 80: int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
81: {
82: int i;
83:
84: gcells->cells = alloc_percpu(struct gro_cell);
85: if (!gcells->cells)
86: return -ENOMEM;
87:
88: for_each_possible_cpu(i) {
89: struct gro_cell *cell = per_cpu_ptr(gcells->cells, i);
90:
91: __skb_queue_head_init(&cell->napi_skbs);
92: local_lock_init(&cell->bh_lock);
93:
94: set_bit(NAPI_STATE_NO_BUSY_POLL, &cell->napi.state);
95:
96: netif_napi_add(dev, &cell->napi, gro_cell_poll);
97: napi_enable(&cell->napi);
98: }
99: return 0;
100: }
SourceFile:net/core/gro_cells.c]
|
| 211/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42925
output: 44
thoughts: 79
Thoughts: Here's my take on those thoughts:
**Analyzing GRO Cell Initialization**
Okay, here we go... *LOOK AT THAT!* I'm looking at this `gro_cells_init` function and specifically these lines:
```c
netif_napi_add(dev, &cell->napi, gro_cell_poll);
napi_enable(&cell->napi);
```
Hmm... I see it's setting up NAPI for GRO on a device. Standard stuff, but... *Wait!* Before I get too deep into the nitty-gritty of GRO cell polling, I need to know the bigger picture. *Who calls `gro_cells_init`?!* I need to understand the context of *when* this initialization happens. Let's trace back and find those call sites. That's the key to understanding the full picture here.
|
| 212/4 |
2026/09/13 00:56 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/core/gro_cells.c IncludeSnippetLines:5 Name:gro_cells_init]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__ip_tunnel_init SourceFile:net/ipv4/ip_tunnel.c SourceLine:1288 SourceSnippet:1283:
1284: err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1285: if (err)
1286: return err;
1287:
1288: err = gro_cells_init(&tunnel->gro_cells, dev);
1289: if (err) {
1290: dst_cache_destroy(&tunnel->dst_cache);
1291: return err;
1292: }
1293:
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:bareudp_init SourceFile:drivers/net/bareudp.c SourceLine:218 SourceSnippet: 213: static int bareudp_init(struct net_device *dev)
214: {
215: struct bareudp_dev *bareudp = netdev_priv(dev);
216: int err;
217:
218: err = gro_cells_init(&bareudp->gro_cells, dev);
219: if (err)
220: return err;
221:
222: return 0;
223: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dsa_user_create SourceFile:net/dsa/user.c SourceLine:2810 SourceSnippet:2805: user_dev->vlan_features = conduit->vlan_features;
2806:
2807: p = netdev_priv(user_dev);
2808: user_dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
2809:
2810: ret = gro_cells_init(&p->gcells, user_dev);
2811: if (ret)
2812: goto out_free;
2813:
2814: p->dp = port;
2815: INIT_LIST_HEAD(&p->mall_tc_list);
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:geneve_init SourceFile:drivers/net/geneve.c SourceLine:399 SourceSnippet: 394: static int geneve_init(struct net_device *dev)
395: {
396: struct geneve_dev *geneve = netdev_priv(dev);
397: int err;
398:
399: err = gro_cells_init(&geneve->gro_cells, dev);
400: if (err)
401: return err;
402:
403: netdev_lockdep_set_classes(dev);
404: return 0;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ip6_tnl_dev_init_gen SourceFile:net/ipv6/ip6_tunnel.c SourceLine:1949 SourceSnippet:1944:
1945: ret = dst_cache_init(&t->dst_cache, GFP_KERNEL);
1946: if (ret)
1947: return ret;
1948:
1949: ret = gro_cells_init(&t->gro_cells, dev);
1950: if (ret)
1951: goto destroy_dst;
1952:
1953: t->tun_hlen = 0;
1954: t->hlen = t->encap_hlen + t->tun_hlen;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ip6erspan_tap_init SourceFile:net/ipv6/ip6_gre.c SourceLine:1862 SourceSnippet:1857:
1858: ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1859: if (ret)
1860: return ret;
1861:
1862: ret = gro_cells_init(&tunnel->gro_cells, dev);
1863: if (ret)
1864: goto cleanup_dst_cache_init;
1865:
1866: t_hlen = ip6erspan_calc_hlen(tunnel);
1867: dev->mtu = ETH_DATA_LEN - t_hlen;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ip6gre_tunnel_init_common SourceFile:net/ipv6/ip6_gre.c SourceLine:1489 SourceSnippet:1484:
1485: ret = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1486: if (ret)
1487: return ret;
1488:
1489: ret = gro_cells_init(&tunnel->gro_cells, dev);
1490: if (ret)
1491: goto cleanup_dst_cache_init;
1492:
1493: t_hlen = ip6gre_calc_hlen(tunnel);
1494: dev->mtu = ETH_DATA_LEN - t_hlen;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:macsec_dev_init SourceFile:drivers/net/macsec.c SourceLine:3538 SourceSnippet:3533: {
3534: struct macsec_dev *macsec = macsec_priv(dev);
3535: struct net_device *real_dev = macsec->real_dev;
3536: int err;
3537:
3538: err = gro_cells_init(&macsec->gro_cells, dev);
3539: if (err)
3540: return err;
3541:
3542: macsec_inherit_tso_max(dev);
3543:
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:vxlan_init SourceFile:drivers/net/vxlan/vxlan_core.c SourceLine:2944 SourceSnippet:2939: err = vxlan_vnigroup_init(vxlan);
2940: if (err)
2941: goto err_rhashtable_destroy;
2942: }
2943:
2944: err = gro_cells_init(&vxlan->gro_cells, dev);
2945: if (err)
2946: goto err_vnigroup_uninit;
2947:
2948: err = vxlan_mdb_init(vxlan);
2949: if (err)
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:xfrm_input_init SourceFile:net/xfrm/xfrm_input.c SourceLine:857 SourceSnippet: 852:
853: xfrm_napi_dev = alloc_netdev_dummy(0);
854: if (!xfrm_napi_dev)
855: panic("Failed to allocate XFRM dummy netdev\n");
856:
857: err = gro_cells_init(&gro_cells, xfrm_napi_dev);
858: if (err)
859: gro_cells.cells = NULL;
860:
861: for_each_possible_cpu(i) {
862: struct xfrm_trans_tasklet *trans;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:xfrmi_dev_init SourceFile:net/xfrm/xfrm_interface_core.c SourceLine:767 SourceSnippet: 762: {
763: struct xfrm_if *xi = netdev_priv(dev);
764: struct net_device *phydev = __dev_get_by_index(xi->net, xi->p.link);
765: int err;
766:
767: err = gro_cells_init(&xi->gro_cells, dev);
768: if (err)
769: return err;
770:
771: dev->lltx = true;
772: dev->features |= XFRMI_FEATURES;
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_gro_cells_init_1489 SourceFile:net/core/gro_cells.c SourceLine:101 SourceSnippet: 101: EXPORT_SYMBOL(gro_cells_init);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_gro_cells_init SourceFile:net/core/gro_cells.c SourceLine:101 SourceSnippet: 101: EXPORT_SYMBOL(gro_cells_init);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_gro_cells_init SourceFile:net/core/gro_cells.c SourceLine:101 SourceSnippet: 101: EXPORT_SYMBOL(gro_cells_init);
]] TruncatedOutput:false]
|
| 213/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 45900
output: 32
thoughts: 319
Thoughts: **My Gro Cells Revelation**
Okay, here's what's running through my mind as I dig into this kernel code. It's becoming increasingly clear how widespread the `gro_cells_init` function is. I'm seeing it called from nearly every conceivable tunneling and encapsulation module. `__ip_tunnel_init`, the VXLAN, GENEVE, and bare UDP initializations, the IPv6 tunnel variantsβbasically, everything I'd expect to see, and a few I didn't even think about immediately. They all jump right to `gro_cells_init(&...->gro_cells, dev)`.
And the code *inside* `gro_cells_init` is the key. For each possible CPU, it iterates and initializes a `gro_cell`. It initializes a `napi_skbs` queue, a lock, and sets the `NAPI_STATE_NO_BUSY_POLL` bit. Then, critically, it calls `netif_napi_add(dev, &cell->napi, gro_cell_poll)` and enables the NAPI instance.
That `netif_napi_add` call is where things get really interesting. It adds `cell->napi` to `dev->napi_list`. Now, *that* structure is a central part of any network device and its packet processing workflow. It's the central place where the NAPI instances are kept, and I need to double-check my understanding of the implications here.
Okay, time to pull up `netif_napi_add` and `netif_napi_add_locked` in `net/core/dev.c`. This is where the core of the NAPI interaction is defined, and it seems like the `gro_cells` setup is absolutely critical for the NAPI flow in these tunneling devices.
|
| 214/4 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:netif_napi_add\( PathPrefix:net/core/]
Results: map[Output:net/core/gro_cells.c=80=int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
--
net/core/gro_cells.c-95-
net/core/gro_cells.c:96: netif_napi_add(dev, &cell->napi, gro_cell_poll);
net/core/gro_cells.c-97- napi_enable(&cell->napi);
]
|
| 215/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 46772
output: 38
thoughts: 25
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `netif_napi_add`**
Okay, so I'm looking at `netif_napi_add`. Time to refresh my memory and pinpoint exactly what this function is doing at a low level. Let's dig into the definition to see what's actually happening. I'm especially interested in the core mechanics of how it links a device with the NAPI poll context. I'm going to pay close attention to the data structures it's manipulating and any spinlocks or concurrency mechanisms it's employing. My initial thought is to identify this function's relation to interrupt handling in the network stack. I anticipate there's some setup here for the NAPI context that will enable the polling and receive path optimization. I'm keen to trace any calls related to registering the device and its associated queue with the NAPI mechanism.
|
| 216/4 |
2026/09/13 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/dev.c Name:netif_napi_add]
Results: map[SourceCode:2898: /**
2899: * netif_napi_add() - initialize a NAPI context
2900: * @dev: network device
2901: * @napi: NAPI context
2902: * @poll: polling function
2903: *
2904: * netif_napi_add() must be used to initialize a NAPI context prior to calling
2905: * *any* of the other NAPI-related functions.
2906: */
2907: static inline void
2908: netif_napi_add(struct net_device *dev, struct napi_struct *napi,
2909: int (*poll)(struct napi_struct *, int))
2910: {
2911: netif_napi_add_weight(dev, napi, poll, NAPI_POLL_WEIGHT);
2912: }
SourceFile:include/linux/netdevice.h]
|
| 217/4 |
2026/09/13 00:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 43817
output: 142
thoughts: 1765
Thoughts: **Analysis of Threaded NAPI with Unprivileged Users and Tunnel Devices**
Alright, let's break this down systematically. The core question is whether a non-root user, but one with `CAP_NET_ADMIN` *within* a user namespace, can effectively leverage threaded NAPI on tunnel devices.
First, let's establish if we can even *create* these tunnels. The analysis highlights that, yes, if the tunnel modules (gre, vxlan, etc.) are loaded or built-in, and we are within a user namespace where we've mapped ourselves to a user ID that gives us `CAP_NET_ADMIN` (via `unshare -U -n -r` or similar), then creating the tunnel devices themselves (e.g., using `ip link add type gre`) is permitted. This aligns with what I'd expect given that `rtnl_link_get_net_capable` checks for that capability in the target network namespace, and we do indeed have it there.
Next, do these tunnel devices actually *support* NAPI? The answer is a clear yes. Functions such as `__ip_tunnel_init`, `vxlan_init`, and similar, leverage `gro_cells_init()` which in turn uses `netif_napi_add` and `napi_enable` for per-CPU NAPI instances. So `dev->napi_list` is populated as expected.
Now, the crucial part: can we *control* threaded NAPI on these devices? Let's start with sysfs. The `/sys/class/net/<dev>/threaded` interface is key. The code confirms that when we write to this file, `netdev_lock_store()` is called. The crucial check here is `ns_capable(net->user_ns, CAP_NET_ADMIN)`. Since we're *inside* the user namespace that has `CAP_NET_ADMIN`, this check will *pass*. The subsequent calls to `modify_napi_threaded` which in turn calls `netif_set_threaded` will thus also succeed, *provided* that the device has NAPI instances (which our tunnel devices do). Hence enabling threaded NAPI via sysfs is perfectly viable.
Finally, the Netlink path. This is where things get interesting. The code reveals that `NETDEV_CMD_NAPI_SET` utilizes Generic Netlink (Genl). This command uses the `GENL_ADMIN_PERM` flag. The implication of this is that the kernel checks `netlink_capable(skb, CAP_NET_ADMIN)`, which in turn checks the capability against the *initial* user namespace (`&init_user_ns`), *not* the user namespace where we have `CAP_NET_ADMIN`. Since our user is *unprivileged* in the initial namespace, we get `-EPERM`. We are *unable* to enable threaded NAPI through Netlink.
In summary, we can *create* the tunnel devices and they *do* have NAPI instances, so that is not an issue. We *can* enable threaded NAPI through the sysfs interface. However, using netlink will fail because we do not have CAP_NET_ADMIN in the initial user namespace. This makes sense.
|
| 218/4 |
2026/09/13 00:56 |
tool |
set-results |
0m
Error:
Args: map[results:Can create tunnel device: Yes (if module is loaded/built-in, rtnl requires net->user_ns CAP_NET_ADMIN).
Can enable threaded NAPI via sysfs: Yes (/sys/class/net/<dev>/threaded checks ns_capable(net->user_ns, CAP_NET_ADMIN) and tunnel devices instantiate per-CPU NAPIs via gro_cells_init).
Can enable threaded NAPI via netlink: No (NETDEV_CMD_NAPI_SET has GENL_ADMIN_PERM which checks netlink_capable against &init_user_ns).]
|
| 219/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 27960
output: 33
thoughts: 0
|
| 220/2 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:threaded_store PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=744=static int modify_napi_threaded(struct net_device *dev, unsigned long val)
--
net/core/net-sysfs.c-758-
net/core/net-sysfs.c:759:static ssize_t threaded_store(struct device *dev,
net/core/net-sysfs.c-760- struct device_attribute *attr,
]
|
| 221/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 28113
output: 38
thoughts: 0
|
| 222/2 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/net-sysfs.c FirstLine:758 LineCount:10]
Results: map[Contents: 758:
759: static ssize_t threaded_store(struct device *dev,
760: struct device_attribute *attr,
761: const char *buf, size_t len)
762: {
763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
764: }
765: static DEVICE_ATTR_RW(threaded);
766:
767: static struct attribute *net_class_attrs[] __ro_after_init = {
]
|
| 223/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 28318
output: 36
thoughts: 0
|
| 224/2 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:netdev_lock_store PathPrefix:net/core/net-sysfs.c]
Results: map[Output:net/core/net-sysfs.c=188=static ssize_t
net/core/net-sysfs.c:189:netdev_lock_store(struct device *dev, struct device_attribute *attr,
net/core/net-sysfs.c-190- const char *buf, size_t len,
--
net/core/net-sysfs.c=528=static ssize_t gro_flush_timeout_store(struct device *dev,
--
net/core/net-sysfs.c-534-
net/core/net-sysfs.c:535: return netdev_lock_store(dev, attr, buf, len, change_gro_flush_timeout);
net/core/net-sysfs.c-536-}
--
net/core/net-sysfs.c=548=static ssize_t napi_defer_hard_irqs_store(struct device *dev,
--
net/core/net-sysfs.c-554-
net/core/net-sysfs.c:555: return netdev_lock_store(dev, attr, buf, len,
net/core/net-sysfs.c-556- change_napi_defer_hard_irqs);
--
net/core/net-sysfs.c=759=static ssize_t threaded_store(struct device *dev,
--
net/core/net-sysfs.c-762-{
net/core/net-sysfs.c:763: return netdev_lock_store(dev, attr, buf, len, modify_napi_threaded);
net/core/net-sysfs.c-764-}
]
|
| 225/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 28782
output: 38
thoughts: 0
|
| 226/2 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/core/net-sysfs.c FirstLine:188 LineCount:20]
Results: map[Contents: 188: static ssize_t
189: netdev_lock_store(struct device *dev, struct device_attribute *attr,
190: const char *buf, size_t len,
191: int (*set)(struct net_device *, unsigned long))
192: {
193: struct net_device *netdev = to_net_dev(dev);
194: struct net *net = dev_net(netdev);
195: unsigned long new;
196: int ret;
197:
198: if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
199: return -EPERM;
200:
201: ret = kstrtoul(buf, 0, &new);
202: if (ret)
203: return ret;
204:
205: netdev_lock(netdev);
206:
207: if (dev_isalive(netdev)) {
]
|
| 227/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 29121
output: 40
thoughts: 0
|
| 228/2 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM PathPrefix:net/core/netdev-genl-gen.c]
Results: map[Output:net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {
--
net/core/netdev-genl-gen.c-236- .maxattr = NETDEV_A_NAPI_THREADED,
net/core/netdev-genl-gen.c:237: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-238- },
--
net/core/netdev-genl-gen.c-250- .maxattr = NETDEV_A_QUEUE_LEASE,
net/core/netdev-genl-gen.c:251: .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
net/core/netdev-genl-gen.c-252- },
]
|
| 229/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 29408
output: 37
thoughts: 0
|
| 230/2 |
2026/09/13 00:56 |
tool |
grepper |
0m
Args: map[Expression:GENL_ADMIN_PERM PathPrefix:net/netlink/genetlink.c]
Results: map[Output:net/netlink/genetlink.c=1155=static int genl_family_rcv_msg(const struct genl_family *family,
--
net/netlink/genetlink.c-1181-
net/netlink/genetlink.c:1182: if ((op.flags & GENL_ADMIN_PERM) &&
net/netlink/genetlink.c-1183- !netlink_capable(skb, CAP_NET_ADMIN))
]
|
| 231/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 29581
output: 39
thoughts: 0
|
| 232/2 |
2026/09/13 00:56 |
tool |
read-file |
0m
Args: map[File:net/netlink/af_netlink.c FirstLine:883 LineCount:10]
Results: map[Contents: 883: bool netlink_capable(const struct sk_buff *skb, int cap)
884: {
885: return netlink_ns_capable(skb, &init_user_ns, cap);
886: }
887: EXPORT_SYMBOL(netlink_capable);
888:
889: /**
890: * netlink_net_capable - Netlink network namespace message capability test
891: * @skb: socket buffer holding a netlink command from userspace
892: * @cap: The capability to use
]
|
| 233/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 29791
output: 66
thoughts: 0
|
| 234/2 |
2026/09/13 00:56 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:true FilesystemTrigger:false NetworkTrigger:true PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:true FilesystemTrigger:false NetworkTrigger:true PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 235/2 |
2026/09/13 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 29921
output: 786
thoughts: 1184
Thoughts: **Analysis of the GRO Cell Data Race Vulnerability**
Okay, so here's the situation. I've pinpointed a data race within the GRO (Generic Receive Offload) cell processing logic, specifically on the `cell->napi_skbs` doubly-linked list of `sk_buff` structures. This race occurs in both `gro_cells_receive` (the enqueue side) and `gro_cell_poll` (the dequeue side). The root cause? Threaded NAPI executing `gro_cell_poll` in an unbound kthread. This means it can land on a CPU different from the one handling packet enqueue in `gro_cells_receive`. The current synchronization, `local_lock_t`, is utterly insufficient because it's only meant to prevent preemption and softirqs *on the local CPU*, providing zero cross-CPU mutual exclusion.
Consequently, we're seeing concurrent and unsynchronized list operations β specifically `__skb_queue_tail` and `__skb_dequeue` β leading to the inevitable corruption of list pointers. This will manifest as use-after-free conditions or general memory corruption. Essentially, this is a textbook example of a Denial of Service vulnerability that is also exploitable.
To trigger this, we need to be using threaded NAPI on a device that utilizes `gro_cells`. Think devices like `gre`, `vxlan`, and similar tunnel technologies. Threaded NAPI can be controlled through sysfs ( `/sys/class/net/<dev>/threaded`) or netlink (`NETDEV_CMD_NAPI_SET`). The critical difference is the access control. The sysfs interface, via `netdev_lock_store`, checks `ns_capable(net->user_ns, CAP_NET_ADMIN)`, meaning a user with `CAP_NET_ADMIN` *within their user namespace* can enable it. Netlink, via `NETDEV_CMD_NAPI_SET`, requires `GENL_ADMIN_PERM`, which boils down to needing `CAP_NET_ADMIN` in the *initial* user namespace.
The real kicker is that an unprivileged user can create a new user namespace *and* network namespace. They can then create a tunnel device (I'll need to check if `gre0` is automatically created, or if I must manually create a `vxlan` or similar), enable threaded NAPI through sysfs and subsequently send traffic through the tunnel β either loopback or veth in the same netns β triggering the race. So this is, without a doubt, accessible from user namespaces, and I should confirm the availability of `gre0` or similar default tunnel devices. I've got to double-check `netdev_lock_store` in `net/core/net-sysfs.c`, but from what I remember, I'm confident about that.
Yes, confirmed. I see it! `netdev_lock_store` *does* check `ns_capable(net->user_ns, CAP_NET_ADMIN)`.
So, to summarize:
* **Exploitable: Yes.** This is memory corruption due to the data race when threaded NAPI is enabled, leading to list corruption and ultimately use-after-free and memory corruption.
* **Denial of Service: Yes.** The list corruption will inevitably lead to kernel crashes or soft lockups.
* **Unprivileged: No.** Enabling threaded NAPI requires `CAP_NET_ADMIN`.
* **User Namespace: Yes.** The sysfs interface, as we've confirmed, allows it with the `ns_capable` check. An unprivileged user can create a new user and network namespace, create a tunnel device (like `vxlan` or even use the default `gre0`), and enable threaded NAPI.
* **Network Trigger: Yes.** It's triggered by incoming network packets on `gro_cells`-enabled devices (tunnels).
* **Other Triggers: No.**
|
| 236/1 |
2026/09/13 00:57 |
action |
format-explanation |
0m
Results: map[Explanation:**Analysis of the Bug and its Security Impact**
**1. Root Cause and Exploitability**
The bug is a data race and missing synchronization issue on the `sk_buff_head`
doubly-linked list (`cell->napi_skbs`) used by `gro_cells`.
When threaded NAPI is enabled on a network device using `gro_cells` (such as
`gre`, `vxlan`, or `geneve` tunnels), the NAPI polling function
(`gro_cell_poll`) is executed in a dedicated kernel thread. Crucially, this
kthread is unbound and can be scheduled on any CPU.
The synchronization mechanism used to protect the `napi_skbs` list is
`local_lock_t` (`cell->bh_lock`). However, `local_lock_t` only disables
preemption and softirqs on the *local* CPU; it provides absolutely no cross-CPU
mutual exclusion.
As a result, if the NAPI kthread runs on CPU B while ingress packets are being
received and queued on CPU A, `__skb_queue_tail` (in `gro_cells_receive`) and
`__skb_dequeue` (in `gro_cell_poll`) will execute concurrently on the same list
without any locking. This leads to classic doubly-linked list corruption
(corrupting `next`/`prev` pointers of `sk_buff` structures), which results in
use-after-free and memory corruption. This is highly **Exploitable**.
**2. Denial of Service**
The list corruption will inevitably lead to kernel panics (e.g., wild pointer
dereferences, "unable to handle kernel paging request") or infinite loops/soft
lockups when traversing the corrupted list. This allows for a reliable **Denial
of Service**.
**3. Reachability and Capabilities**
To trigger the bug, an attacker needs to enable threaded NAPI on a device that
uses `gro_cells`.
Threaded NAPI can be enabled via Netlink (`NETDEV_CMD_NAPI_SET`) or via sysfs
(`/sys/class/net/<dev>/threaded`).
- The Netlink interface requires `CAP_NET_ADMIN` in the initial user namespace
(`netlink_capable(skb, CAP_NET_ADMIN)`).
- However, the sysfs interface (`threaded_store` -> `netdev_lock_store`) only
checks `ns_capable(net->user_ns, CAP_NET_ADMIN)`.
This means an unprivileged user cannot trigger the bug directly from the initial
namespace. But they can unshare their user and network namespaces, gaining
`CAP_NET_ADMIN` over the new network namespace. Inside this namespace, they can
create a tunnel device (like `vxlan`), enable threaded NAPI via the sysfs
attribute, and then send traffic through the tunnel (e.g., via a local veth pair
or loopback) to trigger the concurrent list operations. Therefore, the bug is
**Accessible From User Namespaces**.
**4. Network Trigger**
The vulnerability is triggered by processing ingress network packets on the
affected tunnel device, making it an **Ethernet Network Trigger**.
**Conclusion**
- **Exploitable**: Yes (Memory corruption via doubly-linked list data race).
- **Denial Of Service**: Yes (Kernel crash or soft lockup).
- **Accessible From Unprivileged Processes**: No (Requires `CAP_NET_ADMIN`).
- **Accessible From User Namespaces**: Yes (Sysfs interface allows enabling
threaded NAPI with namespace-local `CAP_NET_ADMIN`).
- **Ethernet Network Trigger**: Yes (Triggered by packet reception).
- **Other Triggers**: No.]
|