| 0/0 |
2026/09/11 00:24 |
flow |
assessment-security |
44m
Results: map[DenialOfService:true Explanation:The bug is a `BUG_ON(monc->monmap->num_mon < 1)` in `pick_new_mon()` which is
triggered when attempting to open a session with a Ceph monitor, but the monitor
map has 0 monitors.
This state is reached because of how the new mount API (`fsopen` + `fsconfig`)
handles parameter parsing errors. When the user provides an invalid `mon_addr`
(e.g., `"127.0.0.\x03:6789"`), `ceph_parse_mon_addr()` saves the string but
`ceph_parse_mon_ips()` fails to resolve it and returns an error (e.g.,
`-ESRCH`). The `fsconfig` syscall returns this error to the user space. However,
the user can simply ignore the error and proceed to call
`fsconfig(FSCONFIG_CMD_CREATE)`.
During the creation phase, `ceph_get_tree()` checks if `fsopt->mon_addr` is set.
Since the string was saved before the parsing failed, this check passes. The
code then proceeds to initialize the monitor client (`ceph_monc_init()`), which
allocates a monitor map with `num_mon = 0`. Later, when `ceph_real_mount()`
attempts to open a session, it calls `pick_new_mon()`, which hits the `BUG_ON`
because `num_mon` is 0.
**Security Impact Assessment:**
- **Exploitable**: No. The bug is a `BUG_ON` which intentionally halts the
kernel (panic). It does not lead to memory corruption, information leaks, or
control-flow hijacking.
- **Denial of Service**: Yes. Triggering the bug causes a kernel panic, leading
to a denial of service.
- **Accessible From Unprivileged Processes / User Namespaces**: No. The `ceph`
filesystem does not have the `FS_USERNS_MOUNT` flag. Therefore, `fsopen("ceph")`
requires `CAP_SYS_ADMIN` in the initial user namespace. If an unprivileged user
attempts to mount it from a new user namespace, the `sget_fc()` function will
reject the mount with `-EPERM` before the vulnerable code (`ceph_real_mount()`)
is reached.
- **Other Triggers**: The bug is triggered by local syscalls
(`fsopen`/`fsconfig`) and does not involve network traffic, malicious filesystem
images, or peripheral devices.
In conclusion, this is a root-only Denial of Service bug, and it does not pose a
security risk to unprivileged users. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/09/11 00:24 |
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>
#ifndef __NR_fsconfig
#define __NR_fsconfig 431
#endif
#ifndef __NR_fsopen
#define __NR_fsopen 430
#endif
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*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=*/0x1000, /*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)) {}
// fsopen arguments: [
// type: ptr[in, buffer] {
// buffer: {63 65 70 68 00} (length 0x5)
// }
// flags: fsopen_flags = 0x0 (8 bytes)
// ]
// returns fd_fscontext
memcpy((void*)0x200000000000, "ceph\000", 5);
res = syscall(__NR_fsopen, /*type=*/0x200000000000ul, /*flags=*/0ul);
if (res != -1)
r[0] = res;
// fsconfig$FSCONFIG_SET_STRING arguments: [
// fd: fd_fscontext (resource)
// cmd: const = 0x1 (8 bytes)
// key: ptr[in, buffer] {
// buffer: {73 6f 75 72 63 65 00} (length 0x7)
// }
// value: ptr[in, buffer] {
// buffer: {63 6c 69 65 6e 74 2e 61 64 6d 69 6e 40 30 30 30 30 30 30 30 30 2d 30 30 30 30 2d 30 30 30 30 2d 30 30 30 30 2d 30 30 30 30 30 30 30 30 30 30 30 30 2e 63 65 70 68 3d 2f 00} (length 0x39)
// }
// aux: const = 0x0 (8 bytes)
// ]
memcpy((void*)0x200000000100, "source\000", 7);
memcpy((void*)0x200000000200, "client.admin@00000000-0000-0000-0000-000000000000.ceph=/\000", 57);
syscall(__NR_fsconfig, /*fd=*/r[0], /*cmd=*/1ul, /*key=*/0x200000000100ul, /*value=*/0x200000000200ul, /*aux=*/0ul);
// fsconfig$FSCONFIG_SET_STRING arguments: [
// fd: fd_fscontext (resource)
// cmd: const = 0x1 (8 bytes)
// key: ptr[in, buffer] {
// buffer: {6d 6f 6e 5f 61 64 64 72 00} (length 0x9)
// }
// value: ptr[in, buffer] {
// buffer: {31 32 37 2e 30 2e 30 2e 03 3a 36 37 38 39 00} (length 0xf)
// }
// aux: const = 0x0 (8 bytes)
// ]
memcpy((void*)0x200000000300, "mon_addr\000", 9);
memcpy((void*)0x200000000400, "127.0.0.\003:6789\000", 15);
syscall(__NR_fsconfig, /*fd=*/r[0], /*cmd=*/1ul, /*key=*/0x200000000300ul, /*value=*/0x200000000400ul, /*aux=*/0ul);
// fsconfig$FSCONFIG_CMD_CREATE arguments: [
// fd: fd_fscontext (resource)
// cmd: const = 0x6 (8 bytes)
// key: const = 0x0 (8 bytes)
// value: const = 0x0 (8 bytes)
// aux: const = 0x0 (8 bytes)
// ]
syscall(__NR_fsconfig, /*fd=*/r[0], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*aux=*/0ul);
return 0;
}
]
|
| 2/1 |
2026/09/11 00:24 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/a476496faa8a72dd8799cae478eb46e169b42666]
|
| 3/1 |
2026/09/11 00:25 |
action |
kernel-builder |
22m
Results: map[KernelObj:/app/workdir/cache/build/a7969b3c91a15bc65b53e474d2929c1fbd6cf74f]
|
| 4/1 |
2026/09/11 00:47 |
action |
codesearch-prepare |
15m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/09/11 01:02 |
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 grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
libceph: resolve '127.0.0.' (ret=-3): failed
------------[ cut here ]------------
kernel BUG at net/ceph/mon_client.c:211!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 2 UID: 0 PID: 5924 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:pick_new_mon net/ceph/mon_client.c:211 [inline]
RIP: 0010:__open_session+0x60f/0x740 net/ceph/mon_client.c:245
Code: f6 44 89 e7 e8 72 1e 27 fa 89 c5 e9 2b fb ff ff e8 96 4b 7e f6 c7 83 b4 09 00 00 0a 00 00 00 e9 22 fc ff ff e8 82 4b 7e f6 90 <0f> 0b e8 9a 86 f1 f6 e9 7b fa ff ff 4c 89 f7 e8 8d 86 f1 f6 e9 16
RSP: 0018:ffffc900039a7be0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888037864290 RCX: 0000000000000000
RDX: ffff888033b68000 RSI: ffffffff8b8dca8e RDI: ffff888033b68000
RBP: ffff88802a3b4d80 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: 00000000ffffffff R14: ffff888037864400 R15: ffff888037864298
FS: 00005555720c7500(0000) GS:ffff8880d5d5a000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055e267f24d48 CR3: 0000000036162000 CR4: 0000000000352ef0
Call Trace:
<TASK>
ceph_monc_open_session+0x46/0x60 net/ceph/mon_client.c:534
__ceph_open_session+0x135/0x590 net/ceph/ceph_common.c:798
ceph_real_mount fs/ceph/super.c:1173 [inline]
ceph_get_tree+0xd98/0x1fd0 fs/ceph/super.c:1362
vfs_get_tree+0x92/0x320 fs/super.c:1947
vfs_cmd_create+0xd7/0x2a0 fs/fsopen.c:231
vfs_fsconfig_locked fs/fsopen.c:295 [inline]
__do_sys_fsconfig+0x55a/0xcb0 fs/fsopen.c:463
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7feb99b9e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff76419958 EFLAGS: 00000246 ORIG_RAX: 00000000000001af
RAX: ffffffffffffffda RBX: 00007feb99e25fa0 RCX: 00007feb99b9e159
RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000003
RBP: 00007feb99c3503b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007feb99e25fac R14: 00007feb99e25fa0 R15: 00007feb99e25fa0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:pick_new_mon net/ceph/mon_client.c:211 [inline]
RIP: 0010:__open_session+0x60f/0x740 net/ceph/mon_client.c:245
Code: f6 44 89 e7 e8 72 1e 27 fa 89 c5 e9 2b fb ff ff e8 96 4b 7e f6 c7 83 b4 09 00 00 0a 00 00 00 e9 22 fc ff ff e8 82 4b 7e f6 90 <0f> 0b e8 9a 86 f1 f6 e9 7b fa ff ff 4c 89 f7 e8 8d 86 f1 f6 e9 16
RSP: 0018:ffffc900039a7be0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888037864290 RCX: 0000000000000000
RDX: ffff888033b68000 RSI: ffffffff8b8dca8e RDI: ffff888033b68000
RBP: ffff88802a3b4d80 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: 00000000ffffffff R14: ffff888037864400 R15: ffff888037864298
FS: 00005555720c7500(0000) GS:ffff8880d5d5a000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055e267f24d48 CR3: 0000000036162000 CR4: 0000000000352ef0
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>
#ifndef __NR_fsconfig
#define __NR_fsconfig 431
#endif
#ifndef __NR_fsopen
#define __NR_fsopen 430
#endif
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*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=*/0x1000, /*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)) {}
// fsopen arguments: [
// type: ptr[in, buffer] {
// buffer: {63 65 70 68 00} (length 0x5)
// }
// flags: fsopen_flags = 0x0 (8 bytes)
// ]
// returns fd_fscontext
memcpy((void*)0x200000000000, "ceph\000", 5);
res = syscall(__NR_fsopen, /*type=*/0x200000000000ul, /*flags=*/0ul);
if (res != -1)
r[0] = res;
// fsconfig$FSCONFIG_SET_STRING arguments: [
// fd: fd_fscontext (resource)
// cmd: const = 0x1 (8 bytes)
// key: ptr[in, buffer] {
// buffer: {73 6f 75 72 63 65 00} (length 0x7)
// }
// value: ptr[in, buffer] {
// buffer: {63 6c 69 65 6e 74 2e 61 64 6d 69 6e 40 30 30 30 30 30 30 30 30 2d 30 30 30 30 2d 30 30 30 30 2d 30 30 30 30 2d 30 30 30 30 30 30 30 30 30 30 30 30 2e 63 65 70 68 3d 2f 00} (length 0x39)
// }
// aux: const = 0x0 (8 bytes)
// ]
memcpy((void*)0x200000000100, "source\000", 7);
memcpy((void*)0x200000000200, "client.admin@00000000-0000-0000-0000-000000000000.ceph=/\000", 57);
syscall(__NR_fsconfig, /*fd=*/r[0], /*cmd=*/1ul, /*key=*/0x200000000100ul, /*value=*/0x200000000200ul, /*aux=*/0ul);
// fsconfig$FSCONFIG_SET_STRING arguments: [
// fd: fd_fscontext (resource)
// cmd: const = 0x1 (8 bytes)
// key: ptr[in, buffer] {
// buffer: {6d 6f 6e 5f 61 64 64 72 00} (length 0x9)
// }
// value: ptr[in, buffer] {
// buffer: {31 32 37 2e 30 2e 30 2e 03 3a 36 37 38 39 00} (length 0xf)
// }
// aux: const = 0x0 (8 bytes)
// ]
memcpy((void*)0x200000000300, "mon_addr\000", 9);
memcpy((void*)0x200000000400, "127.0.0.\003:6789\000", 15);
syscall(__NR_fsconfig, /*fd=*/r[0], /*cmd=*/1ul, /*key=*/0x200000000300ul, /*value=*/0x200000000400ul, /*aux=*/0ul);
// fsconfig$FSCONFIG_CMD_CREATE arguments: [
// fd: fd_fscontext (resource)
// cmd: const = 0x6 (8 bytes)
// key: const = 0x0 (8 bytes)
// value: const = 0x0 (8 bytes)
// aux: const = 0x0 (8 bytes)
// ]
syscall(__NR_fsconfig, /*fd=*/r[0], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*aux=*/0ul);
return 0;
}
Reply: The bug is a `BUG_ON(monc->monmap->num_mon < 1)` in `pick_new_mon()` which is triggered when attempting to open a session with a Ceph monitor, but the monitor map has 0 monitors.
This state is reached because of how the new mount API (`fsopen` + `fsconfig`) handles parameter parsing errors. When the user provides an invalid `mon_addr` (e.g., `"127.0.0.\x03:6789"`), `ceph_parse_mon_addr()` saves the string but `ceph_parse_mon_ips()` fails to resolve it and returns an error (e.g., `-ESRCH`). The `fsconfig` syscall returns this error to the user space. However, the user can simply ignore the error and proceed to call `fsconfig(FSCONFIG_CMD_CREATE)`.
During the creation phase, `ceph_get_tree()` checks if `fsopt->mon_addr` is set. Since the string was saved before the parsing failed, this check passes. The code then proceeds to initialize the monitor client (`ceph_monc_init()`), which allocates a monitor map with `num_mon = 0`. Later, when `ceph_real_mount()` attempts to open a session, it calls `pick_new_mon()`, which hits the `BUG_ON` because `num_mon` is 0.
**Security Impact Assessment:**
- **Exploitable**: No. The bug is a `BUG_ON` which intentionally halts the kernel (panic). It does not lead to memory corruption, information leaks, or control-flow hijacking.
- **Denial of Service**: Yes. Triggering the bug causes a kernel panic, leading to a denial of service.
- **Accessible From Unprivileged Processes / User Namespaces**: No. The `ceph` filesystem does not have the `FS_USERNS_MOUNT` flag. Therefore, `fsopen("ceph")` requires `CAP_SYS_ADMIN` in the initial user namespace. If an unprivileged user attempts to mount it from a new user namespace, the `sget_fc()` function will reject the mount with `-EPERM` before the vulnerable code (`ceph_real_mount()`) is reached.
- **Other Triggers**: The bug is triggered by local syscalls (`fsopen`/`fsconfig`) and does not involve network traffic, malicious filesystem images, or peripheral devices.
In conclusion, this is a root-only Denial of Service bug, and it does not pose a security risk to unprivileged users.
|
| 6/2 |
2026/09/11 01:02 |
llm |
expert |
0m
Model:
Tokens:
input: 10125
output: 37
thoughts: 191
Thoughts: **Analyzing a Kernel Bug in the Ceph Filesystem Client**
Okay, so I've got a kernel bug alert, specifically in `net/ceph/mon_client.c` at line 211. This thing's being triggered by a syzkaller reproducer, which should make analysis a little more straightforward. Let's see... the reproducer does the following: First, `fsopen("ceph")` - standard file system open. Then we have a few `fsconfig` calls. The first sets the "source" configuration string to include a client identifier and the mount point, `/`. The second sets the "mon_addr" to `127.0.0.\x03:6789`. Finally, it finishes things off with `fsconfig(fd, FSCONFIG_CMD_CREATE)`.
The crucial bit, of course, is that mon_addr value. That funky IP address seems like the likely culprit, at least initially. I'll need to dive into the code around line 211 in `mon_client.c` to see how that monitor address is being handled during the filesystem setup and creation. I expect it's something to do with the unexpected character in the IP address, or perhaps the code is expecting a fully populated address and the 0x03 is being interpreted incorrectly. Gotta get into the weeds now and see what the code thinks of that address, and where the assumption is failing.
|
| 7/2 |
2026/09/11 01:03 |
tool |
read-file |
0m
Args: map[File:net/ceph/mon_client.c FirstLine:200 LineCount:50]
Results: map[Contents: 200: ceph_auth_reset(monc->auth);
201: }
202:
203: /*
204: * Pick a new monitor at random and set cur_mon. If we are repicking
205: * (i.e. cur_mon is already set), be sure to pick a different one.
206: */
207: static void pick_new_mon(struct ceph_mon_client *monc)
208: {
209: int old_mon = monc->cur_mon;
210:
211: BUG_ON(monc->monmap->num_mon < 1);
212:
213: if (monc->monmap->num_mon == 1) {
214: monc->cur_mon = 0;
215: } else {
216: int max = monc->monmap->num_mon;
217: int o = -1;
218: int n;
219:
220: if (monc->cur_mon >= 0) {
221: if (monc->cur_mon < monc->monmap->num_mon)
222: o = monc->cur_mon;
223: if (o >= 0)
224: max--;
225: }
226:
227: n = get_random_u32_below(max);
228: if (o >= 0 && n >= o)
229: n++;
230:
231: monc->cur_mon = n;
232: }
233:
234: dout("%s mon%d -> mon%d out of %d mons\n", __func__, old_mon,
235: monc->cur_mon, monc->monmap->num_mon);
236: }
237:
238: /*
239: * Open a session with a new monitor.
240: */
241: static void __open_session(struct ceph_mon_client *monc)
242: {
243: int ret;
244:
245: pick_new_mon(monc);
246:
247: monc->hunting = true;
248: if (monc->had_a_connection) {
249: monc->hunt_mult *= CEPH_MONC_HUNT_BACKOFF;
]
|
| 8/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 11390
output: 37
thoughts: 193
Thoughts: **Debugging a Mysterious Zero**
Okay, here's the deal. I'm looking at this bug: `BUG_ON(monc->monmap->num_mon < 1);` in `pick_new_mon()`. That's a pretty clear indicator - `num_mon` is unexpectedly zero. My first thought is to track down how `monc->monmap` gets initialized and how `num_mon` could end up being zero in the first place. This is where things get interesting. The reproducer is using this rather odd `mon_addr`: `"127.0.0.\x03:6789"`. And there it is, a non-standard IP in the address, the `\x03` character!
Then I see the log message, `libceph: resolve '127.0.0. ' (ret=-3): failed`. Bingo, the resolution failed! But... how did it even *get* to `__open_session` if the address resolution failed? That doesn't make any sense. I need to dig into `ceph_monc_open_session` and `__ceph_open_session` to see how it's getting around that failure condition. There's some subtle interaction going on here I need to understand.
|
| 9/2 |
2026/09/11 01:03 |
tool |
read-file |
0m
Args: map[File:net/ceph/ceph_common.c FirstLine:780 LineCount:50]
Results: map[Contents: 780: {
781: ceph_messenger_reset_nonce(&client->msgr);
782: ceph_monc_reopen_session(&client->monc);
783: ceph_osdc_reopen_osds(&client->osdc);
784: }
785: EXPORT_SYMBOL(ceph_reset_client_addr);
786:
787: /*
788: * mount: join the ceph cluster, and open root directory.
789: */
790: int __ceph_open_session(struct ceph_client *client)
791: {
792: DEFINE_WAIT_FUNC(wait, woken_wake_function);
793: long timeout = ceph_timeout_jiffies(client->options->mount_timeout);
794: bool have_monmap, have_osdmap;
795: int err;
796:
797: /* open session, and wait for mon and osd maps */
798: err = ceph_monc_open_session(&client->monc);
799: if (err < 0)
800: return err;
801:
802: add_wait_queue(&client->auth_wq, &wait);
803: for (;;) {
804: mutex_lock(&client->monc.mutex);
805: err = client->auth_err;
806: have_monmap = client->monc.monmap && client->monc.monmap->epoch;
807: mutex_unlock(&client->monc.mutex);
808:
809: down_read(&client->osdc.lock);
810: have_osdmap = client->osdc.osdmap && client->osdc.osdmap->epoch;
811: up_read(&client->osdc.lock);
812:
813: if (err || (have_monmap && have_osdmap))
814: break;
815:
816: if (signal_pending(current)) {
817: err = -ERESTARTSYS;
818: break;
819: }
820:
821: if (!timeout) {
822: err = -ETIMEDOUT;
823: break;
824: }
825:
826: /* wait */
827: dout("mount waiting for mon_map\n");
828: timeout = wait_woken(&wait, TASK_INTERRUPTIBLE, timeout);
829: }
]
|
| 10/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 12651
output: 37
thoughts: 14
Thoughts: Okay, let's dive into this. Here's my take on `ceph_monc_open_session`:
**Analyzing `ceph_monc_open_session`**
Alright, I'm looking at `ceph_monc_open_session`. Immediately, my expert brain starts whirring. This is likely a critical function within Ceph, probably related to establishing a connection or a session with a Ceph monitor. The name itself suggests this: "ceph," the obvious Ceph connection, "monc" is pretty clearly short for Monitor Client, and "open_session" is the key to it all.
I'm mentally running through the Ceph architecture β this function probably orchestrates the authentication handshake, negotiates communication protocols, and sets up whatever data structures are required for the client to interact with the monitor. Security would be paramount here, I'd expect key exchange, maybe some form of encryption to be happening. I'm already anticipating the potential complexities: error handling for connection failures, authentication failures, and the delicate dance of retries. I'm curious if this function handles the initial discovery of monitors or if that's a separate step. I'm wondering if there are different ways of establishing a session based on the client's configuration, or if there is a common set of options that are always negotiated. I can also imagine potential bottlenecks here, if there is a problem at this stage, it could cascade through the entire cluster. Okay, let's dig into the details and confirm my hypothesis.
|
| 11/2 |
2026/09/11 01:03 |
tool |
read-file |
0m
Args: map[File:net/ceph/mon_client.c FirstLine:520 LineCount:30]
Results: map[Contents: 520: mutex_unlock(&monc->mutex);
521: return 0;
522: }
523: EXPORT_SYMBOL(ceph_monc_wait_osdmap);
524:
525: /*
526: * Open a session with a random monitor. Request monmap and osdmap,
527: * which are waited upon in __ceph_open_session().
528: */
529: int ceph_monc_open_session(struct ceph_mon_client *monc)
530: {
531: mutex_lock(&monc->mutex);
532: __ceph_monc_want_map(monc, CEPH_SUB_MONMAP, 0, true);
533: __ceph_monc_want_map(monc, CEPH_SUB_OSDMAP, 0, false);
534: __open_session(monc);
535: __schedule_delayed(monc);
536: mutex_unlock(&monc->mutex);
537: return 0;
538: }
539: EXPORT_SYMBOL(ceph_monc_open_session);
540:
541: static void ceph_monc_handle_map(struct ceph_mon_client *monc,
542: struct ceph_msg *msg)
543: {
544: struct ceph_client *client = monc->client;
545: struct ceph_monmap *monmap;
546: void *p, *end;
547:
548: mutex_lock(&monc->mutex);
549:
]
|
| 12/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 13506
output: 24
thoughts: 81
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into Ceph Monitor Connection Handling**
Okay, so I'm tracing the `ceph_monc_open_session` function, and it looks like it's calling `__open_session(monc)`. Naturally, `__open_session` hands off the heavy lifting to `pick_new_mon(monc)`. My immediate thought is, what's `pick_new_mon` doing? Let me seeβ¦Ah, it's checking `monc->monmap->num_mon < 1`. A classic starting condition to check. Now, a critical question arises: where is `monc->monmap` actually initialized? It's a key piece of the puzzle. I'll need that to truly understand this session initialization flow. Let's dig into `ceph_monc_init`. That's the most logical place to begin looking. I'll bet the farm that's where the monmap is set up.
|
| 13/2 |
2026/09/11 01:03 |
tool |
codesearch-find-references |
0m
Args:
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ceph_create_client SourceFile:net/ceph/ceph_common.c SourceLine:741] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_ceph_monc_init_1261 SourceFile:net/ceph/mon_client.c SourceLine:1239] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_monc_init SourceFile:net/ceph/mon_client.c SourceLine:1239] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_monc_init SourceFile:net/ceph/mon_client.c SourceLine:1239]] TruncatedOutput:false]
|
| 14/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 14113
output: 24
thoughts: 12
Thoughts: Okay, let's dive into this `ceph_monc_init` function. I see it's likely a critical component for bootstrapping and configuring a Ceph Monitor. My immediate thought is, "What phase of the monitor lifecycle is this responsible for?" Is it initial setup, recovery from failure, or something else entirely? Given the name, I'd bet it's the very first part of bringing a Monitor online.
I want to look for key initialization steps. What configuration files or settings is it reading? Is it accessing the Ceph configuration daemon (`ceph-config`)? Any file I/O operations here are crucial to understand; are we talking about the `ceph.conf` file, the monitor map, or something else entirely? I need to understand the order of operations, especially with respect to other components.
I need to quickly identify any error handling or exception management built into this routine. It is a critical component for running a Ceph cluster. Where are the `try...catch` blocks or conditional checks? A lack of robust error handling at this stage is a massive red flag.
Finally, I'll pay close attention to any external dependencies. What other functions or data structures does this call or depend on? Are there any obvious potential bottlenecks? Any external calls here could easily become a problem in a large cluster, but might be difficult to debug. This will determine how resilient the whole system is. I need to understand this to have a good feel for how robust Cephβs monitor service really is. Let's see what we've got.
|
| 15/2 |
2026/09/11 01:03 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:1163: int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
1164: {
1165: int err;
1166:
1167: dout("init\n");
1168: memset(monc, 0, sizeof(*monc));
1169: monc->client = cl;
1170: mutex_init(&monc->mutex);
1171:
1172: err = build_initial_monmap(monc);
1173: if (err)
1174: goto out;
1175:
1176: /* connection */
1177: /* authentication */
1178: monc->auth = ceph_auth_init(cl->options->name, cl->options->key,
1179: cl->options->con_modes);
1180: if (IS_ERR(monc->auth)) {
1181: err = PTR_ERR(monc->auth);
1182: goto out_monmap;
1183: }
1184: monc->auth->want_keys =
1185: CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON |
1186: CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS;
1187:
1188: /* msgs */
1189: err = -ENOMEM;
1190: monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK,
1191: sizeof(struct ceph_mon_subscribe_ack),
1192: GFP_KERNEL, true);
1193: if (!monc->m_subscribe_ack)
1194: goto out_auth;
1195:
1196: monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 128,
1197: GFP_KERNEL, true);
1198: if (!monc->m_subscribe)
1199: goto out_subscribe_ack;
1200:
1201: monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096,
1202: GFP_KERNEL, true);
1203: if (!monc->m_auth_reply)
1204: goto out_subscribe;
1205:
1206: monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_KERNEL, true);
1207: monc->pending_auth = 0;
1208: if (!monc->m_auth)
1209: goto out_auth_reply;
1210:
1211: ceph_con_init(&monc->con, monc, &mon_con_ops,
1212: &monc->client->msgr);
1213:
1214: monc->cur_mon = -1;
1215: monc->had_a_connection = false;
1216: monc->hunt_mult = 1;
1217:
1218: INIT_DELAYED_WORK(&monc->delayed_work, delayed_work);
1219: monc->generic_request_tree = RB_ROOT;
1220: monc->last_tid = 0;
1221:
1222: monc->fs_cluster_id = CEPH_FS_CLUSTER_ID_NONE;
1223:
1224: return 0;
1225:
1226: out_auth_reply:
1227: ceph_msg_put(monc->m_auth_reply);
1228: out_subscribe:
1229: ceph_msg_put(monc->m_subscribe);
1230: out_subscribe_ack:
1231: ceph_msg_put(monc->m_subscribe_ack);
1232: out_auth:
1233: ceph_auth_destroy(monc->auth);
1234: out_monmap:
1235: kfree(monc->monmap);
1236: out:
1237: return err;
1238: }
SourceFile:net/ceph/mon_client.c]
|
| 16/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 15701
output: 24
thoughts: 17
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Analyzing the Initialization of the Monmap**
Okay, so `build_initial_monmap` has been invoked. My immediate instinct is to dissect this function. Given the critical role of the monitor map (monmap) in Ceph's cluster formation and ongoing operation, its initial construction warrants careful scrutiny. I need to understand its logic, particularly the source of the initial data, the determination of monitor addresses, and the method for seeding the cluster state. What's the strategy being employed to establish this core data structure? I want to ensure it handles potential race conditions or inconsistencies correctly, especially during the very first boot or a cluster reset scenario. Let's delve into the code and see what's happening under the hood. The starting point for this analysis will be to understand the underlying data sources that this initial build leverages, and how it handles potential errors.
|
| 17/2 |
2026/09/11 01:03 |
tool |
codesearch-definition-source |
0m
Args: map[Name:build_initial_monmap]
Results: map[SourceCode:1132: /*
1133: * On startup, we build a temporary monmap populated with the IPs
1134: * provided by mount(2).
1135: */
1136: static int build_initial_monmap(struct ceph_mon_client *monc)
1137: {
1138: __le32 my_type = ceph_msgr2(monc->client) ?
1139: CEPH_ENTITY_ADDR_TYPE_MSGR2 : CEPH_ENTITY_ADDR_TYPE_LEGACY;
1140: struct ceph_options *opt = monc->client->options;
1141: int num_mon = opt->num_mon;
1142: int i;
1143:
1144: /* build initial monmap */
1145: monc->monmap = kzalloc_flex(*monc->monmap, mon_inst, num_mon);
1146: if (!monc->monmap)
1147: return -ENOMEM;
1148: monc->monmap->num_mon = num_mon;
1149:
1150: for (i = 0; i < num_mon; i++) {
1151: struct ceph_entity_inst *inst = &monc->monmap->mon_inst[i];
1152:
1153: memcpy(&inst->addr.in_addr, &opt->mon_addr[i].in_addr,
1154: sizeof(inst->addr.in_addr));
1155: inst->addr.type = my_type;
1156: inst->addr.nonce = 0;
1157: inst->name.type = CEPH_ENTITY_TYPE_MON;
1158: inst->name.num = cpu_to_le64(i);
1159: }
1160: return 0;
1161: }
SourceFile:net/ceph/mon_client.c]
|
| 18/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 16487
output: 21
thoughts: 71
Thoughts: **Tracing the Monitor Count**
Okay, so I'm trying to figure out where `monc->monmap->num_mon` gets its value. The code seems to indicate it comes directly from `opt->num_mon`. That's a reasonable starting point. Now, where is `opt->num_mon` actually initialized? Ah, right, it's part of the `struct ceph_options` within `monc->client->options`. That makes sense in the overall architecture. Now I need to see exactly how this `opt->num_mon` variable is populated, how it's being parsed. I'll need to dive into the parsing logic for those `ceph_options`. I'll trace this variable back to where its actual numerical value is set, probably from an input file, command line argument, or configuration database.
|
| 19/2 |
2026/09/11 01:03 |
tool |
codesearch-find-references |
0m
Error:
Args:
Results: map[References:<nil> TruncatedOutput:false]
|
| 20/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 16779
output: 32
thoughts: 22
Thoughts: Here's my thought process, as it stands:
**Locating the Definition of `num_mon`**
Okay, so I need to find where the variable `num_mon` is defined. Given that I'm working with the Ceph codebase, and the hint points to `net/ceph/ceph_common.c`, my immediate strategy is to go directly to that file. I'm assuming that this is a key variable related to the number of monitors in a Ceph cluster, so its definition should be reasonably central. I'll start by searching within that specific file to save time and narrow down the scope. Let's see what we find.
|
| 21/2 |
2026/09/11 01:03 |
tool |
grepper |
0m
Args: map[Expression:num_mon PathPrefix:net/ceph/ceph_common.c]
Results: map[Output:net/ceph/ceph_common.c=131=int ceph_compare_options(struct ceph_options *new_opt,
--
net/ceph/ceph_common.c-183- /* any matching mon ip implies a match */
net/ceph/ceph_common.c:184: for (i = 0; i < opt1->num_mon; i++) {
net/ceph/ceph_common.c-185- if (ceph_monmap_contains(client->monc.monmap,
--
net/ceph/ceph_common.c=399=int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt,
--
net/ceph/ceph_common.c-406- ret = ceph_parse_ips(buf, buf + len, opt->mon_addr, CEPH_MAX_MON,
net/ceph/ceph_common.c:407: &opt->num_mon, delim);
net/ceph/ceph_common.c-408- if (ret) {
]
|
| 22/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 17251
output: 23
thoughts: 77
Thoughts: Here's my take on those thoughts:
**Dissecting the Monitor IP Parsing**
Okay, so `ceph_parse_mon_ips` is the entry point, and it's calling `ceph_parse_ips`. That's where the magic probably happens. The function call looks like: `ceph_parse_ips(buf, buf + len, opt->mon_addr, CEPH_MAX_MON, &opt->num_mon, delim)`. I'm guessing `buf` and `len` are the buffer and length containing the monitor addresses in some string format. `opt->mon_addr` is likely an array or structure to store the parsed IPs, `CEPH_MAX_MON` seems like the maximum number of monitors we'll support, `opt->num_mon` is probably the count of monitors parsed so far, and `delim` is the delimiter used in the string. I need to dive into `ceph_parse_ips`. I'm pretty sure it's located in `net/ceph/ceph_common.c` or a similar common utility file within the Ceph network code. Let's go take a look there; that's where the implementation details will be.
|
| 23/2 |
2026/09/11 01:03 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:1310: /*
1311: * Parse an ip[:port] list into an addr array. Use the default
1312: * monitor port if a port isn't specified.
1313: */
1314: int ceph_parse_ips(const char *c, const char *end,
1315: struct ceph_entity_addr *addr,
1316: int max_count, int *count, char delim)
1317: {
1318: int i, ret = -EINVAL;
1319: const char *p = c;
1320:
1321: dout("parse_ips on '%.*s'\n", (int)(end-c), c);
1322: for (i = 0; i < max_count; i++) {
1323: char cur_delim = delim;
1324: const char *ipend;
1325: int port;
1326:
1327: if (*p == '[') {
1328: cur_delim = ']';
1329: p++;
1330: }
1331:
1332: ret = ceph_parse_server_name(p, end - p, &addr[i], cur_delim,
1333: &ipend);
1334: if (ret)
1335: goto bad;
1336: ret = -EINVAL;
1337:
1338: p = ipend;
1339:
1340: if (cur_delim == ']') {
1341: if (*p != ']') {
1342: dout("missing matching ']'\n");
1343: goto bad;
1344: }
1345: p++;
1346: }
1347:
1348: /* port? */
1349: if (p < end && *p == ':') {
1350: port = 0;
1351: p++;
1352: while (p < end && *p >= '0' && *p <= '9') {
1353: port = (port * 10) + (*p - '0');
1354: p++;
1355: }
1356: if (port == 0)
1357: port = CEPH_MON_PORT;
1358: else if (port > 65535)
1359: goto bad;
1360: } else {
1361: port = CEPH_MON_PORT;
1362: }
1363:
1364: ceph_addr_set_port(&addr[i], port);
1365: /*
1366: * We want the type to be set according to ms_mode
1367: * option, but options are normally parsed after mon
1368: * addresses. Rather than complicating parsing, set
1369: * to LEGACY and override in build_initial_monmap()
1370: * for mon addresses and ceph_messenger_init() for
1371: * ip option.
1372: */
1373: addr[i].type = CEPH_ENTITY_ADDR_TYPE_LEGACY;
1374: addr[i].nonce = 0;
1375:
1376: dout("%s got %s\n", __func__, ceph_pr_addr(&addr[i]));
1377:
1378: if (p == end)
1379: break;
1380: if (*p != delim)
1381: goto bad;
1382: p++;
1383: }
1384:
1385: if (p != end)
1386: goto bad;
1387:
1388: if (count)
1389: *count = i + 1;
1390: return 0;
1391:
1392: bad:
1393: return ret;
1394: }
SourceFile:net/ceph/messenger.c]
|
| 24/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 18761
output: 25
thoughts: 38
Thoughts: Okay, let me think this through.
**Analyzing the `ceph_parse_ips` Logic**
Alright, I'm diving into this code... Seems like `ceph_parse_ips` is returning `ret` when things go south, when `bad` is flagged. The critical question here is, what's happening *downstream* in `ceph_parse_mon_ips` when a "bad" `ret` is passed along? It's that cascading error handling that always gets you. I need to understand if the caller of `ceph_parse_ips` is correctly checking the return value and handling the failure. Is `ceph_parse_mon_ips` properly propagating or responding to that `ret` value, or is it blithely proceeding as if everything's hunky-dory? Any oversight at this stage and it'll lead to some seriously hard-to-debug issues later. Let me trace that execution pathβ¦
|
| 25/2 |
2026/09/11 01:03 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ceph_parse_mon_ips]
Results: map[SourceCode: 399: int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt,
400: struct fc_log *l, char delim)
401: {
402: struct p_log log = {.prefix = "libceph", .log = l};
403: int ret;
404:
405: /* ip1[:port1][<delim>ip2[:port2]...] */
406: ret = ceph_parse_ips(buf, buf + len, opt->mon_addr, CEPH_MAX_MON,
407: &opt->num_mon, delim);
408: if (ret) {
409: error_plog(&log, "Failed to parse monitor IPs: %d", ret);
410: return ret;
411: }
412:
413: return 0;
414: }
SourceFile:net/ceph/ceph_common.c]
|
| 26/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 19318
output: 25
thoughts: 42
Thoughts: Okay, let's see...
**Analyzing Error Handling in Ceph IP Parsing**
Alright, so if `ceph_parse_mon_ips` throws an error (`ret` is returned), that's a problem for the calling function. I need to understand the potential failure points. Hmm, let me see... It looks like `ceph_parse_server_name` is called within the sequence. Let me take a look at *that* function and see what it is doing. That's likely where the root of this lies. Let me see...
|
| 27/2 |
2026/09/11 01:03 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ceph_parse_server_name]
Results: map[SourceCode:1294: /*
1295: * Parse a server name (IP or hostname). If a valid IP address is not found
1296: * then try to extract a hostname to resolve using userspace DNS upcall.
1297: */
1298: static int ceph_parse_server_name(const char *name, size_t namelen,
1299: struct ceph_entity_addr *addr, char delim, const char **ipend)
1300: {
1301: int ret;
1302:
1303: ret = ceph_pton(name, namelen, addr, delim, ipend);
1304: if (ret)
1305: ret = ceph_dns_resolve_name(name, namelen, addr, delim, ipend);
1306:
1307: return ret;
1308: }
SourceFile:net/ceph/messenger.c]
|
| 28/2 |
2026/09/11 01:03 |
llm |
expert |
0m
Model:
Tokens:
input: 19768
output: 25
thoughts: 21
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Debugging Network Address Resolution in Ceph**
Okay, so `ceph_pton` is failing. Hmm, that's not ideal. This is the first place I'd check when running into issues connecting to a Ceph cluster. My initial thought is likely an invalid IP address format or something very basic. But the code path then calls `ceph_dns_resolve_name`. This makes me think the problem is probably *not* a straight-up invalid IPv4/IPv6 address, but that we're dealing with a hostname lookup. It's likely trying to resolve a name into an IP and failing at that level. I'll need to figure out *why* the DNS lookup is failing. It could be a simple DNS server misconfiguration, a firewall issue preventing outbound DNS queries, a broken or misconfigured `/etc/hosts` entry (though that's less likely if it went straight to DNS), or even a temporary DNS outage. It is unlikely that it is an AAAA record with an empty value. I'll have to investigate which step failed. If I were a new user, I might look at how my DNS servers are configured, or if the DNS server is reachable.
|
| 29/2 |
2026/09/11 01:04 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ceph_dns_resolve_name]
Results: map[SourceCode:1242: static int ceph_dns_resolve_name(const char *name, size_t namelen,
1243: struct ceph_entity_addr *addr, char delim, const char **ipend)
1244: {
1245: const char *end, *delim_p;
1246: char *colon_p, *ip_addr = NULL;
1247: int ip_len, ret;
1248:
1249: /*
1250: * The end of the hostname occurs immediately preceding the delimiter or
1251: * the port marker (':') where the delimiter takes precedence.
1252: */
1253: delim_p = memchr(name, delim, namelen);
1254: colon_p = memchr(name, ':', namelen);
1255:
1256: if (delim_p && colon_p)
1257: end = min(delim_p, colon_p);
1258: else if (!delim_p && colon_p)
1259: end = colon_p;
1260: else {
1261: end = delim_p;
1262: if (!end) /* case: hostname:/ */
1263: end = name + namelen;
1264: }
1265:
1266: if (end <= name)
1267: return -EINVAL;
1268:
1269: /* do dns_resolve upcall */
1270: ip_len = dns_query(current->nsproxy->net_ns,
1271: NULL, name, end - name, NULL, &ip_addr, NULL, false);
1272: if (ip_len > 0)
1273: ret = ceph_pton(ip_addr, ip_len, addr, -1, NULL);
1274: else
1275: ret = -ESRCH;
1276:
1277: kfree(ip_addr);
1278:
1279: *ipend = end;
1280:
1281: pr_info("resolve '%.*s' (ret=%d): %s\n", (int)(end - name), name,
1282: ret, ret ? "failed" : ceph_pr_addr(addr));
1283:
1284: return ret;
1285: }
SourceFile:net/ceph/messenger.c]
|
| 30/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 20770
output: 25
thoughts: 210
Thoughts: **Decoding the Ceph Configuration Logic**
Okay, so `ceph_dns_resolve_name` is key here. I see it sets `*ipend = end;` and then returns `ret`. If `ret` is `-ESRCH` β which we all know is -3 β it just returns -3. Got it. Now, if `ceph_parse_server_name` also returns -3β¦ that's where things get interesting. Looking at the code in `ceph_parse_ips`, I can see:
```c
ret = ceph_parse_server_name(p, end - p, &addr[i], cur_delim,
&ipend);
if (ret)
goto bad;
```
Right, so if `ceph_parse_server_name` returns an error, it jumps to `bad`, and that function then just returns `ret`. `ceph_parse_mon_ips` then seems to inherit that return value. But hold on⦠if that all returns an error, how in the world does `fsconfig` *ever* succeed? There's a disconnect here. This is classic debugging, let's trace the parsing of `mon_addr`. I need to dig into `ceph_parse_param`, likely in `fs/ceph/super.c` or wherever the `mon_addr` parameter is actually handled. I'm betting that's where the magic, or the bug, lies. Let's see how that error gets swallowed or corrected.
|
| 31/2 |
2026/09/11 01:04 |
tool |
codesearch-find-references |
0m
Args: map[Name:ceph_parse_mon_ips]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ceph_parse_mon_addr SourceFile:fs/ceph/super.c SourceLine:402] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ceph_parse_old_source SourceFile:fs/ceph/super.c SourceLine:265] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_ceph_parse_mon_ips_1250 SourceFile:net/ceph/ceph_common.c SourceLine:415] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_parse_mon_ips SourceFile:net/ceph/ceph_common.c SourceLine:415] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_parse_mon_ips SourceFile:net/ceph/ceph_common.c SourceLine:415]] TruncatedOutput:false]
|
| 32/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 21663
output: 25
thoughts: 23
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into Ceph Address Parsing**
Okay, so I need to understand how Ceph monitors are addressed, and that means tracing the code that actually parses those addresses. Right, let's look at `ceph_parse_mon_addr`... specifically, that's in `fs/ceph/super.c`. That's where I'd expect to find the core logic for translating the configuration string into something the kernel can use to connect to the monitor cluster. I'm going to start there and see what jumps out. I'll be looking for things like how it handles different address formats (IP:port, hostname:port, etc.), if it supports any specific address families, and most importantly, how it deals with potential errors during the parsing process. Time to dig in!
|
| 33/2 |
2026/09/11 01:04 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ceph_parse_mon_addr]
Results: map[SourceCode: 392: static int ceph_parse_mon_addr(struct fs_parameter *param,
393: struct fs_context *fc)
394: {
395: struct ceph_parse_opts_ctx *pctx = fc->fs_private;
396: struct ceph_mount_options *fsopt = pctx->opts;
397:
398: kfree(fsopt->mon_addr);
399: fsopt->mon_addr = param->string;
400: param->string = NULL;
401:
402: return ceph_parse_mon_ips(fsopt->mon_addr, strlen(fsopt->mon_addr),
403: pctx->copts, fc->log.log, '/');
404: }
SourceFile:fs/ceph/super.c]
|
| 34/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 22146
output: 23
thoughts: 217
Thoughts: **Analyzing the `ceph_parse_mon_addr` Failure**
Okay, let's break this down. First, `ceph_parse_mon_addr` just hands off to `ceph_parse_mon_ips`, right? And if that returns `-3` (which is `-ESRCH`), then the whole thing *should* fail, meaning `fsconfig` should error out, yeah? But the reproducer code doesn't do that. I see it now:
```c
syscall(__NR_fsconfig, /*fd=*/r[0], /*cmd=*/1ul, /*key=*/0x200000000300ul, /*value=*/0x200000000400ul, /*aux=*/0ul);
```
Wait a second... it's just *ignoring* the return value of `fsconfig` when setting the `mon_addr`! That's it! So, `fsconfig` probably *is* failing for `mon_addr`, and the number of monitors, `opt->num_mon`, is staying at zero. Then, after that, it calls `fsconfig(CMD_CREATE)` regardless. Okay, I need to get to the bottom of this. Let's dig into `ceph_get_tree` in `fs/ceph/super.c`.
|
| 35/2 |
2026/09/11 01:04 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:1309: static int ceph_get_tree(struct fs_context *fc)
1310: {
1311: struct ceph_parse_opts_ctx *pctx = fc->fs_private;
1312: struct ceph_mount_options *fsopt = pctx->opts;
1313: struct super_block *sb;
1314: struct ceph_fs_client *fsc;
1315: struct dentry *res;
1316: int (*compare_super)(struct super_block *, struct fs_context *) =
1317: ceph_compare_super;
1318: int err;
1319:
1320: dout("ceph_get_tree\n");
1321:
1322: if (!fc->source)
1323: return invalfc(fc, "No source");
1324: if (fsopt->new_dev_syntax && !fsopt->mon_addr)
1325: return invalfc(fc, "No monitor address");
1326:
1327: /* create client (which we may/may not use) */
1328: fsc = create_fs_client(pctx->opts, pctx->copts);
1329: pctx->opts = NULL;
1330: pctx->copts = NULL;
1331: if (IS_ERR(fsc)) {
1332: err = PTR_ERR(fsc);
1333: goto out_final;
1334: }
1335:
1336: err = ceph_mdsc_init(fsc);
1337: if (err < 0)
1338: goto out;
1339:
1340: if (ceph_test_opt(fsc->client, NOSHARE))
1341: compare_super = NULL;
1342:
1343: fc->s_fs_info = fsc;
1344: sb = sget_fc(fc, compare_super, ceph_set_super);
1345: fc->s_fs_info = NULL;
1346: if (IS_ERR(sb)) {
1347: err = PTR_ERR(sb);
1348: goto out;
1349: }
1350:
1351: if (ceph_sb_to_fs_client(sb) != fsc) {
1352: destroy_fs_client(fsc);
1353: fsc = ceph_sb_to_fs_client(sb);
1354: dout("get_sb got existing client %p\n", fsc);
1355: } else {
1356: dout("get_sb using new client %p\n", fsc);
1357: err = ceph_setup_bdi(sb, fsc);
1358: if (err < 0)
1359: goto out_splat;
1360: }
1361:
1362: res = ceph_real_mount(fsc, fc);
1363: if (IS_ERR(res)) {
1364: err = PTR_ERR(res);
1365: goto out_splat;
1366: }
1367:
1368: doutc(fsc->client, "root %p inode %p ino %llx.%llx\n", res,
1369: d_inode(res), ceph_vinop(d_inode(res)));
1370: fc->root = fsc->sb->s_root;
1371: return 0;
1372:
1373: out_splat:
1374: if (!ceph_mdsmap_is_cluster_available(fsc->mdsc->mdsmap)) {
1375: pr_info("No mds server is up or the cluster is laggy\n");
1376: err = -EHOSTUNREACH;
1377: }
1378:
1379: ceph_mdsc_close_sessions(fsc->mdsc);
1380: deactivate_locked_super(sb);
1381: goto out_final;
1382:
1383: out:
1384: destroy_fs_client(fsc);
1385: out_final:
1386: dout("ceph_get_tree fail %d\n", err);
1387: return err;
1388: }
SourceFile:fs/ceph/super.c]
|
| 36/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 23945
output: 23
thoughts: 227
Thoughts: **Analyzing the ceph client configuration flow**
Okay, wait a minute. This `fsopt->new_dev_syntax` check is tripping me up. The code explicitly says that *if* `new_dev_syntax` is enabled, *then* `mon_addr` *must* be set. Makes sense, right? A new device syntax likely *requires* a monitor address for obvious reasons.
But hang on. It's checking `!fsopt->mon_addr`, meaning it's verifying `mon_addr` is *not* null. And my understanding is that `fsopt->mon_addr` gets set right here in `ceph_parse_mon_addr`. It's getting assigned the value of `param->string`! But wait - what if `ceph_parse_mon_ips` *failed*? The `param->string` would be NULL, yes? And my further understanding is that `opt->num_mon`, specifically `pctx->copts->num_mon` *remains* at zero.
So, in the scenario where `ceph_parse_mon_ips` fails, we set `mon_addr`, but `num_mon` never gets incremented, right? And then we go on to call `create_fs_client`, which in turn calls `ceph_create_client`. That just feels off. I need to dig into `ceph_create_client` to understand what's happening. There seems to be a potential logic flaw here, where we might be proceeding with an invalid monitor configuration. I need to understand how the client handles an empty monitor list.
|
| 37/2 |
2026/09/11 01:04 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ceph_create_client]
Results: map[SourceCode: 703: /*
704: * create a fresh client instance
705: */
706: struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
707: {
708: struct ceph_client *client;
709: struct ceph_entity_addr *myaddr = NULL;
710: int err;
711:
712: err = wait_for_random_bytes();
713: if (err < 0)
714: return ERR_PTR(err);
715:
716: client = kzalloc_obj(*client);
717: if (client == NULL)
718: return ERR_PTR(-ENOMEM);
719:
720: client->private = private;
721: client->options = opt;
722:
723: mutex_init(&client->mount_mutex);
724: init_waitqueue_head(&client->auth_wq);
725: client->auth_err = 0;
726:
727: client->extra_mon_dispatch = NULL;
728: client->supported_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
729: client->required_features = CEPH_FEATURES_REQUIRED_DEFAULT;
730:
731: if (!ceph_test_opt(client, NOMSGSIGN))
732: client->required_features |= CEPH_FEATURE_MSG_AUTH;
733:
734: /* msgr */
735: if (ceph_test_opt(client, MYIP))
736: myaddr = &client->options->my_addr;
737:
738: ceph_messenger_init(&client->msgr, myaddr);
739:
740: /* subsystems */
741: err = ceph_monc_init(&client->monc, client);
742: if (err < 0)
743: goto fail;
744: err = ceph_osdc_init(&client->osdc, client);
745: if (err < 0)
746: goto fail_monc;
747:
748: return client;
749:
750: fail_monc:
751: ceph_monc_stop(&client->monc);
752: fail:
753: ceph_messenger_fini(&client->msgr);
754: kfree(client);
755: return ERR_PTR(err);
756: }
SourceFile:net/ceph/ceph_common.c]
|
| 38/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 25319
output: 23
thoughts: 461
Thoughts: **Debugging a Ceph Client Initialization Issue**
Okay, so I'm tracking down this nasty bug in Ceph client initialization. It looks like the core issue stems from how the monitor map is handled. We start with `ceph_monc_init`. That function then triggers `build_initial_monmap(monc)`. Inside that, the code allocates memory for the `monc->monmap` based on `opt->num_mon`. The problem? `opt->num_mon` is zero! Therefore, `monc->monmap->num_mon` ends up being zero as well.
The execution then flows through a series of function calls: `ceph_get_tree`, `ceph_real_mount`, `__ceph_open_session`, `ceph_monc_open_session`, and finally to `__open_session`. Within `__open_session`, we hit `pick_new_mon`. And *bam*! That's where it crashes. The `BUG_ON(monc->monmap->num_mon < 1);` assertion fails, because we're trying to work with an empty monitor map.
So, the root cause seems to be the mishandling of the monitor address parsing. `ceph_parse_mon_addr` seems to be stashing `param->string` into `fsopt->mon_addr`. The real problem is, the code *ignores* the error return from `ceph_parse_mon_ips`. The user can potentially miss this and `fsconfig` is called, even with bad monitor addresses. `fsconfig` does return an error, but it doesn't seem to abort the whole context. It simply signals that something is wrong.
The user then calls `fsconfig(CMD_CREATE)`. In `ceph_get_tree`, we check `fsopt->new_dev_syntax && !fsopt->mon_addr` and return an error if there's no monitor address. But that check is skipped! Because `fsopt->mon_addr` *is* set, even though it's likely invalid. But, since `opt->num_mon` is zero at this point, the monitor map initialization fails later.
I need to confirm if `opt->num_mon` is checked elsewhere *before* `ceph_monc_init` or `ceph_get_tree`. It looks like it's a race condition and a potential error-handling weakness! Time to trace back through `create_fs_client` and `ceph_get_tree` to see where the logic goes wrong. I need to ensure that the error from `ceph_parse_mon_ips` causes a more substantial failure that gets propagated correctly, preventing the zero-sized monitor map from being created in the first place.
|
| 39/2 |
2026/09/11 01:04 |
tool |
codesearch-definition-source |
0m
Args: map[Name:create_fs_client]
Results: map[SourceCode: 812: /*
813: * create a new fs client
814: *
815: * Success or not, this function consumes @fsopt and @opt.
816: */
817: static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
818: struct ceph_options *opt)
819: {
820: struct ceph_fs_client *fsc;
821: int err;
822:
823: fsc = kzalloc_obj(*fsc);
824: if (!fsc) {
825: err = -ENOMEM;
826: goto fail;
827: }
828:
829: fsc->client = ceph_create_client(opt, fsc);
830: if (IS_ERR(fsc->client)) {
831: err = PTR_ERR(fsc->client);
832: goto fail;
833: }
834: opt = NULL; /* fsc->client now owns this */
835:
836: fsc->client->extra_mon_dispatch = extra_mon_dispatch;
837: ceph_set_opt(fsc->client, ABORT_ON_FULL);
838:
839: if (!fsopt->mds_namespace) {
840: ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP,
841: 0, true);
842: } else {
843: ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_FSMAP,
844: 0, false);
845: }
846:
847: fsc->mount_options = fsopt;
848:
849: fsc->sb = NULL;
850: fsc->mount_state = CEPH_MOUNT_MOUNTING;
851: fsc->filp_gen = 1;
852: fsc->have_copy_from2 = true;
853:
854: atomic_long_set(&fsc->writeback_count, 0);
855: fsc->write_congested = false;
856:
857: err = -ENOMEM;
858: /*
859: * The number of concurrent works can be high but they don't need
860: * to be processed in parallel, limit concurrency.
861: */
862: fsc->inode_wq = alloc_workqueue("ceph-inode", WQ_UNBOUND, 0);
863: if (!fsc->inode_wq)
864: goto fail_client;
865: fsc->cap_wq = alloc_workqueue("ceph-cap", WQ_PERCPU, 1);
866: if (!fsc->cap_wq)
867: goto fail_inode_wq;
868:
869: hash_init(fsc->async_unlink_conflict);
870: spin_lock_init(&fsc->async_unlink_conflict_lock);
871:
872: spin_lock(&ceph_fsc_lock);
873: list_add_tail(&fsc->metric_wakeup, &ceph_fsc_list);
874: spin_unlock(&ceph_fsc_lock);
875:
876: return fsc;
877:
878: fail_inode_wq:
879: destroy_workqueue(fsc->inode_wq);
880: fail_client:
881: ceph_destroy_client(fsc->client);
882: fail:
883: kfree(fsc);
884: if (opt)
885: ceph_destroy_options(opt);
886: destroy_mount_options(fsopt);
887: return ERR_PTR(err);
888: }
SourceFile:fs/ceph/super.c]
|
| 40/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 27585
output: 31
thoughts: 283
Thoughts: **My Analysis of a Potential Ceph Client Bug**
Okay, so I'm looking at this code and something is immediately jumping out at me: `opt->num_mon` isn't being validated anywhere! That's a red flag. If `ceph_parse_mon_ips` fails, `opt->num_mon` ends up being zero, which, in and of itself, is a normal state, but the problem arises when this is passed to subsequent functions.
Specifically, the code then calls `ceph_create_client`, which in turn initializes `ceph_monc_init`. That function then triggers `build_initial_monmap`. Here's where it gets interesting: `build_initial_monmap` *allocates* a monmap with `num_mon = 0`. This is where it breaks.
After that the code calls `ceph_get_tree`, which calls `ceph_real_mount`, which eventually drills down to `__ceph_open_session`, and then `ceph_monc_open_session`, and finally to `__open_session`, which culminates in `pick_new_mon`. And that's where the hammer drops: `pick_new_mon` executes `BUG_ON(monc->monmap->num_mon < 1);`.
So it looks like we have a `BUG_ON` scenario triggered when a user provides an invalid `mon_addr` and simply ignores the failure. They then call `fsconfig(CMD_CREATE)`.
But wait, I need to consider the broader context. Is `fsconfig` accessible to non-root users? And that's correct, `fsopen` and `fsconfig` are accessible to unprivileged users, provided they're in a user namespace with `CAP_SYS_ADMIN`.
This raises an even more critical question: does Ceph itself support unprivileged mounts? I need to check if `ceph` has `FS_USERNS_MOUNT` enabled. This has the potential to be a significant security issue if abused.
|
| 41/2 |
2026/09/11 01:04 |
tool |
grepper |
0m
Error:
Args: map[Expression:FS_USERNS_MOUNT PathPrefix:fs/ceph/]
Results:
|
| 42/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 28349
output: 30
thoughts: 19
Thoughts: Here's a summary of my thought process, as if I were the one thinking it:
**Diving into Ceph's Filesystem Flag Handling**
Okay, so I need to understand how Ceph handles filesystem flags. The `fs_flags` are critical for controlling how the filesystem behaves. Time to dig into the source code to get the details straight. Let's start with `fs/ceph/super.c`. That's usually the place to find the superblock-related information, and the `fs_flags` are almost certainly going to be defined and handled there. I'm going to look for the definition of the flags themselves β what each bit represents β and also how they're read, written, and interpreted during mount and operation. I'll need to figure out what values are supported and how they relate to the underlying storage and client configuration. I suspect there may be a connection to how the journal is handled too. Let's get to the code.
|
| 43/2 |
2026/09/11 01:04 |
tool |
grepper |
0m
Args: map[Expression:fs_flags PathPrefix:fs/ceph/super.c]
Results: map[Output:fs/ceph/super.c=1615=static struct file_system_type ceph_fs_type = {
--
fs/ceph/super.c-1619- .kill_sb = ceph_kill_sb,
fs/ceph/super.c:1620: .fs_flags = FS_RENAME_DOES_D_MOVE | FS_ALLOW_IDMAP,
fs/ceph/super.c-1621-};
]
|
| 44/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 28729
output: 22
thoughts: 83
Thoughts: **Analyzing the ceph Filesystem Mount Requirement**
Okay, so I'm looking at this and it's clear the ceph filesystem mount doesn't utilize `FS_USERNS_MOUNT`. Alright, that's not unexpected, but it does mean `fsopen("ceph")` is going to demand `CAP_SYS_ADMIN` in the initial user namespace. Hold on, though. I need to be precise here. Is the check purely `capable(CAP_SYS_ADMIN)` or does `fsopen` also consider `ns_capable(fc->user_ns, CAP_SYS_ADMIN)`? Gotta make sure I'm not missing a crucial nuance in the permission model. Best to consult the `fsopen` syscall definition directly to clarify the exact security context being evaluated. That's the only way to be completely certain.
|
| 45/2 |
2026/09/11 01:04 |
tool |
codesearch-definition-source |
0m
Error:
Args:
Results: map[SourceCode: SourceFile:]
|
| 46/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 29033
output: 35
thoughts: 17
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into the `fsopen` Implementation**
Okay, time to get my hands dirty. I'm going to start by taking a look at `fsopen` specifically, and I know that it lives in `fs/fsopen.c`. I need to understand its functionality, how it interacts with the broader filesystem, and any potential edge cases or subtleties it might expose. Let's see what the initial function definition looks like, and then I'll start tracing its control flow, perhaps using a debugger if things get tricky. I'm particularly interested in any mutexes or locking mechanisms used, as concurrency is always a prime concern in the kernel. I also want to see how `fsopen` interacts with other file system operations and data structures; this will give me a good handle on how it operates as a building block for higher-level functions. I'll be looking for opportunities to refine my mental model of this part of the filesystem.
|
| 47/2 |
2026/09/11 01:04 |
tool |
grepper |
0m
Error:
Args: map[Expression:SYSCALL_DEFINE1\(fsopen PathPrefix:fs/fsopen.c]
Results:
|
| 48/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 29313
output: 35
thoughts: 15
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into `SYSCALL_DEFINE2(fsopen)`**
Okay, time to dissect `SYSCALL_DEFINE2(fsopen)`. Let's see what we're dealing with here. My understanding is that this is the system call definition macro for `fsopen`. I remember it's one of the newer system calls in the Linux kernel, likely related to file system operations, maybe creating file systems or some kind of management. Given the `2` in the macro name, I'd assume it takes two arguments, based on the standard `SYSCALL_DEFINE` conventions. Time to dig in and see what those arguments are and the overall purpose. I need to refresh my memory on the arguments to the fsopen syscall...
|
| 49/2 |
2026/09/11 01:04 |
tool |
grepper |
0m
Args: map[Expression:SYSCALL_DEFINE2\(fsopen PathPrefix:fs/fsopen.c]
Results: map[Output:fs/fsopen.c=103=static int fscontext_alloc_log(struct fs_context *fc)
--
fs/fsopen.c-119- */
fs/fsopen.c:120:SYSCALL_DEFINE2(fsopen, const char __user *, _fs_name, unsigned int, flags)
fs/fsopen.c-121-{
]
|
| 50/2 |
2026/09/11 01:04 |
llm |
expert |
0m
Model:
Tokens:
input: 29642
output: 25
thoughts: 10
Thoughts: Okay, here we go...
**Diving into `sys_fsopen`**
Alright, let's get down to brass tacks. I need to understand `sys_fsopen`, the system call. Time to crack open the documentation and get my head around its purpose and implementation. I'm already thinking about its role in the larger file system architecture β what problem does it solve, what are its advantages, and where might it be less than ideal compared to the alternatives? Iβm immediately considering things like resource management implications; how it interacts with file descriptors, permissions, and locking. Is it a POSIX-compliant interface, or something more specialized? Understanding the low-level details of this particular system call is crucial for the context I'm working in, so let's get started.
|
| 51/2 |
2026/09/11 01:05 |
tool |
codesearch-definition-source |
0m
Args: map[Name:__do_sys_fsopen]
Results: map[SourceCode: 113: /*
114: * Open a filesystem by name so that it can be configured for mounting.
115: *
116: * We are allowed to specify a container in which the filesystem will be
117: * opened, thereby indicating which namespaces will be used (notably, which
118: * network namespace will be used for network filesystems).
119: */
120: SYSCALL_DEFINE2(fsopen, const char __user *, _fs_name, unsigned int, flags)
121: {
122: struct file_system_type *fs_type;
123: struct fs_context *fc;
124: const char *fs_name;
125: int ret;
126:
127: if (!may_mount())
128: return -EPERM;
129:
130: if (flags & ~FSOPEN_CLOEXEC)
131: return -EINVAL;
132:
133: fs_name = strndup_user(_fs_name, PAGE_SIZE);
134: if (IS_ERR(fs_name))
135: return PTR_ERR(fs_name);
136:
137: fs_type = get_fs_type(fs_name);
138: kfree(fs_name);
139: if (!fs_type)
140: return -ENODEV;
141:
142: fc = fs_context_for_mount(fs_type, 0);
143: put_filesystem(fs_type);
144: if (IS_ERR(fc))
145: return PTR_ERR(fc);
146:
147: fc->phase = FS_CONTEXT_CREATE_PARAMS;
148:
149: ret = fscontext_alloc_log(fc);
150: if (ret < 0)
151: goto err_fc;
152:
153: return fscontext_create_fd(fc, flags & FSOPEN_CLOEXEC ? O_CLOEXEC : 0);
154:
155: err_fc:
156: put_fs_context(fc);
157: return ret;
158: }
SourceFile:fs/fsopen.c]
|
| 52/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 30525
output: 25
thoughts: 27
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Investigating `fs_context_for_mount` Permissions**
Okay, hold on a second. Did I just see something about `fs_context_for_mount` doing permission checks? That seems⦠unexpected, but potentially important. I need to verify that. It's time to dig into the source code for `fs_context_for_mount` and see precisely what's happening within that function. I need to understand if, and to what extent, it's involved in access control, because if it's handling permissions directly, that significantly impacts the overall security model for mounts. I need to understand its role in the permission context immediately. Let's start by getting a clear picture.
|
| 53/2 |
2026/09/11 01:05 |
tool |
codesearch-definition-source |
0m
Args: map[Name:fs_context_for_mount]
Results: map[SourceCode: 306: struct fs_context *fs_context_for_mount(struct file_system_type *fs_type,
307: unsigned int sb_flags)
308: {
309: return alloc_fs_context(fs_type, NULL, sb_flags, 0,
310: FS_CONTEXT_FOR_MOUNT);
311: }
SourceFile:fs/fs_context.c]
|
| 54/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 30876
output: 23
thoughts: 11
Thoughts: Okay, here's my attempt at summarizing that thought process, keeping in mind I'm speaking to a fellow expert:
**Diving into `alloc_fs_context`**
Alright, time to dig into this. My mind immediately goes to the `alloc_fs_context` function. This is the starting point for a file system's context, right? It's where the initial setup happens before anything else. I'm going to start by confirming my understanding, making sure I'm solid on the fundamental design decisions here: What's the function's purpose? What data structures are initialized? What are the implications of the memory allocation within it, especially if we're dealing with potentially large or complex filesystems? Are there any obvious areas for potential contention or locking that I should be keeping an eye on? Let's trace the execution flow and make sure I fully grasp the intricacies of this key component.
|
| 55/2 |
2026/09/11 01:05 |
tool |
codesearch-definition-source |
0m
Args: map[Name:alloc_fs_context]
Results: map[SourceCode: 245: /**
246: * alloc_fs_context - Create a filesystem context.
247: * @fs_type: The filesystem type.
248: * @reference: The dentry from which this one derives (or NULL)
249: * @sb_flags: Filesystem/superblock flags (SB_*)
250: * @sb_flags_mask: Applicable members of @sb_flags
251: * @purpose: The purpose that this configuration shall be used for.
252: *
253: * Open a filesystem and create a mount context. The mount context is
254: * initialised with the supplied flags and, if a submount/automount from
255: * another superblock (referred to by @reference) is supplied, may have
256: * parameters such as namespaces copied across from that superblock.
257: */
258: static struct fs_context *alloc_fs_context(struct file_system_type *fs_type,
259: struct dentry *reference,
260: unsigned int sb_flags,
261: unsigned int sb_flags_mask,
262: enum fs_context_purpose purpose)
263: {
264: struct fs_context *fc;
265: int ret = -ENOMEM;
266:
267: fc = kzalloc_obj(struct fs_context, GFP_KERNEL_ACCOUNT);
268: if (!fc)
269: return ERR_PTR(-ENOMEM);
270:
271: fc->purpose = purpose;
272: fc->sb_flags = sb_flags;
273: fc->sb_flags_mask = sb_flags_mask;
274: fc->fs_type = get_filesystem(fs_type);
275: fc->cred = get_current_cred();
276: fc->net_ns = get_net(current->nsproxy->net_ns);
277: fc->log.prefix = fs_type->name;
278:
279: mutex_init(&fc->uapi_mutex);
280:
281: switch (purpose) {
282: case FS_CONTEXT_FOR_MOUNT:
283: fc->user_ns = get_user_ns(fc->cred->user_ns);
284: break;
285: case FS_CONTEXT_FOR_SUBMOUNT:
286: fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
287: break;
288: case FS_CONTEXT_FOR_RECONFIGURE:
289: atomic_inc(&reference->d_sb->s_active);
290: fc->user_ns = get_user_ns(reference->d_sb->s_user_ns);
291: fc->root = dget(reference);
292: break;
293: }
294:
295: ret = fc->fs_type->init_fs_context(fc);
296: if (ret < 0)
297: goto err_fc;
298: fc->need_free = true;
299: return fc;
300:
301: err_fc:
302: put_fs_context(fc);
303: return ERR_PTR(ret);
304: }
SourceFile:fs/fs_context.c]
|
| 56/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 32094
output: 21
thoughts: 26
Thoughts: Here's my thought process, as if I were analyzing that code:
**Diving into the Filesystem Mounting Logic**
Okay, so I see a call to `may_mount()` within `sys_fsopen`. That's interesting, as `sys_fsopen` is a key entry point for file system operations. The fact that the code is checking `may_mount()` here strongly suggests that filesystem mounting authorization is a key concern in the context of opening a file. So, I need to understand what `may_mount()` actually *does*. Is this a permission check? A capability check? Does it consider the specific filesystem type? Does it interact with a security module? Knowing the exact implementation of `may_mount()` is critical to understanding the security posture of this file opening function and the broader mount namespace and filesystem handling. My next step is to drill down into the definition of `may_mount()` and analyze its logic thoroughly. This is where the core security policy for mounts likely resides, and I need to understand it cold.
|
| 57/2 |
2026/09/11 01:05 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:2004: /*
2005: * Is the caller allowed to modify his namespace?
2006: */
2007: bool may_mount(void)
2008: {
2009: return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN);
2010: }
SourceFile:fs/namespace.c]
|
| 58/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 32480
output: 24
thoughts: 109
Thoughts: **My Initial Concerns Regarding Ceph Mounts**
Okay, so I'm looking at `may_mount()` and it's using `ns_capable()` to check for the `CAP_SYS_ADMIN` capability within the current user namespace. That seems straightforward enough; it's confirming that we *can* access the mount namespace from a user namespace. But, a red flag is going up...does the `ceph` filesystem *actually* permit mounting from a user namespace? That's the critical question.
My immediate concern is what happens if `ceph` doesn't have `FS_USERNS_MOUNT` support enabled. I'm thinking, if it *doesn't*, the `fsopen` call will likely succeed, but the subsequent `fsconfig(CMD_CREATE)` is almost certainly going to fail. That's a critical point of divergence!
I need to dig deeper. My next move is to examine `vfs_get_tree`. That's where I expect to find the information that will confirm or deny my suspicions about user namespace mount support.
|
| 59/2 |
2026/09/11 01:05 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:1928: /**
1929: * vfs_get_tree - Get the mountable root
1930: * @fc: The superblock configuration context.
1931: *
1932: * The filesystem is invoked to get or create a superblock which can then later
1933: * be used for mounting. The filesystem places a pointer to the root to be
1934: * used for mounting in @fc->root.
1935: */
1936: int vfs_get_tree(struct fs_context *fc)
1937: {
1938: struct super_block *sb;
1939: int error;
1940:
1941: if (fc->root)
1942: return -EBUSY;
1943:
1944: /* Get the mountable root in fc->root, with a ref on the root and a ref
1945: * on the superblock.
1946: */
1947: error = fc->ops->get_tree(fc);
1948: if (error < 0)
1949: return error;
1950:
1951: if (!fc->root) {
1952: pr_err("Filesystem %s get_tree() didn't set fc->root, returned %i\n",
1953: fc->fs_type->name, error);
1954: /* We don't know what the locking state of the superblock is -
1955: * if there is a superblock.
1956: */
1957: BUG();
1958: }
1959:
1960: sb = fc->root->d_sb;
1961: WARN_ON(!sb->s_bdi);
1962:
1963: /*
1964: * super_wake() contains a memory barrier which also care of
1965: * ordering for super_cache_count(). We place it before setting
1966: * SB_BORN as the data dependency between the two functions is
1967: * the superblock structure contents that we just set up, not
1968: * the SB_BORN flag.
1969: */
1970: super_wake(sb, SB_BORN);
1971:
1972: error = security_sb_set_mnt_opts(sb, fc->security, 0, NULL);
1973: if (unlikely(error)) {
1974: fc_drop_locked(fc);
1975: return error;
1976: }
1977:
1978: /*
1979: * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE
1980: * but s_maxbytes was an unsigned long long for many releases. Throw
1981: * this warning for a little while to try and catch filesystems that
1982: * violate this rule.
1983: */
1984: WARN((sb->s_maxbytes < 0), "%s set sb->s_maxbytes to "
1985: "negative value (%lld)\n", fc->fs_type->name, sb->s_maxbytes);
1986:
1987: return 0;
1988: }
SourceFile:fs/super.c]
|
| 60/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 33764
output: 22
thoughts: 26
Thoughts: Here's my thought process, as if I were considering this myself:
**Tracing the `FS_USERNS_MOUNT` Check**
Okay, so I'm trying to figure out where that `FS_USERNS_MOUNT` capability check is happening. It's crucial for understanding how user namespaces are being handled, and it feels like I've got a mental blank on the exact location. Time to dive into the code.
My first instinct is to check where the superblock operations are being handled for a filesystem. I suspect this will be within `sget_fc` as a starting point, which is where the filesystem cache is probably consulted and possibly where some of this checking would be. Let's see if the capability check is done there, or if I need to dig deeper.
|
| 61/2 |
2026/09/11 01:05 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode: 825: /**
826: * sget_fc - Find or create a superblock
827: * @fc: Filesystem context.
828: * @test: Comparison callback
829: * @set: Setup callback
830: *
831: * Create a new superblock or find an existing one.
832: *
833: * The @test callback is used to find a matching existing superblock.
834: * Whether or not the requested parameters in @fc are taken into account
835: * is specific to the @test callback that is used. They may even be
836: * completely ignored.
837: *
838: * If an extant superblock is matched, it will be returned unless:
839: *
840: * (1) the namespace the filesystem context @fc and the extant
841: * superblock's namespace differ
842: *
843: * (2) the filesystem context @fc has requested that reusing an extant
844: * superblock is not allowed
845: *
846: * In both cases EBUSY will be returned.
847: *
848: * If no match is made, a new superblock will be allocated and basic
849: * initialisation will be performed (s_type, s_fs_info and s_id will be
850: * set and the @set callback will be invoked), the superblock will be
851: * published and it will be returned in a partially constructed state
852: * with SB_BORN and SB_ACTIVE as yet unset.
853: *
854: * Return: On success, an extant or newly created superblock is
855: * returned. On failure an error pointer is returned.
856: */
857: struct super_block *sget_fc(struct fs_context *fc,
858: int (*test)(struct super_block *, struct fs_context *),
859: int (*set)(struct super_block *, struct fs_context *))
860: {
861: struct super_block *s = NULL;
862: struct super_block *old;
863: struct user_namespace *user_ns = fc->global ? &init_user_ns : fc->user_ns;
864: int err;
865:
866: /*
867: * Never allow s_user_ns != &init_user_ns when FS_USERNS_MOUNT or
868: * FS_USERNS_DELEGATABLE is not set, as the filesystem is likely
869: * unprepared to handle it. This can happen when fsconfig() is called
870: * from init_user_ns with an fs_fd opened in another user namespace.
871: */
872: if (user_ns != &init_user_ns &&
873: !(fc->fs_type->fs_flags & (FS_USERNS_MOUNT | FS_USERNS_DELEGATABLE))) {
874: errorfc(fc, "VFS: Mounting from non-initial user namespace is not allowed");
875: return ERR_PTR(-EPERM);
876: }
877:
878: retry:
879: spin_lock(&sb_lock);
880: if (test) {
881: hlist_for_each_entry(old, &fc->fs_type->fs_supers, s_instances) {
882: if (test(old, fc))
883: goto share_extant_sb;
884: }
885: }
886: if (!s) {
887: spin_unlock(&sb_lock);
888:
889: s = alloc_super(fc->fs_type, fc->sb_flags, user_ns);
890: if (!s)
891: return ERR_PTR(-ENOMEM);
892: goto retry;
893: }
894:
895: s->s_fs_info = fc->s_fs_info;
896: err = set(s, fc);
897: if (err) {
898: VFS_WARN_ON_ONCE(s->s_super_dev->sd_dev);
899: s->s_fs_info = NULL;
900: spin_unlock(&sb_lock);
901: destroy_unused_super(s);
902: return ERR_PTR(err);
903: }
904: VFS_WARN_ON_ONCE(!s->s_super_dev->sd_dev);
905: fc->s_fs_info = NULL;
906: s->s_type = fc->fs_type;
907: s->s_iflags |= fc->s_iflags;
908: strscpy(s->s_id, s->s_type->name, sizeof(s->s_id));
909: /*
910: * Make the superblock visible on @super_blocks and @fs_supers.
911: * It's in a nascent state and users should wait on SB_BORN or
912: * SB_DYING to be set.
913: */
914: list_add_tail(&s->s_list, &super_blocks);
915: hlist_add_head(&s->s_instances, &s->s_type->fs_supers);
916: spin_unlock(&sb_lock);
917: get_filesystem(s->s_type);
918: shrinker_register(s->s_shrink);
919: return s;
920:
921: share_extant_sb:
922: if (user_ns != old->s_user_ns || fc->exclusive) {
923: spin_unlock(&sb_lock);
924: destroy_unused_super(s);
925: if (fc->exclusive)
926: warnfc(fc, "reusing existing filesystem not allowed");
927: else
928: warnfc(fc, "reusing existing filesystem in another namespace not allowed");
929: return ERR_PTR(-EBUSY);
930: }
931: if (!grab_super(old))
932: goto retry;
933: destroy_unused_super(s);
934: return old;
935: }
SourceFile:fs/super.c]
|
| 62/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 35814
output: 24
thoughts: 1929
Thoughts: **Analysis of the Ceph Filesystem Mount Vulnerability**
Okay, let's break this down systematically. My initial thought process was: the `sget_fc` function is the gatekeeper. It checks if we're mounting from a non-initial user namespace and if the filesystem type has the appropriate flags (`FS_USERNS_MOUNT` or `FS_USERNS_DELEGATABLE`). If not, it returns -EPERM, preventing the mount.
My initial assumption was that the mount sequence calls `sget_fc` *before* the client is fully initialized, which seemed to me the problem lies when calling `create_fs_client`, as it calls `ceph_monc_init`. I looked back into `ceph_get_tree` and realized that `create_fs_client` is called before `sget_fc`, which didn't trigger the bug. I then verified the calls and found that `ceph_real_mount` happens *after* `sget_fc`.
So, the key is the `-EPERM` return from `sget_fc`. If that happens, `ceph_get_tree` bails out, `destroy_fs_client` is called, and `ceph_real_mount` *isn't* reached. This means the intended vulnerability wouldn't be triggered, because the BUG_ON is in `ceph_real_mount`. This suggested that an unprivileged user in a new user namespace *shouldn't* be able to hit the bug, since `sget_fc` would block them.
Then I considered mounting from the initial user namespace. This requires CAP_SYS_ADMIN, essentially root privileges. Could an unprivileged user somehow call `fsopen("ceph")` from the initial user namespace? `sys_fsopen` calls `may_mount()`, which checks for `CAP_SYS_ADMIN`. If the user is in the initial user namespace, this check blocks them. So a regular user can't exploit the bug in this way.
Now, a user in a *new* user namespace would have CAP_SYS_ADMIN within that namespace. They could call `fsopen`, configure options with `fsconfig`, and then trigger `vfs_get_tree`. But this calls `ceph_get_tree`, which *still* calls `sget_fc`, but with `fc->user_ns` pointing to the *new* user namespace, not the initial one. Since Ceph doesn't have the required flags, `sget_fc` returns `-EPERM` *again*, and `ceph_real_mount` is never called. So, the bug is still not triggered in this scenario.
I double-checked to confirm that `fc->user_ns` is indeed the user namespace of the calling process via `fs_context_for_mount` and `alloc_fs_context`. This confirms `sget_fc` would block the mount attempt.
Therefore, my conclusion, based on this review of the code path, is that an unprivileged user cannot trigger the BUG_ON. But syzkaller, which triggered the issue, often runs as root in a VM, in the initial user namespace. This explains why syzkaller can trigger the BUG_ON.
I went on to verify the call graph for `ceph_real_mount` by looking into the other available mount paths, such as the `mount` syscall, and concluded that they all call `vfs_get_tree`, which would also be blocked by the same `sget_fc` check. This would be the same path, and `sget_fc` would block the mount.
Finally, I checked `__ceph_open_session`, which is also called by `rbd_add`. I should probably investigate the `rbd_add` path next.
|
| 63/2 |
2026/09/11 01:05 |
tool |
codesearch-find-references |
0m
Args: map[Name:__ceph_open_session]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ceph_open_session SourceFile:net/ceph/ceph_common.c SourceLine:850] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ceph_real_mount SourceFile:fs/ceph/super.c SourceLine:1173] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable___ceph_open_session_1270 SourceFile:net/ceph/ceph_common.c SourceLine:841] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr___ceph_open_session SourceFile:net/ceph/ceph_common.c SourceLine:841] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr___ceph_open_session SourceFile:net/ceph/ceph_common.c SourceLine:841]] TruncatedOutput:false]
|
| 64/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 38909
output: 23
thoughts: 38
Thoughts: Here's a summary of my thought process:
**Diving into Ceph Session Management**
Okay, so I see that `__ceph_open_session` is a key function in this part of the Ceph client code. I know it's being called from both `ceph_open_session` and `ceph_real_mount`. This suggests it's a critical function for establishing and maintaining client sessions, which is what I'd expect. To really understand what's happening here, the best place to start is with the core function itself. Let's delve into `ceph_open_session` and get a clear picture of its role in the process.
|
| 65/2 |
2026/09/11 01:05 |
tool |
codesearch-find-references |
0m
Args: map[Name:ceph_open_session]
Results: map[References:[map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_ceph_open_session_1273 SourceFile:net/ceph/ceph_common.c SourceLine:855] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_open_session SourceFile:net/ceph/ceph_common.c SourceLine:855] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_open_session SourceFile:net/ceph/ceph_common.c SourceLine:855]] TruncatedOutput:false]
|
| 66/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 39334
output: 25
thoughts: 30
Thoughts: Here's my take on this, assuming I'm an expert in this field:
**Digging into Ceph Kernel Integration**
Okay, hold on a second. I was under the impression that `ceph_open_session` was a key function call within the kernel's Ceph client code. But now I'm thinking, is it actually used? It doesn't seem to be immediately obvious. Let me quickly double-check. Time to bust out the trusty `grep`! I'm going to run a search for `ceph_open_session` across the kernel source. This should quickly tell me if the function is being directly invoked, and, if so, where. Hopefully, that will shed some light on the design and usage of the session management within the kernel space Ceph implementation.
|
| 67/2 |
2026/09/11 01:05 |
tool |
grepper |
0m
Args: map[Expression:ceph_open_session PathPrefix:]
Results: map[Output:drivers/block/rbd.c=697=static struct rbd_client *rbd_client_create(struct ceph_options *ceph_opts)
--
drivers/block/rbd.c-714-
drivers/block/rbd.c:715: ret = ceph_open_session(rbdc->client);
drivers/block/rbd.c-716- if (ret < 0)
--
fs/ceph/super.c=1158=static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
--
fs/ceph/super.c-1172-
fs/ceph/super.c:1173: err = __ceph_open_session(fsc->client);
fs/ceph/super.c-1174- if (err < 0)
--
include/linux/ceph/libceph.h=308=extern void ceph_reset_client_addr(struct ceph_client *client);
include/linux/ceph/libceph.h:309:extern int __ceph_open_session(struct ceph_client *client);
include/linux/ceph/libceph.h:310:extern int ceph_open_session(struct ceph_client *client);
include/linux/ceph/libceph.h-311-int ceph_wait_for_latest_osdmap(struct ceph_client *client,
--
net/ceph/ceph_common.c=785=EXPORT_SYMBOL(ceph_reset_client_addr);
--
net/ceph/ceph_common.c-789- */
net/ceph/ceph_common.c:790:int __ceph_open_session(struct ceph_client *client)
net/ceph/ceph_common.c-791-{
--
net/ceph/ceph_common.c-840-}
net/ceph/ceph_common.c:841:EXPORT_SYMBOL(__ceph_open_session);
net/ceph/ceph_common.c-842-
net/ceph/ceph_common.c:843:int ceph_open_session(struct ceph_client *client)
net/ceph/ceph_common.c-844-{
--
net/ceph/ceph_common.c-849-
net/ceph/ceph_common.c:850: ret = __ceph_open_session(client);
net/ceph/ceph_common.c-851-
--
net/ceph/ceph_common.c-854-}
net/ceph/ceph_common.c:855:EXPORT_SYMBOL(ceph_open_session);
net/ceph/ceph_common.c-856-
--
net/ceph/mon_client.c=523=EXPORT_SYMBOL(ceph_monc_wait_osdmap);
--
net/ceph/mon_client.c-526- * Open a session with a random monitor. Request monmap and osdmap,
net/ceph/mon_client.c:527: * which are waited upon in __ceph_open_session().
net/ceph/mon_client.c-528- */
]
|
| 68/2 |
2026/09/11 01:05 |
llm |
expert |
0m
Model:
Tokens:
input: 40344
output: 22
thoughts: 38
Thoughts: Okay, here's my attempt at summarizing those thoughts from an expert's perspective, using the first person:
**Analyzing the RBD Client Creation Process**
Right, so `rbd_client_create` is the function that kicks things off, and it's calling `ceph_open_session` internally. That's a key detail to note. My immediate instinct is to dig into the relationship between those two and also to see how this fits into the overall picture, so let's check what `rbd_client_create` does in more detail.
I'll need to look at how `rbd_client_create` creates a session with Ceph. The session creation and the client object's initialization are probably tightly coupled. I also need to check how it all leads into the `rbd_add` function. I would presume `rbd_add` is used to add the created client to some internal data structure, such as a list or table. I want to see if `rbd_add` is called within the same function or if it's separate. Maybe there's some kind of linking or initialization going on in the background that I should keep an eye out for.
|
| 69/2 |
2026/09/11 01:06 |
tool |
codesearch-definition-source |
0m
Error:
Args:
Results: map[SourceCode: SourceFile:]
|
| 70/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 40679
output: 32
thoughts: 21
Thoughts: Here's my take on those thoughts:
**Analyzing `rbd_add`**
Alright, let's dive into the guts of the RBD driver. Specifically, I need to get my head around `rbd_add` within `drivers/block/rbd.c`. I know this function is crucial for integrating RBD devices, but I need a refresher on the precise way it orchestrates the setup. I'm going to carefully read this function's logic. I'm looking for the nuances of its interactions with the kernel block layer, the Ceph cluster, and especially how it handles device registration and any necessary initializations. I'll focus on potential race conditions, error handling, and resource allocation. I anticipate this function to contain the complex interplay of various kernel subsystems. I want to understand the complete execution flow here. Time to dig in!
|
| 71/2 |
2026/09/11 01:06 |
tool |
grepper |
0m
Args: map[Expression:rbd_add PathPrefix:drivers/block/rbd.c]
Results: map[Output:drivers/block/rbd.c=893=static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts)
--
drivers/block/rbd.c-904- * Using an existing client. Make sure ->pg_pools is up to
drivers/block/rbd.c:905: * date before we look up the pool id in do_rbd_add().
drivers/block/rbd.c-906- */
--
drivers/block/rbd.c=3770=static int rbd_request_lock(struct rbd_device *rbd_dev)
--
drivers/block/rbd.c-3838-/*
drivers/block/rbd.c:3839: * Either image request state machine(s) or rbd_add_acquire_lock()
drivers/block/rbd.c-3840- * (i.e. "rbd map").
--
drivers/block/rbd.c=5388=static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc,
--
drivers/block/rbd.c-5410-
drivers/block/rbd.c:5411: /* we have a ref from do_rbd_add() */
drivers/block/rbd.c-5412- __module_get(THIS_MODULE);
--
drivers/block/rbd.c=6339=static int rbd_parse_options(char *options, struct rbd_parse_opts_ctx *pctx)
--
drivers/block/rbd.c-6417- */
drivers/block/rbd.c:6418:static int rbd_add_parse_args(const char *buf,
drivers/block/rbd.c-6419- struct ceph_options **ceph_opts,
--
drivers/block/rbd.c=6532=static void rbd_dev_image_unlock(struct rbd_device *rbd_dev)
--
drivers/block/rbd.c-6552- */
drivers/block/rbd.c:6553:static int rbd_add_acquire_lock(struct rbd_device *rbd_dev)
drivers/block/rbd.c-6554-{
--
drivers/block/rbd.c=7044=static int rbd_dev_refresh(struct rbd_device *rbd_dev)
--
drivers/block/rbd.c-7077-
drivers/block/rbd.c:7078:static ssize_t do_rbd_add(const char *buf, size_t count)
drivers/block/rbd.c-7079-{
--
drivers/block/rbd.c-7093- /* parse add command */
drivers/block/rbd.c:7094: rc = rbd_add_parse_args(buf, &ceph_opts, &rbd_opts, &spec);
drivers/block/rbd.c-7095- if (rc < 0)
--
drivers/block/rbd.c-7146-
drivers/block/rbd.c:7147: rc = rbd_add_acquire_lock(rbd_dev);
drivers/block/rbd.c-7148- if (rc)
--
drivers/block/rbd.c=7190=static ssize_t add_store(const struct bus_type *bus, const char *buf, size_t count)
--
drivers/block/rbd.c-7194-
drivers/block/rbd.c:7195: return do_rbd_add(buf, count);
drivers/block/rbd.c-7196-}
--
drivers/block/rbd.c=7198=static ssize_t add_single_major_store(const struct bus_type *bus, const char *buf,
--
drivers/block/rbd.c-7200-{
drivers/block/rbd.c:7201: return do_rbd_add(buf, count);
drivers/block/rbd.c-7202-}
]
|
| 72/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 41964
output: 31
thoughts: 136
Thoughts: **My Initial Assessment**
Okay, so `add_store` is the function that gets triggered when someone writes to `/sys/bus/rbd/add` or `/sys/bus/rbd/add_single_major`. Right, that makes sense. That's a privileged operation, requiring root access or at least write permission on sysfs, meaning that unprivileged users shouldn't be able to just call that through the standard `rbd` tool. No immediate vulnerability there.
But hold on... what about `fsopen`? That's a different angle to consider here, isn't it? Let me think... I seem to recall reaching a conclusion about `sget_fc`. I believe it should return `-EPERM` if it's called from within a user namespace because the `ceph` filesystem doesn't have the `FS_USERNS_MOUNT` flag set. That's the key, right? I'd better confirm that assumption, though. I should double check whether `ceph` is actually compiled with that flag in the current kernel to be absolutely certain. It would be easy to have missed something.
|
| 73/2 |
2026/09/11 01:06 |
tool |
grepper |
0m
Error:
Args: map[Expression:FS_USERNS_MOUNT PathPrefix:fs/ceph/]
Results:
|
| 74/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 42387
output: 19
thoughts: 588
Thoughts: **Analyzing the ceph Filesystem Mount Path**
Okay, so I'm digging into this ceph filesystem mounting process, specifically trying to understand the potential for an unprivileged user to trigger that `BUG_ON`. My initial thought was that if `sget_fc` gets called with a `user_ns` different from the initial one, it'll return `-EPERM`. That seems pretty solid. But I need to be sure.
I started thinking, "Is there *any* other route to get to `ceph_real_mount`?" The natural path seems to be through `fsconfig(CMD_CREATE)` called from the initial user namespace. However, looking at the code, `fsopen` uses `may_mount()`, which checks for `CAP_SYS_ADMIN` in the relevant user namespace. So, if the user's in the initial user namespace, they need that capability there. That means an unprivileged user can't just `fsopen("ceph")` in the initial namespace, right?
They *could* try it in a new namespace, but then I remembered that `sget_fc` will fail with that `-EPERM`, and `ceph_real_mount` would never even get called.
Hold on, I need to check the order of operations: Is `sget_fc` called *before* or *after* `ceph_real_mount`? Ah, yes, looking at `ceph_get_tree`, I see that `sget_fc` is definitely called first. If that returns an error, `ceph_real_mount` is skipped. Got it. So, a failure in `sget_fc` acts as a gatekeeper.
The only way `sget_fc` succeeds, given how `ceph` is currently structured, is if the `user_ns` is the initial user namespace, since ceph doesn't have `FS_USERNS_MOUNT`. And, I need to keep in mind, that `user_ns` is determined by `fc->user_ns`. That's set to the user namespace of the process that called `fsopen`. So, if the process is in a new user namespace, `fc->user_ns` becomes the new user namespace. And if the process is in a new user namespace, `user_ns` will be different from the initial user namespace. The `sget_fc` call would then fail, so an unprivileged user in a *new* user namespace *cannot* trigger this specific error.
Hmm, but what if `fc->global` is set to true somehow? I need to check if that modifies the path. Where is `fc->global` set? Let me look at `fs_context_for_mount`. No, that function doesn't set it. I need to trace this variable's initialization carefully...
|
| 75/2 |
2026/09/11 01:06 |
tool |
codesearch-find-references |
0m
Error:
Args:
Results: map[References:<nil> TruncatedOutput:false]
|
| 76/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 43626
output: 25
thoughts: 10
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into the Code: Finding `fc->global`**
Okay, so I need to find where `fc->global` is used in this codebase. Given my experience, the quickest approach is to just use `grep`. It's a fundamental tool, and I can quickly filter and find the exact lines I'm looking for. Let's start with a basic `grep "fc->global"` and see what we get. Hopefully, this will immediately point me to the critical areas in the code. I can quickly iterate and refine the search based on the initial results. Depending on the size of the codebase and the number of matches, I might need to specify the file types or exclude certain directories to narrow down the search and avoid noise. This also allows me to quickly analyze the surrounding code to understand the context of its use, and pinpoint relevant function calls. I'm hoping this `grep` command will give me a solid starting point for my investigation.
|
| 77/2 |
2026/09/11 01:06 |
tool |
grepper |
0m
Args: map[Expression:fc->global PathPrefix:fs/]
Results: map[Output:fs/failfs.c=130=static int failfs_init_fs_context(struct fs_context *fc)
--
fs/failfs.c-132- fc->ops = &failfs_context_ops;
fs/failfs.c:133: fc->global = true;
fs/failfs.c-134- fc->sb_flags |= SB_NOUSER;
--
fs/libfs.c=727=struct pseudo_fs_context *init_pseudo(struct fs_context *fc,
--
fs/libfs.c-738- fc->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
fs/libfs.c:739: fc->global = true;
fs/libfs.c-740- }
--
fs/resctrl/rdtgroup.c=3384=static int rdt_init_fs_context(struct fs_context *fc)
--
fs/resctrl/rdtgroup.c-3396- fc->user_ns = get_user_ns(&init_user_ns);
fs/resctrl/rdtgroup.c:3397: fc->global = true;
fs/resctrl/rdtgroup.c-3398- return 0;
--
fs/super.c=857=struct super_block *sget_fc(struct fs_context *fc,
--
fs/super.c-862- struct super_block *old;
fs/super.c:863: struct user_namespace *user_ns = fc->global ? &init_user_ns : fc->user_ns;
fs/super.c-864- int err;
--
fs/sysfs/mount.c=41=static int sysfs_init_fs_context(struct fs_context *fc)
--
fs/sysfs/mount.c-65- }
fs/sysfs/mount.c:66: fc->global = true;
fs/sysfs/mount.c-67- return 0;
]
|
| 78/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 44406
output: 26
thoughts: 343
Thoughts: **Analyzing the ceph Bug**
Okay, so the initial thought was that `fc->global` isn't set for `ceph`. That means `user_ns` is just whatever `fc->user_ns` is, and this will cause `sget_fc` to fail if called from a user namespace. The good news (for security!) is that this bug *shouldn't* be reachable from unprivileged processes or within user namespaces. Thatβs a relief.
But wait a minute⦠are there *other* ways `ceph_monc_init` and `ceph_monc_open_session` could be triggered? We need to be thorough. Could `fsopen` in a user namespace do it? Hang on⦠does `create_fs_client` do something that might be problematic? Let's dig into that function.
Alright, looking at `create_fs_client`, I see it calls `ceph_create_client`, and *that* calls `ceph_monc_init`, which then calls `build_initial_monmap`. So far, so good... But `build_initial_monmap` allocates `monc->monmap` with `num_mon = 0`. That *seems* benign, and it even succeeds. But then, *after* that initialization, `create_fs_client` calls `ceph_monc_want_map`. Does that call somehow trigger the bug? We've got to investigate that function call carefully now.
|
| 79/2 |
2026/09/11 01:06 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ceph_monc_want_map]
Results: map[SourceCode: 443: bool ceph_monc_want_map(struct ceph_mon_client *monc, int sub, u32 epoch,
444: bool continuous)
445: {
446: bool need_request;
447:
448: mutex_lock(&monc->mutex);
449: need_request = __ceph_monc_want_map(monc, sub, epoch, continuous);
450: mutex_unlock(&monc->mutex);
451:
452: return need_request;
453: }
SourceFile:net/ceph/mon_client.c]
|
| 80/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 45288
output: 23
thoughts: 233
Thoughts: **My Analysis of the Ceph Filesystem Mounting Process**
Okay, so I'm tracing through this Ceph filesystem mounting sequence. It looks like `__ceph_monc_want_map` is just handling some basic field updates, nothing complex there. Then `create_fs_client` kicks back a file system client object, `fsc`. The next interesting point is that `ceph_get_tree` calls `sget_fc`. This `sget_fc` function appears crucial. If *that* call fails, we branch off either to `out_splat` or directly to `out`.
Specifically, if `sget_fc` returns an error, this section is hit:
```c
sb = sget_fc(fc, compare_super, ceph_set_super);
fc->s_fs_info = NULL;
if (IS_ERR(sb)) {
err = PTR_ERR(sb);
goto out;
}
```
And then, if an error *does* occur at that point, the code jumps to `out`:
```c
out:
destroy_fs_client(fsc);
out_final:
dout("ceph_get_tree fail %d\n", err);
return err;
```
Here, `destroy_fs_client` gets called. My gut feeling is that it's probably the most interesting part of this to investigate, as `destroy_fs_client` calls `ceph_destroy_client(fsc->client)`. It seems to me that understanding the destruction sequence is key, especially if we're encountering errors during the mount process. I'll need to check the internals of `ceph_destroy_client` to get a better handle on what's going on.
|
| 81/2 |
2026/09/11 01:06 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ceph_destroy_client]
Results: map[SourceCode: 759: void ceph_destroy_client(struct ceph_client *client)
760: {
761: dout("destroy_client %p\n", client);
762:
763: atomic_set(&client->msgr.stopping, 1);
764:
765: ceph_debugfs_client_cleanup(client);
766:
767: /* unmount */
768: ceph_osdc_stop(&client->osdc);
769: ceph_monc_stop(&client->monc);
770: ceph_messenger_fini(&client->msgr);
771:
772: ceph_destroy_options(client->options);
773:
774: kfree(client);
775: dout("destroy_client %p done\n", client);
776: }
SourceFile:net/ceph/ceph_common.c]
|
| 82/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 46214
output: 24
thoughts: 11
Thoughts: Okay, here's my interpretation of that thought process, assuming I'm a seasoned Ceph expert:
**Stopping the Ceph Monitor Daemon**
Right, `ceph_monc_stop` is being called. That's the signal to shut down a Ceph Monitor daemon. Okay, a few things immediately jump to mind. First, I need to understand *why* this command is being issued. Is it for maintenance, a planned upgrade, a routine restart, or is there some kind of alert indicating a problem with this specific monitor? Depending on the reason, the approach will differ.
My mind immediately begins to check the mental checklist:
* **Impact Assessment**: How many monitors are running, and what's their status within the quorum? Is this a single monitor outage, or a more critical situation? Losing a majority of monitors would be catastrophic. If it's the last monitor, am I taking the entire cluster down or is there a new monitor to take its place?
* **Safety Net**: What safeguards are in place? Are we running with sufficient redundancy? Are there any automated failover mechanisms that should be kicking in, and are they working as expected?
* **Documentation Check**: I'll need to check the relevant documentation - the official Ceph docs and internal configuration files for any specific procedures or scripts related to this monitor.
* **Logging Review**: The first thing I'll have to do is check the logs. I need to be able to see the reason for the stop operation if it is scheduled. I would look at the `ceph-mon` logs, relevant system logs, and potentially even the output of the command itself to gather context.
* **Cluster Health Check**: After the command, I'll need to immediately verify cluster health using `ceph health detail` or a similar tool. Monitor status, OSDs, and placement groups are the key. If anything looks off, I will need to be prepared to troubleshoot.
* **Monitoring Integration**: I'll also need to check my monitoring systems (Prometheus, Grafana, etc.) to ensure that the monitor shutdown is being correctly reported and that no alerts are firing erroneously. I need to be sure that I have enough information to make the right decisions.
* **Resiliency Plans**: If this is part of a larger planned operation, I'll need to ensure that the recovery plan is ready.
Basically, `ceph_monc_stop` is never a "one-click" operation. It's the trigger for a thorough, well-considered sequence of actions, always prioritizing data integrity and cluster availability. Time to put on my Ceph hat and dig in.
|
| 83/2 |
2026/09/11 01:06 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:1241: void ceph_monc_stop(struct ceph_mon_client *monc)
1242: {
1243: dout("stop\n");
1244:
1245: mutex_lock(&monc->mutex);
1246: __close_session(monc);
1247: monc->hunting = false;
1248: monc->cur_mon = -1;
1249: mutex_unlock(&monc->mutex);
1250:
1251: cancel_delayed_work_sync(&monc->delayed_work);
1252:
1253: /*
1254: * flush msgr queue before we destroy ourselves to ensure that:
1255: * - any work that references our embedded con is finished.
1256: * - any osd_client or other work that may reference an authorizer
1257: * finishes before we shut down the auth subsystem.
1258: */
1259: ceph_msgr_flush();
1260:
1261: ceph_auth_destroy(monc->auth);
1262:
1263: WARN_ON(!RB_EMPTY_ROOT(&monc->generic_request_tree));
1264:
1265: ceph_msg_put(monc->m_auth);
1266: ceph_msg_put(monc->m_auth_reply);
1267: ceph_msg_put(monc->m_subscribe);
1268: ceph_msg_put(monc->m_subscribe_ack);
1269:
1270: kfree(monc->monmap);
1271: }
SourceFile:net/ceph/mon_client.c]
|
| 84/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 47302
output: 22
thoughts: 9
Thoughts: Okay, here's my interpretation of what's happening, summarized in the first person, assuming an expert understanding of the field:
**The Session's Closing Up**
Alright, I see the signal. `__close_session` has been called. That immediately tells me we're wrapping things up. This could be triggered by a variety of reasons β user request, timeout, a specific event we've been monitoring, a scheduled shutdown... the underlying cause isn't immediately clear from *just* this call, but the intention is unambiguous: we're exiting the session. It's time to trigger all the cleanup operations that are tied to closing out a resource.
This means I need to start thinking about the implications. What data needs to be flushed to persistent storage? Are there open connections that need to be gracefully closed, or are they managed by a context manager already? What resources are being released, and in what order? I need to ensure that the tear-down process is clean and consistent to prevent data corruption or orphaned resources. Furthermore, the handling of errors must be carefully considered β we need to log any problems without halting the process, if possible.
Essentially, this is my signal to run the final checks on the session state. No matter how much I have already automated and handled in the session, `__close_session` needs to be considered a critical action point to ensure we are closing everything down correctly.
|
| 85/2 |
2026/09/11 01:06 |
tool |
codesearch-definition-source |
0m
Args: map[Name:__close_session]
Results: map[SourceCode: 187: /*
188: * Close monitor session, if any.
189: */
190: static void __close_session(struct ceph_mon_client *monc)
191: {
192: dout("__close_session closing mon%d\n", monc->cur_mon);
193: ceph_msg_revoke(monc->m_auth);
194: ceph_msg_revoke_incoming(monc->m_auth_reply);
195: ceph_msg_revoke(monc->m_subscribe);
196: ceph_msg_revoke_incoming(monc->m_subscribe_ack);
197: ceph_con_close(&monc->con);
198:
199: monc->pending_auth = 0;
200: ceph_auth_reset(monc->auth);
201: }
SourceFile:net/ceph/mon_client.c]
|
| 86/2 |
2026/09/11 01:06 |
llm |
expert |
0m
Model:
Tokens:
input: 47907
output: 23
thoughts: 445
Thoughts: **Analyzing the Bug's Accessibility**
Okay, so if `sget_fc` fails, the bug isn't triggered, which simplifies things. That narrows down the attack vector: it *only* happens when `sget_fc` succeeds, and that hinges on `user_ns` being the initial namespace (`&init_user_ns`). That's key. Now, `fsopen` demands `CAP_SYS_ADMIN` in the current namespace, and since we need the initial user namespace, the user *must* possess `CAP_SYS_ADMIN` in that very first namespace. This means this particular bug is completely inaccessible to regular, unprivileged processes or those operating within user namespaces. That's a huge relief, at least from a trivial exploit standpoint.
But...wait. Are there *other* paths to `ceph_get_tree`? I need to think this through. What about the `mount` syscall? That also needs `CAP_SYS_ADMIN`, and it also checks `user_ns`. If it's in a user namespace, `user_ns` will be different, so `sget_fc` would fail. And if it's from the initial namespace, we're back to needing `CAP_SYS_ADMIN`, exactly the same scenario.
Okay, let's step back a bit and consider `fsconfig`. Could an unprivileged user craft a `fs_context` for a file system with `FS_USERNS_MOUNT` and somehow switch the `fs_type` to `ceph`? No, because `fs_type` is baked in at the `fsopen` stage, and it's fixed. That's a dead end.
Now, what about the scenario where `ceph` is mounted by root, and then an unprivileged user comes along and tries to poke at it? The bug seems to be triggered *during* the mount process, via `fsconfig(CMD_CREATE)` or the `mount` syscall itself. It's the mounting operation that's the culprit, not subsequent access to an already mounted filesystem.
So... are there any other entry points I'm missing? Hmm. What about `rbd`? Ah, right, `rbd` uses `do_rbd_add`, which triggers on a write to `/sys/bus/rbd/add`. But those sysfs files for `rbd` are root-owned and exclusively writable by root. So unprivileged users are blocked there too. Excellent.
Alright, time to really make sure I've exhausted all options; let me double-check if there's any other function that could possibly trigger `ceph_create_client`.
|
| 87/2 |
2026/09/11 01:07 |
tool |
codesearch-find-references |
0m
Args: map[Name:ceph_create_client]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:create_fs_client SourceFile:fs/ceph/super.c SourceLine:829] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_ceph_create_client_1261 SourceFile:net/ceph/ceph_common.c SourceLine:757] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_create_client SourceFile:net/ceph/ceph_common.c SourceLine:757] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_create_client SourceFile:net/ceph/ceph_common.c SourceLine:757]] TruncatedOutput:false]
|
| 88/2 |
2026/09/11 01:07 |
llm |
expert |
0m
Model:
Tokens:
input: 49214
output: 24
thoughts: 26
Thoughts: Here's my thought process, as if I were considering this myself:
**Investigating the `rbd` and Ceph Client Relationship**
Okay, hold on a second. I need to make sure I've got this right. I was just looking at some `rbd` calls, and it seemed like it was directly invoking `ceph_create_client`. That's a bit unusual, and I'd like to understand that better. I'll need to double check the exact flow. Let me get into `rbd_client_create` to confirm exactly what's happening at the point of client instantiation. I want to see how `rbd` is interacting with the underlying Ceph client creation routines and confirm that assumption about the `ceph_create_client` call.
|
| 89/2 |
2026/09/11 01:07 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[Name:rbd_client_create]
Results: map[SourceCode: SourceFile:]
|
| 90/2 |
2026/09/11 01:07 |
llm |
expert |
0m
Model:
Tokens:
input: 49451
output: 33
thoughts: 23
Thoughts: Here's my take on those thoughts, tailored for an expert audience:
**Diving into the rbd_get_client Function**
Alright, let's get down to brass tacks. I need to refresh my memory on how client connections are handled within the RBD driver. Specifically, I need to revisit the `rbd_get_client` function, which resides in `drivers/block/rbd.c`. I know this is the primary entry point for managing client interactions, so I should see how it handles things. Let's see if there are any subtle changes or potential areas for improvement regarding locking, error handling, or performance within the most recent code base. I also expect this to be the jumping off point to look into other related functions, to give me a more complete picture of the client connection process.
|
| 91/2 |
2026/09/11 01:07 |
tool |
grepper |
0m
Args: map[Expression:ceph_create_client PathPrefix:drivers/block/rbd.c]
Results: map[Output:drivers/block/rbd.c=697=static struct rbd_client *rbd_client_create(struct ceph_options *ceph_opts)
--
drivers/block/rbd.c-709-
drivers/block/rbd.c:710: rbdc->client = ceph_create_client(ceph_opts, rbdc);
drivers/block/rbd.c-711- if (IS_ERR(rbdc->client))
]
|
| 92/2 |
2026/09/11 01:07 |
llm |
expert |
0m
Model:
Tokens:
input: 49806
output: 25
thoughts: 895
Thoughts: **Analyzing the `ceph` Kernel Bug: A Deep Dive**
Okay, so here's the breakdown of this potential issue, as I see it. It appears we're dealing with a kernel panic triggered by a `BUG_ON` statement within `ceph`, specifically when the monitor map's `num_mon` is less than 1. The code path that leads to this involves `rbd_client_create` which is called by `rbd_get_client`, and that's ultimately invoked by `do_rbd_add`. Since that is accessed via sysfs, and accessible only to root, it's not a direct route for an unprivileged user to crash the system.
My initial thought was, could a user namespace with `CAP_SYS_ADMIN` and a filesystem with `FS_USERNS_MOUNT` somehow exploit this? That's quickly dismissed because `ceph_create_client` is only called by the `ceph` and `rbd` modules. This feels like a good sanity check; but it's not looking good for attackers here.
Let's look at exploitability: as a `BUG_ON`, it's a DoS only - doesn't offer escalation or memory corruption. The critical check for `num_mon < 1` indicates that this boils down to a denial-of-service vulnerability, and it's root-only, so that doesn't feel good. The code itself *seems* safe.
Now, could there be another way to get `num_mon` to be zero? Could someone provide an empty string for the monitor address? If that happened, `ceph_parse_ips` returns `-EINVAL`. But again, that would require root privileges to reach `ceph_real_mount`. We're not getting anywhere with this empty string idea.
Could it be triggered by a malicious filesystem image? No, because `ceph` is a network filesystem, not something mounted from a block device image. We use network addresses.
What about a network trigger in some way? No, it looks like this is triggered through parsing mount options, not from an incoming network packet, so that's not going to happen.
Could a VM guest trigger it? I was thinking, if a guest user runs this, they could crash the guest kernel. But they need root privileges within the guest. That feels obvious; but is there something else at play? We're looking for how a guest could trigger a host issue. I'm focusing on the context where the guest is causing a crash of the host. So far, the bug is within the *guest* kernel. That is an important detail. So that's not a concern.
Then, could a host trigger the bug in the guest kernel, in a confidential computing context? No, mount options are provided by the guest userspace, not the host. This scenario also looks safe.
I'm revisiting the basics, just to be sure: can unprivileged users mount `ceph` in some obscure configuration? No, `ceph` doesn't have `FS_USERNS_MOUNT`, so that's not the case. What about `mount` with `MS_BIND`? No, that bypasses option parsing. `fsmount`? That requires `CAP_SYS_ADMIN`.
Okay, finally, let's explore if `ceph_parse_mon_ips` can somehow be called from elsewhere, outside of the normal `ceph` mount path. Let's make a callstack analysis for that function.
The overall picture? It's a DoS vulnerability, root-only, and not a major security threat. But, as always, we should double-check the callers of `ceph_parse_mon_ips`.
|
| 93/2 |
2026/09/11 01:07 |
tool |
codesearch-find-references |
0m
Args: map[Name:ceph_parse_mon_ips]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ceph_parse_mon_addr SourceFile:fs/ceph/super.c SourceLine:402] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ceph_parse_old_source SourceFile:fs/ceph/super.c SourceLine:265] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_ceph_parse_mon_ips_1250 SourceFile:net/ceph/ceph_common.c SourceLine:415] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_parse_mon_ips SourceFile:net/ceph/ceph_common.c SourceLine:415] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_ceph_parse_mon_ips SourceFile:net/ceph/ceph_common.c SourceLine:415]] TruncatedOutput:false]
|
| 94/2 |
2026/09/11 01:07 |
llm |
expert |
0m
Model:
Tokens:
input: 51848
output: 26
thoughts: 115
Thoughts: **Analyzing the Ceph Filesystem Mount Option Parsing**
Okay, so `ceph_parse_old_source` is hanging out in `fs/ceph/super.c`. That makes sense; it's the bit that handles the "source" parameter during mount time. Looking at the code snippet, it looks like it's calling `ceph_parse_mon_ips` with the device name, the length, some mount options, and a logging context. Critically, it then returns an error code if `ceph_parse_mon_ips` fails. The problem here is that this whole process, including any error handling within it, happens during mount-time. And mounting a filesystem almost always requires root privileges, meaning that any vulnerabilities here are confined to the privileged context.
Since this seems to be related to mount options parsing, let's pivot to investigating `rbd_add_parse_args`. That might give us a broader picture of how other related storage systems handle similar parameters. I want to see if there's any consistency in the approach or if there are any relevant parallels.
|
| 95/2 |
2026/09/11 01:07 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[Name:rbd_add_parse_args]
Results: map[SourceCode: SourceFile:]
|
| 96/2 |
2026/09/11 01:07 |
llm |
expert |
0m
Model:
Tokens:
input: 52238
output: 36
thoughts: 25
Thoughts: Here's my summary, as though I'm thinking through this process:
**Diving into the RBD Code: Checking Argument Parsing**
Okay, time to get to the heart of the matter. I need to understand how arguments are handled for the RBD driver, especially how things are parsed. Let's start by zeroing in on `rbd_add_parse_args`. The name itself strongly suggests this function is responsible for adding and parsing command-line arguments, or perhaps configuration parameters, for the RBD driver. The fact that it's located in `drivers/block/rbd.c` confirms it's within the core driver implementation, which is exactly where I'd expect this kind of functionality to reside. I'll need to carefully examine this function's structure: what are the expected arguments, how is the input validated, and what data structures are populated with the parsed information? This is the starting point for figuring out how the RBD driver takes user input and uses it. I expect to see the typical parsing idioms - perhaps `getopt_long` or custom parsing loops - and I anticipate there will be checks for mandatory arguments and perhaps defaults for optional ones.
|
| 97/2 |
2026/09/11 01:07 |
tool |
grepper |
0m
Args: map[Expression:rbd_add_parse_args PathPrefix:drivers/block/rbd.c]
Results: map[Output:drivers/block/rbd.c=6339=static int rbd_parse_options(char *options, struct rbd_parse_opts_ctx *pctx)
--
drivers/block/rbd.c-6417- */
drivers/block/rbd.c:6418:static int rbd_add_parse_args(const char *buf,
drivers/block/rbd.c-6419- struct ceph_options **ceph_opts,
--
drivers/block/rbd.c=7078=static ssize_t do_rbd_add(const char *buf, size_t count)
--
drivers/block/rbd.c-7093- /* parse add command */
drivers/block/rbd.c:7094: rc = rbd_add_parse_args(buf, &ceph_opts, &rbd_opts, &spec);
drivers/block/rbd.c-7095- if (rc < 0)
]
|
| 98/2 |
2026/09/11 01:07 |
llm |
expert |
0m
Model:
Tokens:
input: 52799
output: 26
thoughts: 493
Thoughts: **Analyzing the Bug: A Deep Dive**
Okay, so I've been tracing the logic here, and it's become clear where the vulnerability lies. It started with looking at how parsing options works, specifically within `rbd_add_parse_args`. The fact that it calls `ceph_parse_options` and checks the return value, bailing out on failure, immediately eliminated `rbd` from consideration. That's good practice, and it's working as expected.
But then I saw the `fsconfig` call and realized there's a problem with the *new* mount API. Here's where the nuance comes in. Unlike a straightforward parsing failure in a command-line tool, this API lets you set parameters piecemeal. And crucially, if a parameter *fails* during configuration, the `fs_context` isn't destroyed. The code proceeds as though the user might just shrug and call `fsconfig(CMD_CREATE)` anyway. This is a known quirk, but it's now exposed as a potential flaw.
Specifically, `ceph_parse_mon_addr` might save a string, but if `ceph_parse_mon_ips` fails, `num_mon` is set to zero. This is the critical juncture. Then, `ceph_get_tree` checks `fsopt->mon_addr`, which isn't NULL, and continues execution. Bingo. This is the core of the bug. This is what opens the door.
So, this vulnerability is very much tied to the new mount API ( `fsopen` followed by `fsconfig`). Further investigation shows that the `fsopen` for `ceph` requires `CAP_SYS_ADMIN` in the initial user namespace. This immediately restricts it to root access.
I then did a quick scan to make sure there are no other filesystems using `libceph` and mounting within a user namespace. The good news is that `ceph` is the only one.
Now I'm considering reconfigure. Can an unprivileged user call `fsopen` with `FS_CONTEXT_FOR_RECONFIGURE`? No, because `fsopen` *always* creates a new context. That eliminates a whole other avenue of attack. `fspick` creates a context for reconfigure, so that is the next function to examine.
|
| 99/2 |
2026/09/11 01:07 |
tool |
codesearch-definition-source |
0m
Args: map[Name:__do_sys_fspick]
Results: map[SourceCode: 160: /*
161: * Pick a superblock into a context for reconfiguration.
162: */
163: SYSCALL_DEFINE3(fspick, int, dfd, const char __user *, path, unsigned int, flags)
164: {
165: struct fs_context *fc;
166: struct path target;
167: unsigned int lookup_flags;
168: int ret;
169:
170: if (!may_mount())
171: return -EPERM;
172:
173: if ((flags & ~(FSPICK_CLOEXEC |
174: FSPICK_SYMLINK_NOFOLLOW |
175: FSPICK_NO_AUTOMOUNT |
176: FSPICK_EMPTY_PATH)) != 0)
177: return -EINVAL;
178:
179: lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT;
180: if (flags & FSPICK_SYMLINK_NOFOLLOW)
181: lookup_flags &= ~LOOKUP_FOLLOW;
182: if (flags & FSPICK_NO_AUTOMOUNT)
183: lookup_flags &= ~LOOKUP_AUTOMOUNT;
184: CLASS(filename_flags, filename)(path,
185: (flags & FSPICK_EMPTY_PATH) ? LOOKUP_EMPTY : 0);
186: ret = filename_lookup(dfd, filename, lookup_flags, &target, NULL);
187: if (ret < 0)
188: goto err;
189:
190: ret = -EINVAL;
191: if (target.mnt->mnt_root != target.dentry)
192: goto err_path;
193:
194: fc = fs_context_for_reconfigure(target.dentry, 0, 0);
195: if (IS_ERR(fc)) {
196: ret = PTR_ERR(fc);
197: goto err_path;
198: }
199:
200: fc->phase = FS_CONTEXT_RECONF_PARAMS;
201:
202: ret = fscontext_alloc_log(fc);
203: if (ret < 0)
204: goto err_fc;
205:
206: path_put(&target);
207: return fscontext_create_fd(fc, flags & FSPICK_CLOEXEC ? O_CLOEXEC : 0);
208:
209: err_fc:
210: put_fs_context(fc);
211: err_path:
212: path_put(&target);
213: err:
214: return ret;
215: }
SourceFile:fs/fsopen.c]
|
| 100/2 |
2026/09/11 01:07 |
llm |
expert |
0m
Model:
Tokens:
input: 54653
output: 25
thoughts: 210
Thoughts: **Vulnerability Analysis - fspick and Ceph Mounts**
Okay, so I'm looking at this `fspick` function, and it's calling `may_mount()`, which is immediately raising some red flags. `may_mount()` needs `CAP_SYS_ADMIN` in the *current* namespace. The implications are clear: an unprivileged user can create a user namespace and within that, they're granted `CAP_SYS_ADMIN`. And with that, they *should* be able to run `fspick` on an existing `ceph` mount.
Hold on, I need to make sure I'm following this correctly. `fspick`'s target requires that the root of the mount (`mnt_root`) *equals* the directory entry (`dentry`). Right, that's important. They need to select the root of the mount itself, which, if it's a `ceph` mount, means they can now get a `fs_context` for a reconfigure operation.
Then comes the call to `fsconfig` to set parameters, which then calls `fsconfig(CMD_RECONFIGURE)`. Okay, that's where things get interesting. Is `CMD_RECONFIGURE` triggering a call to `ceph_get_tree` or `ceph_real_mount`? It's essential to confirm that. Let me jump into `vfs_cmd_reconfigure` to see where it leads. I need to understand what this reconfigure command is actually doing with that user-controlled context.
|
| 101/2 |
2026/09/11 01:08 |
tool |
codesearch-definition-source |
0m
Args: map[Name:vfs_cmd_reconfigure]
Results: map[SourceCode: 251: static int vfs_cmd_reconfigure(struct fs_context *fc)
252: {
253: struct super_block *sb;
254: int ret;
255:
256: if (fc->phase != FS_CONTEXT_RECONF_PARAMS)
257: return -EBUSY;
258:
259: fc->phase = FS_CONTEXT_RECONFIGURING;
260:
261: sb = fc->root->d_sb;
262: if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) {
263: fc->phase = FS_CONTEXT_FAILED;
264: return -EPERM;
265: }
266:
267: down_write(&sb->s_umount);
268: ret = reconfigure_super(fc);
269: up_write(&sb->s_umount);
270: if (ret) {
271: fc->phase = FS_CONTEXT_FAILED;
272: return ret;
273: }
274:
275: vfs_clean_context(fc);
276: return 0;
277: }
SourceFile:fs/fsopen.c]
|
| 102/2 |
2026/09/11 01:08 |
llm |
expert |
0m
Model:
Tokens:
input: 55607
output: 66
thoughts: 969
Thoughts: **Analysis of the Ceph Filesystem Configuration Bug**
Okay, let's break this down. My initial thought process focused on the check `ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)`. Because `ceph` was mounted initially by root in the primary user namespace (`init_user_ns`), and an unprivileged user in a new user namespace doesn't have `CAP_SYS_ADMIN` in `init_user_ns`, the call to `vfs_cmd_reconfigure` returns `-EPERM`. This effectively prevents the `fspick` utility from being used by an unprivileged user to reconfigure a root-mounted `ceph` filesystem.
This leads me to conclude that this bug is exclusively limited to users possessing `CAP_SYS_ADMIN` within the initial user namespace. Given that it necessitates root privileges, it poses no security vulnerability to unprivileged users. It amounts to a Denial of Service, but critically, it's only triggerable by root.
Therefore, the initial assessment:
* Exploitable: False
* Denial of Service: True (but root only)
* Accessible From Unprivileged Processes: False
* Accessible From User Namespaces: False
* VM Guest Trigger: False
* VM Host Trigger: False
* Ethernet Network Trigger: False
* Other Remote Trigger: False
* Peripheral Trigger: False
* Malicious Filesystem Trigger: False
Then, I started to explore edge cases. I considered whether the addition of `FS_USERNS_MOUNT` could allow `ceph` to be mounted from a user namespace. However, this hasn't been added. I also searched for alternative ways to trigger `ceph_monc_init`, such as calling `ceph_create_client` elsewhere. However, after reviewing its references, it's only called by `create_fs_client` and `rbd_client_create`, both of which are protected by root checks.
Next, I wanted to double-check `ceph` mount options via the `mount` syscall. By simulating a root-level `mount` call like `mount("none", "/mnt", "ceph", 0, "mon_addr=127.0.0.\x03:6789")`, the `mount` syscall calls `do_new_mount`, which in turn calls `fs_context_for_mount`, then `vfs_parse_fs_string` or `vfs_parse_fs_param`. The legacy mount options are handled by splitting on commas and calling `vfs_parse_fs_param`. In this scenario, if `ceph_parse_mon_addr` fails (returning `-ESRCH`), `vfs_parse_fs_param` returns the error, which then propagated to `vfs_parse_fs_string`, and ultimately aborts `do_new_mount`. This indicates that the legacy `mount` syscall DOES NOT ignore the error, and the mount fails immediately. This is not the case for the new `fsconfig` API. This suggests that the bug is exclusively triggered via the new `fsconfig` API, where the user can choose to ignore the error from `fsconfig(FSCONFIG_SET_STRING)` and then proceed to `fsconfig(FSCONFIG_CMD_CREATE)`. Since `fsconfig` is only accessible to root (for `ceph`), this confirms that it is root-only.
Finally, I confirmed this behavior using a sample `fsconfig` call sequence that matches the reproducer. This matched my analysis perfectly.
Now let's review the questions:
* Exploitable: No. It is a `BUG_ON`.
* DenialOfService: Yes. It results in a kernel crash.
* Unprivileged: No. Requires `CAP_SYS_ADMIN` in the `init_user_ns`.
* UserNamespace: No. `sget_fc` blocks it.
* VMGuestTrigger: No.
* VMHostTrigger: No.
* NetworkTrigger: No.
* RemoteTrigger: No.
* PeripheralTrigger: No.
* FilesystemTrigger: No.
I am now ready to set the final results.
|
| 103/2 |
2026/09/11 01:08 |
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]
|
| 104/2 |
2026/09/11 01:08 |
llm |
expert |
0m
Model:
Tokens:
input: 57619
output: 557
thoughts: 556
Thoughts: **My Analysis of the Ceph Monitor Initialization Bug**
Okay, the data's in, and I need to formulate my final response. Here's how I see this: we've got a critical bug triggered deep within Ceph's monitor initialization, specifically a `BUG_ON(monc->monmap->num_mon < 1)` within the `pick_new_mon()` function. This assertion trips when a session is attempted with a Ceph monitor, but the monitor map is initialized with zero monitors. That's the core of it.
This zero-monitor map condition arises due to a subtle interaction with the new `fsopen` and `fsconfig` mount API and its handling of parameter parsing errors, which, as we know, can be tricky. Here's how it plays out: The user provides an invalid monitor address, let's say "127.0.0.\x03:6789". The address is saved, and `ceph_parse_mon_addr()` succeeds in this, but `ceph_parse_mon_ips()` then fails, returning an error like `-ESRCH`. Crucially, this error is passed up to the user from the `fsconfig` syscall. The user *could* be notified of this error, but can just ignore it and proceed.
So, they call `fsconfig(FSCONFIG_CMD_CREATE)` anyway. This is where things go south. During the mount creation phase, `ceph_get_tree()` checks if `fsopt->mon_addr` is set. Since the invalid string was saved, the check passes. This leads to the monitor client initialization (`ceph_monc_init()`) which allocates that zero-monitor map. Later, when `ceph_real_mount()` tries to open a session, `pick_new_mon()` is called, and boom, the assertion hits because `num_mon` is zero. That's a classic example of an unhandled error condition.
From a security standpoint, the impact is as follows: it's not exploitable for memory corruption or control-flow hijacking, but it *is* a denial-of-service issue. Triggering the bug results in a kernel panic, which is never a good thing.
The good news is, it's not something an unprivileged user can trigger. The Ceph filesystem lacks the `FS_USERNS_MOUNT` flag, meaning `fsopen("ceph")` requires `CAP_SYS_ADMIN` in the initial user namespace. Any attempt to mount it from a new user namespace will be rejected with `-EPERM` by `sget_fc()`. We're safe in that respect. And, thankfully, it's all local syscalls; no network or external device interactions.
In conclusion, this is a root-only denial-of-service vulnerability. I'll need to clearly articulate that in the response.
|
| 105/1 |
2026/09/11 01:08 |
action |
format-explanation |
0m
Results: map[Explanation:The bug is a `BUG_ON(monc->monmap->num_mon < 1)` in `pick_new_mon()` which is
triggered when attempting to open a session with a Ceph monitor, but the monitor
map has 0 monitors.
This state is reached because of how the new mount API (`fsopen` + `fsconfig`)
handles parameter parsing errors. When the user provides an invalid `mon_addr`
(e.g., `"127.0.0.\x03:6789"`), `ceph_parse_mon_addr()` saves the string but
`ceph_parse_mon_ips()` fails to resolve it and returns an error (e.g.,
`-ESRCH`). The `fsconfig` syscall returns this error to the user space. However,
the user can simply ignore the error and proceed to call
`fsconfig(FSCONFIG_CMD_CREATE)`.
During the creation phase, `ceph_get_tree()` checks if `fsopt->mon_addr` is set.
Since the string was saved before the parsing failed, this check passes. The
code then proceeds to initialize the monitor client (`ceph_monc_init()`), which
allocates a monitor map with `num_mon = 0`. Later, when `ceph_real_mount()`
attempts to open a session, it calls `pick_new_mon()`, which hits the `BUG_ON`
because `num_mon` is 0.
**Security Impact Assessment:**
- **Exploitable**: No. The bug is a `BUG_ON` which intentionally halts the
kernel (panic). It does not lead to memory corruption, information leaks, or
control-flow hijacking.
- **Denial of Service**: Yes. Triggering the bug causes a kernel panic, leading
to a denial of service.
- **Accessible From Unprivileged Processes / User Namespaces**: No. The `ceph`
filesystem does not have the `FS_USERNS_MOUNT` flag. Therefore, `fsopen("ceph")`
requires `CAP_SYS_ADMIN` in the initial user namespace. If an unprivileged user
attempts to mount it from a new user namespace, the `sget_fc()` function will
reject the mount with `-EPERM` before the vulnerable code (`ceph_real_mount()`)
is reached.
- **Other Triggers**: The bug is triggered by local syscalls
(`fsopen`/`fsconfig`) and does not involve network traffic, malicious filesystem
images, or peripheral devices.
In conclusion, this is a root-only Denial of Service bug, and it does not pose a
security risk to unprivileged users.]
|