| 0/0 |
2026/05/21 03:56 |
flow |
assessment-security |
57m
Results: map[DenialOfService:true Explanation:The bug report describes a circular locking dependency (deadlock) in the NetROM
protocol stack involving `nr_neigh_list_lock`, `nr_node_list_lock`, and
`nr_node_lock`.
The lockdep report highlights two conflicting locking chains:
1. **`nr_rt_device_down`**: Acquires `nr_neigh_list_lock`, then
`nr_node_list_lock`, and finally `nr_node_lock`.
2. **`nr_dec_obs`**: Acquires `nr_node_list_lock`, then `nr_node_lock`, and
finally `nr_neigh_list_lock` (via `nr_remove_neigh`).
### Analysis:
- **Exploitable**: No. This is a spinlock deadlock. Deadlocks result in a system
hang (hard lockup on the involved CPUs) but do not lead to memory corruption or
privilege escalation.
- **Denial of Service**: Yes. Triggering the bug will cause a hard lockup,
leading to a Denial of Service.
- **Accessible From Unprivileged Processes / User Namespaces**: No.
- `nr_rt_device_down` is called from a netdevice notifier (`nr_device_event`)
when a network device goes down. The notifier explicitly ignores devices
outside of `init_net` (`if (!net_eq(dev_net(dev), &init_net)) return
NOTIFY_DONE;`). Bringing down a device in `init_net` requires `CAP_NET_ADMIN`
in the initial user namespace.
- `nr_dec_obs` is only reachable via the `SIOCNRDECOBS` ioctl on a NetROM
socket. The `nr_ioctl` handler explicitly checks `capable(CAP_NET_ADMIN)`
before processing this ioctl. The `capable()` function checks for capabilities
in the initial user namespace (`init_user_ns`), meaning it cannot be bypassed
by creating a new user namespace.
- Other paths that could potentially trigger the reverse locking order (like
`nr_del_neigh`, `nr_del_node`, or `nr_add_node` replacing a route) are also
only reachable via `nr_rt_ioctl` (`SIOCDELRT`, `SIOCADDRT`), which similarly
require `CAP_NET_ADMIN` in the initial user namespace.
- While `nr_add_node` can be reached by processing an incoming NetROM packet
(`nr_route_frame`), it is called with a `quality` of `0`. The logic in
`nr_add_node` will never replace an existing route (and thus never call
`nr_remove_neigh` to acquire `nr_neigh_list_lock`) if the provided quality is
`0`.
### Conclusion:
This deadlock can only be triggered by a highly privileged user (root or a user
with `CAP_NET_ADMIN` in the initial user namespace). It is not accessible to
unprivileged users, cannot be triggered remotely via network packets, and is not
exploitable for privilege escalation. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/05/21 03:56 |
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>
const int kInitNetNsFd = 201;
static long syz_init_net_socket(volatile long domain, volatile long type, volatile long proto)
{
return syscall(__NR_socket, domain, type, proto);
}
uint64_t r[3] = {0xffffffffffffffff, 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)) {}
// syz_init_net_socket$netrom arguments: [
// domain: const = 0x6 (8 bytes)
// type: const = 0x5 (8 bytes)
// proto: const = 0x0 (8 bytes)
// ]
// returns sock_netrom
res = -1;
res = syz_init_net_socket(/*domain=*/6, /*type=*/5, /*proto=*/0);
if (res != -1)
r[0] = res;
// socketpair$unix arguments: [
// domain: const = 0x1 (8 bytes)
// type: unix_socket_type = 0x1 (8 bytes)
// proto: const = 0x0 (4 bytes)
// fds: ptr[out, unix_pair] {
// unix_pair {
// fd0: sock_unix (resource)
// fd1: sock_unix (resource)
// }
// }
// ]
res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=SOCK_STREAM*/1ul, /*proto=*/0, /*fds=*/0x200000000080ul);
if (res != -1)
r[1] = *(uint32_t*)0x200000000084;
// ioctl$sock_SIOCGIFINDEX arguments: [
// fd: sock (resource)
// cmd: const = 0x8933 (4 bytes)
// arg: ptr[out, ifreq_dev_t[devnames, ifindex]] {
// ifreq_dev_t[devnames, ifindex] {
// ifr_ifrn: buffer: {62 61 74 61 64 76 5f 73 6c 61 76 65 5f 30 00 00} (length 0x10)
// elem: ifindex (resource)
// pad = 0x0 (20 bytes)
// }
// }
// ]
memcpy((void*)0x200000000000, "batadv_slave_0\000\000", 16);
syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x8933, /*arg=*/0x200000000000ul);
// syz_init_net_socket$bt_sco arguments: [
// fam: const = 0x1f (8 bytes)
// type: const = 0x5 (8 bytes)
// proto: const = 0x2 (8 bytes)
// ]
// returns sock_bt_sco
res = -1;
res = syz_init_net_socket(/*fam=*/0x1f, /*type=*/5, /*proto=*/2);
if (res != -1)
r[2] = res;
// setsockopt$ax25_SO_BINDTODEVICE arguments: [
// fd: sock_ax25 (resource)
// level: const = 0x101 (4 bytes)
// optname: const = 0x19 (4 bytes)
// optval: ptr[in, ax25_devname] {
// union ax25_devname {
// bpq0: buffer: {62 70 71 30 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// }
// }
// optlen: len = 0xfffffffffffffe1d (8 bytes)
// ]
memcpy((void*)0x200000000000, "bpq0\000\000\000\000\000\000\000\000\000\000\000\000", 16);
syscall(__NR_setsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x101, /*optname=*/0x19, /*optval=*/0x200000000000ul, /*optlen=*/0xfffffffffffffe1dul);
// ioctl$sock_netdev_private arguments: [
// fd: sock (resource)
// cmd: int32 = 0x8914 (4 bytes)
// arg: ptr[in, buffer] {
// buffer: {} (length 0x0)
// }
// ]
syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x8914, /*arg=*/0x200000000000ul);
// ioctl$sock_netrom_SIOCADDRT arguments: [
// fd: sock_netrom (resource)
// cmd: const = 0x890b (4 bytes)
// arg: ptr[in, nr_route_struct] {
// nr_route_struct {
// type: nr_route_type = 0x1 (4 bytes)
// callsign: union ax25_address {
// null: ax25_address_null {
// b0: const = 0x40 (1 bytes)
// b1: const = 0x40 (1 bytes)
// b2: const = 0x40 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// device: union ax25_devname {
// bpq0: buffer: {62 70 71 30 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// }
// pad = 0x0 (1 bytes)
// quality: int32 = 0x6 (4 bytes)
// mnemonic: buffer: {73 79 7a 30 00 00 00} (length 0x7)
// neighbour: union ax25_address {
// netrom: address_netrom_dev {
// b0: const = 0xbb (1 bytes)
// b1: const = 0xbb (1 bytes)
// b2: const = 0xbb (1 bytes)
// b3: const = 0xbb (1 bytes)
// b4: const = 0xbb (1 bytes)
// b5: const = 0x0 (1 bytes)
// b6: proc = 0x0 (1 bytes)
// }
// }
// pad = 0x0 (2 bytes)
// obs_count: int32 = 0x1 (4 bytes)
// ndigis: int32 = 0x0 (4 bytes)
// digipeaters: array[ax25_address] {
// union ax25_address {
// null: ax25_address_null {
// b0: const = 0x40 (1 bytes)
// b1: const = 0x40 (1 bytes)
// b2: const = 0x40 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// default: ax25_address_default {
// b0: const = 0x98 (1 bytes)
// b1: const = 0x92 (1 bytes)
// b2: const = 0x9c (1 bytes)
// b3: const = 0xaa (1 bytes)
// b4: const = 0xb0 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x2 (1 bytes)
// }
// }
// union ax25_address {
// netrom: address_netrom_dev {
// b0: const = 0xbb (1 bytes)
// b1: const = 0xbb (1 bytes)
// b2: const = 0xbb (1 bytes)
// b3: const = 0xbb (1 bytes)
// b4: const = 0xbb (1 bytes)
// b5: const = 0x0 (1 bytes)
// b6: proc = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// bcast: ax25_address_bcast {
// b0: const = 0xa2 (1 bytes)
// b1: const = 0xa6 (1 bytes)
// b2: const = 0xa8 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// bcast: ax25_address_bcast {
// b0: const = 0xa2 (1 bytes)
// b1: const = 0xa6 (1 bytes)
// b2: const = 0xa8 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// netrom: address_netrom_dev {
// b0: const = 0xbb (1 bytes)
// b1: const = 0xbb (1 bytes)
// b2: const = 0xbb (1 bytes)
// b3: const = 0xbb (1 bytes)
// b4: const = 0xbb (1 bytes)
// b5: const = 0x0 (1 bytes)
// b6: proc = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// null: ax25_address_null {
// b0: const = 0x40 (1 bytes)
// b1: const = 0x40 (1 bytes)
// b2: const = 0x40 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// default: ax25_address_default {
// b0: const = 0x98 (1 bytes)
// b1: const = 0x92 (1 bytes)
// b2: const = 0x9c (1 bytes)
// b3: const = 0xaa (1 bytes)
// b4: const = 0xb0 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x2 (1 bytes)
// }
// }
// }
// }
// }
// ]
*(uint32_t*)0x200000000000 = 1;
*(uint8_t*)0x200000000004 = 0x40;
*(uint8_t*)0x200000000005 = 0x40;
*(uint8_t*)0x200000000006 = 0x40;
*(uint8_t*)0x200000000007 = 0x40;
*(uint8_t*)0x200000000008 = 0x40;
*(uint8_t*)0x200000000009 = 0x40;
*(uint8_t*)0x20000000000a = 0;
memcpy((void*)0x20000000000b, "bpq0\000\000\000\000\000\000\000\000\000\000\000\000", 16);
*(uint32_t*)0x20000000001c = 6;
memcpy((void*)0x200000000020, "syz0\000\000\000", 7);
*(uint8_t*)0x200000000027 = 0xbb;
*(uint8_t*)0x200000000028 = 0xbb;
*(uint8_t*)0x200000000029 = 0xbb;
*(uint8_t*)0x20000000002a = 0xbb;
*(uint8_t*)0x20000000002b = 0xbb;
*(uint8_t*)0x20000000002c = 0;
*(uint8_t*)0x20000000002d = 0;
*(uint32_t*)0x200000000030 = 1;
*(uint32_t*)0x200000000034 = 0;
*(uint8_t*)0x200000000038 = 0x40;
*(uint8_t*)0x200000000039 = 0x40;
*(uint8_t*)0x20000000003a = 0x40;
*(uint8_t*)0x20000000003b = 0x40;
*(uint8_t*)0x20000000003c = 0x40;
*(uint8_t*)0x20000000003d = 0x40;
*(uint8_t*)0x20000000003e = 0;
*(uint8_t*)0x20000000003f = 0x98;
*(uint8_t*)0x200000000040 = 0x92;
*(uint8_t*)0x200000000041 = 0x9c;
*(uint8_t*)0x200000000042 = 0xaa;
*(uint8_t*)0x200000000043 = 0xb0;
*(uint8_t*)0x200000000044 = 0x40;
*(uint8_t*)0x200000000045 = 2;
*(uint8_t*)0x200000000046 = 0xbb;
*(uint8_t*)0x200000000047 = 0xbb;
*(uint8_t*)0x200000000048 = 0xbb;
*(uint8_t*)0x200000000049 = 0xbb;
*(uint8_t*)0x20000000004a = 0xbb;
*(uint8_t*)0x20000000004b = 0;
*(uint8_t*)0x20000000004c = 0;
*(uint8_t*)0x20000000004d = 0xa2;
*(uint8_t*)0x20000000004e = 0xa6;
*(uint8_t*)0x20000000004f = 0xa8;
*(uint8_t*)0x200000000050 = 0x40;
*(uint8_t*)0x200000000051 = 0x40;
*(uint8_t*)0x200000000052 = 0x40;
*(uint8_t*)0x200000000053 = 0;
*(uint8_t*)0x200000000054 = 0xa2;
*(uint8_t*)0x200000000055 = 0xa6;
*(uint8_t*)0x200000000056 = 0xa8;
*(uint8_t*)0x200000000057 = 0x40;
*(uint8_t*)0x200000000058 = 0x40;
*(uint8_t*)0x200000000059 = 0x40;
*(uint8_t*)0x20000000005a = 0;
*(uint8_t*)0x20000000005b = 0xbb;
*(uint8_t*)0x20000000005c = 0xbb;
*(uint8_t*)0x20000000005d = 0xbb;
*(uint8_t*)0x20000000005e = 0xbb;
*(uint8_t*)0x20000000005f = 0xbb;
*(uint8_t*)0x200000000060 = 0;
*(uint8_t*)0x200000000061 = 0;
*(uint8_t*)0x200000000062 = 0x40;
*(uint8_t*)0x200000000063 = 0x40;
*(uint8_t*)0x200000000064 = 0x40;
*(uint8_t*)0x200000000065 = 0x40;
*(uint8_t*)0x200000000066 = 0x40;
*(uint8_t*)0x200000000067 = 0x40;
*(uint8_t*)0x200000000068 = 0;
*(uint8_t*)0x200000000069 = 0x98;
*(uint8_t*)0x20000000006a = 0x92;
*(uint8_t*)0x20000000006b = 0x9c;
*(uint8_t*)0x20000000006c = 0xaa;
*(uint8_t*)0x20000000006d = 0xb0;
*(uint8_t*)0x20000000006e = 0x40;
*(uint8_t*)0x20000000006f = 2;
syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x890b, /*arg=*/0x200000000000ul);
// ioctl$SIOCNRDECOBS arguments: [
// fd: sock_netrom (resource)
// cmd: const = 0x89e2 (4 bytes)
// ]
syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x89e2, 0);
// setsockopt$ax25_SO_BINDTODEVICE arguments: [
// fd: sock_ax25 (resource)
// level: const = 0x101 (4 bytes)
// optname: const = 0x19 (4 bytes)
// optval: ptr[in, ax25_devname] {
// union ax25_devname {
// bpq0: buffer: {62 70 71 30 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// }
// }
// optlen: len = 0xfffffffffffffe1d (8 bytes)
// ]
memcpy((void*)0x200000000000, "bpq0\000\000\000\000\000\000\000\000\000\000\000\000", 16);
syscall(__NR_setsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x101, /*optname=*/0x19, /*optval=*/0x200000000000ul, /*optlen=*/0xfffffffffffffe1dul);
// ioctl$sock_netdev_private arguments: [
// fd: sock (resource)
// cmd: int32 = 0x8914 (4 bytes)
// arg: ptr[in, buffer] {
// buffer: {} (length 0x0)
// }
// ]
syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x8914, /*arg=*/0x200000000000ul);
return 0;
}
]
|
| 2/1 |
2026/05/21 03:56 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/7e706ebe2f003952922a4d7a905b8f2f57be312b]
|
| 3/1 |
2026/05/21 03:58 |
action |
kernel-builder |
32m
Results: map[KernelObj:/app/workdir/cache/build/39c9da62e1ee76eaaab205b08e2a58c760fff9cf]
|
| 4/1 |
2026/05/21 04:31 |
action |
codesearch-prepare |
17m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/05/21 04:49 |
agent |
expert |
5m
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.151/6240 is trying to acquire lock:
ffffffff903a2638 (nr_node_list_lock){+...}-{3:3}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
ffffffff903a2638 (nr_node_list_lock){+...}-{3:3}, at: nr_rt_device_down+0xd3/0x810 net/netrom/nr_route.c:517
but task is already holding lock:
ffffffff903a25d8 (nr_neigh_list_lock){+...}-{3:3}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
ffffffff903a25d8 (nr_neigh_list_lock){+...}-{3:3}, at: nr_rt_device_down+0x2c/0x810 net/netrom/nr_route.c:514
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (nr_neigh_list_lock){+...}-{3:3}:
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_remove_neigh net/netrom/nr_route.c:307 [inline]
nr_dec_obs net/netrom/nr_route.c:472 [inline]
nr_rt_ioctl+0xc66/0x29b0 net/netrom/nr_route.c:692
nr_ioctl+0x19a/0x2d0 net/netrom/af_netrom.c:1254
sock_do_ioctl+0x118/0x280 net/socket.c:1254
sock_ioctl+0x227/0x6b0 net/socket.c:1375
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (&nr_node->node_lock){+...}-{3:3}:
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_node_lock include/net/netrom.h:152 [inline]
nr_dec_obs net/netrom/nr_route.c:459 [inline]
nr_rt_ioctl+0x816/0x29b0 net/netrom/nr_route.c:692
nr_ioctl+0x19a/0x2d0 net/netrom/af_netrom.c:1254
sock_do_ioctl+0x118/0x280 net/socket.c:1254
sock_ioctl+0x227/0x6b0 net/socket.c:1375
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (nr_node_list_lock){+...}-{3:3}:
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+0x1669/0x2890 kernel/locking/lockdep.c:5237
lock_acquire kernel/locking/lockdep.c:5868 [inline]
lock_acquire+0x179/0x330 kernel/locking/lockdep.c:5825
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_rt_device_down+0xd3/0x810 net/netrom/nr_route.c:517
nr_device_event+0x126/0x170 net/netrom/af_netrom.c:126
notifier_call_chain+0xbc/0x3e0 kernel/notifier.c:85
call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2230
call_netdevice_notifiers_extack net/core/dev.c:2268 [inline]
call_netdevice_notifiers net/core/dev.c:2282 [inline]
__dev_notify_flags+0x1f7/0x2e0 net/core/dev.c:9775
netif_change_flags+0x108/0x160 net/core/dev.c:9802
dev_change_flags+0xba/0x250 net/core/dev_api.c:68
dev_ifsioc+0x1498/0x1f70 net/core/dev_ioctl.c:583
dev_ioctl+0x223/0x10e0 net/core/dev_ioctl.c:842
sock_do_ioctl+0x19d/0x280 net/socket.c:1268
sock_ioctl+0x227/0x6b0 net/socket.c:1375
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/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:
nr_node_list_lock --> &nr_node->node_lock --> nr_neigh_list_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(nr_neigh_list_lock);
lock(&nr_node->node_lock);
lock(nr_neigh_list_lock);
lock(nr_node_list_lock);
*** DEADLOCK ***
2 locks held by syz.0.151/6240:
#0: ffffffff90141aa8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_net_lock include/linux/rtnetlink.h:130 [inline]
#0: ffffffff90141aa8 (rtnl_mutex){+.+.}-{4:4}, at: dev_ioctl+0x212/0x10e0 net/core/dev_ioctl.c:841
#1: ffffffff903a25d8 (nr_neigh_list_lock){+...}-{3:3}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
#1: ffffffff903a25d8 (nr_neigh_list_lock){+...}-{3:3}, at: nr_rt_device_down+0x2c/0x810 net/netrom/nr_route.c:514
stack backtrace:
CPU: 2 UID: 0 PID: 6240 Comm: syz.0.151 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_circular_bug+0x275/0x340 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+0x1669/0x2890 kernel/locking/lockdep.c:5237
lock_acquire kernel/locking/lockdep.c:5868 [inline]
lock_acquire+0x179/0x330 kernel/locking/lockdep.c:5825
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
_raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
spin_lock_bh include/linux/spinlock.h:356 [inline]
nr_rt_device_down+0xd3/0x810 net/netrom/nr_route.c:517
nr_device_event+0x126/0x170 net/netrom/af_netrom.c:126
notifier_call_chain+0xbc/0x3e0 kernel/notifier.c:85
call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2230
call_netdevice_notifiers_extack net/core/dev.c:2268 [inline]
call_netdevice_notifiers net/core/dev.c:2282 [inline]
__dev_notify_flags+0x1f7/0x2e0 net/core/dev.c:9775
netif_change_flags+0x108/0x160 net/core/dev.c:9802
dev_change_flags+0xba/0x250 net/core/dev_api.c:68
dev_ifsioc+0x1498/0x1f70 net/core/dev_ioctl.c:583
dev_ioctl+0x223/0x10e0 net/core/dev_ioctl.c:842
sock_do_ioctl+0x19d/0x280 net/socket.c:1268
sock_ioctl+0x227/0x6b0 net/socket.c:1375
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff6faf8f7c9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcff5ed018 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ff6fb1e5fa0 RCX: 00007ff6faf8f7c9
RDX: 0000200000000000 RSI: 0000000000008914 RDI: 0000000000000007
RBP: 00007ff6fb013f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ff6fb1e5fa0 R14: 00007ff6fb1e5fa0 R15: 0000000000000003
</TASK>
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>
const int kInitNetNsFd = 201;
static long syz_init_net_socket(volatile long domain, volatile long type, volatile long proto)
{
return syscall(__NR_socket, domain, type, proto);
}
uint64_t r[3] = {0xffffffffffffffff, 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)) {}
// syz_init_net_socket$netrom arguments: [
// domain: const = 0x6 (8 bytes)
// type: const = 0x5 (8 bytes)
// proto: const = 0x0 (8 bytes)
// ]
// returns sock_netrom
res = -1;
res = syz_init_net_socket(/*domain=*/6, /*type=*/5, /*proto=*/0);
if (res != -1)
r[0] = res;
// socketpair$unix arguments: [
// domain: const = 0x1 (8 bytes)
// type: unix_socket_type = 0x1 (8 bytes)
// proto: const = 0x0 (4 bytes)
// fds: ptr[out, unix_pair] {
// unix_pair {
// fd0: sock_unix (resource)
// fd1: sock_unix (resource)
// }
// }
// ]
res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=SOCK_STREAM*/1ul, /*proto=*/0, /*fds=*/0x200000000080ul);
if (res != -1)
r[1] = *(uint32_t*)0x200000000084;
// ioctl$sock_SIOCGIFINDEX arguments: [
// fd: sock (resource)
// cmd: const = 0x8933 (4 bytes)
// arg: ptr[out, ifreq_dev_t[devnames, ifindex]] {
// ifreq_dev_t[devnames, ifindex] {
// ifr_ifrn: buffer: {62 61 74 61 64 76 5f 73 6c 61 76 65 5f 30 00 00} (length 0x10)
// elem: ifindex (resource)
// pad = 0x0 (20 bytes)
// }
// }
// ]
memcpy((void*)0x200000000000, "batadv_slave_0\000\000", 16);
syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x8933, /*arg=*/0x200000000000ul);
// syz_init_net_socket$bt_sco arguments: [
// fam: const = 0x1f (8 bytes)
// type: const = 0x5 (8 bytes)
// proto: const = 0x2 (8 bytes)
// ]
// returns sock_bt_sco
res = -1;
res = syz_init_net_socket(/*fam=*/0x1f, /*type=*/5, /*proto=*/2);
if (res != -1)
r[2] = res;
// setsockopt$ax25_SO_BINDTODEVICE arguments: [
// fd: sock_ax25 (resource)
// level: const = 0x101 (4 bytes)
// optname: const = 0x19 (4 bytes)
// optval: ptr[in, ax25_devname] {
// union ax25_devname {
// bpq0: buffer: {62 70 71 30 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// }
// }
// optlen: len = 0xfffffffffffffe1d (8 bytes)
// ]
memcpy((void*)0x200000000000, "bpq0\000\000\000\000\000\000\000\000\000\000\000\000", 16);
syscall(__NR_setsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x101, /*optname=*/0x19, /*optval=*/0x200000000000ul, /*optlen=*/0xfffffffffffffe1dul);
// ioctl$sock_netdev_private arguments: [
// fd: sock (resource)
// cmd: int32 = 0x8914 (4 bytes)
// arg: ptr[in, buffer] {
// buffer: {} (length 0x0)
// }
// ]
syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x8914, /*arg=*/0x200000000000ul);
// ioctl$sock_netrom_SIOCADDRT arguments: [
// fd: sock_netrom (resource)
// cmd: const = 0x890b (4 bytes)
// arg: ptr[in, nr_route_struct] {
// nr_route_struct {
// type: nr_route_type = 0x1 (4 bytes)
// callsign: union ax25_address {
// null: ax25_address_null {
// b0: const = 0x40 (1 bytes)
// b1: const = 0x40 (1 bytes)
// b2: const = 0x40 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// device: union ax25_devname {
// bpq0: buffer: {62 70 71 30 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// }
// pad = 0x0 (1 bytes)
// quality: int32 = 0x6 (4 bytes)
// mnemonic: buffer: {73 79 7a 30 00 00 00} (length 0x7)
// neighbour: union ax25_address {
// netrom: address_netrom_dev {
// b0: const = 0xbb (1 bytes)
// b1: const = 0xbb (1 bytes)
// b2: const = 0xbb (1 bytes)
// b3: const = 0xbb (1 bytes)
// b4: const = 0xbb (1 bytes)
// b5: const = 0x0 (1 bytes)
// b6: proc = 0x0 (1 bytes)
// }
// }
// pad = 0x0 (2 bytes)
// obs_count: int32 = 0x1 (4 bytes)
// ndigis: int32 = 0x0 (4 bytes)
// digipeaters: array[ax25_address] {
// union ax25_address {
// null: ax25_address_null {
// b0: const = 0x40 (1 bytes)
// b1: const = 0x40 (1 bytes)
// b2: const = 0x40 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// default: ax25_address_default {
// b0: const = 0x98 (1 bytes)
// b1: const = 0x92 (1 bytes)
// b2: const = 0x9c (1 bytes)
// b3: const = 0xaa (1 bytes)
// b4: const = 0xb0 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x2 (1 bytes)
// }
// }
// union ax25_address {
// netrom: address_netrom_dev {
// b0: const = 0xbb (1 bytes)
// b1: const = 0xbb (1 bytes)
// b2: const = 0xbb (1 bytes)
// b3: const = 0xbb (1 bytes)
// b4: const = 0xbb (1 bytes)
// b5: const = 0x0 (1 bytes)
// b6: proc = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// bcast: ax25_address_bcast {
// b0: const = 0xa2 (1 bytes)
// b1: const = 0xa6 (1 bytes)
// b2: const = 0xa8 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// bcast: ax25_address_bcast {
// b0: const = 0xa2 (1 bytes)
// b1: const = 0xa6 (1 bytes)
// b2: const = 0xa8 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// netrom: address_netrom_dev {
// b0: const = 0xbb (1 bytes)
// b1: const = 0xbb (1 bytes)
// b2: const = 0xbb (1 bytes)
// b3: const = 0xbb (1 bytes)
// b4: const = 0xbb (1 bytes)
// b5: const = 0x0 (1 bytes)
// b6: proc = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// null: ax25_address_null {
// b0: const = 0x40 (1 bytes)
// b1: const = 0x40 (1 bytes)
// b2: const = 0x40 (1 bytes)
// b3: const = 0x40 (1 bytes)
// b4: const = 0x40 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x0 (1 bytes)
// }
// }
// union ax25_address {
// default: ax25_address_default {
// b0: const = 0x98 (1 bytes)
// b1: const = 0x92 (1 bytes)
// b2: const = 0x9c (1 bytes)
// b3: const = 0xaa (1 bytes)
// b4: const = 0xb0 (1 bytes)
// b5: const = 0x40 (1 bytes)
// b6: const = 0x2 (1 bytes)
// }
// }
// }
// }
// }
// ]
*(uint32_t*)0x200000000000 = 1;
*(uint8_t*)0x200000000004 = 0x40;
*(uint8_t*)0x200000000005 = 0x40;
*(uint8_t*)0x200000000006 = 0x40;
*(uint8_t*)0x200000000007 = 0x40;
*(uint8_t*)0x200000000008 = 0x40;
*(uint8_t*)0x200000000009 = 0x40;
*(uint8_t*)0x20000000000a = 0;
memcpy((void*)0x20000000000b, "bpq0\000\000\000\000\000\000\000\000\000\000\000\000", 16);
*(uint32_t*)0x20000000001c = 6;
memcpy((void*)0x200000000020, "syz0\000\000\000", 7);
*(uint8_t*)0x200000000027 = 0xbb;
*(uint8_t*)0x200000000028 = 0xbb;
*(uint8_t*)0x200000000029 = 0xbb;
*(uint8_t*)0x20000000002a = 0xbb;
*(uint8_t*)0x20000000002b = 0xbb;
*(uint8_t*)0x20000000002c = 0;
*(uint8_t*)0x20000000002d = 0;
*(uint32_t*)0x200000000030 = 1;
*(uint32_t*)0x200000000034 = 0;
*(uint8_t*)0x200000000038 = 0x40;
*(uint8_t*)0x200000000039 = 0x40;
*(uint8_t*)0x20000000003a = 0x40;
*(uint8_t*)0x20000000003b = 0x40;
*(uint8_t*)0x20000000003c = 0x40;
*(uint8_t*)0x20000000003d = 0x40;
*(uint8_t*)0x20000000003e = 0;
*(uint8_t*)0x20000000003f = 0x98;
*(uint8_t*)0x200000000040 = 0x92;
*(uint8_t*)0x200000000041 = 0x9c;
*(uint8_t*)0x200000000042 = 0xaa;
*(uint8_t*)0x200000000043 = 0xb0;
*(uint8_t*)0x200000000044 = 0x40;
*(uint8_t*)0x200000000045 = 2;
*(uint8_t*)0x200000000046 = 0xbb;
*(uint8_t*)0x200000000047 = 0xbb;
*(uint8_t*)0x200000000048 = 0xbb;
*(uint8_t*)0x200000000049 = 0xbb;
*(uint8_t*)0x20000000004a = 0xbb;
*(uint8_t*)0x20000000004b = 0;
*(uint8_t*)0x20000000004c = 0;
*(uint8_t*)0x20000000004d = 0xa2;
*(uint8_t*)0x20000000004e = 0xa6;
*(uint8_t*)0x20000000004f = 0xa8;
*(uint8_t*)0x200000000050 = 0x40;
*(uint8_t*)0x200000000051 = 0x40;
*(uint8_t*)0x200000000052 = 0x40;
*(uint8_t*)0x200000000053 = 0;
*(uint8_t*)0x200000000054 = 0xa2;
*(uint8_t*)0x200000000055 = 0xa6;
*(uint8_t*)0x200000000056 = 0xa8;
*(uint8_t*)0x200000000057 = 0x40;
*(uint8_t*)0x200000000058 = 0x40;
*(uint8_t*)0x200000000059 = 0x40;
*(uint8_t*)0x20000000005a = 0;
*(uint8_t*)0x20000000005b = 0xbb;
*(uint8_t*)0x20000000005c = 0xbb;
*(uint8_t*)0x20000000005d = 0xbb;
*(uint8_t*)0x20000000005e = 0xbb;
*(uint8_t*)0x20000000005f = 0xbb;
*(uint8_t*)0x200000000060 = 0;
*(uint8_t*)0x200000000061 = 0;
*(uint8_t*)0x200000000062 = 0x40;
*(uint8_t*)0x200000000063 = 0x40;
*(uint8_t*)0x200000000064 = 0x40;
*(uint8_t*)0x200000000065 = 0x40;
*(uint8_t*)0x200000000066 = 0x40;
*(uint8_t*)0x200000000067 = 0x40;
*(uint8_t*)0x200000000068 = 0;
*(uint8_t*)0x200000000069 = 0x98;
*(uint8_t*)0x20000000006a = 0x92;
*(uint8_t*)0x20000000006b = 0x9c;
*(uint8_t*)0x20000000006c = 0xaa;
*(uint8_t*)0x20000000006d = 0xb0;
*(uint8_t*)0x20000000006e = 0x40;
*(uint8_t*)0x20000000006f = 2;
syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x890b, /*arg=*/0x200000000000ul);
// ioctl$SIOCNRDECOBS arguments: [
// fd: sock_netrom (resource)
// cmd: const = 0x89e2 (4 bytes)
// ]
syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x89e2, 0);
// setsockopt$ax25_SO_BINDTODEVICE arguments: [
// fd: sock_ax25 (resource)
// level: const = 0x101 (4 bytes)
// optname: const = 0x19 (4 bytes)
// optval: ptr[in, ax25_devname] {
// union ax25_devname {
// bpq0: buffer: {62 70 71 30 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// }
// }
// optlen: len = 0xfffffffffffffe1d (8 bytes)
// ]
memcpy((void*)0x200000000000, "bpq0\000\000\000\000\000\000\000\000\000\000\000\000", 16);
syscall(__NR_setsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x101, /*optname=*/0x19, /*optval=*/0x200000000000ul, /*optlen=*/0xfffffffffffffe1dul);
// ioctl$sock_netdev_private arguments: [
// fd: sock (resource)
// cmd: int32 = 0x8914 (4 bytes)
// arg: ptr[in, buffer] {
// buffer: {} (length 0x0)
// }
// ]
syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0x8914, /*arg=*/0x200000000000ul);
return 0;
}
Reply: The bug report describes a circular locking dependency (deadlock) in the NetROM protocol stack involving `nr_neigh_list_lock`, `nr_node_list_lock`, and `nr_node_lock`.
The lockdep report highlights two conflicting locking chains:
1. **`nr_rt_device_down`**: Acquires `nr_neigh_list_lock`, then `nr_node_list_lock`, and finally `nr_node_lock`.
2. **`nr_dec_obs`**: Acquires `nr_node_list_lock`, then `nr_node_lock`, and finally `nr_neigh_list_lock` (via `nr_remove_neigh`).
### Analysis:
- **Exploitable**: No. This is a spinlock deadlock. Deadlocks result in a system hang (hard lockup on the involved CPUs) but do not lead to memory corruption or privilege escalation.
- **Denial of Service**: Yes. Triggering the bug will cause a hard lockup, leading to a Denial of Service.
- **Accessible From Unprivileged Processes / User Namespaces**: No.
- `nr_rt_device_down` is called from a netdevice notifier (`nr_device_event`) when a network device goes down. The notifier explicitly ignores devices outside of `init_net` (`if (!net_eq(dev_net(dev), &init_net)) return NOTIFY_DONE;`). Bringing down a device in `init_net` requires `CAP_NET_ADMIN` in the initial user namespace.
- `nr_dec_obs` is only reachable via the `SIOCNRDECOBS` ioctl on a NetROM socket. The `nr_ioctl` handler explicitly checks `capable(CAP_NET_ADMIN)` before processing this ioctl. The `capable()` function checks for capabilities in the initial user namespace (`init_user_ns`), meaning it cannot be bypassed by creating a new user namespace.
- Other paths that could potentially trigger the reverse locking order (like `nr_del_neigh`, `nr_del_node`, or `nr_add_node` replacing a route) are also only reachable via `nr_rt_ioctl` (`SIOCDELRT`, `SIOCADDRT`), which similarly require `CAP_NET_ADMIN` in the initial user namespace.
- While `nr_add_node` can be reached by processing an incoming NetROM packet (`nr_route_frame`), it is called with a `quality` of `0`. The logic in `nr_add_node` will never replace an existing route (and thus never call `nr_remove_neigh` to acquire `nr_neigh_list_lock`) if the provided quality is `0`.
### Conclusion:
This deadlock can only be triggered by a highly privileged user (root or a user with `CAP_NET_ADMIN` in the initial user namespace). It is not accessible to unprivileged users, cannot be triggered remotely via network packets, and is not exploitable for privilege escalation.
|
| 6/2 |
2026/05/21 04:49 |
llm |
expert |
0m
Model:
Tokens:
input: 14580
output: 46
thoughts: 428
Thoughts: **Analyzing a Circular Locking Dependency in Netrom**
Okay, so I've got this syzkaller report popping up, flagging a potential circular locking dependency in the netrom code. The warning pinpoints a circular dependency, and I need to figure out what's going on. The locks in question are `nr_node_list_lock`, `nr_neigh_list_lock`, and `&nr_node->node_lock`.
Let's break down this dependency chain. The report shows:
1. `nr_neigh_list_lock` is dependent on `&nr_node->node_lock`. This is triggered via a call chain from `nr_rt_ioctl` to `nr_dec_obs` and finally to `nr_remove_neigh`. `nr_dec_obs` first takes the `nr_node_lock` (which is the same as `&nr_node->node_lock`). Then calls `nr_remove_neigh` which grabs `nr_neigh_list_lock`. That seems reasonable.
2. `&nr_node->node_lock` depends on `nr_node_list_lock`. Now, the report indicates `nr_rt_device_down` is involved, and that's where things get interesting. Initially, I thought `nr_rt_device_down` takes `nr_node_list_lock` then *also* takes `nr_neigh_list_lock`. But hang on... the report is a little more specific. It mentions that `nr_rt_device_down` takes `nr_node_list_lock` while *already holding* `nr_neigh_list_lock`. That's the circular part! That means the chain is `nr_neigh_list_lock` --> `nr_node_list_lock` and then the report says the *reverse* order happens in `nr_rt_device_down`. The report also says `nr_rt_device_down` grabs `nr_node_list_lock` at `nr_rt_device_down+0xd3/0x810` while still holding `nr_neigh_list_lock` at `nr_rt_device_down+0x2c/0x810`.
Okay, the report confirms it. This is a classic deadlock scenario. Time to start digging into the `net/netrom/nr_route.c` code to understand the call flow and how to fix this...
|
| 7/2 |
2026/05/21 04:49 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeLines:true Name:nr_rt_device_down]
Results: map[SourceCode: 504: /*
505: * A device has been removed. Remove its routes and neighbours.
506: */
507: void nr_rt_device_down(struct net_device *dev)
508: {
509: struct nr_neigh *s;
510: struct hlist_node *nodet, *node2t;
511: struct nr_node *t;
512: int i;
513:
514: spin_lock_bh(&nr_neigh_list_lock);
515: nr_neigh_for_each_safe(s, nodet, &nr_neigh_list) {
516: if (s->dev == dev) {
517: spin_lock_bh(&nr_node_list_lock);
518: nr_node_for_each_safe(t, node2t, &nr_node_list) {
519: nr_node_lock(t);
520: for (i = 0; i < t->count; i++) {
521: if (t->routes[i].neighbour == s) {
522: t->count--;
523:
524: switch (i) {
525: case 0:
526: t->routes[0] = t->routes[1];
527: fallthrough;
528: case 1:
529: t->routes[1] = t->routes[2];
530: break;
531: case 2:
532: break;
533: }
534: }
535: }
536:
537: if (t->count <= 0)
538: nr_remove_node_locked(t);
539: nr_node_unlock(t);
540: }
541: spin_unlock_bh(&nr_node_list_lock);
542:
543: nr_remove_neigh_locked(s);
544: }
545: }
546: spin_unlock_bh(&nr_neigh_list_lock);
547: }
SourceFile:net/netrom/nr_route.c]
|
| 8/2 |
2026/05/21 04:49 |
llm |
expert |
0m
Model:
Tokens:
input: 16242
output: 44
thoughts: 99
Thoughts: Okay, here's my interpretation of this locking sequence, thinking through it as you asked.
**Analyzing the Lock Ordering in `nr_rt_device_down`**
Right, let me break this down. It seems we're looking at a function, `nr_rt_device_down`, and its locking behavior. It's crucial to understand the order in which locks are acquired to avoid potential deadlock situations, especially in a networking context.
First, I see that `nr_rt_device_down` grabs `nr_neigh_list_lock` first. Then, it proceeds to acquire `nr_node_list_lock`, and finally `nr_node_lock(t)`. So, the acquisition order is crystal clear: `nr_neigh_list_lock` comes before `nr_node_list_lock`, which in turn comes before the per-node lock `nr_node_lock`. That's the critical observation here. This specific ordering, `nr_neigh_list_lock` -> `nr_node_list_lock` -> `nr_node_lock`, has to be maintained consistently throughout the code base to prevent deadlocks. Knowing this order is the first step, and now the next thing I'll check is `nr_dec_obs`.
|
| 9/2 |
2026/05/21 04:49 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeLines:true Name:nr_dec_obs]
Results: map[SourceCode: 445: /*
446: * Decrement the obsolescence count by one. If a route is reduced to a
447: * count of zero, remove it. Also remove any unlocked neighbours with
448: * zero nodes routing via it.
449: */
450: static int nr_dec_obs(void)
451: {
452: struct nr_neigh *nr_neigh;
453: struct nr_node *s;
454: struct hlist_node *nodet;
455: int i;
456:
457: spin_lock_bh(&nr_node_list_lock);
458: nr_node_for_each_safe(s, nodet, &nr_node_list) {
459: nr_node_lock(s);
460: for (i = 0; i < s->count; i++) {
461: switch (s->routes[i].obs_count) {
462: case 0: /* A locked entry */
463: break;
464:
465: case 1: /* From 1 -> 0 */
466: nr_neigh = s->routes[i].neighbour;
467:
468: nr_neigh->count--;
469: nr_neigh_put(nr_neigh);
470:
471: if (nr_neigh->count == 0 && !nr_neigh->locked)
472: nr_remove_neigh(nr_neigh);
473:
474: s->count--;
475:
476: switch (i) {
477: case 0:
478: s->routes[0] = s->routes[1];
479: fallthrough;
480: case 1:
481: s->routes[1] = s->routes[2];
482: break;
483: case 2:
484: break;
485: }
486: break;
487:
488: default:
489: s->routes[i].obs_count--;
490: break;
491:
492: }
493: }
494:
495: if (s->count <= 0)
496: nr_remove_node_locked(s);
497: nr_node_unlock(s);
498: }
499: spin_unlock_bh(&nr_node_list_lock);
500:
501: return 0;
502: }
SourceFile:net/netrom/nr_route.c]
|
| 10/2 |
2026/05/21 04:49 |
llm |
expert |
0m
Model:
Tokens:
input: 17455
output: 44
thoughts: 51
Thoughts: Here's my understanding of the process, breaking it down in my own thought process:
**Deconstructing the Neighbor Removal Sequence**
Okay, so looking at this section of the code, I can see the `nr_dec_obs` function is responsible for decrementing observation counts, I assume related to network neighbors. The first thing that jumps out is the locking order: it grabs `nr_node_list_lock` at line 457. This suggests a global lock on the node list itself, probably to protect the integrity of the overall neighbor data structure during modification. Then, at line 459, it acquires `nr_node_lock(s)`. The plural "s" implies potentially grabbing multiple node-specific locks, likely iterating through a set of nodes. This nested locking is important for managing concurrent access and I need to double-check the context, but it seems that individual nodes are protected by their own lock, while the global list is protected by the list lock. After grabbing the locks, `nr_remove_neigh` is called at line 472. This confirms that these locks are held specifically for performing a neighbor removal. I need to dig into `nr_remove_neigh` now, as that's the core of the operation, to understand exactly how the removal is handled with this locking strategy. The design seems to be attempting to avoid deadlocks by grabbing locks in a specific order: first the global structure, then the per-element locks. I need to make sure this is consistent throughout the other areas of the codebase.
|
| 11/2 |
2026/05/21 04:49 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeLines:true Name:nr_remove_neigh]
Results: map[SourceCode: 305: static void nr_remove_neigh(struct nr_neigh *nr_neigh)
306: {
307: spin_lock_bh(&nr_neigh_list_lock);
308: __nr_remove_neigh(nr_neigh);
309: spin_unlock_bh(&nr_neigh_list_lock);
310: }
SourceFile:net/netrom/nr_route.c]
|
| 12/2 |
2026/05/21 04:49 |
llm |
expert |
0m
Model:
Tokens:
input: 18008
output: 44
thoughts: 303
Thoughts: **Analyzing a Potential Deadlock in the Network Routing Code**
Okay, so I'm looking at this locking sequence in the network routing code, and something's immediately jumping out at me. I see that the `nr_remove_neigh` function, at line 307, grabs the `nr_neigh_list_lock`. Now, `nr_dec_obs` establishes a lock hierarchy that goes: `nr_node_list_lock` then `nr_node_lock` and *then* `nr_neigh_list_lock`. That's not good, that's a clear circular dependency that's screaming "potential deadlock!"
I'm seeing it right here: `nr_rt_device_down` also uses `nr_neigh_list_lock`, then `nr_node_list_lock`, and finally `nr_node_lock`. Combined with `nr_dec_obs`, we've got a definite circular locking dependency. `nr_rt_device_down` and `nr_dec_obs` have conflicting lock acquisition orders. This is a classic recipe for a deadlock and ultimately, a Denial of Service.
Now, generally, deadlocks aren't really exploitable in the sense that they lead to privilege escalation or memory corruption. But they'll absolutely hang the system, especially if it's a spinlock deadlock, which would cause a hard lockup on the involved CPU cores.
The crucial question is whether an unprivileged user can trigger this. `nr_rt_device_down` is called from `nr_device_event`, which is a netdevice notifier, so an admin action could trigger it. `nr_dec_obs` is invoked via `nr_rt_ioctl`, specifically with `SIOCNRDECOBS`. I'll have to take a closer look at `nr_rt_ioctl` now, to see how that's exposed to userspace.
|
| 13/2 |
2026/05/21 04:49 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeLines:true Name:nr_rt_ioctl]
Results: map[SourceCode: 626: /*
627: * Handle the ioctls that control the routing functions.
628: */
629: int nr_rt_ioctl(unsigned int cmd, void __user *arg)
630: {
631: struct nr_route_struct nr_route;
632: struct net_device *dev;
633: ax25_digi digi;
634: int ret;
635:
636: switch (cmd) {
637: case SIOCADDRT:
638: if (copy_from_user(&nr_route, arg, sizeof(struct nr_route_struct)))
639: return -EFAULT;
640: if (nr_route.ndigis > AX25_MAX_DIGIS)
641: return -EINVAL;
642: if ((dev = nr_ax25_dev_get(nr_route.device)) == NULL)
643: return -EINVAL;
644: switch (nr_route.type) {
645: case NETROM_NODE:
646: if (strnlen(nr_route.mnemonic, 7) == 7) {
647: ret = -EINVAL;
648: break;
649: }
650:
651: ret = nr_add_node(&nr_route.callsign,
652: nr_route.mnemonic,
653: &nr_route.neighbour,
654: nr_call_to_digi(&digi, nr_route.ndigis,
655: nr_route.digipeaters),
656: dev, nr_route.quality,
657: nr_route.obs_count);
658: break;
659: case NETROM_NEIGH:
660: ret = nr_add_neigh(&nr_route.callsign,
661: nr_call_to_digi(&digi, nr_route.ndigis,
662: nr_route.digipeaters),
663: dev, nr_route.quality);
664: break;
665: default:
666: ret = -EINVAL;
667: }
668: dev_put(dev);
669: return ret;
670:
671: case SIOCDELRT:
672: if (copy_from_user(&nr_route, arg, sizeof(struct nr_route_struct)))
673: return -EFAULT;
674: if ((dev = nr_ax25_dev_get(nr_route.device)) == NULL)
675: return -EINVAL;
676: switch (nr_route.type) {
677: case NETROM_NODE:
678: ret = nr_del_node(&nr_route.callsign,
679: &nr_route.neighbour, dev);
680: break;
681: case NETROM_NEIGH:
682: ret = nr_del_neigh(&nr_route.callsign,
683: dev, nr_route.quality);
684: break;
685: default:
686: ret = -EINVAL;
687: }
688: dev_put(dev);
689: return ret;
690:
691: case SIOCNRDECOBS:
692: return nr_dec_obs();
693:
694: default:
695: return -EINVAL;
696: }
697:
698: return 0;
699: }
SourceFile:net/netrom/nr_route.c]
|
| 14/2 |
2026/05/21 04:49 |
llm |
expert |
0m
Model:
Tokens:
input: 19841
output: 43
thoughts: 38
Thoughts: Okay, here's my interpretation of those thoughts, framed as my own, given my expertise:
**Checking Net/ROM IOCTL Accessibility**
Alright, a key question just popped into my head: is this `nr_rt_ioctl` function available for unprivileged users to call? That's a crucial security consideration. Time to dig in. The obvious place to start is the `nr_ioctl` function in `net/netrom/af_netrom.c`. That's where the primary IOCTL handling would reside for Net/ROM, so it's the logical jumping-off point to see if there are any access control checks being performed. I need to understand what controls access to that function, to then understand whether `nr_rt_ioctl` is protected.
|
| 15/2 |
2026/05/21 04:49 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/af_netrom.c IncludeLines:true Name:nr_ioctl]
Results: map[SourceCode:1208: static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1209: {
1210: struct sock *sk = sock->sk;
1211: void __user *argp = (void __user *)arg;
1212:
1213: switch (cmd) {
1214: case TIOCOUTQ: {
1215: long amount;
1216:
1217: lock_sock(sk);
1218: amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
1219: if (amount < 0)
1220: amount = 0;
1221: release_sock(sk);
1222: return put_user(amount, (int __user *)argp);
1223: }
1224:
1225: case TIOCINQ: {
1226: struct sk_buff *skb;
1227: long amount = 0L;
1228:
1229: lock_sock(sk);
1230: /* These two are safe on a single CPU system as only user tasks fiddle here */
1231: if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
1232: amount = skb->len;
1233: release_sock(sk);
1234: return put_user(amount, (int __user *)argp);
1235: }
1236:
1237: case SIOCGIFADDR:
1238: case SIOCSIFADDR:
1239: case SIOCGIFDSTADDR:
1240: case SIOCSIFDSTADDR:
1241: case SIOCGIFBRDADDR:
1242: case SIOCSIFBRDADDR:
1243: case SIOCGIFNETMASK:
1244: case SIOCSIFNETMASK:
1245: case SIOCGIFMETRIC:
1246: case SIOCSIFMETRIC:
1247: return -EINVAL;
1248:
1249: case SIOCADDRT:
1250: case SIOCDELRT:
1251: case SIOCNRDECOBS:
1252: if (!capable(CAP_NET_ADMIN))
1253: return -EPERM;
1254: return nr_rt_ioctl(cmd, argp);
1255:
1256: default:
1257: return -ENOIOCTLCMD;
1258: }
1259:
1260: return 0;
1261: }
SourceFile:net/netrom/af_netrom.c]
|
| 16/2 |
2026/05/21 04:49 |
llm |
expert |
0m
Model:
Tokens:
input: 20855
output: 52
thoughts: 156
Thoughts: **Analyzing the Vulnerability in `nr_ioctl`**
Okay, so I'm digging into this `nr_ioctl` function. It seems it uses `capable(CAP_NET_ADMIN)` to gate access for `SIOCADDRT`, `SIOCDELRT`, and `SIOCNRDECOBS`. My initial thought was, "Aha! Security check!" But wait... hold on. That `capable(CAP_NET_ADMIN)` check, it's checking the *initial* user namespace, not the *current* one! That's a critical distinction.
Let me just confirm that. Yes, I see it. `capable()` uses `init_user_ns`. For a more targeted check to apply to a specific namespace, I'd need to use `ns_capable()`. So, the check effectively requires `CAP_NET_ADMIN` in the root namespace, not the user's current one.
This implies that an unprivileged user, even one *within* a user namespace, can't trigger this issue. Excellent! That really reduces the potential attack surface.
Now... I need to be thorough. Is there *any* other path to `nr_dec_obs`? Is there some other way to call that function that I'm overlooking? I can't be confident in this assessment until I've eliminated that possibility. I need to make sure this isn't just a red herring.
|
| 17/2 |
2026/05/21 04:50 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_dec_obs SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_rt_ioctl SourceFile:net/netrom/nr_route.c SourceLine:692]] TruncatedOutput:false]
|
| 18/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 21438
output: 52
thoughts: 32
Thoughts: Okay, here's my interpretation of those thoughts, presented as a summary from my perspective, keeping in mind my expertise:
**Investigating the Call Hierarchy of `nr_dec_obs`**
Alright, let me see... I'm looking at this `nr_dec_obs` function, and my immediate concern is its call graph. The code shows it's only called from `nr_rt_ioctl`, which is a good starting point. But I need to be *absolutely* sure of that. It's a key observation, and if true it will simplify quite a few things.
The question that naturally springs to mind is: does `nr_rt_ioctl` have any other callers? I need to verify its call sites comprehensively. Are there any other potential entry points into the path that eventually leads to the `nr_dec_obs` function? I have to trace back the call chain and make sure that `nr_rt_ioctl` isn't called from another, perhaps unexpected, location. Any unknown sources for calling `nr_rt_ioctl` would warrant a deeper dive to eliminate any unexpected side effects. I need to be 100% confident in that.
|
| 19/2 |
2026/05/21 04:50 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_rt_ioctl SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_ioctl SourceFile:net/netrom/af_netrom.c SourceLine:1254]] TruncatedOutput:false]
|
| 20/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 21845
output: 37
thoughts: 371
Thoughts: **Analyzing the Security Implications of `nr_rt_ioctl`**
Okay, so I'm looking at this code path. It seems `nr_rt_ioctl` is only ever called from `nr_ioctl`, which is a good starting point. The crucial part is that `nr_ioctl` *should* be checking for `capable(CAP_NET_ADMIN)` before it calls `nr_rt_ioctl` when the command is `SIOCNRDECOBS`. That's the key.
Let me just quickly verify the setup of the reproducer. It looks like syzkaller is running it, which is the usual scenario. Syzkaller often runs as root, or within a namespace with the required capabilities, but wait, it's using user namespaces. That makes things more interesting. If `capable(CAP_NET_ADMIN)` is being used, it checks the *initial* user namespace, right? Does syzkaller have that capability there?
Typically, syzkaller runs as root in the initial namespace, if it's not using user namespaces. And if it *is* using user namespaces, it probably *wouldn't* have `CAP_NET_ADMIN` in the initial namespace unless the syzkaller process itself is running as root.
Hold on, let me look at the reproducer: `syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x89e2, 0);`. Ah, 0x89e2 is `SIOCNRDECOBS`, the command we care about. So, if syzkaller is running as root, it *could* trigger the vulnerability.
For the assessment then, I think:
* Exploitable: No, it is a deadlock.
* Denial of Service: Yes, a deadlock is a denial of service.
* Accessible From Unprivileged Processes: No, because it requires `CAP_NET_ADMIN` in the initial namespace.
* Accessible From User Namespaces: No, the `capable(CAP_NET_ADMIN)` check is on the initial namespace, not the current one.
One last thing, let me just quickly double check if `capable()` *definitely* checks the initial namespace to be completely certain.
|
| 21/2 |
2026/05/21 04:50 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/linux/capability.h IncludeLines:true Name:capable]
Results: map[SourceCode: 404: /**
405: * capable - Determine if the current task has a superior capability in effect
406: * @cap: The capability to be tested for
407: *
408: * Return true if the current task has the given superior capability currently
409: * available for use, false if not.
410: *
411: * This sets PF_SUPERPRIV on the task if the capability is available on the
412: * assumption that it's about to be used.
413: */
414: bool capable(int cap)
415: {
416: return ns_capable(&init_user_ns, cap);
417: }
SourceFile:kernel/capability.c]
|
| 22/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 22959
output: 54
thoughts: 80
Thoughts: Okay, let's break this down.
**Analyzing Potential Triggers for `nr_rt_device_down`**
Right, so `capable()` *definitely* checks `init_user_ns`. That's a key piece of information. This strongly suggests that unprivileged processes are fundamentally unable to directly trigger this behavior. User namespaces are also effectively ruled out as a vector. Unless, of course, the user already somehow possesses `CAP_NET_ADMIN` within `init_user_ns`. But, if they have that capability within the initial user namespace, they're essentially already privileged. That's not a concern.
So, where else could this come from? We've eliminated a major class of potential sources. Now, we need to focus on other paths. What other conditions, functions, or system calls could conceivably lead to this state? The attack surface must be narrowed. This opens a new avenue to discover potential exploit vectors.
|
| 23/2 |
2026/05/21 04:50 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_rt_device_down SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_device_event SourceFile:net/netrom/af_netrom.c SourceLine:126]] TruncatedOutput:false]
|
| 24/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 23365
output: 45
thoughts: 19
Thoughts: Okay, here's my interpretation of that thought process, from an expert's perspective:
**My Perspective on `nr_rt_device_down` and `nr_device_event`**
Right, so I'm thinking about the way these radio access network (RAN) device management routines interact. Specifically, the function `nr_rt_device_down`. I understand immediately that this routine is triggered, or at least invoked, from within the broader `nr_device_event` handling. That's key. It tells me something about the flow and the hierarchy of device state transitions in the RAN control plane.
When I see this, my initial thought is: What kind of "event" is causing the `nr_rt_device_down` call? Is it a hardware failure signal, a software-generated deactivation request, a network-initiated shutdown, or perhaps a resource conflict? Itβs crucial to know the triggering event to properly diagnose a device down situation. Understanding the trigger helps immediately focus debugging.
This relationship between `nr_device_event` and `nr_rt_device_down` is important for several reasons. It implies a centralised event handling system that decides which devices need to be affected. It also suggests that this particular "down" transition is a *routine* or *orchestrated* process, part of the wider state machine. It's not a direct, ad-hoc response, but a managed deactivation as part of the overall RAN management system. The architecture is clearly designed so that a central entity decides which specific device is affected.
My next step would be to drill down into the specific implementation of both `nr_device_event` and `nr_rt_device_down`. I'd want to examine the event context passed to `nr_device_event` and what data it holds, and understand exactly what `nr_rt_device_down` does within the real time side of the RAN, and any relevant state variables it touches. Is this a graceful shutdown, or a hard stop? Does this `down` procedure involve resource reclamation, signalling to other network components, or both? Are there any dependencies or race conditions I need to consider? Knowing the details allows us to understand the behavior of the RAN in a controlled manner. It's essential to understand the bigger picture when debugging.
|
| 25/2 |
2026/05/21 04:50 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/af_netrom.c IncludeLines:true Name:nr_device_event]
Results: map[SourceCode: 112: /*
113: * Handle device status changes.
114: */
115: static int nr_device_event(struct notifier_block *this, unsigned long event, void *ptr)
116: {
117: struct net_device *dev = netdev_notifier_info_to_dev(ptr);
118:
119: if (!net_eq(dev_net(dev), &init_net))
120: return NOTIFY_DONE;
121:
122: if (event != NETDEV_DOWN)
123: return NOTIFY_DONE;
124:
125: nr_kill_by_device(dev);
126: nr_rt_device_down(dev);
127:
128: return NOTIFY_DONE;
129: }
SourceFile:net/netrom/af_netrom.c]
|
| 26/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 24194
output: 54
thoughts: 988
Thoughts: **Analyzing a Potential NetROM Deadlock**
Okay, so I'm looking at this `nr_device_event` function, which is a netdevice notifier. It gets triggered when a network device goes down (`NETDEV_DOWN`). The immediate question is, can an unprivileged user bring a network device down and trigger this? Nope, that requires `CAP_NET_ADMIN` in the namespace that owns the network device.
Ah, but wait, a user *can* create a network namespace and, in that namespace, they have `CAP_NET_ADMIN`. They could create a device (like a veth or dummy interface) and then shut it down. But, there's a check in `nr_device_event`: `if (!net_eq(dev_net(dev), &init_net)) return NOTIFY_DONE;`. This means it only cares about devices within the `init_net` namespace. To bring down a device within `init_net`, you need `CAP_NET_ADMIN` in the `init_user_ns`. So, again, unprivileged users or those within user namespaces are out.
Now, let's look at the other side of this potential deadlock: `nr_dec_obs`. We already established that it also requires `capable(CAP_NET_ADMIN)`, which checks the `init_user_ns`. So both sides of this are restricted to privileged users. This means the bug is only exploitable by a user with root privileges or who possesses `CAP_NET_ADMIN` in the initial namespace.
Just to be absolutely sure, I'll double-check if there are any other possible paths to `nr_rt_device_down` or `nr_dec_obs`. I've already used `codesearch-find-references` to verify the callers for both.
Let's review the dimensions:
* **Exploitable:** No. This is a circular locking dependency β a deadlock. Deadlocks cause hangs, not memory corruption or privilege escalation.
* **Denial of Service:** Yes. A deadlock in the kernel will hang the tasks involved. Since these are `spin_lock_bh` locks, it will disable bottom halves and spin forever, causing a hard lockup on the CPUs involved. This is definitely a DoS.
* **Accessible From Unprivileged Processes:** No. Requires `CAP_NET_ADMIN` in `init_user_ns`.
* **Accessible From User Namespaces:** No. `capable(CAP_NET_ADMIN)` checks `init_user_ns`.
* **VM Guest Trigger:** No. This is NetROM-specific, not related to VM guest/host communication.
* **VM Host Trigger in the Confidential Computing Context:** No.
* **Ethernet Network Trigger:** No. This is triggered by ioctls (`SIOCNRDECOBS`) and device down events, not by receiving network packets.
* **Other Remote Trigger:** No.
* **Peripheral Trigger:** No.
* **Malicious Filesystem Trigger:** No.
Okay, I need to confirm if receiving a packet could trigger `nr_dec_obs`. The only caller of `nr_dec_obs` is `nr_rt_ioctl`. Wait, is there any other way `nr_neigh_list_lock` and `nr_node_list_lock` can be taken in the *opposite* order? The lockdep report shows the following dependency:
* `nr_node_list_lock` --> `&nr_node->node_lock` --> `nr_neigh_list_lock`
Okay, the lockdep report is clear:
* `nr_rt_device_down` takes `nr_neigh_list_lock` then `nr_node_list_lock`.
* `nr_dec_obs` takes `nr_node_list_lock` then `nr_node_lock` then `nr_neigh_list_lock`.
The lockdep report points out the specific issue: a task is trying to acquire `nr_node_list_lock` in `nr_rt_device_down` while already holding `nr_neigh_list_lock`. The same situation can happen with nr_dec_obs, confirming the deadlock.
Are there any other places where these locks are taken? I'll check `nr_neigh_list_lock`.
|
| 27/2 |
2026/05/21 04:50 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_neigh_list_lock SourceTreePrefix:]
Results: map[References:<nil> TruncatedOutput:false]
|
| 28/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 26192
output: 54
thoughts: 17
Thoughts: Okay, here's my summarized thought process, assuming I'm an expert and this is relevant to my work:
**Investigating a Concurrency Issue**
Hmm, something's not quite right. I have a hunch that I might be dealing with a concurrency problem, possibly related to some sort of locking mechanism used in the neighborhood list. I should probably start by searching for all instances of `nr_neigh_list_lock` in the codebase. That seems like the most likely point of contention and a good starting point for understanding how the list is accessed and protected from race conditions. This should give me a better understanding of how the lock is being used.
|
| 29/2 |
2026/05/21 04:50 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_neigh_list_lock SourceTreePrefix:]
Results: map[References:<nil> TruncatedOutput:false]
|
| 30/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 26417
output: 21
thoughts: 25
Thoughts: Okay, here's my summary, presented as a stream of thought:
**Initial Assessment: Variable Identification & Search Strategy**
Alright, this is interesting. The first thing that jumps out is that it's a variable. Given that, my immediate instinct is to figure out what it's connected to, how it's used, and what context it lives in. I need more information to understand its significance.
So, let's start with a focused search. I'll reach for grepper β that's usually my go-to for quickly navigating codebases and seeing where a specific symbol is defined and referenced. The target is `nr_neigh_list_lock`, so let's plug that into grepper and see what surfaces. That should give me a good initial picture.
|
| 31/2 |
2026/05/21 04:50 |
tool |
grepper |
0m
Args: map[Expression:nr_neigh_list_lock]
Results: map[Output:net/netrom/nr_route.c=41=static HLIST_HEAD(nr_neigh_list);
net/netrom/nr_route.c:42:static DEFINE_SPINLOCK(nr_neigh_list_lock);
net/netrom/nr_route.c-43-
--
net/netrom/nr_route.c=60=static struct nr_neigh *nr_neigh_get_dev(ax25_address *callsign,
--
net/netrom/nr_route.c-65-
net/netrom/nr_route.c:66: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-67- nr_neigh_for_each(nr_neigh, &nr_neigh_list)
--
net/netrom/nr_route.c-73- }
net/netrom/nr_route.c:74: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-75- return found;
--
net/netrom/nr_route.c=97=static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
--
net/netrom/nr_route.c-174-
net/netrom/nr_route.c:175: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-176- hlist_add_head(&nr_neigh->neigh_node, &nr_neigh_list);
net/netrom/nr_route.c-177- nr_neigh_hold(nr_neigh);
net/netrom/nr_route.c:178: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-179- }
--
net/netrom/nr_route.c=305=static void nr_remove_neigh(struct nr_neigh *nr_neigh)
net/netrom/nr_route.c-306-{
net/netrom/nr_route.c:307: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-308- __nr_remove_neigh(nr_neigh);
net/netrom/nr_route.c:309: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-310-}
--
net/netrom/nr_route.c=379=static int __must_check nr_add_neigh(ax25_address *callsign,
--
net/netrom/nr_route.c-414-
net/netrom/nr_route.c:415: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-416- hlist_add_head(&nr_neigh->neigh_node, &nr_neigh_list);
net/netrom/nr_route.c-417- /* refcount is initialized at 1 */
net/netrom/nr_route.c:418: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-419-
--
net/netrom/nr_route.c=507=void nr_rt_device_down(struct net_device *dev)
--
net/netrom/nr_route.c-513-
net/netrom/nr_route.c:514: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-515- nr_neigh_for_each_safe(s, nodet, &nr_neigh_list) {
--
net/netrom/nr_route.c-545- }
net/netrom/nr_route.c:546: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-547-}
--
net/netrom/nr_route.c=705=void nr_link_failed(ax25_cb *ax25, int reason)
--
net/netrom/nr_route.c-709-
net/netrom/nr_route.c:710: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-711- nr_neigh_for_each(s, &nr_neigh_list) {
--
net/netrom/nr_route.c-717- }
net/netrom/nr_route.c:718: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-719-
--
net/netrom/nr_route.c=902=static void *nr_neigh_start(struct seq_file *seq, loff_t *pos)
net/netrom/nr_route.c:903: __acquires(&nr_neigh_list_lock)
net/netrom/nr_route.c-904-{
net/netrom/nr_route.c:905: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-906- return seq_hlist_start_head(&nr_neigh_list, *pos);
--
net/netrom/nr_route.c=914=static void nr_neigh_stop(struct seq_file *seq, void *v)
net/netrom/nr_route.c:915: __releases(&nr_neigh_list_lock)
net/netrom/nr_route.c-916-{
net/netrom/nr_route.c:917: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-918-}
--
net/netrom/nr_route.c=962=void nr_rt_free(void)
--
net/netrom/nr_route.c-967-
net/netrom/nr_route.c:968: spin_lock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-969- spin_lock_bh(&nr_node_list_lock);
--
net/netrom/nr_route.c-982- spin_unlock_bh(&nr_node_list_lock);
net/netrom/nr_route.c:983: spin_unlock_bh(&nr_neigh_list_lock);
net/netrom/nr_route.c-984-}
]
|
| 32/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 28314
output: 19
thoughts: 176
Thoughts: **Analyzing a Potential Race Condition**
Okay, let's break this down. My initial observation is concerning. I see that `nr_rt_free` acquires `nr_neigh_list_lock` before `nr_node_list_lock`, and `nr_rt_device_down` *also* acquires the locks in the same order: `nr_neigh_list_lock` then `nr_node_list_lock`. That's good; at least those two are consistent. But then I see `nr_dec_obs` β and specifically through its call to `nr_remove_neigh` β acquires the locks in this order: `nr_node_list_lock`, then `nr_node_lock`, and *then* finally `nr_neigh_list_lock`. Bingo. This creates a circular dependency in the lock acquisition order, meaning there's a potential for a deadlock situation. This has to be addressed.
Now, I need to consider the vulnerability surface. Can `nr_rt_free` be triggered by an unprivileged user? If so, this is a much more significant problem. I need to trace the call graph for `nr_rt_free` to verify where it can be called from and what context it is being called from.
|
| 33/2 |
2026/05/21 04:50 |
tool |
grepper |
0m
Args: map[Expression:nr_rt_free]
Results: map[Output:include/net/netrom.h=222=extern const struct seq_operations nr_neigh_seqops;
include/net/netrom.h:223:void nr_rt_free(void);
include/net/netrom.h-224-
--
net/netrom/af_netrom.c=1389=static int __init nr_proto_init(void)
--
net/netrom/af_netrom.c-1470- nr_loopback_clear();
net/netrom/af_netrom.c:1471: nr_rt_free();
net/netrom/af_netrom.c-1472-
--
net/netrom/af_netrom.c=1503=static void __exit nr_exit(void)
--
net/netrom/af_netrom.c-1511-
net/netrom/af_netrom.c:1512: nr_rt_free();
net/netrom/af_netrom.c-1513-
--
net/netrom/nr_route.c=951=const struct seq_operations nr_neigh_seqops = {
--
net/netrom/nr_route.c-961- */
net/netrom/nr_route.c:962:void nr_rt_free(void)
net/netrom/nr_route.c-963-{
]
|
| 34/2 |
2026/05/21 04:50 |
llm |
expert |
0m
Model:
Tokens:
input: 29142
output: 19
thoughts: 37
Thoughts: Okay, here's my interpretation of those thoughts, framed as my own:
**Analyzing Network Resource Release**
Right, so `nr_rt_free`. That's not something that happens at runtime, then. It's tied to module exit or if there's a problem during initialization. That makes sense, a cleanup function if things go south or when the module is no longer needed. So that explains where *that* function fits into the picture.
Now, I need to consider `nr_link_failed`. What does *that* represent in terms of the network resource life cycle? That's going to be key to a fulsome understanding of failure scenarios.
|
| 35/2 |
2026/05/21 04:51 |
tool |
grepper |
0m
Args: map[Expression:nr_link_failed]
Results: map[Output:include/net/netrom.h=218=int nr_rt_ioctl(unsigned int, void __user *);
include/net/netrom.h:219:void nr_link_failed(ax25_cb *, int);
include/net/netrom.h-220-int nr_route_frame(struct sk_buff *, ax25_cb *);
--
net/netrom/af_netrom.c=1385=static struct ax25_linkfail nr_linkfail_notifier = {
net/netrom/af_netrom.c:1386: .func = nr_link_failed,
net/netrom/af_netrom.c-1387-};
--
net/netrom/nr_route.c=629=int nr_rt_ioctl(unsigned int cmd, void __user *arg)
--
net/netrom/nr_route.c-704- */
net/netrom/nr_route.c:705:void nr_link_failed(ax25_cb *ax25, int reason)
net/netrom/nr_route.c-706-{
]
|
| 36/2 |
2026/05/21 04:51 |
llm |
expert |
0m
Model:
Tokens:
input: 29631
output: 44
thoughts: 32
Thoughts: Okay, here's my attempt at summarizing those thoughts from an expert's perspective, using the first person and assuming I'm deeply familiar with the subject matter:
**AX.25 Link Failure Considerations**
Alright, let's see... `nr_link_failed` is triggered by the AX.25 link failure notifier. The immediate question that pops into my head is: *Does it have ownership of `nr_node_list_lock`?* It's crucial to know this because any potential race conditions with other operations touching that node list could be disastrous. I need to understand how the locking hierarchy works here to avoid any data corruption or unexpected behavior when a link goes down. Knowing the locking context of this function is absolutely fundamental to ensure the overall integrity of the AX.25 implementation. Without that knowledge, I can't be confident in the code's robustness.
|
| 37/2 |
2026/05/21 04:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeLines:true Name:nr_link_failed]
Results: map[SourceCode: 701: /*
702: * A level 2 link has timed out, therefore it appears to be a poor link,
703: * then don't use that neighbour until it is reset.
704: */
705: void nr_link_failed(ax25_cb *ax25, int reason)
706: {
707: struct nr_neigh *s, *nr_neigh = NULL;
708: struct nr_node *nr_node = NULL;
709:
710: spin_lock_bh(&nr_neigh_list_lock);
711: nr_neigh_for_each(s, &nr_neigh_list) {
712: if (s->ax25 == ax25) {
713: nr_neigh_hold(s);
714: nr_neigh = s;
715: break;
716: }
717: }
718: spin_unlock_bh(&nr_neigh_list_lock);
719:
720: if (nr_neigh == NULL)
721: return;
722:
723: nr_neigh->ax25 = NULL;
724: ax25_cb_put(ax25);
725:
726: if (++nr_neigh->failed < READ_ONCE(sysctl_netrom_link_fails_count)) {
727: nr_neigh_put(nr_neigh);
728: return;
729: }
730: spin_lock_bh(&nr_node_list_lock);
731: nr_node_for_each(nr_node, &nr_node_list) {
732: nr_node_lock(nr_node);
733: if (nr_node->which < nr_node->count &&
734: nr_node->routes[nr_node->which].neighbour == nr_neigh)
735: nr_node->which++;
736: nr_node_unlock(nr_node);
737: }
738: spin_unlock_bh(&nr_node_list_lock);
739: nr_neigh_put(nr_neigh);
740: }
SourceFile:net/netrom/nr_route.c]
|
| 38/2 |
2026/05/21 04:51 |
llm |
expert |
0m
Model:
Tokens:
input: 30557
output: 44
thoughts: 48
Thoughts: Here's my analysis of the provided code snippet:
**Locking Behavior in Network Routing Functions**
Okay, so `nr_link_failed` is pretty straightforward. I see it's taking `nr_neigh_list_lock`, doing its thing, and then crucially, releasing that lock *before* acquiring `nr_node_list_lock`. That's good; no nested locking shenanigans, which is exactly what I'm looking for in terms of potential deadlock scenarios. This pattern is fairly typical and suggests careful consideration of lock ordering to prevent those concurrency headaches.
The main point I want to address is that I'll need to go deeper into `nr_route_frame` now to ensure it follows the same methodology.
|
| 39/2 |
2026/05/21 04:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeLines:true Name:nr_route_frame]
Results: map[SourceCode: 742: /*
743: * Route a frame to an appropriate AX.25 connection. A NULL ax25_cb
744: * indicates an internally generated frame.
745: */
746: int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
747: {
748: ax25_address *nr_src, *nr_dest;
749: struct nr_neigh *nr_neigh;
750: struct nr_node *nr_node;
751: struct net_device *dev;
752: unsigned char *dptr;
753: ax25_cb *ax25s;
754: int ret;
755: struct sk_buff *skbn;
756:
757: /*
758: * Reject malformed packets early. Check that it contains at least 2
759: * addresses and 1 byte more for Time-To-Live
760: */
761: if (skb->len < 2 * sizeof(ax25_address) + 1)
762: return 0;
763:
764: nr_src = (ax25_address *)(skb->data + 0);
765: nr_dest = (ax25_address *)(skb->data + 7);
766:
767: if (ax25 != NULL) {
768: ret = nr_add_node(nr_src, "", &ax25->dest_addr, ax25->digipeat,
769: ax25->ax25_dev->dev, 0,
770: READ_ONCE(sysctl_netrom_obsolescence_count_initialiser));
771: if (ret)
772: return ret;
773: }
774:
775: if ((dev = nr_dev_get(nr_dest)) != NULL) { /* Its for me */
776: if (ax25 == NULL) /* Its from me */
777: ret = nr_loopback_queue(skb);
778: else
779: ret = nr_rx_frame(skb, dev);
780: dev_put(dev);
781: return ret;
782: }
783:
784: if (!READ_ONCE(sysctl_netrom_routing_control) && ax25 != NULL)
785: return 0;
786:
787: /* Its Time-To-Live has expired */
788: if (skb->data[14] == 1) {
789: return 0;
790: }
791:
792: nr_node = nr_node_get(nr_dest);
793: if (nr_node == NULL)
794: return 0;
795: nr_node_lock(nr_node);
796:
797: if (nr_node->which >= nr_node->count) {
798: nr_node_unlock(nr_node);
799: nr_node_put(nr_node);
800: return 0;
801: }
802:
803: nr_neigh = nr_node->routes[nr_node->which].neighbour;
804:
805: if ((dev = nr_dev_first()) == NULL) {
806: nr_node_unlock(nr_node);
807: nr_node_put(nr_node);
808: return 0;
809: }
810:
811: /* We are going to change the netrom headers so we should get our
812: own skb, we also did not know until now how much header space
813: we had to reserve... - RXQ */
814: if ((skbn=skb_copy_expand(skb, dev->hard_header_len, 0, GFP_ATOMIC)) == NULL) {
815: nr_node_unlock(nr_node);
816: nr_node_put(nr_node);
817: dev_put(dev);
818: return 0;
819: }
820: kfree_skb(skb);
821: skb=skbn;
822: skb->data[14]--;
823:
824: dptr = skb_push(skb, 1);
825: *dptr = AX25_P_NETROM;
826:
827: ax25s = nr_neigh->ax25;
828: nr_neigh->ax25 = ax25_send_frame(skb, 256,
829: (const ax25_address *)dev->dev_addr,
830: &nr_neigh->callsign,
831: nr_neigh->digipeat, nr_neigh->dev);
832: if (ax25s)
833: ax25_cb_put(ax25s);
834:
835: dev_put(dev);
836: ret = (nr_neigh->ax25 != NULL);
837: nr_node_unlock(nr_node);
838: nr_node_put(nr_node);
839:
840: return ret;
841: }
SourceFile:net/netrom/nr_route.c]
|
| 40/2 |
2026/05/21 04:51 |
llm |
expert |
0m
Model:
Tokens:
input: 32402
output: 44
thoughts: 70
Thoughts: Here's my summary, as I understand the situation:
**Potential Locking Issue in Network Routing**
Okay, so I'm looking at this `nr_route_frame` function, and it seems like it grabs `nr_node_lock(nr_node)`. That's standard and expected β protecting the node's internal state during routing decisions. But here's the kicker: it doesn't appear to acquire the `nr_neigh_list_lock` or `nr_node_list_lock` before doing so. Now, that raises a red flag. We're potentially dealing with a race condition here.
And then, I just spotted something that really makes me raise an eyebrow. `nr_add_node` is called directly from within `nr_route_frame` (specifically, at line 768). That's not good. If `nr_add_node` is running concurrently, potentially it is modifying linked list data structures. If `nr_add_node` also assumes a similar locking scheme, we're likely going to run into concurrent access to data structures.
This has serious implications. I'll need to dig deeper into the locking schemes used by `nr_add_node` and its interactions with these shared data structures to determine if a potential locking issue is present. If it doesn't utilize similar locking, or doesn't release the `nr_node_lock`, that could lead to data corruption or, even worse, a kernel panic. I need to figure out what data is shared between these two functions and how they are handled, and analyze how `nr_add_node` actually interacts with the data structures protected by the locks. We need to be careful with this one.
|
| 41/2 |
2026/05/21 04:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeLines:true Name:nr_add_node]
Results: map[SourceCode: 93: /*
94: * Add a new route to a node, and in the process add the node and the
95: * neighbour if it is new.
96: */
97: static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
98: ax25_address *ax25, ax25_digi *ax25_digi, struct net_device *dev,
99: int quality, int obs_count)
100: {
101: struct nr_node *nr_node;
102: struct nr_neigh *nr_neigh;
103: int i, found;
104: struct net_device *odev;
105:
106: if ((odev=nr_dev_get(nr)) != NULL) { /* Can't add routes to ourself */
107: dev_put(odev);
108: return -EINVAL;
109: }
110:
111: nr_node = nr_node_get(nr);
112:
113: nr_neigh = nr_neigh_get_dev(ax25, dev);
114:
115: /*
116: * The L2 link to a neighbour has failed in the past
117: * and now a frame comes from this neighbour. We assume
118: * it was a temporary trouble with the link and reset the
119: * routes now (and not wait for a node broadcast).
120: */
121: if (nr_neigh != NULL && nr_neigh->failed != 0 && quality == 0) {
122: struct nr_node *nr_nodet;
123:
124: spin_lock_bh(&nr_node_list_lock);
125: nr_node_for_each(nr_nodet, &nr_node_list) {
126: nr_node_lock(nr_nodet);
127: for (i = 0; i < nr_nodet->count; i++)
128: if (nr_nodet->routes[i].neighbour == nr_neigh)
129: if (i < nr_nodet->which)
130: nr_nodet->which = i;
131: nr_node_unlock(nr_nodet);
132: }
133: spin_unlock_bh(&nr_node_list_lock);
134: }
135:
136: if (nr_neigh != NULL)
137: nr_neigh->failed = 0;
138:
139: if (quality == 0 && nr_neigh != NULL && nr_node != NULL) {
140: nr_neigh_put(nr_neigh);
141: nr_node_put(nr_node);
142: return 0;
143: }
144:
145: if (nr_neigh == NULL) {
146: if ((nr_neigh = kmalloc(sizeof(*nr_neigh), GFP_ATOMIC)) == NULL) {
147: if (nr_node)
148: nr_node_put(nr_node);
149: return -ENOMEM;
150: }
151:
152: nr_neigh->callsign = *ax25;
153: nr_neigh->digipeat = NULL;
154: nr_neigh->ax25 = NULL;
155: nr_neigh->dev = dev;
156: nr_neigh->quality = READ_ONCE(sysctl_netrom_default_path_quality);
157: nr_neigh->locked = 0;
158: nr_neigh->count = 0;
159: nr_neigh->number = nr_neigh_no++;
160: nr_neigh->failed = 0;
161: refcount_set(&nr_neigh->refcount, 1);
162:
163: if (ax25_digi != NULL && ax25_digi->ndigi > 0) {
164: nr_neigh->digipeat = kmemdup(ax25_digi,
165: sizeof(*ax25_digi),
166: GFP_KERNEL);
167: if (nr_neigh->digipeat == NULL) {
168: kfree(nr_neigh);
169: if (nr_node)
170: nr_node_put(nr_node);
171: return -ENOMEM;
172: }
173: }
174:
175: spin_lock_bh(&nr_neigh_list_lock);
176: hlist_add_head(&nr_neigh->neigh_node, &nr_neigh_list);
177: nr_neigh_hold(nr_neigh);
178: spin_unlock_bh(&nr_neigh_list_lock);
179: }
180:
181: if (quality != 0 && ax25cmp(nr, ax25) == 0 && !nr_neigh->locked)
182: nr_neigh->quality = quality;
183:
184: if (nr_node == NULL) {
185: if ((nr_node = kmalloc(sizeof(*nr_node), GFP_ATOMIC)) == NULL) {
186: if (nr_neigh)
187: nr_neigh_put(nr_neigh);
188: return -ENOMEM;
189: }
190:
191: nr_node->callsign = *nr;
192: strscpy(nr_node->mnemonic, mnemonic);
193:
194: nr_node->which = 0;
195: nr_node->count = 1;
196: refcount_set(&nr_node->refcount, 1);
197: spin_lock_init(&nr_node->node_lock);
198:
199: nr_node->routes[0].quality = quality;
200: nr_node->routes[0].obs_count = obs_count;
201: nr_node->routes[0].neighbour = nr_neigh;
202:
203: nr_neigh_hold(nr_neigh);
204: nr_neigh->count++;
205:
206: spin_lock_bh(&nr_node_list_lock);
207: hlist_add_head(&nr_node->node_node, &nr_node_list);
208: /* refcount initialized at 1 */
209: spin_unlock_bh(&nr_node_list_lock);
210:
211: nr_neigh_put(nr_neigh);
212: return 0;
213: }
214: nr_node_lock(nr_node);
215:
216: if (quality != 0)
217: strscpy(nr_node->mnemonic, mnemonic);
218:
219: for (found = 0, i = 0; i < nr_node->count; i++) {
220: if (nr_node->routes[i].neighbour == nr_neigh) {
221: nr_node->routes[i].quality = quality;
222: nr_node->routes[i].obs_count = obs_count;
223: found = 1;
224: break;
225: }
226: }
227:
228: if (!found) {
229: /* We have space at the bottom, slot it in */
230: if (nr_node->count < 3) {
231: nr_node->routes[2] = nr_node->routes[1];
232: nr_node->routes[1] = nr_node->routes[0];
233:
234: nr_node->routes[0].quality = quality;
235: nr_node->routes[0].obs_count = obs_count;
236: nr_node->routes[0].neighbour = nr_neigh;
237:
238: nr_node->which++;
239: nr_node->count++;
240: nr_neigh_hold(nr_neigh);
241: nr_neigh->count++;
242: } else {
243: /* It must be better than the worst */
244: if (quality > nr_node->routes[2].quality) {
245: nr_node->routes[2].neighbour->count--;
246: nr_neigh_put(nr_node->routes[2].neighbour);
247:
248: if (nr_node->routes[2].neighbour->count == 0 && !nr_node->routes[2].neighbour->locked)
249: nr_remove_neigh(nr_node->routes[2].neighbour);
250:
251: nr_node->routes[2].quality = quality;
252: nr_node->routes[2].obs_count = obs_count;
253: nr_node->routes[2].neighbour = nr_neigh;
254:
255: nr_neigh_hold(nr_neigh);
256: nr_neigh->count++;
257: }
258: }
259: }
260:
261: /* Now re-sort the routes in quality order */
262: switch (nr_node->count) {
263: case 3:
264: re_sort_routes(nr_node, 0, 1);
265: re_sort_routes(nr_node, 1, 2);
266: fallthrough;
267: case 2:
268: re_sort_routes(nr_node, 0, 1);
269: break;
270: case 1:
271: break;
272: }
273:
274: for (i = 0; i < nr_node->count; i++) {
275: if (nr_node->routes[i].neighbour == nr_neigh) {
276: if (i < nr_node->which)
277: nr_node->which = i;
278: break;
279: }
280: }
281:
282: nr_neigh_put(nr_neigh);
283: nr_node_unlock(nr_node);
284: nr_node_put(nr_node);
285: return 0;
286: }
SourceFile:net/netrom/nr_route.c]
|
| 42/2 |
2026/05/21 04:51 |
llm |
expert |
0m
Model:
Tokens:
input: 35958
output: 52
thoughts: 270
Thoughts: **Analyzing Potential Deadlock in `nr_add_node`**
Okay, let's break this down. Line 124 in `nr_add_node` grabs `nr_node_list_lock`, which is fine, no locks held at that point. Then it moves on to taking `nr_node_lock` at line 126. So far, so good. Then, it grabs `nr_neigh_list_lock` at line 175. That feels a bit early. Back to `nr_node_list_lock` at 206, hmm... now it gets interesting. Line 214... `nr_node_lock(nr_node)` is taken.
That's when things are starting to look suspicious! At line 249, `nr_add_node` calls `nr_remove_neigh()`. And *that* function, I see, takes `nr_neigh_list_lock`! Aha! So `nr_add_node` grabs `nr_node_lock` (specifically, at line 214 with the `nr_node` argument) and then *calls* `nr_remove_neigh`, which takes `nr_neigh_list_lock`.
Thatβs a definite lock ordering concern... `nr_node_lock` is grabbed *before* `nr_neigh_list_lock`, which could lead to a deadlock situation with another function that takes these locks in reverse order. This needs some further investigation. And, `nr_add_node` is called from `nr_route_frame` at line 768.
Okay, `nr_route_frame` is called when a packet is received, so itβs a critical path function. Now let's see which functions call `nr_route_frame`.
|
| 43/2 |
2026/05/21 04:51 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_route_frame SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__nr_transmit_reply SourceFile:net/netrom/nr_subr.c SourceLine:257] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_transmit_buffer SourceFile:net/netrom/nr_out.c SourceLine:211] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_xmit SourceFile:net/netrom/nr_dev.c SourceLine:144]] TruncatedOutput:false]
|
| 44/2 |
2026/05/21 04:51 |
llm |
expert |
0m
Model:
Tokens:
input: 36849
output: 19
thoughts: 114
Thoughts: **My Analysis of the Netrom Frame Routing**
Okay, so I'm diving into this Netrom code, specifically looking at how frames are routed. My initial thought is that `nr_route_frame` is the crucial function here, and I'm tracking its calls. I see it's definitely invoked from `nr_xmit`, which, if I remember correctly, is the same as `ndo_start_xmit` for the netrom device. That makes sense; it's being used when *transmitting* a frame, as expected. I'm also seeing calls from `nr_transmit_buffer` and `__nr_transmit_reply`, which further reinforces that it's handling the outbound side.
But I'm starting to think a bit more broadly now. It's the routing function, after all. My question is: is it *only* used for transmitting? Does it have any role when a frame is *received*? I need to be absolutely sure I understand this process comprehensively. To confirm, I should investigate the receiving side. I'm going to quickly check `nr_rx_frame`. I'll likely find it in `net/netrom/nr_dev.c` or perhaps `nr_in.c`. It's time to confirm, one way or the other, if the frame routing also takes place during reception, or if it's separate.
|
| 45/2 |
2026/05/21 04:51 |
tool |
grepper |
0m
Args: map[Expression:nr_rx_frame]
Results: map[Output:include/net/netrom.h=188=extern int sysctl_netrom_reset_circuit;
include/net/netrom.h-189-
include/net/netrom.h:190:int nr_rx_frame(struct sk_buff *, struct net_device *);
include/net/netrom.h-191-void nr_destroy_socket(struct sock *);
--
net/netrom/af_netrom.c=838=static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
--
net/netrom/af_netrom.c-870-
net/netrom/af_netrom.c:871:int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
net/netrom/af_netrom.c-872-{
--
net/netrom/nr_loopback.c=48=static void nr_loopback_timer(struct timer_list *unused)
--
net/netrom/nr_loopback.c-58-
net/netrom/nr_loopback.c:59: if (dev == NULL || nr_rx_frame(skb, dev) == 0)
net/netrom/nr_loopback.c-60- kfree_skb(skb);
--
net/netrom/nr_route.c=746=int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
--
net/netrom/nr_route.c-778- else
net/netrom/nr_route.c:779: ret = nr_rx_frame(skb, dev);
net/netrom/nr_route.c-780- dev_put(dev);
]
|
| 46/2 |
2026/05/21 04:51 |
llm |
expert |
0m
Model:
Tokens:
input: 37731
output: 19
thoughts: 78
Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue:
**Investigating the Data Flow of `nr_rx_frame`**
Right, so `nr_rx_frame` is the core function for receiving packets, and the initial call paths are clear: directly from `nr_route_frame` (line 779 in the code) and indirectly from `nr_loopback_timer` (line 59). That makes sense, handling routed frames and loopback scenarios respectively. Now the question is, how does it handle raw reception, not via routing or loopback? Where does `nr_route_frame` get *its* input when receiving a Net/ROM packet from AX.25? Time to delve into the reception side of things. I'll need to trace back from that point. Let's look at `nr_in.c` or, more generally, where the AX.25 packets actually enter the Net/ROM processing pipeline. That's the key.
|
| 47/2 |
2026/05/21 04:51 |
tool |
grepper |
0m
Args: map[Expression:nr_route_frame]
Results: map[Output:include/net/netrom.h=219=void nr_link_failed(ax25_cb *, int);
include/net/netrom.h:220:int nr_route_frame(struct sk_buff *, ax25_cb *);
include/net/netrom.h-221-extern const struct seq_operations nr_node_seqops;
--
net/netrom/af_netrom.c=1380=static struct ax25_protocol nr_pid = {
net/netrom/af_netrom.c-1381- .pid = AX25_P_NETROM,
net/netrom/af_netrom.c:1382: .func = nr_route_frame
net/netrom/af_netrom.c-1383-};
--
net/netrom/nr_dev.c=139=static netdev_tx_t nr_xmit(struct sk_buff *skb, struct net_device *dev)
--
net/netrom/nr_dev.c-143-
net/netrom/nr_dev.c:144: if (!nr_route_frame(skb, NULL)) {
net/netrom/nr_dev.c-145- kfree_skb(skb);
--
net/netrom/nr_out.c=187=void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb)
--
net/netrom/nr_out.c-210-
net/netrom/nr_out.c:211: if (!nr_route_frame(skb, NULL)) {
net/netrom/nr_out.c-212- kfree_skb(skb);
--
net/netrom/nr_route.c=705=void nr_link_failed(ax25_cb *ax25, int reason)
--
net/netrom/nr_route.c-745- */
net/netrom/nr_route.c:746:int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
net/netrom/nr_route.c-747-{
--
net/netrom/nr_subr.c=213=void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags)
--
net/netrom/nr_subr.c-256-
net/netrom/nr_subr.c:257: if (!nr_route_frame(skbn, NULL))
net/netrom/nr_subr.c-258- kfree_skb(skbn);
]
|
| 48/2 |
2026/05/21 04:51 |
llm |
expert |
0m
Model:
Tokens:
input: 38725
output: 52
thoughts: 1815
Thoughts: **Analyzing the Locking Order in Netrom's Routing Update**
Okay, so `nr_route_frame` is the handler for AX.25 frames with the NET/ROM PID, that's straightforward. This means receiving a network packet triggers `nr_route_frame`. Let's trace what happens when we receive such a packet. `nr_route_frame` calls `nr_add_node` if the `ax25` pointer is valid, as it is in the `ax25_protocol` handler.
`nr_add_node` then gets called. Digging into `nr_add_node`'s code, I see that if `nr_neigh` is null, a new neighbor is allocated and added to a list with `spin_lock_bh(&nr_neigh_list_lock)` and then `hlist_add_head()` is called. Similar logic happens for the `nr_node` and its list, and finally, `nr_node_lock(nr_node)` is taken. Then there is this crucial block:
```c
if (!found) {
if (nr_node->count < 3) {
// ...
} else {
if (quality > nr_node->routes[2].quality) {
nr_node->routes[2].neighbour->count--;
nr_neigh_put(nr_node->routes[2].neighbour);
if (nr_node->routes[2].neighbour->count == 0 && !nr_node->routes[2].neighbour->locked)
nr_remove_neigh(nr_node->routes[2].neighbour);
```
Wait, `nr_remove_neigh` takes `nr_neigh_list_lock`. This means that within `nr_add_node`, we have `nr_node_lock` followed by a call to `nr_remove_neigh`, which attempts to take `nr_neigh_list_lock`. So, this establishes the dependency `nr_node_lock` -> `nr_neigh_list_lock`. This is *exactly* the locking dependency that's causing the deadlock in `nr_dec_obs`: `nr_node_list_lock` -> `nr_node_lock` -> `nr_neigh_list_lock`. `nr_add_node` has the dependency `nr_node_lock` -> `nr_neigh_list_lock`, and, as discovered, `nr_rt_device_down` has the dependency: `nr_neigh_list_lock` -> `nr_node_list_lock` -> `nr_node_lock`.
Therefore, the circular dependency is:
* `nr_rt_device_down`: `nr_neigh_list_lock` -> `nr_node_list_lock` -> `nr_node_lock`
* `nr_add_node`: `nr_node_lock` -> `nr_neigh_list_lock`
Can `nr_add_node` be called through packet reception? Yes, `nr_route_frame` calls `nr_add_node` when receiving an AX.25 packet. Wait, `nr_route_frame` calls `nr_add_node` with `quality = 0`. Let me see what happens with `nr_add_node` when `quality = 0`. If both `nr_neigh` and `nr_node` exist, it returns early. If `nr_node` exists, but `nr_neigh` is null (meaning a *new* neighbor), it takes `nr_node_lock(nr_node)`. It then searches for `nr_neigh` within the routes of `nr_node`, it will not find it because it was just allocated, and `found` will be zero. Now, the condition to enter the problematic block becomes relevant:
* `!found` which is true because the neighbor is new.
* `nr_node->count >= 3`
* `quality > nr_node->routes[2].quality`
Since `quality = 0`, the last condition becomes `0 > nr_node->routes[2].quality`. Qualities are non-negative, right? Yes, they should be, meaning this check will *always* evaluate to false. So, it will *not* call `nr_remove_neigh` which means it will NOT trigger the deadlock. Even when `nr_node->count < 3`, no `nr_remove_neigh` is called.
So, the critical insight is that `nr_add_node` called from `nr_route_frame` with `quality = 0` will NEVER call `nr_remove_neigh`. To call `nr
|
| 49/2 |
2026/05/21 04:52 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_add_node SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_route_frame SourceFile:net/netrom/nr_route.c SourceLine:768] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_rt_ioctl SourceFile:net/netrom/nr_route.c SourceLine:651]] TruncatedOutput:false]
|
| 50/2 |
2026/05/21 04:52 |
llm |
expert |
0m
Model:
Tokens:
input: 41741
output: 52
thoughts: 250
Thoughts: **Analyzing the Node and Neighbor Locking Dependency**
Okay, let me think this through. I see that `nr_add_node` is the function we're concerned with, and it's called from two places: `nr_rt_ioctl` (specifically with `SIOCADDRT`) and `nr_route_frame`. Now, the crucial thing here is this lock dependency: `nr_node_lock` followed by `nr_neigh_list_lock`. I need to figure out how this specific lock order is achieved.
Looking at `nr_rt_ioctl`, the `quality` parameter is user-controlled via `nr_route.quality`, which is interesting, but also relevant is that it requires `CAP_NET_ADMIN`. So, to reach that lock order, I'm already thinking that the pathway to the potentially problematic lock order goes via `nr_rt_ioctl` (using either `SIOCADDRT` or `SIOCNRDECOBS`). And because of that `CAP_NET_ADMIN` requirement, that implies this is happening in `init_user_ns`.
Hold on... there's also `nr_dec_obs`. This seems to be called *only* from `nr_rt_ioctl` when the call is using `SIOCNRDECOBS`. So, again, it seems like both routes that might lead to the problematic lock order require `CAP_NET_ADMIN`.
But, I can't be too hasty. I have to verify. My question is: Is there any *other* way to trigger the `nr_node_lock` -> `nr_neigh_list_lock` dependency? I need to check every single caller of `nr_remove_neigh` right now. I need to be absolutely certain I haven't missed a path that *doesn't* require `CAP_NET_ADMIN`.
|
| 51/2 |
2026/05/21 04:52 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_remove_neigh SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_add_node SourceFile:net/netrom/nr_route.c SourceLine:249] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_dec_obs SourceFile:net/netrom/nr_route.c SourceLine:472] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_del_neigh SourceFile:net/netrom/nr_route.c SourceLine:439] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_del_node SourceFile:net/netrom/nr_route.c SourceLine:342]] TruncatedOutput:false]
|
| 52/2 |
2026/05/21 04:52 |
llm |
expert |
0m
Model:
Tokens:
input: 42667
output: 54
thoughts: 451
Thoughts: **Analyzing Potential Race Conditions in Neighbor Discovery**
Okay, let's break this down. My primary concern is `nr_remove_neigh` and how it interacts with locks, specifically `nr_node_lock` and `nr_neigh_list_lock`. I need to ensure there aren't any race conditions.
Right, so `nr_remove_neigh` is called by several functions: `nr_add_node`, `nr_dec_obs`, and `nr_del_neigh`, and `nr_del_node`. And `nr_add_node` can be called from `nr_route_frame`, which I already proved cannot call `nr_remove_neigh`. All these functions seem to only be reached from `nr_rt_ioctl`. And `nr_rt_ioctl` is called only from `nr_ioctl`. The code checks if the user has `CAP_NET_ADMIN`. This seems secure, but I'm being thorough, so I'll double-check this.
Hang on... is `nr_rt_ioctl` called from anywhere *else*? I've checked the references, but I'll quickly verify again to make absolutely certain. Yep, just `nr_ioctl`.
Okay, what about the reverse? Could `nr_remove_neigh` be called *from* anywhere else? No, the reference list is exhaustive, so that's covered.
Alright, the critical question: is `nr_neigh_list_lock` ever taken *while* holding `nr_node_lock` anywhere else in the code? Let's refresh our memory on where `nr_neigh_list_lock` is used. I see it in: `nr_neigh_get_dev`, `nr_add_node`, `nr_remove_neigh`, `nr_add_neigh`, `nr_rt_device_down`, `nr_link_failed`, `nr_neigh_start` / `nr_neigh_stop`, and `nr_rt_free`.
Now, in `nr_neigh_get_dev`, it acquires and releases the lock. The question is, does `nr_neigh_get_dev` ever get called *while* another part of the code is holding `nr_node_lock`? I'll check the callers of `nr_neigh_get_dev` to be sure.
|
| 53/2 |
2026/05/21 04:52 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:net/netrom/nr_route.c IncludeSnippetLines:0 Name:nr_neigh_get_dev SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_add_neigh SourceFile:net/netrom/nr_route.c SourceLine:384] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_add_node SourceFile:net/netrom/nr_route.c SourceLine:113] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_del_neigh SourceFile:net/netrom/nr_route.c SourceLine:431] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:nr_del_node SourceFile:net/netrom/nr_route.c SourceLine:327]] TruncatedOutput:false]
|
| 54/2 |
2026/05/21 04:52 |
llm |
expert |
0m
Model:
Tokens:
input: 43903
output: 20
thoughts: 670
Thoughts: **Analyzing the NET/ROM Locking Issue**
Okay, so I've been looking at this locking issue in the NET/ROM code. The problem centers around a potential circular dependency between `nr_node_lock` and `nr_neigh_list_lock`. It looks like none of the callers of `nr_neigh_get_dev` hold `nr_node_lock` when they call it. Specifically, `nr_add_node` calls it before taking the `nr_node_lock`.
The critical point is that `nr_neigh_list_lock` is *only* held while `nr_node_lock` is held within `nr_remove_neigh`. That function is called from `nr_add_node`, `nr_dec_obs`, `nr_del_neigh`, and `nr_del_node`. The key is that all these paths, *except* the safe one in `nr_route_frame`, are reached only through `nr_rt_ioctl`. And importantly, `nr_rt_ioctl` *requires* `CAP_NET_ADMIN` in the initial user namespace.
Therefore, the only way to trigger this circular locking dependency is through a user with `CAP_NET_ADMIN` in the initial user namespace. That's a huge restriction. A user with that capability is already incredibly privileged; they are, for all practical purposes, equivalent to root when it comes to network configuration. This means this *isn't* accessible from unprivileged processes. It's not exploitable, not accessible from user namespaces, and it's definitely *not* remotely triggerable.
Just to be absolutely sure, I'll double-check how `nr_ioctl` is called. It's the `ioctl` handler for `AF_NETROM` sockets. Let's see... looking at the `nr_ops` structure, I see the typical socket operations defined: `release`, `bind`, `connect`, `ioctl`, etc. Yes, it's definitely through the socket `ioctl` interface.
Now, let's look at `nr_ioctl` itself:
```c
case SIOCADDRT:
case SIOCDELRT:
case SIOCNRDECOBS:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
return nr_rt_ioctl(cmd, argp);
```
Yep, it explicitly checks `capable(CAP_NET_ADMIN)` for those critical cases. So that seems solid.
Wait... could there be a `compat_ioctl`? Is there a `compat_ioctl` for `AF_NETROM`? I need to make *absolutely* sure. Let me go back and look at that `nr_ops` structure again. Nope. Doesn't look like there is one. That seems to confirm the previous analysis.
|
| 55/2 |
2026/05/21 04:52 |
tool |
grepper |
0m
Error:
Args: map[Expression:compat_ioctl.*nr_]
Results:
|
| 56/2 |
2026/05/21 04:52 |
llm |
expert |
0m
Model:
Tokens:
input: 45217
output: 43
thoughts: 11
Thoughts: Here's my take on the thought process:
**Diving into `nr_ops`**
Okay, so I'm taking a look at this code, and the first thing I need to do is get my bearings. I see `nr_ops` and my brain immediately flags that as a key variable, likely related to the number of operations, whatever those may be. Before I go any further, I need a solid understanding of exactly what `nr_ops` represents in this context. It could be anything from the number of mathematical calculations, to the number of instructions executed, or even some higher-level concept depending on the system at hand. Therefore, I'm going to jump right into the definition of `nr_ops`. No point in guessing or making assumptions at this stage. Gotta be precise. Let's see what that definition reveals.
|
| 57/2 |
2026/05/21 04:52 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:net/netrom/af_netrom.c IncludeLines:true Name:nr_ops]
Results: map[SourceCode: SourceFile:]
|
| 58/2 |
2026/05/21 04:52 |
llm |
expert |
0m
Model:
Tokens:
input: 45470
output: 19
thoughts: 24
Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue:
**Investigating `proto_ops` in Net/ROM**
Alright, time to get to work. Seems like I need to delve into the Net/ROM implementation a bit further. The first thing I'm going to do is locate the `proto_ops` data structure within the `net/netrom/af_netrom.c` file. This is usually where the socket operations for the Net/ROM protocol family are defined. I'm thinking I need to find the specific handlers for things like `connect`, `accept`, `sendmsg`, and the rest. Knowing the `proto_ops` will provide the core interface to understand the protocol stack's socket interaction. Let's see what's in there. I bet I can quickly get a handle on the key areas I need to focus on once I find it. Time to open the file and get started.
|
| 59/2 |
2026/05/21 04:52 |
tool |
grepper |
0m
Args: map[Expression:proto_ops.*nr]
Results: map[Output:net/netrom/af_netrom.c=62=static DEFINE_SPINLOCK(nr_list_lock);
net/netrom/af_netrom.c-63-
net/netrom/af_netrom.c:64:static const struct proto_ops nr_proto_ops;
net/netrom/af_netrom.c-65-
--
net/netrom/af_netrom.c=1347=static const struct net_proto_family nr_family_ops = {
--
net/netrom/af_netrom.c-1352-
net/netrom/af_netrom.c:1353:static const struct proto_ops nr_proto_ops = {
net/netrom/af_netrom.c-1354- .family = PF_NETROM,
]
|
| 60/2 |
2026/05/21 04:52 |
llm |
expert |
0m
Model:
Tokens:
input: 45934
output: 45
thoughts: 11
Thoughts: Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:
**Analyzing the Proto Operations**
Alright, the first thing I'm seeing is `nr_proto_ops`. Hmm, right away, that's sparking some ideas. This likely references the operation handlers for a network protocol. The naming convention strongly suggests we're dealing with a numbered or potentially indexed structure. My initial instinct is that this points towards a table, or a vector, holding function pointers related to the different operations that can be performed on the protocol being described. Things like connection establishment, data transmission, error handling, termination, all potentially residing in this. I'm already anticipating the structure itself. It's probably going to define how the different functions will interact with the kernel. I should look into the source and see if this hunch is correct, or if there is something else going on.
|
| 61/2 |
2026/05/21 04:53 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netrom/af_netrom.c IncludeLines:true Name:nr_proto_ops]
Results: map[SourceCode:1353: static const struct proto_ops nr_proto_ops = {
1354: .family = PF_NETROM,
1355: .owner = THIS_MODULE,
1356: .release = nr_release,
1357: .bind = nr_bind,
1358: .connect = nr_connect,
1359: .socketpair = sock_no_socketpair,
1360: .accept = nr_accept,
1361: .getname = nr_getname,
1362: .poll = datagram_poll,
1363: .ioctl = nr_ioctl,
1364: .gettstamp = sock_gettstamp,
1365: .listen = nr_listen,
1366: .shutdown = sock_no_shutdown,
1367: .setsockopt = nr_setsockopt,
1368: .getsockopt = nr_getsockopt,
1369: .sendmsg = nr_sendmsg,
1370: .recvmsg = nr_recvmsg,
1371: .mmap = sock_no_mmap,
1372: };
SourceFile:net/netrom/af_netrom.c]
|
| 62/2 |
2026/05/21 04:53 |
llm |
expert |
0m
Model:
Tokens:
input: 46561
output: 19
thoughts: 4831
Thoughts: **Analysis of the NET/ROM Deadlock Vulnerability**
Okay, here's what I've got after diving deep into this: It looks like there's a serious deadlock vulnerability in the NET/ROM code. Initially, I was looking for the `compat_ioctl` handler, thinking the VFS layer might be the entry point, but no, it falls back to the standard `ioctl` for sockets, ultimately hitting `nr_ioctl`. The critical paths I identified are `nr_rt_ioctl`, `nr_dec_obs`, and `nr_rt_device_down`. I also looked to see if there were alternate paths to call these functions but found that references indicated there are not.
The key finding is that `nr_rt_device_down` is triggered through `nr_device_event`, which is a netdevice notifier. Critically, this notifier checks if the device is in `init_net`. To bring a device down in `init_net`, you need `CAP_NET_ADMIN` in the `init_user_ns`. So, a user without that capability can't do it.
This led me to the conclusion that this is a circular locking dependency, a deadlock, that *can only be triggered* by a user *with* `CAP_NET_ADMIN` in the *initial user namespace*. That means it's *not* accessible from unprivileged processes, and it's *not* accessible from user namespaces. It *is* a Denial of Service because it's a deadlock. But the fact it requires root is important.
So, let's look at the dimensions:
* Exploitable: No (deadlock)
* DoS: Yes (deadlock)
* Unprivileged: No (requires CAP_NET_ADMIN in init_user_ns)
* User Namespace: No (requires CAP_NET_ADMIN in init_user_ns)
* VM Guest/Host/Remote/Peripheral/Filesystem: No.
I then double-checked whether `nr_route_frame` could trigger `nr_remove_neigh`. Analyzing that code carefully, especially the `nr_add_node` call with `quality = 0`, the logic is such that if `nr_neigh` is not NULL and `nr_node` is not NULL, the function returns. The case where `nr_neigh` is NULL is carefully checked, initialized, locked, and unlocked, but no `nr_remove_neigh` call is seen. I re-verified this code.
Crucially, when `nr_node` is NULL, it is initialized, locked, and unlocked, and it returns 0. If both are non-NULL, it will attempt to assign a quality, and check if it has space to put the route.
With `quality=0`, a `nr_neigh` can never trigger the call.
I then realized that the `quality` variable is an `int`, and a user can set a negative quality via `nr_rt_ioctl`. The user has control over the value of `quality`. This could cause `nr_remove_neigh` to be called if a route with a negative quality gets in the third slot. But `nr_rt_ioctl` requires `CAP_NET_ADMIN`! Therefore an unprivileged user cannot set a negative quality.
I double checked if there are other cases such as a negative `sysctl_netrom_default_path_quality`, but that can be only set with root privilege, which isn't the concern.
Thus `nr_route_frame` cannot trigger `nr_remove_neigh`.
I also checked if any other ioctls triggered the deadlock. I confirmed that `SIOCNRDECOBS` does call `nr_dec_obs`, and it checks for `capable(CAP_NET_ADMIN)`. `nr_rt_device_down` requires `CAP_NET_ADMIN` to trigger as well.
So, the issue *solely* resides with a user with `CAP_NET_ADMIN` in the initial user namespace.
Reviewing the reproducer:
The reproducer calls `SIOCADDRT` (adds a route), `SIOCNRDECOBS` (calls `nr_dec_obs`), and `SIOCSIFFLAGS` to bring down a device. All of these calls require `CAP_NET_ADMIN`. So, while the reproducer _can_ trigger it, it is reliant on privileges that a normal user doesn't have. Thus the bug *cannot* be used by an unprivileged user. I then confirmed that `capable()` checks the `init_user_ns` correctly.
I checked again whether there were other ways to reach `nr_ioctl`. I ruled out `io_uring` and `eBPF`.
So, the
|
| 63/2 |
2026/05/21 04:53 |
tool |
grepper |
0m
Args: map[Expression:\.quality\s*=]
Results: map[Output:drivers/char/hw_random/cctrng.c=457=static int cctrng_probe(struct platform_device *pdev)
--
drivers/char/hw_random/cctrng.c-478- drvdata->rng.priv = (unsigned long)drvdata;
drivers/char/hw_random/cctrng.c:479: drvdata->rng.quality = CC_TRNG_QUALITY;
drivers/char/hw_random/cctrng.c-480-
--
drivers/char/hw_random/imx-rngc.c=246=static int __init imx_rngc_probe(struct platform_device *pdev)
--
drivers/char/hw_random/imx-rngc.c-288- rngc->rng.cleanup = imx_rngc_cleanup;
drivers/char/hw_random/imx-rngc.c:289: rngc->rng.quality = 19;
drivers/char/hw_random/imx-rngc.c-290-
--
drivers/char/hw_random/mtk-rng.c=106=static int mtk_rng_probe(struct platform_device *pdev)
--
drivers/char/hw_random/mtk-rng.c-121- priv->rng.read = mtk_rng_read;
drivers/char/hw_random/mtk-rng.c:122: priv->rng.quality = 900;
drivers/char/hw_random/mtk-rng.c-123-
--
drivers/char/hw_random/omap-rng.c=423=static int omap_rng_probe(struct platform_device *pdev)
--
drivers/char/hw_random/omap-rng.c-435- priv->rng.cleanup = omap_rng_cleanup;
drivers/char/hw_random/omap-rng.c:436: priv->rng.quality = 900;
drivers/char/hw_random/omap-rng.c-437-
--
drivers/char/hw_random/omap3-rom-rng.c=110=static int omap3_rom_rng_probe(struct platform_device *pdev)
--
drivers/char/hw_random/omap3-rom-rng.c-122- ddata->ops.read = of_device_get_match_data(&pdev->dev);
drivers/char/hw_random/omap3-rom-rng.c:123: ddata->ops.quality = 900;
drivers/char/hw_random/omap3-rom-rng.c-124- if (!ddata->ops.read) {
--
drivers/char/hw_random/optee-rng.c=176=static int get_optee_rng_info(struct device *dev)
--
drivers/char/hw_random/optee-rng.c-200- pvt_data.data_rate = param[0].u.value.a;
drivers/char/hw_random/optee-rng.c:201: pvt_data.optee_rng.quality = param[0].u.value.b;
drivers/char/hw_random/optee-rng.c-202-
--
drivers/char/hw_random/rockchip-rng.c=361=static const struct rk_rng_soc_data rk3568_soc_data = {
--
drivers/char/hw_random/rockchip-rng.c-364- .rk_rng_cleanup = rk3568_rng_cleanup,
drivers/char/hw_random/rockchip-rng.c:365: .quality = 900,
drivers/char/hw_random/rockchip-rng.c-366- .reset_optional = false,
--
drivers/char/hw_random/rockchip-rng.c=369=static const struct rk_rng_soc_data rk3576_soc_data = {
--
drivers/char/hw_random/rockchip-rng.c-372- .rk_rng_cleanup = rk3588_rng_cleanup,
drivers/char/hw_random/rockchip-rng.c:373: .quality = 999, /* as determined by actual testing */
drivers/char/hw_random/rockchip-rng.c-374- .reset_optional = true,
--
drivers/char/hw_random/rockchip-rng.c=377=static const struct rk_rng_soc_data rk3588_soc_data = {
--
drivers/char/hw_random/rockchip-rng.c-380- .rk_rng_cleanup = rk3588_rng_cleanup,
drivers/char/hw_random/rockchip-rng.c:381: .quality = 999, /* as determined by actual testing */
drivers/char/hw_random/rockchip-rng.c-382- .reset_optional = true,
--
drivers/char/hw_random/rockchip-rng.c=385=static int rk_rng_probe(struct platform_device *pdev)
--
drivers/char/hw_random/rockchip-rng.c-428- rk_rng->dev = dev;
drivers/char/hw_random/rockchip-rng.c:429: rk_rng->rng.quality = rk_rng->soc_data->quality;
drivers/char/hw_random/rockchip-rng.c-430-
--
drivers/char/hw_random/stm32-rng.c=531=static int stm32_rng_probe(struct platform_device *ofdev)
--
drivers/char/hw_random/stm32-rng.c-566- priv->rng.read = stm32_rng_read;
drivers/char/hw_random/stm32-rng.c:567: priv->rng.quality = 900;
drivers/char/hw_random/stm32-rng.c-568-
--
drivers/char/hw_random/timeriomem-rng.c=103=static int timeriomem_rng_probe(struct platform_device *pdev)
--
drivers/char/hw_random/timeriomem-rng.c-146- "quality", &i))
drivers/char/hw_random/timeriomem-rng.c:147: priv->rng_ops.quality = i;
drivers/char/hw_random/timeriomem-rng.c-148- } else {
drivers/char/hw_random/timeriomem-rng.c-149- period = pdata->period;
drivers/char/hw_random/timeriomem-rng.c:150: priv->rng_ops.quality = pdata->quality;
drivers/char/hw_random/timeriomem-rng.c-151- }
--
drivers/char/hw_random/xiphera-trng.c=60=static int xiphera_trng_probe(struct platform_device *pdev)
--
drivers/char/hw_random/xiphera-trng.c-115- trng->rng.read = xiphera_trng_read;
drivers/char/hw_random/xiphera-trng.c:116: trng->rng.quality = 900;
drivers/char/hw_random/xiphera-trng.c-117-
--
drivers/char/tpm/tpm_tis_core.c=1105=int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
--
drivers/char/tpm/tpm_tis_core.c-1124-
drivers/char/tpm/tpm_tis_core.c:1125: chip->hwrng.quality = priv->rng_quality;
drivers/char/tpm/tpm_tis_core.c-1126-
--
drivers/crypto/atmel-sha204a.c=150=static int atmel_sha204a_probe(struct i2c_client *client)
--
drivers/crypto/atmel-sha204a.c-169- */
drivers/crypto/atmel-sha204a.c:170: i2c_priv->hwrng.quality = 1;
drivers/crypto/atmel-sha204a.c-171-
--
drivers/crypto/gemini/sl3516-ce-rng.c=44=int sl3516_ce_rng_register(struct sl3516_ce_dev *ce)
--
drivers/crypto/gemini/sl3516-ce-rng.c-49- ce->trng.read = sl3516_ce_rng_read;
drivers/crypto/gemini/sl3516-ce-rng.c:50: ce->trng.quality = 700;
drivers/crypto/gemini/sl3516-ce-rng.c-51-
--
drivers/crypto/hisilicon/trng/trng.c=250=static int hisi_trng_probe(struct platform_device *pdev)
--
drivers/crypto/hisilicon/trng/trng.c-286- trng->rng.read = hisi_trng_read;
drivers/crypto/hisilicon/trng/trng.c:287: trng->rng.quality = HISI_TRNG_QUALITY;
drivers/crypto/hisilicon/trng/trng.c-288- ret = devm_hwrng_register(&pdev->dev, &trng->rng);
--
drivers/crypto/qcom-rng.c=179=static int qcom_rng_probe(struct platform_device *pdev)
--
drivers/crypto/qcom-rng.c-211- rng->hwrng.read = qcom_hwrng_read;
drivers/crypto/qcom-rng.c:212: rng->hwrng.quality = QCOM_TRNG_QUALITY;
drivers/crypto/qcom-rng.c-213- ret = devm_hwrng_register(&pdev->dev, &rng->hwrng);
--
drivers/media/pci/zoran/zoran_card.c=716=int zoran_check_jpg_settings(struct zoran *zr,
--
drivers/media/pci/zoran/zoran_card.c-843- if (settings->jpg_comp.quality > 100)
drivers/media/pci/zoran/zoran_card.c:844: settings->jpg_comp.quality = 100;
drivers/media/pci/zoran/zoran_card.c-845- if (settings->jpg_comp.quality < 5)
drivers/media/pci/zoran/zoran_card.c:846: settings->jpg_comp.quality = 5;
drivers/media/pci/zoran/zoran_card.c-847- if (settings->jpg_comp.APPn < 0)
--
drivers/media/pci/zoran/zoran_card.c=952=void zoran_open_init_params(struct zoran *zr)
--
drivers/media/pci/zoran/zoran_card.c-963- zr->jpg_settings.decimation = 1;
drivers/media/pci/zoran/zoran_card.c:964: zr->jpg_settings.jpg_comp.quality = 50; /* default compression factor 8 */
drivers/media/pci/zoran/zoran_card.c-965- if (zr->card.type != BUZ)
--
drivers/media/pci/zoran/zoran_card.c=1164=static int zoran_video_set_ctrl(struct v4l2_ctrl *ctrl)
--
drivers/media/pci/zoran/zoran_card.c-1169- case V4L2_CID_JPEG_COMPRESSION_QUALITY:
drivers/media/pci/zoran/zoran_card.c:1170: zr->jpg_settings.jpg_comp.quality = ctrl->val;
drivers/media/pci/zoran/zoran_card.c-1171- return zoran_check_jpg_settings(zr, &zr->jpg_settings, 0);
--
drivers/media/pci/zoran/zoran_device.c=606=void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode)
--
drivers/media/pci/zoran/zoran_device.c-618- zr->jpg_settings.hor_dcm | (zr->jpg_settings.ver_dcm << 8);
drivers/media/pci/zoran/zoran_device.c:619: cap.quality = zr->jpg_settings.jpg_comp.quality;
drivers/media/pci/zoran/zoran_device.c-620-
--
drivers/media/platform/verisilicon/hantro_h1_jpeg_enc.c=106=int hantro_h1_jpeg_enc_run(struct hantro_ctx *ctx)
--
drivers/media/platform/verisilicon/hantro_h1_jpeg_enc.c-121- jpeg_ctx.height = ctx->dst_fmt.height;
drivers/media/platform/verisilicon/hantro_h1_jpeg_enc.c:122: jpeg_ctx.quality = ctx->jpeg_quality;
drivers/media/platform/verisilicon/hantro_h1_jpeg_enc.c-123- hantro_jpeg_header_assemble(&jpeg_ctx);
--
drivers/media/platform/verisilicon/rockchip_vpu2_hw_jpeg_enc.c=132=int rockchip_vpu2_jpeg_enc_run(struct hantro_ctx *ctx)
--
drivers/media/platform/verisilicon/rockchip_vpu2_hw_jpeg_enc.c-150- jpeg_ctx.height = ctx->dst_fmt.height;
drivers/media/platform/verisilicon/rockchip_vpu2_hw_jpeg_enc.c:151: jpeg_ctx.quality = ctx->jpeg_quality;
drivers/media/platform/verisilicon/rockchip_vpu2_hw_jpeg_enc.c-152- hantro_jpeg_header_assemble(&jpeg_ctx);
--
drivers/misc/nsm.c=421=static int nsm_device_probe(struct virtio_device *vdev)
--
drivers/misc/nsm.c-445- .name = "nsm-hwrng",
drivers/misc/nsm.c:446: .quality = 1000,
drivers/misc/nsm.c-447- };
--
drivers/net/wireless/ath/ath9k/rng.c=95=void ath9k_rng_start(struct ath_softc *sc)
--
drivers/net/wireless/ath/ath9k/rng.c-109- sc->rng_ops.read = ath9k_rng_read;
drivers/net/wireless/ath/ath9k/rng.c:110: sc->rng_ops.quality = 320;
drivers/net/wireless/ath/ath9k/rng.c-111-
--
drivers/s390/crypto/zcrypt_api.c=1782=static struct hwrng zcrypt_rng_dev = {
--
drivers/s390/crypto/zcrypt_api.c-1784- .data_read = zcrypt_rng_data_read,
drivers/s390/crypto/zcrypt_api.c:1785: .quality = 990,
drivers/s390/crypto/zcrypt_api.c-1786-};
--
net/netrom/nr_route.c=97=static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
--
net/netrom/nr_route.c-198-
net/netrom/nr_route.c:199: nr_node->routes[0].quality = quality;
net/netrom/nr_route.c-200- nr_node->routes[0].obs_count = obs_count;
--
net/netrom/nr_route.c-220- if (nr_node->routes[i].neighbour == nr_neigh) {
net/netrom/nr_route.c:221: nr_node->routes[i].quality = quality;
net/netrom/nr_route.c-222- nr_node->routes[i].obs_count = obs_count;
--
net/netrom/nr_route.c-233-
net/netrom/nr_route.c:234: nr_node->routes[0].quality = quality;
net/netrom/nr_route.c-235- nr_node->routes[0].obs_count = obs_count;
--
net/netrom/nr_route.c-250-
net/netrom/nr_route.c:251: nr_node->routes[2].quality = quality;
net/netrom/nr_route.c-252- nr_node->routes[2].obs_count = obs_count;
]
|
| 64/2 |
2026/05/21 04:53 |
llm |
expert |
0m
Model:
Tokens:
input: 56897
output: 66
thoughts: 256
Thoughts: **My Assessment of the `net/netrom/nr_route.c` Bug**
Okay, let's break this down. My analysis of `net/netrom/nr_route.c` shows that the `quality` variable is only set within `nr_add_node`, and specifically, it's just assigned whatever value is passed as the `quality` parameter. That means `quality` is never *internally* set to a negative value. Given that `nr_route_frame` specifically passes `0` as that parameter, it can't possibly trigger `nr_remove_neigh`. Which means this deadlock is effectively blocked.
Therefore, this bug is completely inaccessible to anyone without root, and it's not exploitable. It's a textbook case of a deadlock, so it's a denial of service, but not an exploitable one.
Let me double-check my findings: Exploitable? False. Denial of Service? True, of course (deadlock). Unprivileged? Absolutely false. It demands CAP_NET_ADMIN within `init_user_ns`. User Namespace is not possible because `capable()` checks init_user_ns. VM Guest Trigger? No. VM Host Trigger? No. Network Trigger? Nope, `nr_route_frame` can't do it. Remote Trigger? Also no. Peripheral Trigger? Negatory. CAP_NET_ADMIN is still needed on the other side. And finally, Filesystem Trigger? Not a chance.
Alright, I'm confident. Time to call `set-results`.
|
| 65/2 |
2026/05/21 04:53 |
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]
|
| 66/2 |
2026/05/21 04:53 |
llm |
expert |
0m
Model:
Tokens:
input: 57613
output: 654
thoughts: 476
Thoughts: **Final Thoughts on the Netrom Locking Dependency**
Okay, the analysis is complete, and I've got a clear picture of what's going on. Time to put together the final assessment.
The core of the issue boils down to a circular locking dependency. Specifically, we've got a deadlock scenario involving `nr_neigh_list_lock`, `nr_node_list_lock`, and `nr_node_lock`. The lockdep report shows the following paths leading to the deadlock:
1. `nr_rt_device_down` acquires `nr_neigh_list_lock`, then `nr_node_list_lock`, and finally `nr_node_lock`.
2. `nr_dec_obs` follows the reverse order, taking `nr_node_list_lock`, then `nr_node_lock`, and finally `nr_neigh_list_lock`.
`nr_rt_device_down` kicks in when a netdevice in `init_net` goes down, triggered by a netdevice notifier. Bringing down a device in `init_net`, however, demands `CAP_NET_ADMIN` privileges within the initial user namespace. Similarly, `nr_dec_obs` gets called by the `SIOCNRDECOBS` ioctl on a netrom socket, which has an explicit check for `capable(CAP_NET_ADMIN)`. That means, we need `CAP_NET_ADMIN` in the initial user namespace to trigger it as well.
I've also looked at other potential paths through `nr_node_lock` to `nr_neigh_list_lock`. These involve `nr_add_node` (when replacing a route), `nr_del_neigh`, and `nr_del_node`. All of these paths are reached through `nr_rt_ioctl` (with `SIOCADDRT` or `SIOCDELRT`) which also requires `CAP_NET_ADMIN` in the initial user namespace. Even though `nr_add_node` can be reached via `nr_route_frame`, the condition preventing route replacement makes that path irrelevant to this circular dependency.
Therefore, the upshot is that triggering this deadlock absolutely requires `CAP_NET_ADMIN` within the *initial* user namespace. This immediately tells me that it's beyond the reach of unprivileged users, and it also means this can't be triggered from within a user namespace. So, while it's a deadlock, leading to a Denial of Service (DoS), it isn't exploitable for any kind of privilege escalation or memory corruption.
|
| 67/1 |
2026/05/21 04:54 |
action |
format-explanation |
0m
Results: map[Explanation:The bug report describes a circular locking dependency (deadlock) in the NetROM
protocol stack involving `nr_neigh_list_lock`, `nr_node_list_lock`, and
`nr_node_lock`.
The lockdep report highlights two conflicting locking chains:
1. **`nr_rt_device_down`**: Acquires `nr_neigh_list_lock`, then
`nr_node_list_lock`, and finally `nr_node_lock`.
2. **`nr_dec_obs`**: Acquires `nr_node_list_lock`, then `nr_node_lock`, and
finally `nr_neigh_list_lock` (via `nr_remove_neigh`).
### Analysis:
- **Exploitable**: No. This is a spinlock deadlock. Deadlocks result in a system
hang (hard lockup on the involved CPUs) but do not lead to memory corruption or
privilege escalation.
- **Denial of Service**: Yes. Triggering the bug will cause a hard lockup,
leading to a Denial of Service.
- **Accessible From Unprivileged Processes / User Namespaces**: No.
- `nr_rt_device_down` is called from a netdevice notifier (`nr_device_event`)
when a network device goes down. The notifier explicitly ignores devices
outside of `init_net` (`if (!net_eq(dev_net(dev), &init_net)) return
NOTIFY_DONE;`). Bringing down a device in `init_net` requires `CAP_NET_ADMIN`
in the initial user namespace.
- `nr_dec_obs` is only reachable via the `SIOCNRDECOBS` ioctl on a NetROM
socket. The `nr_ioctl` handler explicitly checks `capable(CAP_NET_ADMIN)`
before processing this ioctl. The `capable()` function checks for capabilities
in the initial user namespace (`init_user_ns`), meaning it cannot be bypassed
by creating a new user namespace.
- Other paths that could potentially trigger the reverse locking order (like
`nr_del_neigh`, `nr_del_node`, or `nr_add_node` replacing a route) are also
only reachable via `nr_rt_ioctl` (`SIOCDELRT`, `SIOCADDRT`), which similarly
require `CAP_NET_ADMIN` in the initial user namespace.
- While `nr_add_node` can be reached by processing an incoming NetROM packet
(`nr_route_frame`), it is called with a `quality` of `0`. The logic in
`nr_add_node` will never replace an existing route (and thus never call
`nr_remove_neigh` to acquire `nr_neigh_list_lock`) if the provided quality is
`0`.
### Conclusion:
This deadlock can only be triggered by a highly privileged user (root or a user
with `CAP_NET_ADMIN` in the initial user namespace). It is not accessible to
unprivileged users, cannot be triggered remotely via network packets, and is not
exploitable for privilege escalation.]
|