| 0/0 |
2026/05/13 01:28 |
flow |
assessment-security |
44m
Results: map[DenialOfService:true Explanation:The bug report describes a circular locking dependency (deadlock) detected by
lockdep. The cycle involves four locks:
1. `param_lock` -> `i_mutex_dir_key`: Triggered when writing to the `block2mtd`
module parameter. `param_attr_store()` acquires `param_lock`, and then
`block2mtd_setup()` calls `add_device()` which resolves the block device path
via `kern_path()`, acquiring the directory inode lock (`i_mutex_dir_key`).
2. `i_mutex_dir_key` -> `cgroup_mutex`: Triggered during `rmdir` of a cgroup.
`vfs_rmdir()` acquires the parent directory's inode lock, and then
`cgroup_rmdir()` acquires `cgroup_mutex`.
3. `cgroup_mutex` -> `rtnl_mutex`: Triggered during `mkdir` of a cgroup.
`cgroup_mkdir()` acquires `cgroup_mutex`, and then `cgrp_css_online()` acquires
`rtnl_mutex`.
4. `rtnl_mutex` -> `param_lock`: Triggered when registering a new mac80211
hardware device (e.g., via `mac80211_hwsim`). `ieee80211_register_hw()` acquires
`rtnl_lock()`, and then calls `ieee80211_init_rate_ctrl_alg()` which acquires
`param_lock` to resolve the rate control algorithm.
**Security Assessment:**
While this is a valid deadlock that can cause a Denial of Service (DoS), it is
**not accessible to unprivileged users**.
To trigger the first dependency in the cycle (`param_lock` ->
`i_mutex_dir_key`), a user must write to
`/sys/module/block2mtd/parameters/block2mtd`. This sysfs file has `0200`
permissions (`-w-------`) and is owned by the global `root` user. It is not
writable by unprivileged users, and because sysfs module parameters are not
mapped as writable into user namespaces, it cannot be triggered from within a
user namespace either.
Since completing the deadlock cycle requires global root privileges, it does not
cross any security boundaries. An attacker without root access cannot
intentionally trigger this deadlock. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/05/13 01:28 |
action |
syz-repro-to-c-repro |
0m
Results: map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// open arguments: [
// file: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 00} (length 0x9)
// }
// flags: open_flags = 0x0 (8 bytes)
// mode: open_mode = 0x64 (8 bytes)
// ]
// returns fd
memcpy((void*)0x200000000000, "./cgroup\000", 9);
res = syscall(__NR_open, /*file=*/0x200000000000ul, /*flags=*/0ul, /*mode=S_IROTH|S_IRGRP|S_IXUSR*/0x64ul);
if (res != -1)
r[0] = res;
// fchdir$auto arguments: [
// fd: fd (resource)
// ]
syscall(__NR_fchdir, /*fd=*/r[0]);
// mkdir$auto arguments: [
// pathname: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 00} (length 0x9)
// }
// mode: int16 = 0xa (2 bytes)
// ]
memcpy((void*)0x2000000001c0, "./cgroup\000", 9);
syscall(__NR_mkdir, /*pathname=*/0x2000000001c0ul, /*mode=*/0xa);
// rmdir$auto arguments: [
// pathname: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 00} (length 0x9)
// }
// ]
memcpy((void*)0x200000000080, "./cgroup\000", 9);
syscall(__NR_rmdir, /*pathname=*/0x200000000080ul);
// openat$auto_kernfs_file_fops_kernfs_internal arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 73 79 73 2f 6d 6f 64 75 6c 65 2f 62 6c 6f 63 6b 32 6d 74 64 2f 70 61 72 61 6d 65 74 65 72 73 2f 62 6c 6f 63 6b 32 6d 74 64 00} (length 0x2b)
// }
// flags: open_flags = 0x601 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_kernfs_file_fops_kernfs_internal
memcpy((void*)0x2000000000c0, "/sys/module/block2mtd/parameters/block2mtd\000", 43);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x2000000000c0ul, /*flags=O_TRUNC|O_APPEND|O_WRONLY*/0x601, /*mode=*/0);
if (res != -1)
r[1] = res;
// write$auto_kernfs_file_fops_kernfs_internal arguments: [
// fd: fd_kernfs_file_fops_kernfs_internal (resource)
// buf: ptr[in, buffer] {
// buffer: {e7 69 6e 58 91 a9 bc cb f2 a8 14 c2 b1 c2 da 6a 46 42 e7 1e 42 3e 55 bb 3b df b8 0f b3 49 6c 6b ac 2c 47 69 42} (length 0x25)
// }
// len: bytesize = 0x25 (8 bytes)
// ]
memcpy((void*)0x200000000000, "\xe7\x69\x6e\x58\x91\xa9\xbc\xcb\xf2\xa8\x14\xc2\xb1\xc2\xda\x6a\x46\x42\xe7\x1e\x42\x3e\x55\xbb\x3b\xdf\xb8\x0f\xb3\x49\x6c\x6b\xac\x2c\x47\x69\x42", 37);
syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000000000ul, /*len=*/0x25ul);
return 0;
}
]
|
| 2/1 |
2026/05/13 01:28 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/75d85871eba5338b06e781078aa02b9e58e24f91]
|
| 3/1 |
2026/05/13 01:29 |
action |
kernel-builder |
16m
Results: map[KernelObj:/app/workdir/cache/build/4768dc7b0affb3d8eac721e7719bec548591344b]
|
| 4/1 |
2026/05/13 01:46 |
action |
codesearch-prepare |
19m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/05/13 02:05 |
agent |
expert |
7m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false 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 greeping
".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).
Don't make assumptions; verify them with source code access. 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 or elevated privileges.
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 completly 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 tranfers, that's 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 exploitabability depends on how exactly the uninit value
is used in the code, and what it affects.
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 Confidetial 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.
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:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.17/6008 is trying to acquire lock:
ffff88807982dab8 (&type->i_mutex_dir_key#6){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:1043 [inline]
ffff88807982dab8 (&type->i_mutex_dir_key#6){++++}-{4:4}, at: lookup_slow+0x42/0x70 fs/namei.c:1932
but task is already holding lock:
ffffffff8e69df08 (param_lock){+.+.}-{4:4}, at: kernel_param_lock kernel/params.c:602 [inline]
ffffffff8e69df08 (param_lock){+.+.}-{4:4}, at: param_attr_store+0xec/0x300 kernel/params.c:587
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (param_lock){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:614 [inline]
__mutex_lock+0x1a2/0x1b90 kernel/locking/mutex.c:776
ieee80211_rate_control_ops_get net/mac80211/rate.c:223 [inline]
rate_control_alloc net/mac80211/rate.c:269 [inline]
ieee80211_init_rate_ctrl_alg+0x1df/0x3b0 net/mac80211/rate.c:1016
ieee80211_register_hw+0x2950/0x4140 net/mac80211/main.c:1544
mac80211_hwsim_new_radio+0x2847/0x57d0 drivers/net/wireless/virtual/mac80211_hwsim.c:5810
init_mac80211_hwsim+0x6db/0x7f0 drivers/net/wireless/virtual/mac80211_hwsim.c:7173
do_one_initcall+0x11d/0x760 init/main.c:1382
do_initcall_level init/main.c:1444 [inline]
do_initcalls init/main.c:1460 [inline]
do_basic_setup init/main.c:1479 [inline]
kernel_init_freeable+0x6e5/0x7a0 init/main.c:1692
kernel_init+0x1f/0x1e0 init/main.c:1582
ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #2 (rtnl_mutex){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:614 [inline]
__mutex_lock+0x1a2/0x1b90 kernel/locking/mutex.c:776
cgrp_css_online+0xa1/0x1f0 net/core/netprio_cgroup.c:157
online_css+0xb2/0x350 kernel/cgroup/cgroup.c:5732
css_create kernel/cgroup/cgroup.c:5820 [inline]
cgroup_apply_control_enable+0x8bd/0xbd0 kernel/cgroup/cgroup.c:3389
cgroup_mkdir+0x57f/0x1330 kernel/cgroup/cgroup.c:6021
kernfs_iop_mkdir+0x111/0x190 fs/kernfs/dir.c:1273
vfs_mkdir+0x361/0x850 fs/namei.c:5233
filename_mkdirat+0x48b/0x5e0 fs/namei.c:5266
__do_sys_mkdirat fs/namei.c:5287 [inline]
__se_sys_mkdirat fs/namei.c:5284 [inline]
__x64_sys_mkdirat+0x89/0xc0 fs/namei.c:5284
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (cgroup_mutex){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:614 [inline]
__mutex_lock+0x1a2/0x1b90 kernel/locking/mutex.c:776
cgroup_lock include/linux/cgroup.h:394 [inline]
cgroup_kn_lock_live+0x116/0x520 kernel/cgroup/cgroup.c:1732
cgroup_rmdir+0x22/0x2e0 kernel/cgroup/cgroup.c:6226
kernfs_iop_rmdir+0x106/0x170 fs/kernfs/dir.c:1291
vfs_rmdir fs/namei.c:5338 [inline]
vfs_rmdir+0x328/0x8a0 fs/namei.c:5311
filename_rmdir+0x31a/0x5c0 fs/namei.c:5393
__do_sys_rmdir fs/namei.c:5416 [inline]
__se_sys_rmdir fs/namei.c:5413 [inline]
__x64_sys_rmdir+0x46/0x70 fs/namei.c:5413
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&type->i_mutex_dir_key#6){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x14b8/0x2630 kernel/locking/lockdep.c:5237
lock_acquire kernel/locking/lockdep.c:5868 [inline]
lock_acquire+0x1cf/0x380 kernel/locking/lockdep.c:5825
down_read+0x99/0x460 kernel/locking/rwsem.c:1537
inode_lock_shared include/linux/fs.h:1043 [inline]
lookup_slow+0x42/0x70 fs/namei.c:1932
walk_component fs/namei.c:2279 [inline]
lookup_last fs/namei.c:2780 [inline]
path_lookupat+0x5e8/0xc40 fs/namei.c:2804
filename_lookup+0x202/0x590 fs/namei.c:2833
kern_path+0x37/0x50 fs/namei.c:3040
lookup_bdev+0xd8/0x280 block/bdev.c:1221
bdev_file_open_by_path+0x82/0x330 block/bdev.c:1094
add_device drivers/mtd/devices/block2mtd.c:279 [inline]
block2mtd_setup2.isra.0+0x2ee/0xc70 drivers/mtd/devices/block2mtd.c:459
block2mtd_setup+0xbd/0xd0 drivers/mtd/devices/block2mtd.c:476
param_attr_store+0x199/0x300 kernel/params.c:589
module_attr_store+0x58/0x80 kernel/params.c:913
sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:142
kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:352
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x6ac/0x1070 fs/read_write.c:688
ksys_write+0x12a/0x250 fs/read_write.c:740
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
&type->i_mutex_dir_key#6 --> rtnl_mutex --> param_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(param_lock);
lock(rtnl_mutex);
lock(param_lock);
rlock(&type->i_mutex_dir_key#6);
*** DEADLOCK ***
4 locks held by syz.0.17/6008:
#0: ffff888037100420 (sb_writers#7){.+.+}-{0:0}, at: ksys_write+0x12a/0x250 fs/read_write.c:740
#1: ffff888063a41488 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x2c2/0x5f0 fs/kernfs/file.c:343
#2: ffff88803515ee18 (kn->active#4){.+.+}-{0:0}, at: kernfs_get_active_of fs/kernfs/file.c:80 [inline]
#2: ffff88803515ee18 (kn->active#4){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x332/0x5f0 fs/kernfs/file.c:344
#3: ffffffff8e69df08 (param_lock){+.+.}-{4:4}, at: kernel_param_lock kernel/params.c:602 [inline]
#3: ffffffff8e69df08 (param_lock){+.+.}-{4:4}, at: param_attr_store+0xec/0x300 kernel/params.c:587
stack backtrace:
CPU: 1 UID: 0 PID: 6008 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/27/2026
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_circular_bug.cold+0x178/0x1c7 kernel/locking/lockdep.c:2043
check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2175
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x14b8/0x2630 kernel/locking/lockdep.c:5237
lock_acquire kernel/locking/lockdep.c:5868 [inline]
lock_acquire+0x1cf/0x380 kernel/locking/lockdep.c:5825
down_read+0x99/0x460 kernel/locking/rwsem.c:1537
inode_lock_shared include/linux/fs.h:1043 [inline]
lookup_slow+0x42/0x70 fs/namei.c:1932
walk_component fs/namei.c:2279 [inline]
lookup_last fs/namei.c:2780 [inline]
path_lookupat+0x5e8/0xc40 fs/namei.c:2804
filename_lookup+0x202/0x590 fs/namei.c:2833
kern_path+0x37/0x50 fs/namei.c:3040
lookup_bdev+0xd8/0x280 block/bdev.c:1221
bdev_file_open_by_path+0x82/0x330 block/bdev.c:1094
add_device drivers/mtd/devices/block2mtd.c:279 [inline]
block2mtd_setup2.isra.0+0x2ee/0xc70 drivers/mtd/devices/block2mtd.c:459
block2mtd_setup+0xbd/0xd0 drivers/mtd/devices/block2mtd.c:476
param_attr_store+0x199/0x300 kernel/params.c:589
module_attr_store+0x58/0x80 kernel/params.c:913
sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:142
kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:352
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x6ac/0x1070 fs/read_write.c:688
ksys_write+0x12a/0x250 fs/read_write.c:740
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7faeae79c799
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd3b6d7408 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007faeaea15fa0 RCX: 00007faeae79c799
RDX: 0000000000000025 RSI: 0000200000000000 RDI: 0000000000000004
RBP: 00007faeae832c99 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007faeaea15fac R14: 00007faeaea15fa0 R15: 00007faeaea15fa0
</TASK>
block2mtd: error: cannot open device οΏ½inXοΏ½οΏ½οΏ½οΏ½οΏ½οΏ½Β±οΏ½οΏ½jFBοΏ½B>UοΏ½;ίΈοΏ½IlkοΏ½
It is reproducible with the followint program.
Keep in mind that it may lack the precise threading, sandboxing, and some arguments of a working reproducer.
But it should give an idea of the involved syscalls.
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// open arguments: [
// file: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 00} (length 0x9)
// }
// flags: open_flags = 0x0 (8 bytes)
// mode: open_mode = 0x64 (8 bytes)
// ]
// returns fd
memcpy((void*)0x200000000000, "./cgroup\000", 9);
res = syscall(__NR_open, /*file=*/0x200000000000ul, /*flags=*/0ul, /*mode=S_IROTH|S_IRGRP|S_IXUSR*/0x64ul);
if (res != -1)
r[0] = res;
// fchdir$auto arguments: [
// fd: fd (resource)
// ]
syscall(__NR_fchdir, /*fd=*/r[0]);
// mkdir$auto arguments: [
// pathname: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 00} (length 0x9)
// }
// mode: int16 = 0xa (2 bytes)
// ]
memcpy((void*)0x2000000001c0, "./cgroup\000", 9);
syscall(__NR_mkdir, /*pathname=*/0x2000000001c0ul, /*mode=*/0xa);
// rmdir$auto arguments: [
// pathname: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 00} (length 0x9)
// }
// ]
memcpy((void*)0x200000000080, "./cgroup\000", 9);
syscall(__NR_rmdir, /*pathname=*/0x200000000080ul);
// openat$auto_kernfs_file_fops_kernfs_internal arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 73 79 73 2f 6d 6f 64 75 6c 65 2f 62 6c 6f 63 6b 32 6d 74 64 2f 70 61 72 61 6d 65 74 65 72 73 2f 62 6c 6f 63 6b 32 6d 74 64 00} (length 0x2b)
// }
// flags: open_flags = 0x601 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_kernfs_file_fops_kernfs_internal
memcpy((void*)0x2000000000c0, "/sys/module/block2mtd/parameters/block2mtd\000", 43);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x2000000000c0ul, /*flags=O_TRUNC|O_APPEND|O_WRONLY*/0x601, /*mode=*/0);
if (res != -1)
r[1] = res;
// write$auto_kernfs_file_fops_kernfs_internal arguments: [
// fd: fd_kernfs_file_fops_kernfs_internal (resource)
// buf: ptr[in, buffer] {
// buffer: {e7 69 6e 58 91 a9 bc cb f2 a8 14 c2 b1 c2 da 6a 46 42 e7 1e 42 3e 55 bb 3b df b8 0f b3 49 6c 6b ac 2c 47 69 42} (length 0x25)
// }
// len: bytesize = 0x25 (8 bytes)
// ]
memcpy((void*)0x200000000000, "\xe7\x69\x6e\x58\x91\xa9\xbc\xcb\xf2\xa8\x14\xc2\xb1\xc2\xda\x6a\x46\x42\xe7\x1e\x42\x3e\x55\xbb\x3b\xdf\xb8\x0f\xb3\x49\x6c\x6b\xac\x2c\x47\x69\x42", 37);
syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000000000ul, /*len=*/0x25ul);
return 0;
}
Reply: The bug report describes a circular locking dependency (deadlock) detected by lockdep. The cycle involves four locks:
1. `param_lock` -> `i_mutex_dir_key`: Triggered when writing to the `block2mtd` module parameter. `param_attr_store()` acquires `param_lock`, and then `block2mtd_setup()` calls `add_device()` which resolves the block device path via `kern_path()`, acquiring the directory inode lock (`i_mutex_dir_key`).
2. `i_mutex_dir_key` -> `cgroup_mutex`: Triggered during `rmdir` of a cgroup. `vfs_rmdir()` acquires the parent directory's inode lock, and then `cgroup_rmdir()` acquires `cgroup_mutex`.
3. `cgroup_mutex` -> `rtnl_mutex`: Triggered during `mkdir` of a cgroup. `cgroup_mkdir()` acquires `cgroup_mutex`, and then `cgrp_css_online()` acquires `rtnl_mutex`.
4. `rtnl_mutex` -> `param_lock`: Triggered when registering a new mac80211 hardware device (e.g., via `mac80211_hwsim`). `ieee80211_register_hw()` acquires `rtnl_lock()`, and then calls `ieee80211_init_rate_ctrl_alg()` which acquires `param_lock` to resolve the rate control algorithm.
**Security Assessment:**
While this is a valid deadlock that can cause a Denial of Service (DoS), it is **not accessible to unprivileged users**.
To trigger the first dependency in the cycle (`param_lock` -> `i_mutex_dir_key`), a user must write to `/sys/module/block2mtd/parameters/block2mtd`. This sysfs file has `0200` permissions (`-w-------`) and is owned by the global `root` user. It is not writable by unprivileged users, and because sysfs module parameters are not mapped as writable into user namespaces, it cannot be triggered from within a user namespace either.
Since completing the deadlock cycle requires global root privileges, it does not cross any security boundaries. An attacker without root access cannot intentionally trigger this deadlock.
|
| 6/2 |
2026/05/13 02:05 |
llm |
expert |
0m
Model:
Tokens:
input: 10747
output: 21
thoughts: 2021
Thoughts: **Analyzing a Circular Locking Dependency**
Okay, so I'm looking at this lockdep warning. It seems like task `syz.0.17/6008` is trying to acquire `&type->i_mutex_dir_key#6`, which is a directory inode mutex, while it's already holding `param_lock`. The critical bit is that `param_lock` is already *dependent* on `&type->i_mutex_dir_key#6`, creating a circular dependency β a classic recipe for a deadlock.
The chain shows that the `param_lock` (held by the task) is acquired within the parameter handling code, specifically in `param_attr_store`, which calls into `block2mtd_setup` to set up block2mtd. The other lock it is trying to acquire is `&type->i_mutex_dir_key#6` during a lookup operation (`lookup_slow`). And the chain shows the existing dependency that goes: cgroup_mutex -> rtnl_mutex -> param_lock, with the first operation being the one we're trying to perform.
My immediate concern is whether this is exploitable and leads to a denial of service. If a deadlock is possible, it *will* result in a denial of service, so that's what I have to assess.
The reproducer attempts to write to `/sys/module/block2mtd/parameters/block2mtd`. This is important because, typically, these module parameter files in `/sys/module/*/parameters/` are only writable by root. So I need to verify if this is true and that the `block2mtd` module parameter is defined in `drivers/mtd/devices/block2mtd.c`.
|
| 7/2 |
2026/05/13 02:05 |
tool |
grepper |
0m
Args: map[Expression:module_param.*block2mtd]
Results: map[Output:drivers/mtd/devices/block2mtd.c=465=static int block2mtd_setup(const char *val, const struct kernel_param *kp)
--
drivers/mtd/devices/block2mtd.c-491-
drivers/mtd/devices/block2mtd.c:492:module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
drivers/mtd/devices/block2mtd.c-493-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,[<erasesize>][,<label>]]\"");
]
|
| 8/2 |
2026/05/13 02:05 |
llm |
expert |
0m
Model:
Tokens:
input: 13322
output: 56
thoughts: 558
Thoughts: **Analyzing a Potential Race Condition**
Okay, so the permissions are `0200`, meaning the file is only writable by root. That's straightforward. The initial thought is, is there any other way to get to that? I need to think this through carefully, tracing the execution path.
The lock chain looks like this: `param_lock` then `rtnl_mutex` within `mac80211_hwsim_new_radio`. My first inclination is, wait, `mac80211_hwsim_new_radio` is called during `init_mac80211_hwsim`, which is an initcall. So, is `param_lock` held *before* `mac80211_hwsim_new_radio` is called? No, an initcall can't be called from module load - it's done during kernel initialization. Wait, `do_initcalls` doesn't hold `param_lock`, so that's not it.
Okay, let's look at the trace. The trace looks like this:
-> #3 (param_lock){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:614 [inline]
__mutex_lock+0x1a2/0x1b90 kernel/locking/mutex.c:776
ieee80211_rate_control_ops_get net/mac80211/rate.c:223 [inline]
rate_control_alloc net/mac80211/rate.c:269 [inline]
ieee80211_init_rate_ctrl_alg+0x1df/0x3b0 net/mac80211/rate.c:1016
ieee80211_register_hw+0x2950/0x4140 net/mac80211/main.c:1544
mac80211_hwsim_new_radio+0x2847/0x57d0 drivers/net/wireless/virtual/mac80211_hwsim.c:5810
init_mac80211_hwsim+0x6db/0x7f0 drivers/net/wireless/virtual/mac80211_hwsim.c:7173
Right, that makes things clearer. The trace shows a clear path through `ieee80211_rate_control_ops_get`. Let's dig into that function and see what's going on with the locking there.
|
| 9/2 |
2026/05/13 02:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/rate.c IncludeLines:true Name:ieee80211_rate_control_ops_get]
Results: map[SourceCode: 216: /* Get the rate control algorithm. */
217: static const struct rate_control_ops *
218: ieee80211_rate_control_ops_get(const char *name)
219: {
220: const struct rate_control_ops *ops;
221: const char *alg_name;
222:
223: kernel_param_lock(THIS_MODULE);
224: if (!name)
225: alg_name = ieee80211_default_rc_algo;
226: else
227: alg_name = name;
228:
229: ops = ieee80211_try_rate_control_ops_get(alg_name);
230: if (!ops && name)
231: /* try default if specific alg requested but not found */
232: ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo);
233:
234: /* Note: check for > 0 is intentional to avoid clang warning */
235: if (!ops && (strlen(CONFIG_MAC80211_RC_DEFAULT) > 0))
236: /* try built-in one if specific alg requested but not found */
237: ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT);
238:
239: kernel_param_unlock(THIS_MODULE);
240:
241: return ops;
242: }
SourceFile:net/mac80211/rate.c]
|
| 10/2 |
2026/05/13 02:06 |
llm |
expert |
0m
Model:
Tokens:
input: 15038
output: 59
thoughts: 133
Thoughts: **Concurrency Concerns in mac80211_hwsim Initialization**
Okay, so I'm digging into this `kernel_param_lock(THIS_MODULE)` call and it's grabbing `param_lock`. Right, and that's the global mutex. Then I see `ieee80211_rate_control_ops_get` is also acquiring `param_lock`. Hmm, that's not immediately concerning, but I need to ensure there are no issues.
Now, `mac80211_hwsim_new_radio` gets called from `init_mac80211_hwsim`. This is where it gets interesting. I need to make sure that there isnβt potential deadlock, race conditions or other concurrency issues.
Specifically, I need to check whether `init_mac80211_hwsim` has locked any other mutexes, especially `rtnl_mutex`. If so, I need to understand the locking order, or else this could result in significant issues. Let me go and check `init_mac80211_hwsim` to make sure it is safe to execute.
|
| 11/2 |
2026/05/13 02:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.c IncludeLines:true Name:init_mac80211_hwsim]
Results: map[SourceCode:7056: static int __init init_mac80211_hwsim(void)
7057: {
7058: int i, err;
7059:
7060: if (radios < 0 || radios > 100)
7061: return -EINVAL;
7062:
7063: if (channels < 1)
7064: return -EINVAL;
7065:
7066: err = rhashtable_init(&hwsim_radios_rht, &hwsim_rht_params);
7067: if (err)
7068: return err;
7069:
7070: err = register_pernet_device(&hwsim_net_ops);
7071: if (err)
7072: goto out_free_rht;
7073:
7074: err = platform_driver_register(&mac80211_hwsim_driver);
7075: if (err)
7076: goto out_unregister_pernet;
7077:
7078: err = hwsim_init_netlink();
7079: if (err)
7080: goto out_unregister_driver;
7081:
7082: err = hwsim_register_virtio_driver();
7083: if (err)
7084: goto out_exit_netlink;
7085:
7086: hwsim_class = class_create("mac80211_hwsim");
7087: if (IS_ERR(hwsim_class)) {
7088: err = PTR_ERR(hwsim_class);
7089: goto out_exit_virtio;
7090: }
7091:
7092: hwsim_init_s1g_channels(hwsim_channels_s1g);
7093:
7094: for (i = 0; i < radios; i++) {
7095: struct hwsim_new_radio_params param = { 0 };
7096:
7097: param.channels = channels;
7098:
7099: switch (regtest) {
7100: case HWSIM_REGTEST_DIFF_COUNTRY:
7101: if (i < ARRAY_SIZE(hwsim_alpha2s))
7102: param.reg_alpha2 = hwsim_alpha2s[i];
7103: break;
7104: case HWSIM_REGTEST_DRIVER_REG_FOLLOW:
7105: if (!i)
7106: param.reg_alpha2 = hwsim_alpha2s[0];
7107: break;
7108: case HWSIM_REGTEST_STRICT_ALL:
7109: param.reg_strict = true;
7110: fallthrough;
7111: case HWSIM_REGTEST_DRIVER_REG_ALL:
7112: param.reg_alpha2 = hwsim_alpha2s[0];
7113: break;
7114: case HWSIM_REGTEST_WORLD_ROAM:
7115: if (i == 0)
7116: param.regd = &hwsim_world_regdom_custom_01;
7117: break;
7118: case HWSIM_REGTEST_CUSTOM_WORLD:
7119: param.regd = &hwsim_world_regdom_custom_03;
7120: break;
7121: case HWSIM_REGTEST_CUSTOM_WORLD_2:
7122: if (i == 0)
7123: param.regd = &hwsim_world_regdom_custom_03;
7124: else if (i == 1)
7125: param.regd = &hwsim_world_regdom_custom_02;
7126: break;
7127: case HWSIM_REGTEST_STRICT_FOLLOW:
7128: if (i == 0) {
7129: param.reg_strict = true;
7130: param.reg_alpha2 = hwsim_alpha2s[0];
7131: }
7132: break;
7133: case HWSIM_REGTEST_STRICT_AND_DRIVER_REG:
7134: if (i == 0) {
7135: param.reg_strict = true;
7136: param.reg_alpha2 = hwsim_alpha2s[0];
7137: } else if (i == 1) {
7138: param.reg_alpha2 = hwsim_alpha2s[1];
7139: }
7140: break;
7141: case HWSIM_REGTEST_ALL:
7142: switch (i) {
7143: case 0:
7144: param.regd = &hwsim_world_regdom_custom_01;
7145: break;
7146: case 1:
7147: param.regd = &hwsim_world_regdom_custom_02;
7148: break;
7149: case 2:
7150: param.reg_alpha2 = hwsim_alpha2s[0];
7151: break;
7152: case 3:
7153: param.reg_alpha2 = hwsim_alpha2s[1];
7154: break;
7155: case 4:
7156: param.reg_strict = true;
7157: param.reg_alpha2 = hwsim_alpha2s[2];
7158: break;
7159: }
7160: break;
7161: default:
7162: break;
7163: }
7164:
7165: param.p2p_device = support_p2p_device;
7166: param.mlo = mlo;
7167: param.multi_radio = multi_radio;
7168: param.use_chanctx = channels > 1 || mlo || multi_radio;
7169: param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
7170: if (param.p2p_device)
7171: param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
7172:
7173: err = mac80211_hwsim_new_radio(NULL, ¶m);
7174: if (err < 0)
7175: goto out_free_radios;
7176: }
7177:
7178: hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN,
7179: hwsim_mon_setup);
7180: if (hwsim_mon == NULL) {
7181: err = -ENOMEM;
7182: goto out_free_radios;
7183: }
7184:
7185: rtnl_lock();
7186: err = dev_alloc_name(hwsim_mon, hwsim_mon->name);
7187: if (err < 0) {
7188: rtnl_unlock();
7189: goto out_free_mon;
7190: }
7191:
7192: err = register_netdevice(hwsim_mon);
7193: if (err < 0) {
7194: rtnl_unlock();
7195: goto out_free_mon;
7196: }
7197: rtnl_unlock();
7198:
7199: return 0;
7200:
7201: out_free_mon:
7202: free_netdev(hwsim_mon);
7203: out_free_radios:
7204: mac80211_hwsim_free();
7205: out_exit_virtio:
7206: hwsim_unregister_virtio_driver();
7207: out_exit_netlink:
7208: hwsim_exit_netlink();
7209: out_unregister_driver:
7210: platform_driver_unregister(&mac80211_hwsim_driver);
7211: out_unregister_pernet:
7212: unregister_pernet_device(&hwsim_net_ops);
7213: out_free_rht:
7214: rhashtable_destroy(&hwsim_radios_rht);
7215: return err;
7216: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.c]
|
| 12/2 |
2026/05/13 02:06 |
llm |
expert |
0m
Model:
Tokens:
input: 17928
output: 61
thoughts: 69
Thoughts: **Potential Race Condition in Hardware Simulation Initialization**
Okay, here's what's running through my mind. I'm looking at this `init_mac80211_hwsim` function, and something's pinging my radar. It looks like it's calling `mac80211_hwsim_new_radio`. The issue is, from what I'm seeing, `init_mac80211_hwsim` isn't holding the `rtnl_lock` when it makes that call. But...and here's the kicker... `mac80211_hwsim_new_radio` *might* try to acquire that very same `rtnl_lock`. That's a potential recipe for a race condition, and we all know how nasty those can be! I need to confirm whether `mac80211_hwsim_new_radio` actually *does* interact with the `rtnl_lock`. I better check the code to see what's going on within `mac80211_hwsim_new_radio`. This warrants a closer look before it blows up later.
|
| 13/2 |
2026/05/13 02:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.c IncludeLines:true Name:mac80211_hwsim_new_radio]
Results: map[SourceCode:5383: static int mac80211_hwsim_new_radio(struct genl_info *info,
5384: struct hwsim_new_radio_params *param)
5385: {
5386: int err;
5387: u8 addr[ETH_ALEN];
5388: struct mac80211_hwsim_data *data;
5389: struct ieee80211_hw *hw;
5390: enum nl80211_band band;
5391: const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
5392: struct net *net;
5393: int idx, i;
5394: int n_limits = 0;
5395: int n_bands = 0;
5396:
5397: if (WARN_ON(param->channels > 1 && !param->use_chanctx))
5398: return -EINVAL;
5399:
5400: spin_lock_bh(&hwsim_radio_lock);
5401: idx = hwsim_radio_idx++;
5402: spin_unlock_bh(&hwsim_radio_lock);
5403:
5404: if (param->mlo)
5405: ops = &mac80211_hwsim_mlo_ops;
5406: else if (param->use_chanctx)
5407: ops = &mac80211_hwsim_mchan_ops;
5408: hw = ieee80211_alloc_hw_nm(sizeof(*data), ops, param->hwname);
5409: if (!hw) {
5410: pr_debug("mac80211_hwsim: ieee80211_alloc_hw failed\n");
5411: err = -ENOMEM;
5412: goto failed;
5413: }
5414:
5415: /* ieee80211_alloc_hw_nm may have used a default name */
5416: param->hwname = wiphy_name(hw->wiphy);
5417:
5418: if (info)
5419: net = genl_info_net(info);
5420: else
5421: net = &init_net;
5422: wiphy_net_set(hw->wiphy, net);
5423:
5424: data = hw->priv;
5425: data->hw = hw;
5426:
5427: data->dev = device_create(hwsim_class, NULL, 0, hw, "hwsim%d", idx);
5428: if (IS_ERR(data->dev)) {
5429: printk(KERN_DEBUG
5430: "mac80211_hwsim: device_create failed (%ld)\n",
5431: PTR_ERR(data->dev));
5432: err = -ENOMEM;
5433: goto failed_drvdata;
5434: }
5435: data->dev->driver = &mac80211_hwsim_driver.driver;
5436: err = device_bind_driver(data->dev);
5437: if (err != 0) {
5438: pr_debug("mac80211_hwsim: device_bind_driver failed (%d)\n",
5439: err);
5440: goto failed_bind;
5441: }
5442:
5443: skb_queue_head_init(&data->pending);
5444:
5445: SET_IEEE80211_DEV(hw, data->dev);
5446: if (!param->perm_addr) {
5447: eth_zero_addr(addr);
5448: addr[0] = 0x02;
5449: addr[3] = idx >> 8;
5450: addr[4] = idx;
5451: memcpy(data->addresses[0].addr, addr, ETH_ALEN);
5452: /* Why need here second address ? */
5453: memcpy(data->addresses[1].addr, addr, ETH_ALEN);
5454: data->addresses[1].addr[0] |= 0x40;
5455: memcpy(data->addresses[2].addr, addr, ETH_ALEN);
5456: data->addresses[2].addr[0] |= 0x50;
5457:
5458: hw->wiphy->n_addresses = 3;
5459: hw->wiphy->addresses = data->addresses;
5460: /* possible address clash is checked at hash table insertion */
5461: } else {
5462: memcpy(data->addresses[0].addr, param->perm_addr, ETH_ALEN);
5463: /* compatibility with automatically generated mac addr */
5464: memcpy(data->addresses[1].addr, param->perm_addr, ETH_ALEN);
5465: memcpy(data->addresses[2].addr, param->perm_addr, ETH_ALEN);
5466: hw->wiphy->n_addresses = 3;
5467: hw->wiphy->addresses = data->addresses;
5468: }
5469:
5470: data->channels = param->channels;
5471: data->use_chanctx = param->use_chanctx;
5472: data->idx = idx;
5473: data->destroy_on_close = param->destroy_on_close;
5474: if (info)
5475: data->portid = info->snd_portid;
5476:
5477: /* setup interface limits, only on interface types we support */
5478: if (param->iftypes & BIT(NL80211_IFTYPE_ADHOC)) {
5479: data->if_limits[n_limits].max = 1;
5480: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_ADHOC);
5481: n_limits++;
5482: }
5483:
5484: if (param->iftypes & HWSIM_DEFAULT_IF_LIMIT) {
5485: data->if_limits[n_limits].max = 2048;
5486: /*
5487: * For this case, we may only support a subset of
5488: * HWSIM_DEFAULT_IF_LIMIT, therefore we only want to add the
5489: * bits that both param->iftype & HWSIM_DEFAULT_IF_LIMIT have.
5490: */
5491: data->if_limits[n_limits].types =
5492: HWSIM_DEFAULT_IF_LIMIT & param->iftypes;
5493: n_limits++;
5494: }
5495:
5496: if (param->iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
5497: data->if_limits[n_limits].max = 1;
5498: data->if_limits[n_limits].types =
5499: BIT(NL80211_IFTYPE_P2P_DEVICE);
5500: n_limits++;
5501: }
5502:
5503: if (param->iftypes & BIT(NL80211_IFTYPE_NAN)) {
5504: data->if_limits[n_limits].max = 1;
5505: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN);
5506: n_limits++;
5507:
5508: hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ) |
5509: BIT(NL80211_BAND_5GHZ);
5510:
5511: hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
5512: WIPHY_NAN_FLAGS_USERSPACE_DE;
5513: hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
5514: NAN_OP_MODE_80P80MHZ |
5515: NAN_OP_MODE_160MHZ;
5516:
5517: hw->wiphy->nan_capa.n_antennas = 0x22;
5518: hw->wiphy->nan_capa.max_channel_switch_time = 0;
5519: hw->wiphy->nan_capa.dev_capabilities =
5520: NAN_DEV_CAPA_EXT_KEY_ID_SUPPORTED |
5521: NAN_DEV_CAPA_NDPE_SUPPORTED;
5522:
5523: hrtimer_setup(&data->nan_timer, mac80211_hwsim_nan_dw_start,
5524: CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
5525: }
5526:
5527: data->if_combination.radar_detect_widths =
5528: BIT(NL80211_CHAN_WIDTH_5) |
5529: BIT(NL80211_CHAN_WIDTH_10) |
5530: BIT(NL80211_CHAN_WIDTH_20_NOHT) |
5531: BIT(NL80211_CHAN_WIDTH_20) |
5532: BIT(NL80211_CHAN_WIDTH_40) |
5533: BIT(NL80211_CHAN_WIDTH_80) |
5534: BIT(NL80211_CHAN_WIDTH_160);
5535:
5536: if (data->use_chanctx) {
5537: hw->wiphy->max_scan_ssids = 255;
5538: hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
5539: hw->wiphy->max_remain_on_channel_duration = 1000;
5540: data->if_combination.num_different_channels = data->channels;
5541: } else {
5542: data->if_combination.num_different_channels = 1;
5543: }
5544:
5545: if (!n_limits) {
5546: err = -EINVAL;
5547: goto failed_hw;
5548: }
5549:
5550: data->if_combination.max_interfaces = 0;
5551: for (i = 0; i < n_limits; i++)
5552: data->if_combination.max_interfaces +=
5553: data->if_limits[i].max;
5554:
5555: data->if_combination.n_limits = n_limits;
5556: data->if_combination.limits = data->if_limits;
5557:
5558: /*
5559: * If we actually were asked to support combinations,
5560: * advertise them - if there's only a single thing like
5561: * only IBSS then don't advertise it as combinations.
5562: */
5563: if (data->if_combination.max_interfaces > 1) {
5564: hw->wiphy->iface_combinations = &data->if_combination;
5565: hw->wiphy->n_iface_combinations = 1;
5566: }
5567:
5568: if (param->ciphers) {
5569: memcpy(data->ciphers, param->ciphers,
5570: param->n_ciphers * sizeof(u32));
5571: hw->wiphy->cipher_suites = data->ciphers;
5572: hw->wiphy->n_cipher_suites = param->n_ciphers;
5573: }
5574:
5575: hw->wiphy->mbssid_max_interfaces = 8;
5576: hw->wiphy->ema_max_profile_periodicity = 3;
5577:
5578: data->rx_rssi = DEFAULT_RX_RSSI;
5579:
5580: INIT_DELAYED_WORK(&data->roc_start, hw_roc_start);
5581: INIT_DELAYED_WORK(&data->roc_done, hw_roc_done);
5582: INIT_DELAYED_WORK(&data->hw_scan, hw_scan_work);
5583:
5584: hw->queues = 5;
5585: hw->offchannel_tx_hw_queue = 4;
5586:
5587: ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
5588: ieee80211_hw_set(hw, CHANCTX_STA_CSA);
5589: ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
5590: ieee80211_hw_set(hw, QUEUE_CONTROL);
5591: ieee80211_hw_set(hw, WANT_MONITOR_VIF);
5592: ieee80211_hw_set(hw, AMPDU_AGGREGATION);
5593: ieee80211_hw_set(hw, MFP_CAPABLE);
5594: ieee80211_hw_set(hw, SIGNAL_DBM);
5595: ieee80211_hw_set(hw, SUPPORTS_PS);
5596: ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
5597: ieee80211_hw_set(hw, TDLS_WIDER_BW);
5598: ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
5599: ieee80211_hw_set(hw, STRICT);
5600:
5601: if (param->mlo) {
5602: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
5603: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5604: ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
5605: ieee80211_hw_set(hw, CONNECTION_MONITOR);
5606: ieee80211_hw_set(hw, AP_LINK_PS);
5607:
5608: hw->wiphy->iftype_ext_capab = mac80211_hwsim_iftypes_ext_capa;
5609: hw->wiphy->num_iftype_ext_capab =
5610: ARRAY_SIZE(mac80211_hwsim_iftypes_ext_capa);
5611: } else {
5612: ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
5613: ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
5614: if (rctbl)
5615: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
5616: }
5617:
5618: hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
5619: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
5620: WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
5621: WIPHY_FLAG_AP_UAPSD |
5622: WIPHY_FLAG_SUPPORTS_5_10_MHZ |
5623: WIPHY_FLAG_HAS_CHANNEL_SWITCH;
5624: hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
5625: NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
5626: NL80211_FEATURE_STATIC_SMPS |
5627: NL80211_FEATURE_DYNAMIC_SMPS |
5628: NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
5629: NL80211_FEATURE_AP_SCAN;
5630: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
5631: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
5632: wiphy_ext_feature_set(hw->wiphy,
5633: NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
5634: wiphy_ext_feature_set(hw->wiphy,
5635: NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
5636: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
5637:
5638: wiphy_ext_feature_set(hw->wiphy,
5639: NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT);
5640: wiphy_ext_feature_set(hw->wiphy,
5641: NL80211_EXT_FEATURE_BSS_COLOR);
5642:
5643: hw->wiphy->interface_modes = param->iftypes;
5644:
5645: /* ask mac80211 to reserve space for magic */
5646: hw->vif_data_size = sizeof(struct hwsim_vif_priv);
5647: hw->sta_data_size = sizeof(struct hwsim_sta_priv);
5648: hw->chanctx_data_size = sizeof(struct hwsim_chanctx_priv);
5649:
5650: memcpy(data->channels_2ghz, hwsim_channels_2ghz,
5651: sizeof(hwsim_channels_2ghz));
5652: memcpy(data->channels_5ghz, hwsim_channels_5ghz,
5653: sizeof(hwsim_channels_5ghz));
5654: memcpy(data->channels_6ghz, hwsim_channels_6ghz,
5655: sizeof(hwsim_channels_6ghz));
5656: memcpy(data->channels_s1g, hwsim_channels_s1g,
5657: sizeof(hwsim_channels_s1g));
5658: memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates));
5659:
5660: for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
5661: struct ieee80211_supported_band *sband = &data->bands[band];
5662: struct wiphy_radio_freq_range *radio_range;
5663: const struct ieee80211_channel *c;
5664: struct wiphy_radio *radio;
5665:
5666: sband->band = band;
5667:
5668: switch (band) {
5669: case NL80211_BAND_2GHZ:
5670: sband->channels = data->channels_2ghz;
5671: sband->n_channels = ARRAY_SIZE(hwsim_channels_2ghz);
5672: sband->bitrates = data->rates;
5673: sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
5674: break;
5675: case NL80211_BAND_5GHZ:
5676: sband->channels = data->channels_5ghz;
5677: sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
5678: sband->bitrates = data->rates + 4;
5679: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
5680:
5681: sband->vht_cap.vht_supported = true;
5682: sband->vht_cap.cap =
5683: IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
5684: IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
5685: IEEE80211_VHT_CAP_RXLDPC |
5686: IEEE80211_VHT_CAP_SHORT_GI_80 |
5687: IEEE80211_VHT_CAP_SHORT_GI_160 |
5688: IEEE80211_VHT_CAP_TXSTBC |
5689: IEEE80211_VHT_CAP_RXSTBC_4 |
5690: IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
5691: sband->vht_cap.vht_mcs.rx_mcs_map =
5692: cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 |
5693: IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 |
5694: IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 |
5695: IEEE80211_VHT_MCS_SUPPORT_0_9 << 6 |
5696: IEEE80211_VHT_MCS_SUPPORT_0_9 << 8 |
5697: IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 |
5698: IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 |
5699: IEEE80211_VHT_MCS_SUPPORT_0_9 << 14);
5700: sband->vht_cap.vht_mcs.tx_mcs_map =
5701: sband->vht_cap.vht_mcs.rx_mcs_map;
5702: break;
5703: case NL80211_BAND_6GHZ:
5704: sband->channels = data->channels_6ghz;
5705: sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
5706: sband->bitrates = data->rates + 4;
5707: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
5708: break;
5709: case NL80211_BAND_S1GHZ:
5710: memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
5711: sizeof(sband->s1g_cap));
5712: sband->channels = data->channels_s1g;
5713: sband->n_channels = ARRAY_SIZE(hwsim_channels_s1g);
5714: break;
5715: default:
5716: continue;
5717: }
5718:
5719: if (band != NL80211_BAND_6GHZ){
5720: sband->ht_cap.ht_supported = true;
5721: sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
5722: IEEE80211_HT_CAP_GRN_FLD |
5723: IEEE80211_HT_CAP_SGI_20 |
5724: IEEE80211_HT_CAP_SGI_40 |
5725: IEEE80211_HT_CAP_DSSSCCK40;
5726: sband->ht_cap.ampdu_factor = 0x3;
5727: sband->ht_cap.ampdu_density = 0x6;
5728: memset(&sband->ht_cap.mcs, 0,
5729: sizeof(sband->ht_cap.mcs));
5730: sband->ht_cap.mcs.rx_mask[0] = 0xff;
5731: sband->ht_cap.mcs.rx_mask[1] = 0xff;
5732: sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
5733: }
5734:
5735: mac80211_hwsim_sband_capab(sband);
5736:
5737: hw->wiphy->bands[band] = sband;
5738:
5739: if (!param->multi_radio)
5740: continue;
5741:
5742: c = sband->channels;
5743: radio_range = &data->radio_range[n_bands];
5744: radio_range->start_freq = ieee80211_channel_to_khz(c) - 10000;
5745:
5746: c += sband->n_channels - 1;
5747: radio_range->end_freq = ieee80211_channel_to_khz(c) + 10000;
5748:
5749: radio = &data->radio[n_bands++];
5750: radio->freq_range = radio_range;
5751: radio->n_freq_range = 1;
5752: radio->iface_combinations = &data->if_combination_radio;
5753: radio->n_iface_combinations = 1;
5754: }
5755:
5756: if (param->multi_radio) {
5757: hw->wiphy->radio = data->radio;
5758: hw->wiphy->n_radio = n_bands;
5759:
5760: memcpy(&data->if_combination_radio, &data->if_combination,
5761: sizeof(data->if_combination));
5762: data->if_combination.num_different_channels *= n_bands;
5763: }
5764:
5765: if (data->use_chanctx)
5766: data->if_combination.radar_detect_widths = 0;
5767:
5768: /* By default all radios belong to the first group */
5769: data->group = 1;
5770: mutex_init(&data->mutex);
5771:
5772: data->netgroup = hwsim_net_get_netgroup(net);
5773: data->wmediumd = hwsim_net_get_wmediumd(net);
5774:
5775: /* Enable frame retransmissions for lossy channels */
5776: hw->max_rates = 4;
5777: hw->max_rate_tries = 11;
5778:
5779: hw->wiphy->vendor_commands = mac80211_hwsim_vendor_commands;
5780: hw->wiphy->n_vendor_commands =
5781: ARRAY_SIZE(mac80211_hwsim_vendor_commands);
5782: hw->wiphy->vendor_events = mac80211_hwsim_vendor_events;
5783: hw->wiphy->n_vendor_events = ARRAY_SIZE(mac80211_hwsim_vendor_events);
5784:
5785: if (param->reg_strict)
5786: hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
5787: if (param->regd) {
5788: data->regd = param->regd;
5789: hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
5790: wiphy_apply_custom_regulatory(hw->wiphy, param->regd);
5791: /* give the regulatory workqueue a chance to run */
5792: schedule_timeout_interruptible(1);
5793: }
5794:
5795: wiphy_ext_feature_set(hw->wiphy,
5796: NL80211_EXT_FEATURE_DFS_CONCURRENT);
5797:
5798: if (param->no_vif)
5799: ieee80211_hw_set(hw, NO_AUTO_VIF);
5800:
5801: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
5802: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PUNCT);
5803:
5804: for (i = 0; i < ARRAY_SIZE(data->link_data); i++) {
5805: hrtimer_setup(&data->link_data[i].beacon_timer, mac80211_hwsim_beacon,
5806: CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
5807: data->link_data[i].link_id = i;
5808: }
5809:
5810: err = ieee80211_register_hw(hw);
5811: if (err < 0) {
5812: pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
5813: err);
5814: goto failed_hw;
5815: }
5816:
5817: wiphy_dbg(hw->wiphy, "hwaddr %pM registered\n", hw->wiphy->perm_addr);
5818:
5819: if (param->reg_alpha2) {
5820: data->alpha2[0] = param->reg_alpha2[0];
5821: data->alpha2[1] = param->reg_alpha2[1];
5822: regulatory_hint(hw->wiphy, param->reg_alpha2);
5823: }
5824:
5825: data->debugfs = debugfs_create_dir("hwsim", hw->wiphy->debugfsdir);
5826: debugfs_create_file("ps", 0666, data->debugfs, data, &hwsim_fops_ps);
5827: debugfs_create_file("group", 0666, data->debugfs, data,
5828: &hwsim_fops_group);
5829: debugfs_create_file("rx_rssi", 0666, data->debugfs, data,
5830: &hwsim_fops_rx_rssi);
5831: if (!data->use_chanctx)
5832: debugfs_create_file("dfs_simulate_radar", 0222,
5833: data->debugfs,
5834: data, &hwsim_simulate_radar);
5835:
5836: if (param->pmsr_capa) {
5837: data->pmsr_capa = *param->pmsr_capa;
5838: hw->wiphy->pmsr_capa = &data->pmsr_capa;
5839: }
5840:
5841: spin_lock_bh(&hwsim_radio_lock);
5842: err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
5843: hwsim_rht_params);
5844: if (err < 0) {
5845: if (info) {
5846: GENL_SET_ERR_MSG(info, "perm addr already present");
5847: NL_SET_BAD_ATTR(info->extack,
5848: info->attrs[HWSIM_ATTR_PERM_ADDR]);
5849: }
5850: spin_unlock_bh(&hwsim_radio_lock);
5851: goto failed_final_insert;
5852: }
5853:
5854: list_add_tail(&data->list, &hwsim_radios);
5855: hwsim_radios_generation++;
5856: spin_unlock_bh(&hwsim_radio_lock);
5857:
5858: hwsim_mcast_new_radio(idx, info, param);
5859:
5860: return idx;
5861:
5862: failed_final_insert:
5863: debugfs_remove_recursive(data->debugfs);
5864: ieee80211_unregister_hw(data->hw);
5865: failed_hw:
5866: device_release_driver(data->dev);
5867: failed_bind:
5868: device_unregister(data->dev);
5869: failed_drvdata:
5870: ieee80211_free_hw(hw);
5871: failed:
5872: return err;
5873: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.c]
|
| 14/2 |
2026/05/13 02:06 |
llm |
expert |
0m
Model:
Tokens:
input: 27720
output: 37
thoughts: 3909
Thoughts: **Analyzing a Potential Locking Dependency in mac80211_hwsim**
Okay, so I'm digging into this lockdep output. It looks like `mac80211_hwsim_new_radio` is calling `ieee80211_register_hw`, which eventually leads to acquiring `param_lock`. The lockdep trace shows this chain. However, initially, it doesn't appear that `rtnl_mutex` is held at the time `param_lock` is acquired within `init_mac80211_hwsim`, which is concerning.
The lockdep output then shows a dependency chain in *reverse* order: `&type->i_mutex_dir_key#6` -> `cgroup_mutex` -> `rtnl_mutex` -> `param_lock`. This *doesn't* mean that those locks are acquired in that order. Instead it means that, for example, `rtnl_mutex` *depends* on `param_lock`. The output is telling us that a scenario exists where `rtnl_mutex` might be acquired after `param_lock`, establishing a dependency.
The specific dependency chain shown suggests that a task is trying to acquire `&type->i_mutex_dir_key#6` while already holding `param_lock`. And this is causing a conflict somewhere. The chain is `&type->i_mutex_dir_key#6` depends on `cgroup_mutex`, `cgroup_mutex` depends on `rtnl_mutex` and `rtnl_mutex` depends on `param_lock`. This means lockdep is flagging a potential *reverse* locking order scenario: CPU1 might acquire `rtnl_mutex` and *then* try to acquire `param_lock`, while CPU0 might acquire `param_lock` and then try to take `i_mutex_dir_key`.
So, the critical question is *how* is the dependency `rtnl_mutex` -> `param_lock` established? I've checked the direct call stack within `init_mac80211_hwsim` and confirmed that `rtnl_mutex` is NOT held *before* the call to `mac80211_hwsim_new_radio`. But, is `mac80211_hwsim_new_radio` reachable from netlink? If it is, and the netlink path holds `rtnl_mutex`, then there *could* be a scenario where the dependency is established.
Therefore, the key point is that `mac80211_hwsim_new_radio` needs to be investigated in the netlink path.
|
| 15/2 |
2026/05/13 02:07 |
tool |
codesearch-find-references |
0m
Args: map[IncludeSnippetLines:0 Name:mac80211_hwsim_new_radio]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:hwsim_new_radio_nl SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.c SourceLine:6504] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:init_mac80211_hwsim SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.c SourceLine:7173]] TruncatedOutput:false]
|
| 16/2 |
2026/05/13 02:07 |
llm |
expert |
0m
Model:
Tokens:
input: 32392
output: 56
thoughts: 14
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person:
**Deep Dive into `hwsim_new_radio_nl`**
Alright, let's get down to brass tacks. I need to take a look at `hwsim_new_radio_nl`. That function name itself is pretty explicit, so it's probably connected to some new radio or network layer setup within the hardware simulator. My immediate questions are: What's the scope of "new"? Is this implementing a new RAT, frequency band, or potentially something more fundamental like a new PHY design? Is it something Iβve seen before?
I'm expecting to find details around Netlink messages, configuration parameters, and the overall data flow. Iβll need to understand how this function interfaces with the existing `hwsim` framework. Is it a standalone module, or is it tightly coupled with existing radio interface logic? Is this where they are trying to fix that slow handover problem I saw last week?
Specifically, I'll be looking for details regarding:
* **Netlink Message Structure:** What specific attributes are being passed? What are the implications for radio configuration and signaling? Is it using a custom Netlink family, or leveraging existing ones?
* **Initialization Flow:** How is this function called? What are the prerequisites? Is there any dependency on specific kernel modules or hardware components?
* **Error Handling:** Are there robust error checks in place? What happens if the radio fails to initialize, or configuration parameters are invalid?
* **Concurrency:** How is the access to radio data protected from race conditions? What locking mechanisms are being used? I hope they did a good job.
* **Performance:** What is the overhead of this new Netlink interface, and how does it compare to the previous approach? Are there any obvious bottlenecks?
* **Debugging Hooks:** Are there helpful tracing capabilities? Do they provide any kprobes?
Ultimately, my goal is to understand the complete picture of this new radio NL interface and how well it is designed. I want to assess whether this is well-engineered and ready for integration, or if it has some potential problems. It needs to be stable, efficient, and well-integrated. No surprises here!
|
| 17/2 |
2026/05/13 02:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.c IncludeLines:true Name:hwsim_new_radio_nl]
Results: map[SourceCode:6358: static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
6359: {
6360: struct hwsim_new_radio_params param = { 0 };
6361: const char *hwname = NULL;
6362: int ret;
6363:
6364: param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
6365: param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
6366: param.nan_device = info->attrs[HWSIM_ATTR_SUPPORT_NAN_DEVICE];
6367: param.channels = channels;
6368: param.destroy_on_close =
6369: info->attrs[HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE];
6370:
6371: if (info->attrs[HWSIM_ATTR_CHANNELS])
6372: param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]);
6373:
6374: if (param.channels < 1) {
6375: GENL_SET_ERR_MSG(info, "must have at least one channel");
6376: return -EINVAL;
6377: }
6378:
6379: if (info->attrs[HWSIM_ATTR_NO_VIF])
6380: param.no_vif = true;
6381:
6382: if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
6383: param.use_chanctx = true;
6384: else
6385: param.use_chanctx = (param.channels > 1);
6386:
6387: if (info->attrs[HWSIM_ATTR_MULTI_RADIO])
6388: param.multi_radio = true;
6389:
6390: if (info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2])
6391: param.reg_alpha2 =
6392: nla_data(info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]);
6393:
6394: if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
6395: u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
6396:
6397: if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
6398: return -EINVAL;
6399:
6400: idx = array_index_nospec(idx,
6401: ARRAY_SIZE(hwsim_world_regdom_custom));
6402: param.regd = hwsim_world_regdom_custom[idx];
6403: }
6404:
6405: if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
6406: if (!is_valid_ether_addr(
6407: nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
6408: GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
6409: NL_SET_BAD_ATTR(info->extack,
6410: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6411: return -EINVAL;
6412: }
6413:
6414: param.perm_addr = nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]);
6415: }
6416:
6417: if (info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]) {
6418: param.iftypes =
6419: nla_get_u32(info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]);
6420:
6421: if (param.iftypes & ~HWSIM_IFTYPE_SUPPORT_MASK) {
6422: NL_SET_ERR_MSG_ATTR(info->extack,
6423: info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT],
6424: "cannot support more iftypes than kernel");
6425: return -EINVAL;
6426: }
6427: } else {
6428: param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
6429: }
6430:
6431: /* ensure both flag and iftype support is honored */
6432: if (param.p2p_device ||
6433: param.iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
6434: param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
6435: param.p2p_device = true;
6436: }
6437:
6438: /* ensure both flag and iftype support is honored */
6439: if (param.nan_device ||
6440: param.iftypes & BIT(NL80211_IFTYPE_NAN)) {
6441: param.iftypes |= BIT(NL80211_IFTYPE_NAN);
6442: param.nan_device = true;
6443: }
6444:
6445: if (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]) {
6446: u32 len = nla_len(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6447:
6448: param.ciphers =
6449: nla_data(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6450:
6451: if (len % sizeof(u32)) {
6452: NL_SET_ERR_MSG_ATTR(info->extack,
6453: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6454: "bad cipher list length");
6455: return -EINVAL;
6456: }
6457:
6458: param.n_ciphers = len / sizeof(u32);
6459:
6460: if (param.n_ciphers > ARRAY_SIZE(hwsim_ciphers)) {
6461: NL_SET_ERR_MSG_ATTR(info->extack,
6462: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6463: "too many ciphers specified");
6464: return -EINVAL;
6465: }
6466:
6467: if (!hwsim_known_ciphers(param.ciphers, param.n_ciphers)) {
6468: NL_SET_ERR_MSG_ATTR(info->extack,
6469: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6470: "unsupported ciphers specified");
6471: return -EINVAL;
6472: }
6473: }
6474:
6475: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
6476:
6477: if (param.mlo || param.multi_radio)
6478: param.use_chanctx = true;
6479:
6480: if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
6481: hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6482: nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6483: GFP_KERNEL);
6484: if (!hwname)
6485: return -ENOMEM;
6486: param.hwname = hwname;
6487: }
6488:
6489: if (info->attrs[HWSIM_ATTR_PMSR_SUPPORT]) {
6490: struct cfg80211_pmsr_capabilities *pmsr_capa;
6491:
6492: pmsr_capa = kmalloc_obj(*pmsr_capa);
6493: if (!pmsr_capa) {
6494: ret = -ENOMEM;
6495: goto out_free;
6496: }
6497: param.pmsr_capa = pmsr_capa;
6498:
6499: ret = parse_pmsr_capa(info->attrs[HWSIM_ATTR_PMSR_SUPPORT], pmsr_capa, info);
6500: if (ret)
6501: goto out_free;
6502: }
6503:
6504: ret = mac80211_hwsim_new_radio(info, ¶m);
6505:
6506: out_free:
6507: kfree(hwname);
6508: kfree(param.pmsr_capa);
6509: return ret;
6510: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.c]
|
| 18/2 |
2026/05/13 02:07 |
llm |
expert |
0m
Model:
Tokens:
input: 35558
output: 39
thoughts: 826
Thoughts: **Analyzing a Potential Locking Issue in hwsim_new_radio_nl**
Okay, so I'm looking at `hwsim_new_radio_nl`, and my initial thought is that it's a Netlink callback, and those are often called with `rtnl_mutex` held. I need to be sure. Let me see... Right, `hwsim_new_radio_nl` is registered within `hwsim_genl_ops`. Time to check the flags on `hwsim_genl_ops` to confirm the mutex usage, specifically if it's using something like `GENL_UNS_ADMIN_PERM`.
Ah, it's Generic Netlink. That changes things; generic Netlink doesn't *automatically* hold `rtnl_mutex` unless certain flags are set. But does `GENL_FLAG_RTNL` have any effect? No, that doesn't exist. So, the direct assumption about `rtnl_mutex` might be wrong.
But wait, hold on. Maybe `rtnl_mutex` isn't held, which is what I'm trying to figure out.
Let's look at the lockdep report now. It's showing a dependency chain with `param_lock`... Okay, looking at the stacktrace, I can see that `rtnl_mutex` is not being held in `hwsim_new_radio_nl`. The stack trace shows the following function calls which lead to the mutex: `init_mac80211_hwsim` -> `mac80211_hwsim_new_radio` -> `ieee80211_register_hw` -> `ieee80211_init_rate_ctrl_alg` -> `rate_control_alloc` -> `ieee80211_rate_control_ops_get` -> `__mutex_lock_common` -> `__mutex_lock`.
Wait, the lockdep report is showing that the lock is being acquired by `init_mac80211_hwsim`. If `rtnl_mutex` were held, it would show up in the *acquisition* stack trace. But the lockdep report shows that `param_lock` comes *before* `rtnl_mutex`, and `init_mac80211_hwsim` looks like it's holding `param_lock`. Let's see what the dependency chain means.
The dependency chain, in reverse, is:
* `#0` (`&type->i_mutex_dir_key#6`)
* `#1` (`cgroup_mutex`)
* `#2` (`rtnl_mutex`)
* `#3` (`param_lock`)
So, this means that:
* `#0` depends on `#1`
* `#1` depends on `#2`
* `#2` depends on `#3`
Thus, `rtnl_mutex` depends on `param_lock`. I need to figure out *where* `rtnl_mutex` is acquired while `param_lock` is held. Okay, I'll go check `param_attr_store` in `kernel/params.c`.
|
| 19/2 |
2026/05/13 02:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/params.c IncludeLines:true Name:param_attr_store]
Results: map[SourceCode: 576: /* sysfs always hands a nul-terminated string in buf. We rely on that. */
577: static ssize_t param_attr_store(const struct module_attribute *mattr,
578: struct module_kobject *mk,
579: const char *buf, size_t len)
580: {
581: int err;
582: const struct param_attribute *attribute = to_param_attr(mattr);
583:
584: if (!attribute->param->ops->set)
585: return -EPERM;
586:
587: kernel_param_lock(mk->mod);
588: if (param_check_unsafe(attribute->param))
589: err = attribute->param->ops->set(buf, attribute->param);
590: else
591: err = -EPERM;
592: kernel_param_unlock(mk->mod);
593: if (!err)
594: return len;
595: return err;
596: }
SourceFile:kernel/params.c]
|
| 20/2 |
2026/05/13 02:07 |
llm |
expert |
0m
Model:
Tokens:
input: 37464
output: 45
thoughts: 99
Thoughts: **Analyzing the `block2mtd` Parameter Setup**
Okay, so I'm looking at this code and immediately see something interesting: `param_attr_store` is grabbing `kernel_param_lock`, which I understand is the same as `param_lock`. Standard locking practice, nothing surprising there. What comes next is key: it calls `attribute->param->ops->set(buf, attribute->param)`. Right, so this is where the parameter value is *actually* set.
In this reproducer, the code is writing to `/sys/module/block2mtd/parameters/block2mtd`. That nails it down: `attribute->param->ops->set` *has* to be `block2mtd_setup`. Bingo! Now, the logical next step is to dive into `block2mtd_setup` and see exactly what's going on within that function. I need to understand how that value is being handled, especially given the reproducer. Let's see what secrets it holds.
|
| 21/2 |
2026/05/13 02:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mtd/devices/block2mtd.c IncludeLines:true Name:block2mtd_setup]
Results: map[SourceCode: 465: static int block2mtd_setup(const char *val, const struct kernel_param *kp)
466: {
467: #ifdef MODULE
468: return block2mtd_setup2(val);
469: #else
470: /* If more parameters are later passed in via
471: /sys/module/block2mtd/parameters/block2mtd
472: and block2mtd_init() has already been called,
473: we can parse the argument now. */
474:
475: if (block2mtd_init_called)
476: return block2mtd_setup2(val);
477:
478: /* During early boot stage, we only save the parameters
479: here. We must parse them later: if the param passed
480: from kernel boot command line, block2mtd_setup() is
481: called so early that it is not possible to resolve
482: the device (even kmalloc() fails). Deter that work to
483: block2mtd_setup2(). */
484:
485: strscpy(block2mtd_paramline, val, sizeof(block2mtd_paramline));
486:
487: return 0;
488: #endif
489: }
SourceFile:drivers/mtd/devices/block2mtd.c]
|
| 22/2 |
2026/05/13 02:07 |
llm |
expert |
0m
Model:
Tokens:
input: 38234
output: 43
thoughts: 15
Thoughts: Here's a summary of my understanding:
**Analyzing the Device Addition Process**
Okay, so I'm looking at this code and specifically, how a new device gets integrated. It seems that the function `block2mtd_setup2` is crucial here, and within its execution, it calls `add_device`. This implies that `block2mtd_setup2` is acting as the setup routine, and it uses `add_device` to actually register the newly configured device within the system. Therefore, I can deduce `add_device` is likely doing the low-level work. Makes sense, that's a pretty standard pattern. Now I need to check `block2mtd_setup2` and `add_device`'s definition to see which arguments are being passed, so I can understand the configuration data.
|
| 23/2 |
2026/05/13 02:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mtd/devices/block2mtd.c IncludeLines:true Name:add_device]
Results: map[SourceCode: 261: static struct block2mtd_dev *add_device(char *devname, int erase_size,
262: char *label, int timeout)
263: {
264: const blk_mode_t mode = BLK_OPEN_READ | BLK_OPEN_WRITE;
265: struct file *bdev_file;
266: struct block_device *bdev;
267: struct block2mtd_dev *dev;
268: loff_t size;
269: char *name;
270:
271: if (!devname)
272: return NULL;
273:
274: dev = kzalloc_obj(struct block2mtd_dev);
275: if (!dev)
276: return NULL;
277:
278: /* Get a handle on the device */
279: bdev_file = bdev_file_open_by_path(devname, mode, dev, NULL);
280: if (IS_ERR(bdev_file))
281: bdev_file = mdtblock_early_get_bdev(devname, mode, timeout,
282: dev);
283: if (IS_ERR(bdev_file)) {
284: pr_err("error: cannot open device %s\n", devname);
285: goto err_free_block2mtd;
286: }
287: dev->bdev_file = bdev_file;
288: bdev = file_bdev(bdev_file);
289:
290: if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
291: pr_err("attempting to use an MTD device as a block device\n");
292: goto err_free_block2mtd;
293: }
294:
295: size = bdev_nr_bytes(bdev);
296: if ((long)size % erase_size) {
297: pr_err("erasesize must be a divisor of device size\n");
298: goto err_free_block2mtd;
299: }
300:
301: mutex_init(&dev->write_mutex);
302:
303: /* Setup the MTD structure */
304: /* make the name contain the block device in */
305: if (!label)
306: name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
307: else
308: name = kstrdup(label, GFP_KERNEL);
309: if (!name)
310: goto err_destroy_mutex;
311:
312: dev->mtd.name = name;
313:
314: dev->mtd.size = size & PAGE_MASK;
315: dev->mtd.erasesize = erase_size;
316: dev->mtd.writesize = 1;
317: dev->mtd.writebufsize = PAGE_SIZE;
318: dev->mtd.type = MTD_RAM;
319: dev->mtd.flags = MTD_CAP_RAM;
320: dev->mtd._erase = block2mtd_erase;
321: dev->mtd._write = block2mtd_write;
322: dev->mtd._sync = block2mtd_sync;
323: dev->mtd._read = block2mtd_read;
324: dev->mtd.priv = dev;
325: dev->mtd.owner = THIS_MODULE;
326:
327: if (mtd_device_register(&dev->mtd, NULL, 0)) {
328: /* Device didn't get added, so free the entry */
329: goto err_destroy_mutex;
330: }
331:
332: list_add(&dev->list, &blkmtd_device_list);
333: pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n",
334: dev->mtd.index,
335: label ? label : dev->mtd.name + strlen("block2mtd: "),
336: dev->mtd.erasesize >> 10, dev->mtd.erasesize);
337: return dev;
338:
339: err_destroy_mutex:
340: mutex_destroy(&dev->write_mutex);
341: err_free_block2mtd:
342: block2mtd_free_device(dev);
343: return NULL;
344: }
SourceFile:drivers/mtd/devices/block2mtd.c]
|
| 24/2 |
2026/05/13 02:08 |
llm |
expert |
0m
Model:
Tokens:
input: 39818
output: 52
thoughts: 1341
Thoughts: **Analyzing a Lockdep Report and Tracing a Potential Deadlock**
Okay, let's break this down. I'm looking at a lockdep report triggered by `add_device`. This call chain is interesting: `add_device` -> `bdev_file_open_by_path` -> `lookup_bdev` -> `kern_path` -> `filename_lookup` -> `path_lookupat` -> `lookup_last` -> `walk_component` -> `lookup_slow`. Ultimately, we're taking `inode_lock_shared`, which, as I see it, corresponds to `i_mutex_dir_key`. So, *that* call chain establishes a dependency on `i_mutex_dir_key`.
But the lockdep output is screaming at me: there's a problem! A thread is attempting to acquire `i_mutex_dir_key` (`ffff88807982dab8`) at `include/linux/fs.h:1043`, but it *already* holds `param_lock` (`ffffffff8e69df08`) at `kernel/params.c:602`, and lockdep is telling me the latter *already* depends on the former. This is a classic potential deadlock situation.
So, current thread is trying to acquire `i_mutex_dir_key` while already holding `param_lock`. Lockdep claims `param_lock` *already* depends on `i_mutex_dir_key`. Time to investigate the existing dependency chain.
Lockdep says the existing dependency chain is: `i_mutex_dir_key` -> `cgroup_mutex` -> `rtnl_mutex` -> `param_lock`. If that's true, acquiring `i_mutex_dir_key` while holding `param_lock` creates a cycle: `param_lock` -> `i_mutex_dir_key` -> `cgroup_mutex` -> `rtnl_mutex` -> `param_lock`.
Let me check the existing dependency chain again. It's indicating `param_lock` comes from `#3`. Checking the backtrace I see, the chain looks like:
* `i_mutex_dir_key` (from call stack)
* `cgroup_mutex` (from `#1` in the original trace)
* `rtnl_mutex` (from `#2` in the original trace)
* `param_lock` (from `#3` in the original trace)
My question now is where is the dependency `rtnl_mutex` -> `param_lock` established? I'm trying to trace the point where a lock on `rtnl_mutex` might be held when a lock on `param_lock` is taken.
In the `#3` entry, I can see that `param_lock` is being acquired. But is `rtnl_mutex` held? Let me check the trace for when `init_mac80211_hwsim` is called. However, since it is an initcall, is `rtnl_mutex` held during initcalls? No, that can't be. Then how is `rtnl_mutex` -> `param_lock` established?
Ah, look at the lockdep output for `#3` again! It shows the call stack:
* `param_lock` via `__mutex_lock_common` and `__mutex_lock`
* `ieee80211_rate_control_ops_get`
* `rate_control_alloc`
* `ieee80211_init_rate_ctrl_alg`
* `ieee80211_register_hw`
* `mac80211_hwsim_new_radio`
* `init_mac80211_hwsim`
Maybe `rtnl_mutex` IS held during `init_mac80211_hwsim`? No, because I see `rtnl_lock()` being called *explicitly later* in `init_mac80211_hwsim`.
Could `rtnl_mutex` be held by `do_initcalls`? No. The key is in `mac80211_hwsim_new_radio` or earlier calls in the trace. Let me look at `mac80211_hwsim_new_radio` closely. It calls `ieee80211_register_hw(hw)`.
The question becomes, does `ieee80211_register_hw` (or functions it calls) take `rtnl_lock`? That's the next
|
| 25/2 |
2026/05/13 02:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/main.c IncludeLines:true Name:ieee80211_register_hw]
Results: map[SourceCode:1120: int ieee80211_register_hw(struct ieee80211_hw *hw)
1121: {
1122: struct ieee80211_local *local = hw_to_local(hw);
1123: int result, i;
1124: enum nl80211_band band;
1125: int channels, max_bitrates;
1126: bool supp_ht, supp_vht, supp_he, supp_eht, supp_s1g, supp_uhr;
1127: struct cfg80211_chan_def dflt_chandef = {};
1128:
1129: if (ieee80211_hw_check(hw, QUEUE_CONTROL) &&
1130: (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
1131: local->hw.offchannel_tx_hw_queue >= local->hw.queues))
1132: return -EINVAL;
1133:
1134: if ((hw->wiphy->features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) &&
1135: (!local->ops->tdls_channel_switch ||
1136: !local->ops->tdls_cancel_channel_switch ||
1137: !local->ops->tdls_recv_channel_switch))
1138: return -EOPNOTSUPP;
1139:
1140: if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_TX_FRAG) &&
1141: !local->ops->set_frag_threshold))
1142: return -EINVAL;
1143:
1144: if (WARN_ON(local->hw.wiphy->interface_modes &
1145: BIT(NL80211_IFTYPE_NAN) &&
1146: (!local->ops->start_nan || !local->ops->stop_nan)))
1147: return -EINVAL;
1148:
1149: if (hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) {
1150: /*
1151: * For drivers capable of doing MLO, assume modern driver
1152: * or firmware facilities, so software doesn't have to do
1153: * as much, e.g. monitoring beacons would be hard if we
1154: * might not even know which link is active at which time.
1155: */
1156: if (WARN_ON(local->emulate_chanctx))
1157: return -EINVAL;
1158:
1159: if (WARN_ON(!local->ops->link_info_changed))
1160: return -EINVAL;
1161:
1162: if (WARN_ON(!ieee80211_hw_check(hw, HAS_RATE_CONTROL)))
1163: return -EINVAL;
1164:
1165: if (WARN_ON(!ieee80211_hw_check(hw, AMPDU_AGGREGATION)))
1166: return -EINVAL;
1167:
1168: if (WARN_ON(ieee80211_hw_check(hw, HOST_BROADCAST_PS_BUFFERING)))
1169: return -EINVAL;
1170:
1171: if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_PS) &&
1172: (!ieee80211_hw_check(hw, SUPPORTS_DYNAMIC_PS) ||
1173: ieee80211_hw_check(hw, PS_NULLFUNC_STACK))))
1174: return -EINVAL;
1175:
1176: if (WARN_ON(!ieee80211_hw_check(hw, MFP_CAPABLE)))
1177: return -EINVAL;
1178:
1179: if (WARN_ON(ieee80211_hw_check(hw, NEED_DTIM_BEFORE_ASSOC)))
1180: return -EINVAL;
1181:
1182: if (WARN_ON(ieee80211_hw_check(hw, TIMING_BEACON_ONLY)))
1183: return -EINVAL;
1184:
1185: if (WARN_ON(!ieee80211_hw_check(hw, AP_LINK_PS)))
1186: return -EINVAL;
1187: }
1188:
1189: #ifdef CONFIG_PM
1190: if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
1191: return -EINVAL;
1192: #endif
1193:
1194: if (local->emulate_chanctx) {
1195: for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
1196: const struct ieee80211_iface_combination *comb;
1197:
1198: comb = &local->hw.wiphy->iface_combinations[i];
1199:
1200: if (comb->num_different_channels > 1)
1201: return -EINVAL;
1202: }
1203: }
1204:
1205: if (hw->wiphy->n_radio) {
1206: for (i = 0; i < hw->wiphy->n_radio; i++) {
1207: const struct wiphy_radio *radio = &hw->wiphy->radio[i];
1208:
1209: if (!ieee80211_ifcomb_check(radio->iface_combinations,
1210: radio->n_iface_combinations))
1211: return -EINVAL;
1212: }
1213: } else {
1214: if (!ieee80211_ifcomb_check(hw->wiphy->iface_combinations,
1215: hw->wiphy->n_iface_combinations))
1216: return -EINVAL;
1217: }
1218:
1219: /* Only HW csum features are currently compatible with mac80211 */
1220: if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES))
1221: return -EINVAL;
1222:
1223: if (hw->max_report_rates == 0)
1224: hw->max_report_rates = hw->max_rates;
1225:
1226: local->rx_chains = 1;
1227:
1228: /*
1229: * generic code guarantees at least one band,
1230: * set this very early because much code assumes
1231: * that hw.conf.channel is assigned
1232: */
1233: channels = 0;
1234: max_bitrates = 0;
1235: supp_ht = false;
1236: supp_vht = false;
1237: supp_he = false;
1238: supp_eht = false;
1239: supp_s1g = false;
1240: supp_uhr = false;
1241: for (band = 0; band < NUM_NL80211_BANDS; band++) {
1242: const struct ieee80211_sband_iftype_data *iftd;
1243: struct ieee80211_supported_band *sband;
1244:
1245: sband = local->hw.wiphy->bands[band];
1246: if (!sband)
1247: continue;
1248:
1249: if (!dflt_chandef.chan) {
1250: /*
1251: * Assign the first enabled channel to dflt_chandef
1252: * from the list of channels. For S1G interfaces
1253: * ensure it can be used as a primary.
1254: */
1255: for (i = 0; i < sband->n_channels; i++)
1256: if (!(sband->channels[i].flags &
1257: (IEEE80211_CHAN_DISABLED |
1258: IEEE80211_CHAN_S1G_NO_PRIMARY)))
1259: break;
1260: /* if none found then use the first anyway */
1261: if (i == sband->n_channels)
1262: i = 0;
1263: cfg80211_chandef_create(&dflt_chandef,
1264: &sband->channels[i],
1265: NL80211_CHAN_NO_HT);
1266: /* init channel we're on */
1267: local->monitor_chanreq.oper = dflt_chandef;
1268: if (local->emulate_chanctx) {
1269: local->dflt_chandef = dflt_chandef;
1270: local->hw.conf.chandef = dflt_chandef;
1271: }
1272: }
1273:
1274: channels += sband->n_channels;
1275:
1276: /*
1277: * Due to the way the aggregation code handles this and it
1278: * being an HT capability, we can't really support delayed
1279: * BA in MLO (yet).
1280: */
1281: if (WARN_ON(sband->ht_cap.ht_supported &&
1282: (sband->ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA) &&
1283: hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO))
1284: return -EINVAL;
1285:
1286: if (max_bitrates < sband->n_bitrates)
1287: max_bitrates = sband->n_bitrates;
1288: supp_ht = supp_ht || sband->ht_cap.ht_supported;
1289: supp_vht = supp_vht || sband->vht_cap.vht_supported;
1290: supp_s1g = supp_s1g || sband->s1g_cap.s1g;
1291:
1292: for_each_sband_iftype_data(sband, i, iftd) {
1293: u8 he_40_mhz_cap;
1294:
1295: supp_he = supp_he || iftd->he_cap.has_he;
1296: supp_eht = supp_eht || iftd->eht_cap.has_eht;
1297: supp_uhr = supp_uhr || iftd->uhr_cap.has_uhr;
1298:
1299: if (band == NL80211_BAND_2GHZ)
1300: he_40_mhz_cap =
1301: IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G;
1302: else
1303: he_40_mhz_cap =
1304: IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
1305:
1306: /* currently no support for HE client where HT has 40 MHz but not HT */
1307: if (iftd->he_cap.has_he &&
1308: iftd->types_mask & (BIT(NL80211_IFTYPE_STATION) |
1309: BIT(NL80211_IFTYPE_P2P_CLIENT)) &&
1310: sband->ht_cap.ht_supported &&
1311: sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 &&
1312: !(iftd->he_cap.he_cap_elem.phy_cap_info[0] & he_40_mhz_cap))
1313: return -EINVAL;
1314:
1315: /* no support for per-band vendor elems with MLO */
1316: if (WARN_ON(iftd->vendor_elems.len &&
1317: hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO))
1318: return -EINVAL;
1319: }
1320:
1321: /* HT, VHT, HE require QoS, thus >= 4 queues */
1322: if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
1323: (supp_ht || supp_vht || supp_he)))
1324: return -EINVAL;
1325:
1326: /* EHT requires HE support */
1327: if (WARN_ON(supp_eht && !supp_he))
1328: return -EINVAL;
1329:
1330: /* UHR requires EHT support */
1331: if (WARN_ON(supp_uhr && !supp_eht))
1332: return -EINVAL;
1333:
1334: if (!sband->ht_cap.ht_supported)
1335: continue;
1336:
1337: /* TODO: consider VHT for RX chains, hopefully it's the same */
1338: local->rx_chains =
1339: max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs),
1340: local->rx_chains);
1341:
1342: /* no need to mask, SM_PS_DISABLED has all bits set */
1343: sband->ht_cap.cap |= WLAN_HT_CAP_SM_PS_DISABLED <<
1344: IEEE80211_HT_CAP_SM_PS_SHIFT;
1345: }
1346:
1347: /* if low-level driver supports AP, we also support VLAN.
1348: * drivers advertising SW_CRYPTO_CONTROL should enable AP_VLAN
1349: * based on their support to transmit SW encrypted packets.
1350: */
1351: if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) &&
1352: !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) {
1353: hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
1354: hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
1355: }
1356:
1357: /* mac80211 always supports monitor */
1358: hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
1359: hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
1360:
1361:
1362: local->int_scan_req = kzalloc_flex(*local->int_scan_req, channels,
1363: channels);
1364: if (!local->int_scan_req)
1365: return -ENOMEM;
1366:
1367: eth_broadcast_addr(local->int_scan_req->bssid);
1368:
1369: for (band = 0; band < NUM_NL80211_BANDS; band++) {
1370: if (!local->hw.wiphy->bands[band])
1371: continue;
1372: local->int_scan_req->rates[band] = (u32) -1;
1373: }
1374:
1375: #ifndef CONFIG_MAC80211_MESH
1376: /* mesh depends on Kconfig, but drivers should set it if they want */
1377: local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
1378: #endif
1379:
1380: /* if the underlying driver supports mesh, mac80211 will (at least)
1381: * provide routing of mesh authentication frames to userspace */
1382: if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
1383: local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
1384:
1385: /* mac80211 supports control port protocol changing */
1386: local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
1387:
1388: if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) {
1389: local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
1390: } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) {
1391: local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
1392: if (hw->max_signal <= 0) {
1393: result = -EINVAL;
1394: goto fail_workqueue;
1395: }
1396: }
1397:
1398: /* Mac80211 and therefore all drivers using SW crypto only
1399: * are able to handle PTK rekeys and Extended Key ID.
1400: */
1401: if (!local->ops->set_key) {
1402: wiphy_ext_feature_set(local->hw.wiphy,
1403: NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
1404: wiphy_ext_feature_set(local->hw.wiphy,
1405: NL80211_EXT_FEATURE_EXT_KEY_ID);
1406: }
1407:
1408: if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC))
1409: wiphy_ext_feature_set(local->hw.wiphy,
1410: NL80211_EXT_FEATURE_DEL_IBSS_STA);
1411:
1412: /*
1413: * Calculate scan IE length -- we need this to alloc
1414: * memory and to subtract from the driver limit. It
1415: * includes the DS Params, (extended) supported rates, and HT
1416: * information -- SSID is the driver's responsibility.
1417: */
1418: local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
1419: 3 /* DS Params */;
1420: if (supp_ht)
1421: local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
1422:
1423: if (supp_vht)
1424: local->scan_ies_len +=
1425: 2 + sizeof(struct ieee80211_vht_cap);
1426:
1427: if (supp_s1g)
1428: local->scan_ies_len += 2 + sizeof(struct ieee80211_s1g_cap);
1429:
1430: /*
1431: * HE cap element is variable in size - set len to allow max size */
1432: if (supp_he) {
1433: local->scan_ies_len +=
1434: 3 + sizeof(struct ieee80211_he_cap_elem) +
1435: sizeof(struct ieee80211_he_mcs_nss_supp) +
1436: IEEE80211_HE_PPE_THRES_MAX_LEN;
1437:
1438: if (supp_eht)
1439: local->scan_ies_len +=
1440: 3 + sizeof(struct ieee80211_eht_cap_elem) +
1441: sizeof(struct ieee80211_eht_mcs_nss_supp) +
1442: IEEE80211_EHT_PPE_THRES_MAX_LEN;
1443: }
1444:
1445: if (supp_uhr)
1446: local->scan_ies_len +=
1447: 3 + sizeof(struct ieee80211_uhr_cap) +
1448: sizeof(struct ieee80211_uhr_cap_phy);
1449:
1450: if (!local->ops->hw_scan) {
1451: /* For hw_scan, driver needs to set these up. */
1452: local->hw.wiphy->max_scan_ssids = 4;
1453: local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
1454: }
1455:
1456: /*
1457: * If the driver supports any scan IEs, then assume the
1458: * limit includes the IEs mac80211 will add, otherwise
1459: * leave it at zero and let the driver sort it out; we
1460: * still pass our IEs to the driver but userspace will
1461: * not be allowed to in that case.
1462: */
1463: if (local->hw.wiphy->max_scan_ie_len)
1464: local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
1465:
1466: result = ieee80211_init_cipher_suites(local);
1467: if (result < 0)
1468: goto fail_workqueue;
1469:
1470: if (!local->ops->remain_on_channel)
1471: local->hw.wiphy->max_remain_on_channel_duration = 5000;
1472:
1473: /* mac80211 based drivers don't support internal TDLS setup */
1474: if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
1475: local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
1476:
1477: /* mac80211 supports eCSA, if the driver supports STA CSA at all */
1478: if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA))
1479: local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
1480:
1481: /* mac80211 supports multi BSSID, if the driver supports it */
1482: if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) {
1483: local->hw.wiphy->support_mbssid = true;
1484: if (ieee80211_hw_check(&local->hw,
1485: SUPPORTS_ONLY_HE_MULTI_BSSID))
1486: local->hw.wiphy->support_only_he_mbssid = true;
1487: else
1488: local->ext_capa[2] |=
1489: WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT;
1490: }
1491:
1492: local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM;
1493:
1494: /*
1495: * We use the number of queues for feature tests (QoS, HT) internally
1496: * so restrict them appropriately.
1497: */
1498: if (hw->queues > IEEE80211_MAX_QUEUES)
1499: hw->queues = IEEE80211_MAX_QUEUES;
1500:
1501: local->workqueue =
1502: alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy));
1503: if (!local->workqueue) {
1504: result = -ENOMEM;
1505: goto fail_workqueue;
1506: }
1507:
1508: /*
1509: * The hardware needs headroom for sending the frame,
1510: * and we need some headroom for passing the frame to monitor
1511: * interfaces, but never both at the same time.
1512: */
1513: local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
1514: IEEE80211_TX_STATUS_HEADROOM);
1515:
1516: /*
1517: * if the driver doesn't specify a max listen interval we
1518: * use 5 which should be a safe default
1519: */
1520: if (local->hw.max_listen_interval == 0)
1521: local->hw.max_listen_interval = 5;
1522:
1523: local->hw.conf.listen_interval = local->hw.max_listen_interval;
1524:
1525: local->dynamic_ps_forced_timeout = -1;
1526:
1527: if (!local->hw.max_nan_de_entries)
1528: local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID;
1529:
1530: if (!local->hw.weight_multiplier)
1531: local->hw.weight_multiplier = 1;
1532:
1533: ieee80211_wep_init(local);
1534:
1535: local->hw.conf.flags = IEEE80211_CONF_IDLE;
1536:
1537: ieee80211_led_init(local);
1538:
1539: result = ieee80211_txq_setup_flows(local);
1540: if (result)
1541: goto fail_flows;
1542:
1543: rtnl_lock();
1544: result = ieee80211_init_rate_ctrl_alg(local,
1545: hw->rate_control_algorithm);
1546: rtnl_unlock();
1547: if (result < 0) {
1548: wiphy_debug(local->hw.wiphy,
1549: "Failed to initialize rate control algorithm\n");
1550: goto fail_rate;
1551: }
1552:
1553: if (local->rate_ctrl) {
1554: clear_bit(IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, hw->flags);
1555: if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW)
1556: ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
1557: }
1558:
1559: /*
1560: * If the VHT capabilities don't have IEEE80211_VHT_EXT_NSS_BW_CAPABLE,
1561: * or have it when we don't, copy the sband structure and set/clear it.
1562: * This is necessary because rate scaling algorithms could be switched
1563: * and have different support values.
1564: * Print a message so that in the common case the reallocation can be
1565: * avoided.
1566: */
1567: BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated));
1568: for (band = 0; band < NUM_NL80211_BANDS; band++) {
1569: struct ieee80211_supported_band *sband;
1570: bool local_cap, ie_cap;
1571:
1572: local_cap = ieee80211_hw_check(hw, SUPPORTS_VHT_EXT_NSS_BW);
1573:
1574: sband = local->hw.wiphy->bands[band];
1575: if (!sband || !sband->vht_cap.vht_supported)
1576: continue;
1577:
1578: ie_cap = !!(sband->vht_cap.vht_mcs.tx_highest &
1579: cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE));
1580:
1581: if (local_cap == ie_cap)
1582: continue;
1583:
1584: sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL);
1585: if (!sband) {
1586: result = -ENOMEM;
1587: goto fail_rate;
1588: }
1589:
1590: wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n",
1591: band);
1592:
1593: sband->vht_cap.vht_mcs.tx_highest ^=
1594: cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE);
1595:
1596: local->hw.wiphy->bands[band] = sband;
1597: local->sband_allocated |= BIT(band);
1598: }
1599:
1600: result = wiphy_register(local->hw.wiphy);
1601: if (result < 0)
1602: goto fail_wiphy_register;
1603:
1604: debugfs_hw_add(local);
1605: rate_control_add_debugfs(local);
1606:
1607: ieee80211_check_wbrf_support(local);
1608:
1609: rtnl_lock();
1610: wiphy_lock(hw->wiphy);
1611:
1612: /* add one default STA interface if supported */
1613: if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
1614: !ieee80211_hw_check(hw, NO_AUTO_VIF)) {
1615: struct vif_params params = {0};
1616:
1617: result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
1618: NL80211_IFTYPE_STATION, ¶ms);
1619: if (result)
1620: wiphy_warn(local->hw.wiphy,
1621: "Failed to add default virtual iface\n");
1622: }
1623:
1624: wiphy_unlock(hw->wiphy);
1625: rtnl_unlock();
1626:
1627: #ifdef CONFIG_INET
1628: local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
1629: result = register_inetaddr_notifier(&local->ifa_notifier);
1630: if (result)
1631: goto fail_ifa;
1632: #endif
1633:
1634: #if IS_ENABLED(CONFIG_IPV6)
1635: local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
1636: result = register_inet6addr_notifier(&local->ifa6_notifier);
1637: if (result)
1638: goto fail_ifa6;
1639: #endif
1640:
1641: return 0;
1642:
1643: #if IS_ENABLED(CONFIG_IPV6)
1644: fail_ifa6:
1645: #ifdef CONFIG_INET
1646: unregister_inetaddr_notifier(&local->ifa_notifier);
1647: #endif
1648: #endif
1649: #if defined(CONFIG_INET) || defined(CONFIG_IPV6)
1650: fail_ifa:
1651: #endif
1652: wiphy_unregister(local->hw.wiphy);
1653: fail_wiphy_register:
1654: rtnl_lock();
1655: rate_control_deinitialize(local);
1656: ieee80211_remove_interfaces(local);
1657: rtnl_unlock();
1658: fail_rate:
1659: ieee80211_txq_teardown_flows(local);
1660: fail_flows:
1661: ieee80211_led_exit(local);
1662: destroy_workqueue(local->workqueue);
1663: fail_workqueue:
1664: kfree(local->int_scan_req);
1665: return result;
1666: }
SourceFile:net/mac80211/main.c]
|
| 26/2 |
2026/05/13 02:08 |
llm |
expert |
0m
Model:
Tokens:
input: 51842
output: 22
thoughts: 1422
Thoughts: **Analyzing a Potential Kernel Lock Dependency Cycle**
Okay, let's break this down. My initial observation is that `ieee80211_register_hw` calls `ieee80211_init_rate_ctrl_alg`, which eventually leads to the acquisition of `param_lock` after grabbing `rtnl_mutex`, establishing a dependency. Specifically, `rtnl_mutex` before `param_lock`. This is triggered during the initialization of the mac80211 hardware simulation.
The next piece of the puzzle arises from the lockdep report, pointing to a different chain involving `i_mutex_dir_key`. My initial attempt to understand the connection quickly evolved into tracing the flow of execution and lock acquisition. I've deduced that the established dependency chain is: `i_mutex_dir_key` -> `cgroup_mutex` -> `rtnl_mutex` -> `param_lock`.
I had to trace through code, like that within `vfs_rmdir`, `cgroup_mkdir`, and the various calls within `ieee80211_register_hw`, to arrive at that conclusion. The dependency chains are established via common calls across various kernel subsystems. The initial suspicion that `rtnl_mutex` -> `param_lock` was not the only relationship, it's actually an entire lock dependency loop.
Now, the lockdep report highlights the critical issue: a cycle. I'm seeing a situation where a thread might try to acquire `i_mutex_dir_key` while already holding `param_lock`, which would create a nasty cycle. The existing and troublesome dependency chain is: `param_lock` -> `i_mutex_dir_key` -> `cgroup_mutex` -> `rtnl_mutex` -> `param_lock`.
To confirm the deadlock scenario, let's explore if this cycle could actually be triggered by multiple threads. I've outlined a possible scenario.
* Thread 1 holds `param_lock` (within `param_attr_store`, likely through `/sys/module/block2mtd/parameters/block2mtd` path handling) and tries to get `i_mutex_dir_key`.
* Thread 2 holds `i_mutex_dir_key` (likely in `vfs_rmdir`, a cgroup directory) and tries to obtain `cgroup_mutex`.
* Thread 3 holds `cgroup_mutex` (e.g., in `cgroup_mkdir`) and wants `rtnl_mutex`.
* Thread 4 holds `rtnl_mutex` (during `ieee80211_register_hw` or elsewhere) and is trying to get `param_lock`.
The question is, can this be triggered in a real-world scenario?
I've considered how userspace actions could lead to this. `ieee80211_register_hw` can be triggered via netlink if a user has sufficient permissions to request a new hardware simulation. `cgroup_mkdir` and `cgroup_rmdir` are user-triggered as well, so cgroupfs access plays a critical role here. `/sys/module/block2mtd/parameters/block2mtd` is root-only.
Then I paused... Wait, if an unprivileged user cannot trigger `param_lock` -> `i_mutex_dir_key` through `block2mtd`, are there other world-writable module parameters that could trigger `param_lock` -> `i_mutex_dir_key` ? That's a huge potential vulnerability! Any module parameter that takes a path and does `kern_path` or `filp_open` inside its `set` function would potentially take `i_mutex_dir_key` while holding `param_lock`, I need to check for these immediately.
I need to look for any world-writable module parameters right away. That will be the key to understanding if this is a serious and exploitable deadlock scenario.
|
| 27/2 |
2026/05/13 02:08 |
tool |
grepper |
0m
Error:
Args: map[Expression:module_param.*0666]
Results:
|
| 28/2 |
2026/05/13 02:08 |
llm |
expert |
0m
Model:
Tokens:
input: 54157
output: 22
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Initial Assessment: Code Review - `0222`**
Alright, let's dive into this specific snippet, specifically looking at `0222`. My initial thought is to quickly ascertain its function within the larger system. Is it a core module, a utility function, or something more peripheral? I need to quickly establish the context before I even start to look at the specifics. I'm going to be looking for clues from its structure, the naming conventions used around it, or any commenting that might offer a quick overview. I'll need to rapidly assess its potential impact on performance, security, and maintainability.
|
| 29/2 |
2026/05/13 02:09 |
tool |
grepper |
0m
Error:
Args: map[Expression:module_param.*0222]
Results:
|
| 30/2 |
2026/05/13 02:09 |
llm |
expert |
0m
Model:
Tokens:
input: 54360
output: 22
thoughts: 10
Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:
**Initial Assessment of `0622`**
Alright, let's zero in on `0622`. My initial instinct, given my experience, is to immediately try and categorize it. What context does this string belong to? Is it a date, a code, an ID, a quantity, or perhaps a portion of a larger data set? Itβs too early to jump to conclusions, but thatβs the general thought process I need to start with.
My first thought process is that it is a date, likely representing June 22. Okay, that's possible, though it could also be a numerical code of some kind. Does the context provide any initial clues about what this means? My mind is already searching for related patterns or systems. I'm mentally pulling up all the relevant tables, databases, protocols, and past projects where a number like this might appear. I'm looking for associations, potential cross-references.
|
| 31/2 |
2026/05/13 02:09 |
tool |
grepper |
0m
Error:
Args: map[Expression:module_param.*0622]
Results:
|
| 32/2 |
2026/05/13 02:09 |
llm |
expert |
0m
Model:
Tokens:
input: 54631
output: 55
thoughts: 120
Thoughts: **Analyzing Privilege Escalation Potential**
Okay, so I'm looking at this code and immediately I see that module parameters are locked down from unprivileged users β that's a good first step for security. Therefore, it's clear Thread 1 would definitely require root privileges to execute. My concern now pivots to Thread 4. It's calling `ieee80211_rate_control_ops_get`, and that function takes `param_lock`. The question is, can an unprivileged user somehow trigger that path? I need to dig deeper into the context.
Next, I see `hwsim_new_radio_nl`. That looks interesting. It appears to be tied to network namespaces, which often have their own permission models. And the comment says `CAP_NET_ADMIN` is needed in the initial network namespace, which is typical for generic netlink families. But is it *always* needed, or is it checked *internally*? I really need to check `hwsim_genl_family` to confirm. That's the next step; I need to understand how the netlink family and its associated permissions function.
|
| 33/2 |
2026/05/13 02:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.c IncludeLines:true Name:hwsim_genl_family]
Results: map[SourceCode:6694: static struct genl_family hwsim_genl_family __ro_after_init = {
6695: .name = "MAC80211_HWSIM",
6696: .version = 1,
6697: .maxattr = HWSIM_ATTR_MAX,
6698: .policy = hwsim_genl_policy,
6699: .netnsok = true,
6700: .module = THIS_MODULE,
6701: .small_ops = hwsim_ops,
6702: .n_small_ops = ARRAY_SIZE(hwsim_ops),
6703: .resv_start_op = HWSIM_CMD_REPORT_PMSR + 1, // match with __HWSIM_CMD_MAX
6704: .mcgrps = hwsim_mcgrps,
6705: .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
6706: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.c]
|
| 34/2 |
2026/05/13 02:09 |
llm |
expert |
0m
Model:
Tokens:
input: 55351
output: 52
thoughts: 10
Thoughts: Okay, let's dive into this. Here's my thought process on this:
**Analyzing `hwsim_ops`**
Right, so the immediate next step is to examine the `hwsim_ops`. It's a critical area, usually the go-to when something isn't behaving as expected with the hardware simulation aspect. I need to refresh my memory, likely, and see what the defined operations are and how they're being used. I'll need to look at both the definition of the structure itself and any code that's calling functions that might be contained within it. Things to look for initially: are there any obvious errors, missing implementations, or unexpected data types being passed? I'll probably start with a general grep search within the relevant codebase to understand its overall scope and then drill down further. I need to trace the usage, understand the flow and context, and think about the implications of any changes or debugging attempts.
|
| 35/2 |
2026/05/13 02:10 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.c IncludeLines:true Name:hwsim_ops]
Results: map[SourceCode:6651: /* Generic Netlink operations array */
6652: static const struct genl_small_ops hwsim_ops[] = {
6653: {
6654: .cmd = HWSIM_CMD_REGISTER,
6655: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
6656: .doit = hwsim_register_received_nl,
6657: .flags = GENL_UNS_ADMIN_PERM,
6658: },
6659: {
6660: .cmd = HWSIM_CMD_FRAME,
6661: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
6662: .doit = hwsim_cloned_frame_received_nl,
6663: },
6664: {
6665: .cmd = HWSIM_CMD_TX_INFO_FRAME,
6666: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
6667: .doit = hwsim_tx_info_frame_received_nl,
6668: },
6669: {
6670: .cmd = HWSIM_CMD_NEW_RADIO,
6671: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
6672: .doit = hwsim_new_radio_nl,
6673: .flags = GENL_UNS_ADMIN_PERM,
6674: },
6675: {
6676: .cmd = HWSIM_CMD_DEL_RADIO,
6677: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
6678: .doit = hwsim_del_radio_nl,
6679: .flags = GENL_UNS_ADMIN_PERM,
6680: },
6681: {
6682: .cmd = HWSIM_CMD_GET_RADIO,
6683: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
6684: .doit = hwsim_get_radio_nl,
6685: .dumpit = hwsim_dump_radio_nl,
6686: },
6687: {
6688: .cmd = HWSIM_CMD_REPORT_PMSR,
6689: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
6690: .doit = hwsim_pmsr_report_nl,
6691: },
6692: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.c]
|
| 36/2 |
2026/05/13 02:10 |
llm |
expert |
0m
Model:
Tokens:
input: 56405
output: 29
thoughts: 185
Thoughts: **Analyzing the Access Requirements for `hwsim_new_radio_nl` and Potential Privilege Escalation**
Okay, so I'm digging into this `hwsim_new_radio_nl` function. The code says it has `GENL_UNS_ADMIN_PERM`. Right, that means it needs `CAP_NET_ADMIN` in the user namespace. Ah, hang on, that's not quite right. `GENL_UNS_ADMIN_PERM` specifies `CAP_NET_ADMIN` in the _user namespace that owns the network namespace_. Interesting, so it *is* accessible from a user namespace! That's a good starting point.
But then there's Thread 1, the one writing to `/sys/module/block2mtd/parameters/block2mtd`. That seems to require root in the initial namespace, because the sysfs files for module parameters are owned by root, and I'm pretty sure they're *not* mapped into user namespaces. That's a classic privilege boundary.
Now, the important question is: is there another way to get Thread 1 to trigger? Can `param_lock` be taken by *something else* that an unprivileged user can access? I need to check where `kernel_param_lock` is actually used. That's where I need to focus my efforts. I need to trace the lock usage to see if it's possible to indirectly trigger Thread 1 through an unprivileged path.
|
| 37/2 |
2026/05/13 02:10 |
tool |
codesearch-find-references |
0m
Args: map[IncludeSnippetLines:0 Name:kernel_param_lock]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:cmvs_file_name SourceFile:drivers/usb/atm/ueagle-atm.c SourceLine:1560] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ieee80211_rate_control_ops_get SourceFile:net/mac80211/rate.c SourceLine:223] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:param_attr_show SourceFile:kernel/params.c SourceLine:570] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:param_attr_store SourceFile:kernel/params.c SourceLine:587] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:parse_one SourceFile:kernel/params.c SourceLine:141]] TruncatedOutput:false]
|
| 38/2 |
2026/05/13 02:10 |
llm |
expert |
0m
Model:
Tokens:
input: 57213
output: 47
thoughts: 1024
Thoughts: **Analyzing a Potential Kernel Deadlock**
Okay, so I'm looking at this potential deadlock and breaking it down. The core seems to revolve around interactions with module parameters and a series of locks: `param_lock`, `i_mutex_dir_key`, `cgroup_mutex`, and `rtnl_mutex`.
First thought: `param_attr_show` takes `param_lock`. Can an unprivileged user read a module parameter? Yes, most of them in `/sys/module/*/parameters/` are world-readable. So, an unprivileged user can trigger `param_attr_show`, thus taking the `param_lock`. Hmm, can an unprivileged user *cause* this deadlock by triggering the necessary lock acquisition order?
Let's see. If a thread is just reading a parameter, it takes `param_lock` - but it doesn't take `i_mutex_dir_key`! That's not the critical path. The deadlock requires the thread to grab `param_lock` *then* `i_mutex_dir_key`. Does `param_attr_show` even take `i_mutex_dir_key`? No, it calls the `get` operation. Usually it just `sprintf`s a value. Are there any `get` operations that take additional locks? Unlikely. I'll need to double check, but the lockdep report seems to indicate the cycle happens through `param_attr_store` -> `block2mtd_setup` -> `add_device` -> `kern_path`, acquiring locks in that order.
So, the deadlock cycle is confirmed: `param_lock` -> `i_mutex_dir_key` (through `block2mtd_setup` in `param_attr_store`) -> `i_mutex_dir_key` -> `cgroup_mutex` (via `vfs_rmdir` -> `cgroup_rmdir`) -> `cgroup_mutex` -> `rtnl_mutex` (via `cgroup_mkdir` -> `cgrp_css_online`) -> `rtnl_mutex` -> `param_lock` (via `ieee80211_register_hw` -> `ieee80211_rate_control_ops_get`).
Now, to trigger it, we need at least four threads, or fewer if some locks are taken together:
* Thread A: `param_attr_store` (takes `param_lock`, then `i_mutex_dir_key`).
* Thread B: `vfs_rmdir` on a cgroup (takes `i_mutex_dir_key`, then `cgroup_mutex`).
* Thread C: `cgroup_mkdir` (takes `cgroup_mutex`, then `rtnl_mutex`).
* Thread D: `ieee80211_register_hw` (takes `rtnl_mutex`, then `param_lock`).
The problem: who can trigger these threads? Thread A requires root (to write to `block2mtd` parameters). B and C also probably require root (at least user namespace root) for the cgroup operations. D needs `CAP_NET_ADMIN` (to create a new hwsim radio).
Since Thread A needs global root privileges to write to `/sys/module/block2mtd/parameters/block2mtd`, an unprivileged user CANNOT trigger Thread A directly. Can they indirectly trigger thread A? Is there another module parameter whose `set` function takes `i_mutex_dir_key` and is writable by an unprivileged user? We already checked, and none of them are writable by unprivileged users (`0666`, `0222`, `0622`). So, `param_attr_store` is root-only. What about `parse_one`? It's called during boot or module load. Module load needs `CAP_SYS_MODULE` (root). So `param_lock` -> `i_mutex_dir_key` needs root.
Wait, are there any other paths to get `param_lock` then `i_mutex_dir_key`? Looking at the code, `kernel_param_lock` is called only in: `cmvs_file_name` (in `ueagle-atm.c`), `ieee80211_rate_control_ops_get`, `param_attr_show`, `param_attr_store` and `parse_one`.
Let me check `cmvs_file_name`.
|
| 39/2 |
2026/05/13 02:11 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/usb/atm/ueagle-atm.c IncludeLines:true Name:cmvs_file_name]
Results: map[SourceCode:1555: static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
1556: {
1557: char file_arr[] = "CMVxy.bin";
1558: char *file;
1559:
1560: kernel_param_lock(THIS_MODULE);
1561: /* set proper name corresponding modem version and line type */
1562: if (cmv_file[sc->modem_index] == NULL) {
1563: if (UEA_CHIP_VERSION(sc) == ADI930)
1564: file_arr[3] = '9';
1565: else if (UEA_CHIP_VERSION(sc) == EAGLE_IV)
1566: file_arr[3] = '4';
1567: else
1568: file_arr[3] = 'e';
1569:
1570: file_arr[4] = IS_ISDN(sc) ? 'i' : 'p';
1571: file = file_arr;
1572: } else
1573: file = cmv_file[sc->modem_index];
1574:
1575: strcpy(cmv_name, FW_DIR);
1576: strlcat(cmv_name, file, UEA_FW_NAME_MAX);
1577: if (ver == 2)
1578: strlcat(cmv_name, ".v2", UEA_FW_NAME_MAX);
1579: kernel_param_unlock(THIS_MODULE);
1580: }
SourceFile:drivers/usb/atm/ueagle-atm.c]
|
| 40/2 |
2026/05/13 02:11 |
llm |
expert |
0m
Model:
Tokens:
input: 59750
output: 32
thoughts: 2041
Thoughts: **Deadlock Analysis: Root-Controlled Denial of Service**
Okay, let's break this down systematically. My initial thought was that `cmvs_file_name` doesn't use `i_mutex_dir_key`, so `param_lock` has to get to it via `param_attr_store` or `parse_one`, which need root. If root's needed, it's not a security issue, usually, but is this user namespace-reachable? Since `/sys/module/` isn't user-namespace writable, that's not a concern. Even mounting sysfs read-write in a user namespace still doesn't let you write to `/sys/module`.
Now, if a deadlock can be reached without Thread A, then what? Let's rule that out quickly. I've checked all `kernel_param_lock` uses, and there's no other path that could get it. Could `param_lock` be held by `param_attr_show`, which then calls a `get` that takes `i_mutex_dir_key`? Let me look for those `get` functions quickly. They are usually simple, so it's not likely.
But wait, the lockdep report is clear: the task already has `param_lock` and wants `i_mutex_dir_key`! That's it β we have a root-only path to the deadlock, and the syzkaller reproducer confirms it because itβs opening and writing to `/sys/module/block2mtd/parameters/block2mtd`. Since it needs root to write to it, it is not accessible from unprivileged processes or user namespaces.
Alright, so the deadlock exists, and it's a denial-of-service, but only root can trigger it. Root can crash the kernel already in many ways, so it's not a security boundary crossing. So it's exploitable: False; DenialOfService: True (root only); Accessible From Unprivileged Processes: False; Accessible From User Namespaces: False; VM Guest Trigger: False; VM Host Trigger: False; Network Trigger: False; Remote Trigger: False; Peripheral Trigger: False; Filesystem Trigger: False.
I need to double-check that `/sys/module/block2mtd/parameters/block2mtd` isn't writeable. Looking at `block2mtd.c`, the permissions are `-w-------` or 0200. Only root can write to it. Can a setuid binary write it? Probably not; most setuid don't write to arbitrary sysfs files. Could an unprivileged user use `block2mtd_setup` some other way? Only via the kernel command line during boot, or `modprobe`, which requires `CAP_SYS_MODULE` (root).
I'm now thinking about the complete cycle: `i_mutex_dir_key` -> `cgroup_mutex` -> `rtnl_mutex` -> `param_lock`. Could an unprivileged user trigger that deadlock using the other three locks? Only if those three locks, *plus* another one form a cycle. However, the lockdep report specifically flags `param_lock` -> `i_mutex_dir_key` as the broken link that completes the cycle. Without that last piece, the dependency is linear, which isnβt a deadlock. The cycle is only complete with `param_lock` -> `i_mutex_dir_key`.
Just re-checking the lockdep report, the task is *already holding* `param_lock` and *trying to acquire* `i_mutex_dir_key`. This is the confirmation: that's exactly the root-only path. Is there anything else that can do this? We checked `kernel_param_lock` and now `param->ops->get`. Now let me see if any of these unusual `get` functions are in play. Let me see, most of the `get` functions are from the `module_param` macros and are simple reads, so I don't think any could be a source.
|
| 41/2 |
2026/05/13 02:12 |
tool |
grepper |
0m
Args: map[Expression:\.get\s*=\s*[a-zA-Z0-9_]+]
Results: map[Output:
Full output is too long, showing 500 out of 10664 lines.
Use more precise expression if possible.
[Documentation/sound/kernel-api/writing-an-alsa-driver.rst=2368=struct snd_kcontrol_new record, such as::
--
Documentation/sound/kernel-api/writing-an-alsa-driver.rst-2377- .info = my_control_info,
Documentation/sound/kernel-api/writing-an-alsa-driver.rst:2378: .get = my_control_get,
Documentation/sound/kernel-api/writing-an-alsa-driver.rst-2379- .put = my_control_put
--
arch/arm/common/sa1111.c=611=static int sa1111_setup_gpios(struct sa1111 *sachip)
--
arch/arm/common/sa1111.c-618- sachip->gc.direction_output = sa1111_gpio_direction_output;
arch/arm/common/sa1111.c:619: sachip->gc.get = sa1111_gpio_get;
arch/arm/common/sa1111.c-620- sachip->gc.set = sa1111_gpio_set;
--
arch/arm/common/scoop.c=178=static int scoop_probe(struct platform_device *pdev)
--
arch/arm/common/scoop.c-221- devptr->gpio.set = scoop_gpio_set;
arch/arm/common/scoop.c:222: devptr->gpio.get = scoop_gpio_get;
arch/arm/common/scoop.c-223- devptr->gpio.direction_input = scoop_gpio_direction_input;
--
arch/arm/plat-orion/gpio.c=520=void __init orion_gpio_init(int gpio_base, int ngpio,
--
arch/arm/plat-orion/gpio.c-540- ochip->chip.direction_input = orion_gpio_direction_input;
arch/arm/plat-orion/gpio.c:541: ochip->chip.get = orion_gpio_get;
arch/arm/plat-orion/gpio.c-542- ochip->chip.direction_output = orion_gpio_direction_output;
--
arch/m68k/coldfire/gpio.c=156=static struct gpio_chip mcfgpio_chip = {
--
arch/m68k/coldfire/gpio.c-161- .direction_output = mcfgpio_direction_output,
arch/m68k/coldfire/gpio.c:162: .get = mcfgpio_get_value,
arch/m68k/coldfire/gpio.c-163- .set = mcfgpio_set_value,
--
arch/mips/alchemy/common/gpiolib.c=98=struct gpio_chip alchemy_gpio_chip[] = {
--
arch/mips/alchemy/common/gpiolib.c-102- .direction_output = gpio1_direction_output,
arch/mips/alchemy/common/gpiolib.c:103: .get = gpio1_get,
arch/mips/alchemy/common/gpiolib.c-104- .set = gpio1_set,
--
arch/mips/alchemy/common/gpiolib.c-112- .direction_output = gpio2_direction_output,
arch/mips/alchemy/common/gpiolib.c:113: .get = gpio2_get,
arch/mips/alchemy/common/gpiolib.c-114- .set = gpio2_set,
--
arch/mips/alchemy/common/gpiolib.c=149=static struct gpio_chip au1300_gpiochip = {
--
arch/mips/alchemy/common/gpiolib.c-152- .direction_output = alchemy_gpic_dir_output,
arch/mips/alchemy/common/gpiolib.c:153: .get = alchemy_gpic_get,
arch/mips/alchemy/common/gpiolib.c-154- .set = alchemy_gpic_set,
--
arch/mips/bcm63xx/gpio.c=129=static struct gpio_chip bcm63xx_gpio_chip = {
--
arch/mips/bcm63xx/gpio.c-132- .direction_output = bcm63xx_gpio_direction_output,
arch/mips/bcm63xx/gpio.c:133: .get = bcm63xx_gpio_get,
arch/mips/bcm63xx/gpio.c-134- .set = bcm63xx_gpio_set,
--
arch/mips/kernel/gpio_txx9.c=71=static struct gpio_chip txx9_gpio_chip = {
arch/mips/kernel/gpio_txx9.c:72: .get = txx9_gpio_get,
arch/mips/kernel/gpio_txx9.c-73- .set = txx9_gpio_set,
--
arch/mips/rb532/gpio.c=160=static struct rb532_gpio_chip rb532_gpio_chip[] = {
--
arch/mips/rb532/gpio.c-165- .direction_output = rb532_gpio_direction_output,
arch/mips/rb532/gpio.c:166: .get = rb532_gpio_get,
arch/mips/rb532/gpio.c-167- .set = rb532_gpio_set,
--
arch/mips/txx9/generic/setup.c=635=void __init txx9_iocled_init(unsigned long baseaddr,
--
arch/mips/txx9/generic/setup.c-656- goto out_free;
arch/mips/txx9/generic/setup.c:657: iocled->chip.get = txx9_iocled_get;
arch/mips/txx9/generic/setup.c-658- iocled->chip.set = txx9_iocled_set;
--
arch/powerpc/kvm/book3s_hv.c=118=static const struct kernel_param_ops module_param_ops = {
arch/powerpc/kvm/book3s_hv.c-119- .set = param_set_int,
arch/powerpc/kvm/book3s_hv.c:120: .get = param_get_int,
arch/powerpc/kvm/book3s_hv.c-121-};
--
arch/powerpc/platforms/52xx/mpc52xx_gpt.c=321=static void mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt)
--
arch/powerpc/platforms/52xx/mpc52xx_gpt.c-337- gpt->gc.direction_output = mpc52xx_gpt_gpio_dir_out;
arch/powerpc/platforms/52xx/mpc52xx_gpt.c:338: gpt->gc.get = mpc52xx_gpt_gpio_get;
arch/powerpc/platforms/52xx/mpc52xx_gpt.c-339- gpt->gc.set = mpc52xx_gpt_gpio_set;
--
arch/powerpc/platforms/powernv/opal-secvar.c=146=static const struct secvar_operations opal_secvar_ops = {
arch/powerpc/platforms/powernv/opal-secvar.c:147: .get = opal_get_variable,
arch/powerpc/platforms/powernv/opal-secvar.c-148- .get_next = opal_get_next_variable,
--
arch/powerpc/platforms/powernv/pci-ioda.c=1263=static struct iommu_table_ops pnv_ioda2_iommu_ops = {
--
arch/powerpc/platforms/powernv/pci-ioda.c-1270- .clear = pnv_ioda2_tce_free,
arch/powerpc/platforms/powernv/pci-ioda.c:1271: .get = pnv_tce_get,
arch/powerpc/platforms/powernv/pci-ioda.c-1272- .free = pnv_pci_ioda2_table_free_pages,
--
arch/powerpc/platforms/pseries/iommu.c=616=struct iommu_table_ops iommu_table_pseries_ops = {
--
arch/powerpc/platforms/pseries/iommu.c-618- .clear = tce_clear_pSeries,
arch/powerpc/platforms/pseries/iommu.c:619: .get = tce_get_pseries
arch/powerpc/platforms/pseries/iommu.c-620-};
--
arch/powerpc/platforms/pseries/iommu.c=735=struct iommu_table_ops iommu_table_lpar_multi_ops = {
--
arch/powerpc/platforms/pseries/iommu.c-741- .clear = tce_freemulti_pSeriesLP,
arch/powerpc/platforms/pseries/iommu.c:742: .get = tce_get_pSeriesLP,
arch/powerpc/platforms/pseries/iommu.c-743- .free = tce_free_pSeries
--
arch/powerpc/platforms/pseries/plpks-secvar.c=196=static const struct secvar_operations plpks_secvar_ops_static = {
arch/powerpc/platforms/pseries/plpks-secvar.c:197: .get = plpks_get_variable,
arch/powerpc/platforms/pseries/plpks-secvar.c-198- .set = plpks_set_variable,
--
arch/powerpc/platforms/pseries/plpks-secvar.c=204=static const struct secvar_operations plpks_secvar_ops_dynamic = {
arch/powerpc/platforms/pseries/plpks-secvar.c:205: .get = plpks_get_variable,
arch/powerpc/platforms/pseries/plpks-secvar.c-206- .set = plpks_set_variable,
--
arch/riscv/kvm/vcpu_sbi_fwft.c=218=static const struct kvm_sbi_fwft_feature features[] = {
--
arch/riscv/kvm/vcpu_sbi_fwft.c-225- .set = kvm_sbi_fwft_set_misaligned_delegation,
arch/riscv/kvm/vcpu_sbi_fwft.c:226: .get = kvm_sbi_fwft_get_misaligned_delegation,
arch/riscv/kvm/vcpu_sbi_fwft.c-227- },
--
arch/riscv/kvm/vcpu_sbi_fwft.c-235- .set = kvm_sbi_fwft_set_pointer_masking_pmlen,
arch/riscv/kvm/vcpu_sbi_fwft.c:236: .get = kvm_sbi_fwft_get_pointer_masking_pmlen,
arch/riscv/kvm/vcpu_sbi_fwft.c-237- },
--
arch/s390/kernel/perf_cpum_sf.c=2028=static const struct kernel_param_ops param_ops_sfb_size = {
arch/s390/kernel/perf_cpum_sf.c-2029- .set = param_set_sfb_size,
arch/s390/kernel/perf_cpum_sf.c:2030: .get = param_get_sfb_size,
arch/s390/kernel/perf_cpum_sf.c-2031-};
--
arch/sh/boards/mach-sdk7786/gpio.c=33=static struct gpio_chip usrgpir_gpio_chip = {
--
arch/sh/boards/mach-sdk7786/gpio.c-36- .direction_input = usrgpir_gpio_direction_input,
arch/sh/boards/mach-sdk7786/gpio.c:37: .get = usrgpir_gpio_get,
arch/sh/boards/mach-sdk7786/gpio.c-38- .base = -1, /* don't care */
--
arch/sh/boards/mach-x3proto/gpio.c=76=struct gpio_chip x3proto_gpio_chip = {
--
arch/sh/boards/mach-x3proto/gpio.c-78- .direction_input = x3proto_gpio_direction_input,
arch/sh/boards/mach-x3proto/gpio.c:79: .get = x3proto_gpio_get,
arch/sh/boards/mach-x3proto/gpio.c-80- .to_irq = x3proto_gpio_to_irq,
--
arch/um/drivers/vfio_kern.c=631=static const struct kernel_param_ops uml_vfio_cmdline_param_ops = {
arch/um/drivers/vfio_kern.c-632- .set = uml_vfio_cmdline_set,
arch/um/drivers/vfio_kern.c:633: .get = uml_vfio_cmdline_get,
arch/um/drivers/vfio_kern.c-634-};
--
arch/um/drivers/virtio_uml.c=1116=static const struct virtio_config_ops virtio_uml_config_ops = {
arch/um/drivers/virtio_uml.c:1117: .get = vu_get,
arch/um/drivers/virtio_uml.c-1118- .set = vu_set,
--
arch/um/drivers/virtio_uml.c=1401=static const struct kernel_param_ops vu_cmdline_param_ops = {
arch/um/drivers/virtio_uml.c-1402- .set = vu_cmdline_set,
arch/um/drivers/virtio_uml.c:1403: .get = vu_cmdline_get,
arch/um/drivers/virtio_uml.c-1404-};
--
arch/x86/kernel/cpu/mtrr/amd.c=112=const struct mtrr_ops amd_mtrr_ops = {
--
arch/x86/kernel/cpu/mtrr/amd.c-114- .set = amd_set_mtrr,
arch/x86/kernel/cpu/mtrr/amd.c:115: .get = amd_get_mtrr,
arch/x86/kernel/cpu/mtrr/amd.c-116- .get_free_region = generic_get_free_region,
--
arch/x86/kernel/cpu/mtrr/centaur.c=105=const struct mtrr_ops centaur_mtrr_ops = {
--
arch/x86/kernel/cpu/mtrr/centaur.c-107- .set = centaur_set_mcr,
arch/x86/kernel/cpu/mtrr/centaur.c:108: .get = centaur_get_mcr,
arch/x86/kernel/cpu/mtrr/centaur.c-109- .get_free_region = centaur_get_free_region,
--
arch/x86/kernel/cpu/mtrr/cyrix.c=237=const struct mtrr_ops cyrix_mtrr_ops = {
--
arch/x86/kernel/cpu/mtrr/cyrix.c-239- .set = cyrix_set_arr,
arch/x86/kernel/cpu/mtrr/cyrix.c:240: .get = cyrix_get_arr,
arch/x86/kernel/cpu/mtrr/cyrix.c-241- .get_free_region = cyrix_get_free_region,
--
arch/x86/kernel/cpu/mtrr/generic.c=1073=const struct mtrr_ops generic_mtrr_ops = {
arch/x86/kernel/cpu/mtrr/generic.c:1074: .get = generic_get_mtrr,
arch/x86/kernel/cpu/mtrr/generic.c-1075- .get_free_region = generic_get_free_region,
--
arch/x86/kernel/msr.c=325=static const struct kernel_param_ops allow_writes_ops = {
arch/x86/kernel/msr.c-326- .set = set_allow_writes,
arch/x86/kernel/msr.c:327: .get = get_allow_writes
arch/x86/kernel/msr.c-328-};
--
arch/x86/kvm/mmu/mmu.c=77=static const struct kernel_param_ops nx_huge_pages_ops = {
arch/x86/kvm/mmu/mmu.c-78- .set = set_nx_huge_pages,
arch/x86/kvm/mmu/mmu.c:79: .get = get_nx_huge_pages,
arch/x86/kvm/mmu/mmu.c-80-};
--
arch/x86/kvm/mmu/mmu.c=82=static const struct kernel_param_ops nx_huge_pages_recovery_param_ops = {
arch/x86/kvm/mmu/mmu.c-83- .set = set_nx_huge_pages_recovery_param,
arch/x86/kvm/mmu/mmu.c:84: .get = param_get_uint,
arch/x86/kvm/mmu/mmu.c-85-};
--
arch/x86/kvm/svm/avic.c=79=static const struct kernel_param_ops avic_ops = {
--
arch/x86/kvm/svm/avic.c-81- .set = avic_param_set,
arch/x86/kvm/svm/avic.c:82: .get = param_get_bool,
arch/x86/kvm/svm/avic.c-83-};
--
arch/x86/kvm/vmx/vmx.c=467=static const struct kernel_param_ops vmentry_l1d_flush_ops = {
arch/x86/kvm/vmx/vmx.c-468- .set = vmentry_l1d_flush_set,
arch/x86/kvm/vmx/vmx.c:469: .get = vmentry_l1d_flush_get,
arch/x86/kvm/vmx/vmx.c-470-};
--
arch/x86/platform/uv/uv_nmi.c=126=static const struct kernel_param_ops param_ops_local64 = {
arch/x86/platform/uv/uv_nmi.c:127: .get = param_get_local64,
arch/x86/platform/uv/uv_nmi.c-128- .set = param_set_local64,
--
arch/x86/platform/uv/uv_nmi.c=235=static const struct kernel_param_ops param_ops_action = {
arch/x86/platform/uv/uv_nmi.c:236: .get = param_get_action,
arch/x86/platform/uv/uv_nmi.c-237- .set = param_set_action,
--
block/disk-events.c=418=static const struct kernel_param_ops disk_events_dfl_poll_msecs_param_ops = {
block/disk-events.c-419- .set = disk_events_set_dfl_poll_msecs,
block/disk-events.c:420: .get = param_get_ulong,
block/disk-events.c-421-};
--
drivers/acpi/sysfs.c=141=static const struct kernel_param_ops param_ops_debug_layer = {
drivers/acpi/sysfs.c-142- .set = param_set_uint,
drivers/acpi/sysfs.c:143: .get = param_get_debug_layer,
drivers/acpi/sysfs.c-144-};
--
drivers/acpi/sysfs.c=146=static const struct kernel_param_ops param_ops_debug_level = {
drivers/acpi/sysfs.c-147- .set = param_set_uint,
drivers/acpi/sysfs.c:148: .get = param_get_debug_level,
drivers/acpi/sysfs.c-149-};
--
drivers/acpi/sysfs.c=204=static const struct kernel_param_ops param_ops_trace_method = {
drivers/acpi/sysfs.c-205- .set = param_set_trace_method_name,
drivers/acpi/sysfs.c:206: .get = param_get_trace_method_name,
drivers/acpi/sysfs.c-207-};
--
drivers/acpi/sysfs.c=209=static const struct kernel_param_ops param_ops_trace_attrib = {
drivers/acpi/sysfs.c-210- .set = param_set_uint,
drivers/acpi/sysfs.c:211: .get = param_get_uint,
drivers/acpi/sysfs.c-212-};
--
drivers/base/swnode.c=694=static const struct fwnode_operations software_node_ops = {
drivers/base/swnode.c:695: .get = software_node_get,
drivers/base/swnode.c-696- .put = software_node_put,
--
drivers/block/loop.c=1809=static const struct kernel_param_ops max_loop_param_ops = {
drivers/block/loop.c-1810- .set = max_loop_param_set_int,
drivers/block/loop.c:1811: .get = param_get_int,
drivers/block/loop.c-1812-};
--
drivers/block/loop.c=1839=static const struct kernel_param_ops loop_hw_qdepth_param_ops = {
drivers/block/loop.c-1840- .set = loop_set_hw_queue_depth,
drivers/block/loop.c:1841: .get = param_get_int,
drivers/block/loop.c-1842-};
--
drivers/block/null_blk/main.c=152=static const struct kernel_param_ops null_queue_mode_param_ops = {
drivers/block/null_blk/main.c-153- .set = null_set_queue_mode,
drivers/block/null_blk/main.c:154: .get = param_get_int,
drivers/block/null_blk/main.c-155-};
--
drivers/block/null_blk/main.c=196=static const struct kernel_param_ops null_irqmode_param_ops = {
drivers/block/null_blk/main.c-197- .set = null_set_irqmode,
drivers/block/null_blk/main.c:198: .get = param_get_int,
drivers/block/null_blk/main.c-199-};
--
drivers/block/rnbd/rnbd-srv.c=52=static const struct kernel_param_ops dev_search_path_ops = {
drivers/block/rnbd/rnbd-srv.c-53- .set = dev_search_path_set,
drivers/block/rnbd/rnbd-srv.c:54: .get = param_get_string,
drivers/block/rnbd/rnbd-srv.c-55-};
--
drivers/block/ublk_drv.c=5441=static const struct kernel_param_ops ublk_max_unprivileged_ublks_ops = {
drivers/block/ublk_drv.c-5442- .set = ublk_set_max_unprivileged_ublks,
drivers/block/ublk_drv.c:5443: .get = ublk_get_max_unprivileged_ublks,
drivers/block/ublk_drv.c-5444-};
--
drivers/char/ipmi/ipmi_msghandler.c=105=static const struct kernel_param_ops panic_op_ops = {
drivers/char/ipmi/ipmi_msghandler.c-106- .set = panic_op_write_handler,
drivers/char/ipmi/ipmi_msghandler.c:107: .get = panic_op_read_handler
drivers/char/ipmi/ipmi_msghandler.c-108-};
--
drivers/char/ipmi/ipmi_watchdog.c=196=static const struct kernel_param_ops param_ops_timeout = {
drivers/char/ipmi/ipmi_watchdog.c-197- .set = set_param_timeout,
drivers/char/ipmi/ipmi_watchdog.c:198: .get = param_get_int,
drivers/char/ipmi/ipmi_watchdog.c-199-};
--
drivers/char/ipmi/ipmi_watchdog.c=262=static const struct kernel_param_ops param_ops_wdog_ifnum = {
drivers/char/ipmi/ipmi_watchdog.c-263- .set = set_param_wdog_ifnum,
drivers/char/ipmi/ipmi_watchdog.c:264: .get = param_get_int,
drivers/char/ipmi/ipmi_watchdog.c-265-};
--
drivers/char/ipmi/ipmi_watchdog.c=269=static const struct kernel_param_ops param_ops_str = {
drivers/char/ipmi/ipmi_watchdog.c-270- .set = set_param_str,
drivers/char/ipmi/ipmi_watchdog.c:271: .get = get_param_str,
drivers/char/ipmi/ipmi_watchdog.c-272-};
--
drivers/cpufreq/acpi-cpufreq.c=678=static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
--
drivers/cpufreq/acpi-cpufreq.c-874- case ACPI_ADR_SPACE_FIXED_HARDWARE:
drivers/cpufreq/acpi-cpufreq.c:875: acpi_cpufreq_driver.get = get_cur_freq_on_cpu;
drivers/cpufreq/acpi-cpufreq.c-876- break;
--
drivers/cpufreq/apple-soc-cpufreq.c=342=static struct cpufreq_driver apple_soc_cpufreq_driver = {
--
drivers/cpufreq/apple-soc-cpufreq.c-346- .verify = cpufreq_generic_frequency_table_verify,
drivers/cpufreq/apple-soc-cpufreq.c:347: .get = apple_soc_cpufreq_get_rate,
drivers/cpufreq/apple-soc-cpufreq.c-348- .init = apple_soc_cpufreq_init,
--
drivers/cpufreq/bmips-cpufreq.c=146=static struct cpufreq_driver bmips_cpufreq_driver = {
--
drivers/cpufreq/bmips-cpufreq.c-149- .target_index = bmips_cpufreq_target_index,
drivers/cpufreq/bmips-cpufreq.c:150: .get = bmips_cpufreq_get,
drivers/cpufreq/bmips-cpufreq.c-151- .init = bmips_cpufreq_init,
--
drivers/cpufreq/brcmstb-avs-cpufreq.c=729=static struct cpufreq_driver brcm_avs_driver = {
--
drivers/cpufreq/brcmstb-avs-cpufreq.c-732- .target_index = brcm_avs_target_index,
drivers/cpufreq/brcmstb-avs-cpufreq.c:733: .get = brcm_avs_cpufreq_get,
drivers/cpufreq/brcmstb-avs-cpufreq.c-734- .suspend = brcm_avs_suspend,
--
drivers/cpufreq/cppc_cpufreq.c=929=static struct cpufreq_driver cppc_cpufreq_driver = {
--
drivers/cpufreq/cppc_cpufreq.c-932- .target = cppc_cpufreq_set_target,
drivers/cpufreq/cppc_cpufreq.c:933: .get = cppc_cpufreq_get_rate,
drivers/cpufreq/cppc_cpufreq.c-934- .fast_switch = cppc_cpufreq_fast_switch,
--
drivers/cpufreq/cpufreq-dt.c=140=static struct cpufreq_driver dt_cpufreq_driver = {
--
drivers/cpufreq/cpufreq-dt.c-144- .target_index = set_target,
drivers/cpufreq/cpufreq-dt.c:145: .get = cpufreq_generic_get,
drivers/cpufreq/cpufreq-dt.c-146- .init = cpufreq_init,
--
drivers/cpufreq/cpufreq-nforce2.c=364=static struct cpufreq_driver nforce2_driver = {
--
drivers/cpufreq/cpufreq-nforce2.c-368- .target = nforce2_target,
drivers/cpufreq/cpufreq-nforce2.c:369: .get = nforce2_get,
drivers/cpufreq/cpufreq-nforce2.c-370- .init = nforce2_cpu_init,
--
drivers/cpufreq/davinci-cpufreq.c=97=static struct cpufreq_driver davinci_driver = {
--
drivers/cpufreq/davinci-cpufreq.c-100- .target_index = davinci_target,
drivers/cpufreq/davinci-cpufreq.c:101: .get = cpufreq_generic_get,
drivers/cpufreq/davinci-cpufreq.c-102- .init = davinci_cpu_init,
--
drivers/cpufreq/e_powersaver.c=370=static struct cpufreq_driver eps_driver = {
--
drivers/cpufreq/e_powersaver.c-374- .exit = eps_cpu_exit,
drivers/cpufreq/e_powersaver.c:375: .get = eps_get,
drivers/cpufreq/e_powersaver.c-376- .name = "e_powersaver",
--
drivers/cpufreq/elanfreq.c=189=static struct cpufreq_driver elanfreq_driver = {
drivers/cpufreq/elanfreq.c:190: .get = elanfreq_get_cpu_frequency,
drivers/cpufreq/elanfreq.c-191- .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
--
drivers/cpufreq/gx-suspmod.c=435=static struct cpufreq_driver gx_suspmod_driver = {
drivers/cpufreq/gx-suspmod.c-436- .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING,
drivers/cpufreq/gx-suspmod.c:437: .get = gx_get_cpuspeed,
drivers/cpufreq/gx-suspmod.c-438- .verify = cpufreq_gx_verify,
--
drivers/cpufreq/imx6q-cpufreq.c=201=static struct cpufreq_driver imx6q_cpufreq_driver = {
--
drivers/cpufreq/imx6q-cpufreq.c-205- .target_index = imx6q_set_target,
drivers/cpufreq/imx6q-cpufreq.c:206: .get = cpufreq_generic_get,
drivers/cpufreq/imx6q-cpufreq.c-207- .init = imx6q_cpufreq_init,
--
drivers/cpufreq/kirkwood-cpufreq.c=92=static struct cpufreq_driver kirkwood_cpufreq_driver = {
drivers/cpufreq/kirkwood-cpufreq.c-93- .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK,
drivers/cpufreq/kirkwood-cpufreq.c:94: .get = kirkwood_cpufreq_get_cpu_frequency,
drivers/cpufreq/kirkwood-cpufreq.c-95- .verify = cpufreq_generic_frequency_table_verify,
--
drivers/cpufreq/longhaul.c=902=static struct cpufreq_driver longhaul_driver = {
--
drivers/cpufreq/longhaul.c-904- .target_index = longhaul_target,
drivers/cpufreq/longhaul.c:905: .get = longhaul_get,
drivers/cpufreq/longhaul.c-906- .init = longhaul_cpu_init,
--
drivers/cpufreq/longrun.c=274=static struct cpufreq_driver longrun_driver = {
--
drivers/cpufreq/longrun.c-277- .setpolicy = longrun_set_policy,
drivers/cpufreq/longrun.c:278: .get = longrun_get,
drivers/cpufreq/longrun.c-279- .init = longrun_cpu_init,
--
drivers/cpufreq/loongson2_cpufreq.c=88=static struct cpufreq_driver loongson2_cpufreq_driver = {
--
drivers/cpufreq/loongson2_cpufreq.c-92- .target_index = loongson2_cpufreq_target,
drivers/cpufreq/loongson2_cpufreq.c:93: .get = cpufreq_generic_get,
drivers/cpufreq/loongson2_cpufreq.c-94-};
--
drivers/cpufreq/loongson3_cpufreq.c=322=static struct cpufreq_driver loongson3_cpufreq_driver = {
--
drivers/cpufreq/loongson3_cpufreq.c-328- .offline = loongson3_cpufreq_cpu_offline,
drivers/cpufreq/loongson3_cpufreq.c:329: .get = loongson3_cpufreq_get,
drivers/cpufreq/loongson3_cpufreq.c-330- .target_index = loongson3_cpufreq_target,
--
drivers/cpufreq/mediatek-cpufreq-hw.c=355=static struct cpufreq_driver cpufreq_mtk_hw_driver = {
--
drivers/cpufreq/mediatek-cpufreq-hw.c-360- .target_index = mtk_cpufreq_hw_target_index,
drivers/cpufreq/mediatek-cpufreq-hw.c:361: .get = mtk_cpufreq_hw_get,
drivers/cpufreq/mediatek-cpufreq-hw.c-362- .init = mtk_cpufreq_hw_cpu_init,
--
drivers/cpufreq/mediatek-cpufreq.c=617=static struct cpufreq_driver mtk_cpufreq_driver = {
--
drivers/cpufreq/mediatek-cpufreq.c-622- .target_index = mtk_cpufreq_set_target,
drivers/cpufreq/mediatek-cpufreq.c:623: .get = cpufreq_generic_get,
drivers/cpufreq/mediatek-cpufreq.c-624- .init = mtk_cpufreq_init,
--
drivers/cpufreq/p4-clockmod.c=224=static struct cpufreq_driver p4clockmod_driver = {
--
drivers/cpufreq/p4-clockmod.c-227- .init = cpufreq_p4_cpu_init,
drivers/cpufreq/p4-clockmod.c:228: .get = cpufreq_p4_get,
drivers/cpufreq/p4-clockmod.c-229- .name = "p4-clockmod",
--
drivers/cpufreq/pcc-cpufreq.c=565=static struct cpufreq_driver pcc_cpufreq_driver = {
drivers/cpufreq/pcc-cpufreq.c-566- .flags = CPUFREQ_CONST_LOOPS,
drivers/cpufreq/pcc-cpufreq.c:567: .get = pcc_get_freq,
drivers/cpufreq/pcc-cpufreq.c-568- .verify = pcc_cpufreq_verify,
--
drivers/cpufreq/pmac32-cpufreq.c=434=static struct cpufreq_driver pmac_cpufreq_driver = {
--
drivers/cpufreq/pmac32-cpufreq.c-436- .target_index = pmac_cpufreq_target,
drivers/cpufreq/pmac32-cpufreq.c:437: .get = pmac_cpufreq_get_speed,
drivers/cpufreq/pmac32-cpufreq.c-438- .init = pmac_cpufreq_cpu_init,
--
drivers/cpufreq/pmac64-cpufreq.c=328=static struct cpufreq_driver g5_cpufreq_driver = {
--
drivers/cpufreq/pmac64-cpufreq.c-333- .target_index = g5_cpufreq_target,
drivers/cpufreq/pmac64-cpufreq.c:334: .get = g5_cpufreq_get_speed,
drivers/cpufreq/pmac64-cpufreq.c-335-};
--
drivers/cpufreq/powernow-k6.c=249=static struct cpufreq_driver powernow_k6_driver = {
--
drivers/cpufreq/powernow-k6.c-253- .exit = powernow_k6_cpu_exit,
drivers/cpufreq/powernow-k6.c:254: .get = powernow_k6_get,
drivers/cpufreq/powernow-k6.c-255- .name = "powernow-k6",
--
drivers/cpufreq/powernow-k7.c=660=static struct cpufreq_driver powernow_driver = {
--
drivers/cpufreq/powernow-k7.c-662- .target_index = powernow_target,
drivers/cpufreq/powernow-k7.c:663: .get = powernow_get,
drivers/cpufreq/powernow-k7.c-664-#ifdef CONFIG_X86_POWERNOW_K7_ACPI
--
drivers/cpufreq/powernow-k8.c=1137=static struct cpufreq_driver cpufreq_amd64_driver = {
--
drivers/cpufreq/powernow-k8.c-1143- .exit = powernowk8_cpu_exit,
drivers/cpufreq/powernow-k8.c:1144: .get = powernowk8_get,
drivers/cpufreq/powernow-k8.c-1145- .name = "powernow-k8",
--
drivers/cpufreq/powernv-cpufreq.c=1031=static struct cpufreq_driver powernv_cpufreq_driver = {
--
drivers/cpufreq/powernv-cpufreq.c-1038- .fast_switch = powernv_fast_switch,
drivers/cpufreq/powernv-cpufreq.c:1039: .get = powernv_cpufreq_get,
drivers/cpufreq/powernv-cpufreq.c-1040- .attr = powernv_cpu_freq_attr,
--
drivers/cpufreq/pxa2xx-cpufreq.c=288=static struct cpufreq_driver pxa_cpufreq_driver = {
--
drivers/cpufreq/pxa2xx-cpufreq.c-292- .init = pxa_cpufreq_init,
drivers/cpufreq/pxa2xx-cpufreq.c:293: .get = pxa_cpufreq_get,
drivers/cpufreq/pxa2xx-cpufreq.c-294- .name = "PXA2xx",
--
drivers/cpufreq/pxa3xx-cpufreq.c=210=static struct cpufreq_driver pxa3xx_cpufreq_driver = {
--
drivers/cpufreq/pxa3xx-cpufreq.c-214- .init = pxa3xx_cpufreq_init,
drivers/cpufreq/pxa3xx-cpufreq.c:215: .get = pxa3xx_cpufreq_get,
drivers/cpufreq/pxa3xx-cpufreq.c-216- .name = "pxa3xx-cpufreq",
--
drivers/cpufreq/qcom-cpufreq-hw.c=592=static struct cpufreq_driver cpufreq_qcom_hw_driver = {
--
drivers/cpufreq/qcom-cpufreq-hw.c-597- .target_index = qcom_cpufreq_hw_target_index,
drivers/cpufreq/qcom-cpufreq-hw.c:598: .get = qcom_cpufreq_hw_get,
drivers/cpufreq/qcom-cpufreq-hw.c-599- .init = qcom_cpufreq_hw_cpu_init,
--
drivers/cpufreq/qoriq-cpufreq.c=248=static struct cpufreq_driver qoriq_cpufreq_driver = {
--
drivers/cpufreq/qoriq-cpufreq.c-255- .target_index = qoriq_cpufreq_target,
drivers/cpufreq/qoriq-cpufreq.c:256: .get = cpufreq_generic_get,
drivers/cpufreq/qoriq-cpufreq.c-257-};
--
drivers/cpufreq/s3c64xx-cpufreq.c=198=static struct cpufreq_driver s3c64xx_cpufreq_driver = {
--
drivers/cpufreq/s3c64xx-cpufreq.c-201- .target_index = s3c64xx_cpufreq_set_target,
drivers/cpufreq/s3c64xx-cpufreq.c:202: .get = cpufreq_generic_get,
drivers/cpufreq/s3c64xx-cpufreq.c-203- .init = s3c64xx_cpufreq_driver_init,
--
drivers/cpufreq/s5pv210-cpufreq.c=576=static struct cpufreq_driver s5pv210_driver = {
--
drivers/cpufreq/s5pv210-cpufreq.c-579- .target_index = s5pv210_target,
drivers/cpufreq/s5pv210-cpufreq.c:580: .get = cpufreq_generic_get,
drivers/cpufreq/s5pv210-cpufreq.c-581- .init = s5pv210_cpu_init,
--
drivers/cpufreq/sa1110-cpufreq.c=312=static struct cpufreq_driver sa1110_driver __refdata = {
--
drivers/cpufreq/sa1110-cpufreq.c-316- .target_index = sa1110_target,
drivers/cpufreq/sa1110-cpufreq.c:317: .get = sa11x0_getspeed,
drivers/cpufreq/sa1110-cpufreq.c-318- .init = sa1110_cpu_init,
--
drivers/cpufreq/sc520_freq.c=88=static struct cpufreq_driver sc520_freq_driver = {
drivers/cpufreq/sc520_freq.c:89: .get = sc520_freq_get_cpu_frequency,
drivers/cpufreq/sc520_freq.c-90- .verify = cpufreq_generic_frequency_table_verify,
--
drivers/cpufreq/scmi-cpufreq.c=383=static struct cpufreq_driver scmi_cpufreq_driver = {
--
drivers/cpufreq/scmi-cpufreq.c-390- .fast_switch = scmi_cpufreq_fast_switch,
drivers/cpufreq/scmi-cpufreq.c:391: .get = scmi_cpufreq_get_rate,
drivers/cpufreq/scmi-cpufreq.c-392- .init = scmi_cpufreq_init,
--
drivers/cpufreq/scpi-cpufreq.c=188=static struct cpufreq_driver scpi_cpufreq_driver = {
--
drivers/cpufreq/scpi-cpufreq.c-193- .verify = cpufreq_generic_frequency_table_verify,
drivers/cpufreq/scpi-cpufreq.c:194: .get = scpi_cpufreq_get_rate,
drivers/cpufreq/scpi-cpufreq.c-195- .init = scpi_cpufreq_init,
--
]
]
|
| 42/2 |
2026/05/13 02:12 |
llm |
expert |
0m
Model:
Tokens:
input: 75006
output: 66
thoughts: 1324
Thoughts: **Analysis of Kernel Deadlock and Exploitability**
Okay, so I've been digging into this potential kernel deadlock. My initial thought was that the `get` functions are generally tied to cpufreq or GPIO, but the lockdep report pinpoints a specific path: `param_attr_store` calling `kernel_param_lock`, which then runs `block2mtd_setup` that acquires `i_mutex_dir_key`. This is exactly what the syzkaller reproducer triggers. Since the reproducer runs as root and writing to the `block2mtd` parameter *requires* root, it's clear this deadlock isn't something an unprivileged process can trigger.
And, because user namespaces don't let me write to `/sys/module/block2mtd/parameters/block2mtd`, user namespaces are also out of the question. Therefore, although it's a DoS, it's only exploitable by root. I'm marking this as "not exploitable," "not accessible from unprivileged users," and "not accessible from user namespaces."
Now, let's play devil's advocate and see if there are *any* other ways to trigger the lock sequence of `param_lock` -> `i_mutex_dir_key`. Could a non-root user load a module? No, `finit_module` and `init_module` both need `CAP_SYS_MODULE`. Could an unprivileged user somehow coax the kernel into loading a module through `request_module`? Yes, like by creating a new socket family. This spawns the `modprobe` user-mode helper, which runs as root. If `modprobe` loads `block2mtd` *with a parameter* it could trigger the problem. But `block2mtd` is an MTD driver, not something autoloaded by unprivileged actions, and even if it were autoloaded, the `block2mtd=` parameter needs a block device path. A non-root user can't control what arguments are passed to `modprobe` from the kernel (those are hardcoded in `modprobe.d` or kernel code). So, injecting something like `block2mtd=/dev/loop0` through `request_module` is a non-starter.
What about other lock sequences? Can an unprivileged user trigger `rtnl_mutex` -> `param_lock`? I saw that `hwsim_new_radio_nl` needs `GENL_UNS_ADMIN_PERM`, which means a user namespace with `CAP_NET_ADMIN`. A user can *create* a user namespace, get `CAP_NET_ADMIN`, and trigger `hwsim_new_radio_nl`. That calls `ieee80211_register_hw` (takes `rtnl_lock()`), which *then* calls `ieee80211_init_rate_ctrl_alg`, which takes `param_lock`. So, yes, `rtnl_mutex` -> `param_lock` *is* triggerable from a user namespace.
Now, on to `cgroup_mutex` -> `rtnl_mutex`. `cgroup_mkdir` takes `cgroup_mutex`, then `cgrp_css_online` takes `rtnl_mutex`. Can an unprivileged user do a `cgroup_mkdir`? Yes, if they have write access to a cgroup directory (delegated cgroup). Also, if in a user namespace with cgroupfs mounted. So this can also be triggered by an unprivileged user, assuming delegated cgroups or cgroupfs is mounted in the user namespace.
And what about `i_mutex_dir_key` -> `cgroup_mutex`? `vfs_rmdir` takes `i_mutex_dir_key`, then `cgroup_rmdir` takes `cgroup_mutex`. Can an unprivileged user do a `vfs_rmdir` on a cgroup? Yes, if they have write access to the parent cgroup directory (delegated cgroup again). So, it's possible for an unprivileged user.
So, here's where we stand:
1. `i_mutex_dir_key` -> `cgroup_mutex`: Unprivileged (delegated cgroup)
2. `cgroup_mutex` -> `rtnl_mutex`: Unprivileged (delegated cgroup)
3. `rtnl_mutex` -> `param_lock`: User namespace (`CAP_NET_ADMIN`)
4. `param_lock` -> `i_mutex_dir_key`: Root only (`/sys/module/block2mtd/parameters/block2mtd` or `modprobe`)
The critical point is that #4 requires global root. A deadlock only happens when all dependencies
|
| 43/2 |
2026/05/13 02:12 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 44/2 |
2026/05/13 02:12 |
llm |
expert |
0m
Model:
Tokens:
input: 77485
output: 501
thoughts: 363
Thoughts: **My Analysis of the Deadlock**
Alright, the analysis is complete, and it's time to craft the final response. I need to clearly articulate the nature of this locking cycle and why it necessitates root privileges, making sure it's all airtight.
Let's break down the cycle. The root cause lies in this sequence:
1. We start with `param_lock`, which deadlocks with `i_mutex_dir_key`. This happens when calling `param_attr_store`, which leads to a write to `/sys/module/block2mtd/parameters/block2mtd` from the `kern_path` function during device addition.
2. `i_mutex_dir_key` then deadlocks with `cgroup_mutex`, which is caused by a `vfs_rmdir` operation calling `cgroup_rmdir`.
3. `cgroup_mutex` in turn deadlocks with `rtnl_mutex`, stemming from a `cgroup_mkdir` and then `cgrp_css_online` call.
4. Finally, `rtnl_mutex` deadlocks with `param_lock`, and this is triggered by the `ieee80211_register_hw` function that subsequently calls `ieee80211_init_rate_ctrl_alg` which leads to `ieee80211_rate_control_ops_get`.
Now, the crucial point: the initial dependency, `param_lock` -> `i_mutex_dir_key`, is initiated by writing to that specific sysfs file: `/sys/module/block2mtd/parameters/block2mtd`. Crucially, this file's permissions are set to `0200`, meaning it's only writable by root. Itβs also owned by global root. This means it is entirely inaccessible to unprivileged users, and also is not writable within a user namespace.
Therefore, the deadlock, as much as it exists, can *only* be triggered by a user with global root privileges. Because it *requires* global root privileges to complete the cycle, it doesn't cross any security boundaries. Itβs a Denial of Service, specifically a deadlock, but it's not exploitable by an unprivileged user, and is therefore not a security vulnerability in the conventional sense. I need to make sure that distinction is absolutely clear in the final response.
|
| 45/1 |
2026/05/13 02:12 |
action |
format-explanation |
0m
Results: map[Explanation:The bug report describes a circular locking dependency (deadlock) detected by
lockdep. The cycle involves four locks:
1. `param_lock` -> `i_mutex_dir_key`: Triggered when writing to the `block2mtd`
module parameter. `param_attr_store()` acquires `param_lock`, and then
`block2mtd_setup()` calls `add_device()` which resolves the block device path
via `kern_path()`, acquiring the directory inode lock (`i_mutex_dir_key`).
2. `i_mutex_dir_key` -> `cgroup_mutex`: Triggered during `rmdir` of a cgroup.
`vfs_rmdir()` acquires the parent directory's inode lock, and then
`cgroup_rmdir()` acquires `cgroup_mutex`.
3. `cgroup_mutex` -> `rtnl_mutex`: Triggered during `mkdir` of a cgroup.
`cgroup_mkdir()` acquires `cgroup_mutex`, and then `cgrp_css_online()` acquires
`rtnl_mutex`.
4. `rtnl_mutex` -> `param_lock`: Triggered when registering a new mac80211
hardware device (e.g., via `mac80211_hwsim`). `ieee80211_register_hw()` acquires
`rtnl_lock()`, and then calls `ieee80211_init_rate_ctrl_alg()` which acquires
`param_lock` to resolve the rate control algorithm.
**Security Assessment:**
While this is a valid deadlock that can cause a Denial of Service (DoS), it is
**not accessible to unprivileged users**.
To trigger the first dependency in the cycle (`param_lock` ->
`i_mutex_dir_key`), a user must write to
`/sys/module/block2mtd/parameters/block2mtd`. This sysfs file has `0200`
permissions (`-w-------`) and is owned by the global `root` user. It is not
writable by unprivileged users, and because sysfs module parameters are not
mapped as writable into user namespaces, it cannot be triggered from within a
user namespace either.
Since completing the deadlock cycle requires global root privileges, it does not
cross any security boundaries. An attacker without root access cannot
intentionally trigger this deadlock.]
|