| 0/0 |
2026/08/21 01:58 |
flow |
assessment-security |
54m
Results: map[DenialOfService:false Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the security impact:
**Bug Mechanism:**
The warning is triggered in `fs/tracefs/event_inode.c` at `free_ei()` when
checking `WARN_ON_ONCE(!list_empty(&ei->children))`.
During the creation of a new trace instance, `eventfs_create_events_dir()`
allocates a new root eventfs inode (`ei`) via `alloc_root_ei()`. This allocation
uses `kzalloc`, meaning the memory is zeroed out. The initialization of the
`ei->children` list head (`INIT_LIST_HEAD(&ei->children)`) is done later in the
function, *after* a call to `tracefs_get_inode()`.
If `tracefs_get_inode()` fails (e.g., due to an out-of-memory condition caused
by a cgroup memory limit, as seen in the reproducer), the code jumps to the
`fail` label and calls `cleanup_ei(ei)`. This eventually calls `free_ei(ei)`,
which checks if the `ei->children` list is empty.
Because the list head was never initialized and is still all zeros, `head->next`
is `NULL`. The `list_empty()` function checks if `head->next == head`. Since
`NULL` is not equal to the address of the list head, `list_empty()` returns
false, triggering the `WARN_ON_ONCE`.
**Exploitability & Impact:**
This is a harmless warning. The uninitialized list head is not dereferenced (no
NULL pointer dereference occurs because `list_empty` only reads the `next`
pointer). The `ei` structure is not yet linked into any global or parent data
structures, so no other threads or RCU readers can access it. After the warning,
the memory is properly freed via `call_srcu` and `kfree`. It does not cause
memory corruption, crashes, or denial of service.
**Accessibility:**
The bug is triggered by creating a new trace instance (creating a directory
inside the tracefs `instances/` directory).
- Tracefs does not have the `FS_USERNS_MOUNT` flag, meaning it cannot be mounted
from an unprivileged user namespace; it requires `CAP_SYS_ADMIN` in the initial
namespace.
- The `instances/` directory is owned by root and has restricted permissions, so
unprivileged users cannot create directories inside it.
Therefore, this bug cannot be reached by unprivileged processes or from within
user namespaces. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/08/21 01:58 |
action |
syz-repro-to-c-repro |
0m
Results: map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/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)) {}
// mkdirat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 2e 63 70 75 2f 74 65 73 74 00} (length 0x12)
// }
// mode: open_mode = 0x777 (8 bytes)
// ]
memcpy((void*)0x200000000000, "./cgroup.cpu/test\000", 18);
syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IWGRP|S_IRGRP|S_IXUSR|S_IRUSR|0x600*/0x777ul);
// openat arguments: [
// fd: fd_dir (resource)
// file: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 2e 63 70 75 2f 74 65 73 74 2f 6d 65 6d 6f 72 79 2e 6c 69 6d 69 74 5f 69 6e 5f 62 79 74 65 73 00} (length 0x28)
// }
// flags: open_flags = 0x2 (4 bytes)
// mode: open_mode = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000140, "./cgroup.cpu/test/memory.limit_in_bytes\000", 40);
res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000140ul, /*flags=O_RDWR*/2, /*mode=*/0);
if (res != -1)
r[0] = res;
// write arguments: [
// fd: fd (resource)
// buf: ptr[in, buffer] {
// buffer: {31 30 30 30 30} (length 0x5)
// }
// count: len = 0x5 (8 bytes)
// ]
memcpy((void*)0x200000000180, "10000", 5);
syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000180ul, /*count=*/5ul);
// openat arguments: [
// fd: fd_dir (resource)
// file: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 2e 63 70 75 2f 74 65 73 74 2f 63 67 72 6f 75 70 2e 70 72 6f 63 73 00} (length 0x1f)
// }
// flags: open_flags = 0x2 (4 bytes)
// mode: open_mode = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000240, "./cgroup.cpu/test/cgroup.procs\000", 31);
res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000240ul, /*flags=O_RDWR*/2, /*mode=*/0);
if (res != -1)
r[1] = res;
// write arguments: [
// fd: fd (resource)
// buf: ptr[in, buffer] {
// buffer: {30} (length 0x1)
// }
// count: len = 0x1 (8 bytes)
// ]
memset((void*)0x200000000280, 48, 1);
syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000000280ul, /*count=*/1ul);
// mkdirat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 74 72 61 63 65 66 73 00} (length 0xa)
// }
// mode: open_mode = 0x1ff (8 bytes)
// ]
memcpy((void*)0x200000000000, "./tracefs\000", 10);
syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/0x1fful);
// mount arguments: [
// src: nil
// dst: ptr[in, buffer] {
// buffer: {2e 2f 74 72 61 63 65 66 73 00} (length 0xa)
// }
// type: ptr[in, buffer] {
// buffer: {74 72 61 63 65 66 73 00} (length 0x8)
// }
// flags: mount_flags = 0x0 (8 bytes)
// data: nil
// ]
memcpy((void*)0x200000000000, "./tracefs\000", 10);
memcpy((void*)0x200000000040, "tracefs\000", 8);
syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000000ul, /*type=*/0x200000000040ul, /*flags=*/0ul, /*data=*/0ul);
// mkdirat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 74 72 61 63 65 66 73 2f 69 6e 73 74 61 6e 63 65 73 2f 66 6f 6f 00} (length 0x18)
// }
// mode: open_mode = 0x1ff (8 bytes)
// ]
memcpy((void*)0x200000000140, "./tracefs/instances/foo\000", 24);
syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000140ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/0x1fful);
return 0;
}
]
|
| 2/1 |
2026/08/21 01:58 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/26801e7db6d7ad1b11f49a256b373cd68170f893]
|
| 3/1 |
2026/08/21 02:00 |
action |
kernel-builder |
30m
Results: map[KernelObj:/app/workdir/cache/build/4528410e7fc3618a21d49c7c765ced7313262c95]
|
| 4/1 |
2026/08/21 02:30 |
action |
codesearch-prepare |
19m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/08/21 02:49 |
agent |
expert |
2m
Model:
Results: map[DenialOfService:false 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:
Could not create tracefs 'set_event_pid' entry
Could not create tracefs 'set_event_notrace_pid' entry
------------[ cut here ]------------
!list_empty(&ei->children)
WARNING: fs/tracefs/event_inode.c:128 at free_ei fs/tracefs/event_inode.c:128 [inline], CPU#1: syz.0.20/6104
WARNING: fs/tracefs/event_inode.c:128 at cleanup_ei fs/tracefs/event_inode.c:150 [inline], CPU#1: syz.0.20/6104
WARNING: fs/tracefs/event_inode.c:128 at cleanup_ei fs/tracefs/event_inode.c:145 [inline], CPU#1: syz.0.20/6104
WARNING: fs/tracefs/event_inode.c:128 at eventfs_create_events_dir+0xa3d/0xbe0 fs/tracefs/event_inode.c:834, CPU#1: syz.0.20/6104
Modules linked in:
CPU: 1 UID: 0 PID: 6104 Comm: syz.0.20 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:free_ei fs/tracefs/event_inode.c:128 [inline]
RIP: 0010:cleanup_ei fs/tracefs/event_inode.c:150 [inline]
RIP: 0010:cleanup_ei fs/tracefs/event_inode.c:145 [inline]
RIP: 0010:eventfs_create_events_dir+0xa3d/0xbe0 fs/tracefs/event_inode.c:834
Code: 00 e8 57 f7 f9 00 e9 ab fb ff ff e8 2d 6d e6 fd 48 8b 7c 24 10 be 03 00 00 00 e8 3e f7 f9 00 e9 c2 fd ff ff e8 14 6d e6 fd 90 <0f> 0b 90 e9 59 fe ff ff e8 f6 0a 56 fe e9 4b f7 ff ff 48 89 44 24
RSP: 0018:ffffc90002617b88 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888077746000 RCX: 0000000000000000
RDX: ffff88802f489f40 RSI: ffffffff8424403c RDI: ffffffff8e679928
RBP: ffff88802737f210 R08: 00000000ffffffff R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000001 R12: ffff88802737f250
R13: 0000000000000003 R14: ffff88802737f24c R15: ffff88802737f200
FS: 00007f6c427fe6c0(0000) GS:ffff888123ccc000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2cf63fff CR3: 0000000026acc000 CR4: 0000000000350ef0
Call Trace:
<TASK>
create_event_toplevel_files+0x12d/0x1a0 kernel/trace/trace_events.c:4593
event_trace_add_tracer+0x72/0x260 kernel/trace/trace_events.c:4624
trace_array_create_dir+0x8e/0x210 kernel/trace/trace.c:8548
trace_array_create_systems+0x8b3/0xc30 kernel/trace/trace.c:8639
trace_array_create kernel/trace/trace.c:8666 [inline]
instance_mkdir+0xca/0x140 kernel/trace/trace.c:8681
tracefs_syscall_mkdir+0x10e/0x180 fs/tracefs/inode.c:121
vfs_mkdir+0x364/0x850 fs/namei.c:5410
filename_mkdirat+0x48b/0x5e0 fs/namei.c:5443
__do_sys_mkdirat fs/namei.c:5464 [inline]
__se_sys_mkdirat fs/namei.c:5461 [inline]
__x64_sys_mkdirat+0x89/0xc0 fs/namei.c:5461
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:0x7f6c4319e0d9
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:00007f6c427fe028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f6c43425fa0 RCX: 00007f6c4319e0d9
RDX: 00000000000001ff RSI: 0000200000000140 RDI: ffffffffffffff9c
RBP: 00007f6c43235024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f6c43426038 R14: 00007f6c43425fa0 R15: 00007fff53277798
</TASK>
It is reproducible with the followint program.
Keep in mind that it may lack the precise threading, sandboxing, and some arguments of a working reproducer.
But it should give an idea of the involved syscalls.
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
uint64_t r[2] = {0xffffffffffffffff, 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)) {}
// mkdirat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 2e 63 70 75 2f 74 65 73 74 00} (length 0x12)
// }
// mode: open_mode = 0x777 (8 bytes)
// ]
memcpy((void*)0x200000000000, "./cgroup.cpu/test\000", 18);
syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IWGRP|S_IRGRP|S_IXUSR|S_IRUSR|0x600*/0x777ul);
// openat arguments: [
// fd: fd_dir (resource)
// file: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 2e 63 70 75 2f 74 65 73 74 2f 6d 65 6d 6f 72 79 2e 6c 69 6d 69 74 5f 69 6e 5f 62 79 74 65 73 00} (length 0x28)
// }
// flags: open_flags = 0x2 (4 bytes)
// mode: open_mode = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000140, "./cgroup.cpu/test/memory.limit_in_bytes\000", 40);
res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000140ul, /*flags=O_RDWR*/2, /*mode=*/0);
if (res != -1)
r[0] = res;
// write arguments: [
// fd: fd (resource)
// buf: ptr[in, buffer] {
// buffer: {31 30 30 30 30} (length 0x5)
// }
// count: len = 0x5 (8 bytes)
// ]
memcpy((void*)0x200000000180, "10000", 5);
syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000180ul, /*count=*/5ul);
// openat arguments: [
// fd: fd_dir (resource)
// file: ptr[in, buffer] {
// buffer: {2e 2f 63 67 72 6f 75 70 2e 63 70 75 2f 74 65 73 74 2f 63 67 72 6f 75 70 2e 70 72 6f 63 73 00} (length 0x1f)
// }
// flags: open_flags = 0x2 (4 bytes)
// mode: open_mode = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000240, "./cgroup.cpu/test/cgroup.procs\000", 31);
res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000240ul, /*flags=O_RDWR*/2, /*mode=*/0);
if (res != -1)
r[1] = res;
// write arguments: [
// fd: fd (resource)
// buf: ptr[in, buffer] {
// buffer: {30} (length 0x1)
// }
// count: len = 0x1 (8 bytes)
// ]
memset((void*)0x200000000280, 48, 1);
syscall(__NR_write, /*fd=*/r[1], /*buf=*/0x200000000280ul, /*count=*/1ul);
// mkdirat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 74 72 61 63 65 66 73 00} (length 0xa)
// }
// mode: open_mode = 0x1ff (8 bytes)
// ]
memcpy((void*)0x200000000000, "./tracefs\000", 10);
syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000000ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/0x1fful);
// mount arguments: [
// src: nil
// dst: ptr[in, buffer] {
// buffer: {2e 2f 74 72 61 63 65 66 73 00} (length 0xa)
// }
// type: ptr[in, buffer] {
// buffer: {74 72 61 63 65 66 73 00} (length 0x8)
// }
// flags: mount_flags = 0x0 (8 bytes)
// data: nil
// ]
memcpy((void*)0x200000000000, "./tracefs\000", 10);
memcpy((void*)0x200000000040, "tracefs\000", 8);
syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000000000ul, /*type=*/0x200000000040ul, /*flags=*/0ul, /*data=*/0ul);
// mkdirat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 74 72 61 63 65 66 73 2f 69 6e 73 74 61 6e 63 65 73 2f 66 6f 6f 00} (length 0x18)
// }
// mode: open_mode = 0x1ff (8 bytes)
// ]
memcpy((void*)0x200000000140, "./tracefs/instances/foo\000", 24);
syscall(__NR_mkdirat, /*fd=*/0xffffff9c, /*path=*/0x200000000140ul, /*mode=S_IXOTH|S_IWOTH|S_IROTH|S_IXGRP|S_IWGRP|S_IRGRP|S_IXUSR|S_IWUSR|0x100*/0x1fful);
return 0;
}
Reply: Based on the analysis of the bug report and the kernel source code, here is the assessment of the security impact:
**Bug Mechanism:**
The warning is triggered in `fs/tracefs/event_inode.c` at `free_ei()` when checking `WARN_ON_ONCE(!list_empty(&ei->children))`.
During the creation of a new trace instance, `eventfs_create_events_dir()` allocates a new root eventfs inode (`ei`) via `alloc_root_ei()`. This allocation uses `kzalloc`, meaning the memory is zeroed out. The initialization of the `ei->children` list head (`INIT_LIST_HEAD(&ei->children)`) is done later in the function, *after* a call to `tracefs_get_inode()`.
If `tracefs_get_inode()` fails (e.g., due to an out-of-memory condition caused by a cgroup memory limit, as seen in the reproducer), the code jumps to the `fail` label and calls `cleanup_ei(ei)`. This eventually calls `free_ei(ei)`, which checks if the `ei->children` list is empty.
Because the list head was never initialized and is still all zeros, `head->next` is `NULL`. The `list_empty()` function checks if `head->next == head`. Since `NULL` is not equal to the address of the list head, `list_empty()` returns false, triggering the `WARN_ON_ONCE`.
**Exploitability & Impact:**
This is a harmless warning. The uninitialized list head is not dereferenced (no NULL pointer dereference occurs because `list_empty` only reads the `next` pointer). The `ei` structure is not yet linked into any global or parent data structures, so no other threads or RCU readers can access it. After the warning, the memory is properly freed via `call_srcu` and `kfree`. It does not cause memory corruption, crashes, or denial of service.
**Accessibility:**
The bug is triggered by creating a new trace instance (creating a directory inside the tracefs `instances/` directory).
- Tracefs does not have the `FS_USERNS_MOUNT` flag, meaning it cannot be mounted from an unprivileged user namespace; it requires `CAP_SYS_ADMIN` in the initial namespace.
- The `instances/` directory is owned by root and has restricted permissions, so unprivileged users cannot create directories inside it.
Therefore, this bug cannot be reached by unprivileged processes or from within user namespaces.
|
| 6/2 |
2026/08/21 02:49 |
llm |
expert |
0m
Model:
Tokens:
input: 10370
output: 39
thoughts: 351
Thoughts: **Analyzing a Tracefs Kernel Bug**
Okay, so I've got a kernel bug report here, and it's complaining about issues creating entries within tracefs, specifically related to `set_event_pid` and `set_event_notrace_pid`. The kernel is also spitting out some warnings, notably at `fs/tracefs/event_inode.c:128`. That's a classic sign pointing to a memory management issue or a race condition within the event infrastructure. The stack trace, with all those warnings at line 128, indicates that the problem stems from a condition that is being violated, specifically the list not being empty when it's expected to be.
The reproducer apparently mounts tracefs and creates a directory in `instances/foo`, which suggests the problem is triggered during the instantiation of a tracefs instance. Given that I'm familiar with the tracefs subsystem, my first instinct is to dive into the `fs/tracefs/event_inode.c` code. My thought is, whatever is happening on line 128 is likely the root cause of the problem. Time to see what's actually happening at that point.
|
| 7/2 |
2026/08/21 02:50 |
tool |
read-file |
0m
Args: map[File:fs/tracefs/event_inode.c FirstLine:100 LineCount:100]
Results: map[Contents: 100: * count is always a superset of the inode reference count.
101: */
102: static void release_ei(struct kref *ref)
103: {
104: struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
105: const struct eventfs_entry *entry;
106:
107: WARN_ON_ONCE(!ei->is_freed);
108:
109: for (int i = 0; i < ei->nr_entries; i++) {
110: entry = &ei->entries[i];
111: if (entry->release)
112: entry->release(entry->name, ei->data);
113: }
114:
115: call_srcu(&eventfs_srcu, &ei->rcu, free_ei_rcu);
116: }
117:
118: static inline void put_ei(struct eventfs_inode *ei)
119: {
120: if (ei)
121: kref_put(&ei->kref, release_ei);
122: }
123:
124: static inline void free_ei(struct eventfs_inode *ei)
125: {
126: if (ei) {
127: /* The ei should have no children if it is being freed. */
128: WARN_ON_ONCE(!list_empty(&ei->children));
129: ei->is_freed = 1;
130: /*
131: * The SRCU iteration has a smp_rmb() to make sure it
132: * sees a child (that may have already been freed)
133: * before it reads is_free. If is_free is set, it must
134: * not use the child it acquired from ei->children, as
135: * the list may be used for SRCU.
136: */
137: smp_wmb();
138: put_ei(ei);
139: }
140: }
141:
142: /*
143: * Called when creation of an ei fails, do not call release() functions.
144: */
145: static inline void cleanup_ei(struct eventfs_inode *ei)
146: {
147: if (ei) {
148: /* Set nr_entries to 0 to prevent release() function being called */
149: ei->nr_entries = 0;
150: free_ei(ei);
151: }
152: }
153:
154: static inline struct eventfs_inode *get_ei(struct eventfs_inode *ei)
155: {
156: if (ei)
157: kref_get(&ei->kref);
158: return ei;
159: }
160:
161: static struct dentry *eventfs_root_lookup(struct inode *dir,
162: struct dentry *dentry,
163: unsigned int flags);
164: static int eventfs_iterate(struct file *file, struct dir_context *ctx);
165:
166: static void update_attr(struct eventfs_attr *attr, struct iattr *iattr)
167: {
168: unsigned int ia_valid = iattr->ia_valid;
169:
170: if (ia_valid & ATTR_MODE) {
171: attr->mode = (attr->mode & ~EVENTFS_MODE_MASK) |
172: (iattr->ia_mode & EVENTFS_MODE_MASK) |
173: EVENTFS_SAVE_MODE;
174: }
175: if (ia_valid & ATTR_UID) {
176: attr->mode |= EVENTFS_SAVE_UID;
177: attr->uid = iattr->ia_uid;
178: }
179: if (ia_valid & ATTR_GID) {
180: attr->mode |= EVENTFS_SAVE_GID;
181: attr->gid = iattr->ia_gid;
182: }
183: }
184:
185: static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
186: struct iattr *iattr)
187: {
188: const struct eventfs_entry *entry;
189: struct eventfs_inode *ei;
190: const char *name;
191: int ret;
192:
193: guard(mutex)(&eventfs_mutex);
194: ei = dentry->d_fsdata;
195: /* Do not allow changes if the event is about to be removed. */
196: if (ei->is_freed)
197: return -ENODEV;
198:
199: /* Preallocate the children mode array if necessary */
]
|
| 8/2 |
2026/08/21 02:50 |
llm |
expert |
0m
Model:
Tokens:
input: 12485
output: 39
thoughts: 82
Thoughts: Here's my analysis of the code, as if I were working through it:
**Digging into a Potential Tracefs Issue**
Okay, so I've got a warning flagged: `WARN_ON_ONCE(!list_empty(&ei->children))` within the `free_ei` function. Right away, this screams potential resource leak or improper cleanup to me. Something is probably leaving data in a list when it shouldn't be. Let's see where `free_ei` is being called. Tracing backwards, it looks like `free_ei` is called by `cleanup_ei`, which isn't entirely surprising - usually a cleanup function. Now, `cleanup_ei` is called from `eventfs_create_events_dir`, specifically at `fs/tracefs/event_inode.c:834`. Alright, let's take a look at that function, `eventfs_create_events_dir`. I need to understand the context here. I'm going to scan through that code block and surrounding code in `eventfs_create_events_dir` to understand how events directories are created and when. That will give me the information I need to understand *why* the warning is being thrown and where the error is most likely to be.
|
| 9/2 |
2026/08/21 02:50 |
tool |
read-file |
0m
Args: map[File:fs/tracefs/event_inode.c FirstLine:800 LineCount:100]
Results: map[Contents: 800:
801: INIT_LIST_HEAD(&ei->children);
802: INIT_LIST_HEAD(&ei->list);
803:
804: ti = get_tracefs(inode);
805: ti->flags |= TRACEFS_EVENT_INODE;
806: ti->private = ei;
807:
808: inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
809: inode->i_uid = uid;
810: inode->i_gid = gid;
811: inode->i_op = &eventfs_dir_inode_operations;
812: inode->i_fop = &eventfs_file_operations;
813:
814: dentry->d_fsdata = get_ei(ei);
815:
816: /*
817: * Keep all eventfs directories with i_nlink == 1.
818: * Due to the dynamic nature of the dentry creations and not
819: * wanting to add a pointer to the parent eventfs_inode in the
820: * eventfs_inode structure, keeping the i_nlink in sync with the
821: * number of directories would cause too much complexity for
822: * something not worth much. Keeping directory links at 1
823: * tells userspace not to trust the link number.
824: */
825: d_make_persistent(dentry, inode);
826: /* The dentry of the "events" parent does keep track though */
827: inc_nlink(dentry->d_parent->d_inode);
828: fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
829: tracefs_end_creating(dentry);
830:
831: return ei;
832:
833: fail:
834: cleanup_ei(ei);
835: tracefs_failed_creating(dentry);
836: return ERR_PTR(-ENOMEM);
837: }
838:
839: /**
840: * eventfs_remove_rec - remove eventfs dir or file from list
841: * @ei: eventfs_inode to be removed.
842: * @level: prevent recursion from going more than 3 levels deep.
843: *
844: * This function recursively removes eventfs_inodes which
845: * contains info of files and/or directories.
846: */
847: static void eventfs_remove_rec(struct eventfs_inode *ei, int level)
848: {
849: struct eventfs_inode *ei_child, *tmp;
850:
851: /*
852: * Check recursion depth. It should never be greater than 3:
853: * 0 - events/
854: * 1 - events/group/
855: * 2 - events/group/event/
856: * 3 - events/group/event/file
857: */
858: if (WARN_ON_ONCE(level > 3))
859: return;
860:
861: /* search for nested folders or files */
862: list_for_each_entry_safe(ei_child, tmp, &ei->children, list)
863: eventfs_remove_rec(ei_child, level + 1);
864:
865: list_del_rcu(&ei->list);
866: free_ei(ei);
867: }
868:
869: /**
870: * eventfs_remove_dir - remove eventfs dir or file from list
871: * @ei: eventfs_inode to be removed.
872: *
873: * This function acquire the eventfs_mutex lock and call eventfs_remove_rec()
874: */
875: void eventfs_remove_dir(struct eventfs_inode *ei)
876: {
877: if (!ei)
878: return;
879:
880: guard(mutex)(&eventfs_mutex);
881: eventfs_remove_rec(ei, 0);
882: }
883:
884: /**
885: * eventfs_remove_events_dir - remove the top level eventfs directory
886: * @ei: the event_inode returned by eventfs_create_events_dir().
887: *
888: * This function removes the events main directory
889: */
890: void eventfs_remove_events_dir(struct eventfs_inode *ei)
891: {
892: struct eventfs_root_inode *rei;
893: struct dentry *dentry;
894:
895: rei = get_root_inode(ei);
896: dentry = rei->events_dir;
897: if (!dentry)
898: return;
899:
]
|
| 10/2 |
2026/08/21 02:50 |
llm |
expert |
0m
Model:
Tokens:
input: 14361
output: 39
thoughts: 21
Thoughts: Here's a summary of my thought process, as requested:
**Navigating the Event Filesystem Creation**
Okay, so I'm diving back into this code and I need to refresh my memory on the event file system creation. Specifically, I'm thinking about `eventfs_create_events_dir`. That's where things should be happening, right? Line 834 feels like a good starting point. I need to understand how the directory structure is built and if there are any subtle aspects of the function to consider. I'm going to start with the surrounding code blocks.
|
| 11/2 |
2026/08/21 02:50 |
tool |
read-file |
0m
Args: map[File:fs/tracefs/event_inode.c FirstLine:750 LineCount:100]
Results: map[Contents: 750: *
751: * This function creates the top of the trace event directory.
752: *
753: * See eventfs_create_dir() for use of @entries.
754: */
755: struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry *parent,
756: const struct eventfs_entry *entries,
757: int size, void *data)
758: {
759: struct dentry *dentry;
760: struct eventfs_root_inode *rei;
761: struct eventfs_inode *ei;
762: struct tracefs_inode *ti;
763: struct inode *inode;
764: kuid_t uid;
765: kgid_t gid;
766:
767: if (security_locked_down(LOCKDOWN_TRACEFS))
768: return NULL;
769:
770: dentry = tracefs_start_creating(name, parent);
771: if (IS_ERR(dentry))
772: return ERR_CAST(dentry);
773:
774: ei = alloc_root_ei(name);
775: if (!ei)
776: goto fail;
777:
778: inode = tracefs_get_inode(dentry->d_sb);
779: if (unlikely(!inode))
780: goto fail;
781:
782: // Note: we have a ref to the dentry from tracefs_start_creating()
783: rei = get_root_inode(ei);
784: rei->events_dir = dentry;
785:
786: ei->entries = entries;
787: ei->nr_entries = size;
788: ei->data = data;
789:
790: /* Save the ownership of this directory */
791: uid = d_inode(dentry->d_parent)->i_uid;
792: gid = d_inode(dentry->d_parent)->i_gid;
793:
794: /*
795: * The ei->attr will be used as the default values for the
796: * files beneath this directory.
797: */
798: ei->attr.uid = uid;
799: ei->attr.gid = gid;
800:
801: INIT_LIST_HEAD(&ei->children);
802: INIT_LIST_HEAD(&ei->list);
803:
804: ti = get_tracefs(inode);
805: ti->flags |= TRACEFS_EVENT_INODE;
806: ti->private = ei;
807:
808: inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
809: inode->i_uid = uid;
810: inode->i_gid = gid;
811: inode->i_op = &eventfs_dir_inode_operations;
812: inode->i_fop = &eventfs_file_operations;
813:
814: dentry->d_fsdata = get_ei(ei);
815:
816: /*
817: * Keep all eventfs directories with i_nlink == 1.
818: * Due to the dynamic nature of the dentry creations and not
819: * wanting to add a pointer to the parent eventfs_inode in the
820: * eventfs_inode structure, keeping the i_nlink in sync with the
821: * number of directories would cause too much complexity for
822: * something not worth much. Keeping directory links at 1
823: * tells userspace not to trust the link number.
824: */
825: d_make_persistent(dentry, inode);
826: /* The dentry of the "events" parent does keep track though */
827: inc_nlink(dentry->d_parent->d_inode);
828: fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
829: tracefs_end_creating(dentry);
830:
831: return ei;
832:
833: fail:
834: cleanup_ei(ei);
835: tracefs_failed_creating(dentry);
836: return ERR_PTR(-ENOMEM);
837: }
838:
839: /**
840: * eventfs_remove_rec - remove eventfs dir or file from list
841: * @ei: eventfs_inode to be removed.
842: * @level: prevent recursion from going more than 3 levels deep.
843: *
844: * This function recursively removes eventfs_inodes which
845: * contains info of files and/or directories.
846: */
847: static void eventfs_remove_rec(struct eventfs_inode *ei, int level)
848: {
849: struct eventfs_inode *ei_child, *tmp;
]
|
| 12/2 |
2026/08/21 02:50 |
llm |
expert |
0m
Model:
Tokens:
input: 16046
output: 39
thoughts: 67
Thoughts: **Digging into Tracefs Initialization**
Okay, so I'm looking at this `eventfs_create_events_dir` function, and it seems like if `tracefs_get_inode` fails, we get a call to `cleanup_ei(ei)`. That's standard error handling, nothing surprising there. But something about this makes me think I've missed a detail. Wait, I'm going to have to make sure that the `ei->children` element has been initialized correctly. `alloc_root_ei` is the function responsible for allocation, so I need to check how it initializes the `ei` struct. Let's dive into `alloc_root_ei` and verify that the children structure is properly initialized. Gotta cover all my bases.
|
| 13/2 |
2026/08/21 02:50 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/tracefs/event_inode.c Name:alloc_root_ei]
Results: map[SourceCode: 459: static inline struct eventfs_inode *alloc_root_ei(const char *name)
460: {
461: struct eventfs_root_inode *rei = kzalloc_obj(*rei);
462: struct eventfs_inode *ei;
463:
464: if (!rei)
465: return NULL;
466:
467: rei->ei.is_events = 1;
468: ei = init_ei(&rei->ei, name);
469: if (!ei)
470: kfree(rei);
471:
472: return ei;
473: }
SourceFile:fs/tracefs/event_inode.c]
|
| 14/2 |
2026/08/21 02:50 |
llm |
expert |
0m
Model:
Tokens:
input: 16542
output: 37
thoughts: 9
Thoughts: Okay, here's my attempt at summarizing the thought process, as if it were my own, assuming I'm an expert in the field:
**Initial Examination of `init_ei`**
Alright, let's dive into this. First thing's first: `init_ei`. I need to understand what this function, variable, or module—context is important here, I'm assuming it's related to Expectation Improvement. Without knowing more, I'm going to start with the obvious: What's its purpose? Is it responsible for initialization, configuration, or perhaps a core component of the EI calculation itself? Is it setting some sort of threshold? Is it determining initial parameters for optimization? Does it use the initial data for EI computations? Perhaps an EI acquisition function for initial exploration.
My mind immediately starts ticking through potential implementations based on what I would expect in my own code. I'm mentally parsing this as either a set of computations or initial definitions within the code I am working with. What variables are being input? What is the output? Is it simply returning a value, modifying an existing structure, or calling other functions? I need to look closely at the surrounding code to grasp its role within the larger system. The documentation, if it exists, will be key to understanding the intended design. The comments around `init_ei` would be useful. Ultimately, my analysis needs to begin with asking questions to understand this function. Let's see.
|
| 15/2 |
2026/08/21 02:50 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/tracefs/event_inode.c Name:init_ei]
Results: map[SourceCode: 435: static inline struct eventfs_inode *init_ei(struct eventfs_inode *ei, const char *name)
436: {
437: ei->name = kstrdup_const(name, GFP_KERNEL);
438: if (!ei->name)
439: return NULL;
440: kref_init(&ei->kref);
441: return ei;
442: }
SourceFile:fs/tracefs/event_inode.c]
|
| 16/2 |
2026/08/21 02:50 |
llm |
expert |
0m
Model:
Tokens:
input: 17046
output: 40
thoughts: 214
Thoughts: **Debugging a Trace Event Issue**
Okay, so I've been staring at this code and I think I've found the problem. The `init_ei` function... Aha! It doesn't actually initialize `ei->children`! That initialization, `INIT_LIST_HEAD(&ei->children)`, happens later, at line 801 in `eventfs_create_events_dir`, which is *after* the `tracefs_get_inode` call.
So, here's what's happening. If `tracefs_get_inode` fails, the system calls `cleanup_ei(ei)`. Inside `cleanup_ei`, `free_ei(ei)` is called, and *that's* where the `WARN_ON_ONCE(!list_empty(&ei->children))` shows up.
Wait a second... I see it now. `rei` (or the equivalent) is allocated with `kzalloc_obj`, so `ei->children` is initialized with all zeros! `list_empty` checks if `head->next == head`. Since everything's zeroed, `head->next` is NULL, which isn't equal to `head`, so `list_empty` is going to return false! That's why the warning is triggered.
Alright, let's go check out the `eventfs_create_dir` function and see if there are any similar problems there.
|
| 17/2 |
2026/08/21 02:50 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/tracefs/event_inode.c Name:eventfs_create_dir]
Results: map[SourceCode: 677: /**
678: * eventfs_create_dir - Create the eventfs_inode for this directory
679: * @name: The name of the directory to create.
680: * @parent: The eventfs_inode of the parent directory.
681: * @entries: A list of entries that represent the files under this directory
682: * @size: The number of @entries
683: * @data: The default data to pass to the files (an entry may override it).
684: *
685: * This function creates the descriptor to represent a directory in the
686: * eventfs. This descriptor is an eventfs_inode, and it is returned to be
687: * used to create other children underneath.
688: *
689: * The @entries is an array of eventfs_entry structures which has:
690: * const char *name
691: * eventfs_callback callback;
692: *
693: * The name is the name of the file, and the callback is a pointer to a function
694: * that will be called when the file is reference (either by lookup or by
695: * reading a directory). The callback is of the prototype:
696: *
697: * int callback(const char *name, umode_t *mode, void **data,
698: * const struct file_operations **fops);
699: *
700: * When a file needs to be created, this callback will be called with
701: * name = the name of the file being created (so that the same callback
702: * may be used for multiple files).
703: * mode = a place to set the file's mode
704: * data = A pointer to @data, and the callback may replace it, which will
705: * cause the file created to pass the new data to the open() call.
706: * fops = the fops to use for the created file.
707: *
708: * NB. @callback is called while holding internal locks of the eventfs
709: * system. The callback must not call any code that might also call into
710: * the tracefs or eventfs system or it will risk creating a deadlock.
711: */
712: struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode *parent,
713: const struct eventfs_entry *entries,
714: int size, void *data)
715: {
716: struct eventfs_inode *ei;
717:
718: if (!parent)
719: return ERR_PTR(-EINVAL);
720:
721: ei = alloc_ei(name);
722: if (!ei)
723: return ERR_PTR(-ENOMEM);
724:
725: ei->entries = entries;
726: ei->nr_entries = size;
727: ei->data = data;
728: INIT_LIST_HEAD(&ei->children);
729: INIT_LIST_HEAD(&ei->list);
730:
731: scoped_guard(mutex, &eventfs_mutex) {
732: if (!parent->is_freed)
733: list_add_tail_rcu(&ei->list, &parent->children);
734: }
735: /* Was the parent freed? */
736: if (list_empty(&ei->list)) {
737: cleanup_ei(ei);
738: ei = ERR_PTR(-EBUSY);
739: }
740: return ei;
741: }
SourceFile:fs/tracefs/event_inode.c]
|
| 18/2 |
2026/08/21 02:50 |
llm |
expert |
0m
Model:
Tokens:
input: 18696
output: 38
thoughts: 98
Thoughts: **My Analysis of Eventfs and Tracefs Initialization**
Okay, so I'm looking at this `eventfs_create_dir` function. I see they're initializing the `ei->children` list head *before* calling `cleanup_ei(ei)`. Seems reasonable. However, the `eventfs_create_events_dir` function has a slightly different pattern. Here, the initialization of `ei->children` is *after* the call to `tracefs_get_inode`. And that's where things get interesting because `tracefs_get_inode` can, apparently, fail.
The critical question here is *why* is `tracefs_get_inode` failing? Is there some resource contention? Are we hitting some kind of limit on inodes, or some permission issue? Before I can even begin to understand the implications of the differing initialization sequence, I need to understand what's happening *inside* that `tracefs_get_inode` call. I need to dig into its implementation and see what its failure modes are. It's the lynchpin, and the root cause for all concerns. That's the first place to look.
|
| 19/2 |
2026/08/21 02:50 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/tracefs/inode.c Name:tracefs_get_inode]
Results: map[SourceCode: 248: struct inode *tracefs_get_inode(struct super_block *sb)
249: {
250: struct inode *inode = new_inode(sb);
251: if (inode) {
252: inode->i_ino = get_next_ino();
253: simple_inode_init_ts(inode);
254: }
255: return inode;
256: }
SourceFile:fs/tracefs/inode.c]
|
| 20/2 |
2026/08/21 02:50 |
llm |
expert |
0m
Model:
Tokens:
input: 19234
output: 32
thoughts: 1580
Thoughts: **Analysis of the Eventfs Inode Initialization Issue**
Okay, so here's what's happening. The reproducer in syzkaller is creating cgroups with memory limits, and then attempting to create a directory within `tracefs`. This leads to a memory allocation failure during the `tracefs_get_inode` call. Specifically, the cgroup memory limit is preventing the allocation. This failure then triggers a cleanup path for an `eventfs_inode` ( `ei` ).
The core issue lies in the `cleanup_ei` function, which ends up calling `free_ei`. Inside `free_ei`, there's a `WARN_ON_ONCE` that checks if `ei->children` is empty. Because the inode isn't fully initialized, `ei->children` isn't properly initialized. Since its contents are all zeroes, `list_empty` returns `false`, causing the `WARN_ON_ONCE` to fire.
My initial thought was this *might* be exploitable. However, looking closer, the check is for an uninitialized list head. The `WARN_ON_ONCE` doesn't actually trigger any memory corruption or undefined behavior. It simply prints a warning to the kernel log and continues. In a production build, this is the expected behavior of `WARN_ON_ONCE`.
The crucial bit is tracing the `ei`'s lifetime through `free_ei`, `put_ei`, `release_ei`, and finally `free_ei_rcu`. `free_ei_rcu` is the one which actually releases the memory associated with `ei`.
No other part of the code accesses `ei->children` before it's set in the case of a failed allocation in `tracefs_get_inode` where we call `cleanup_ei(ei)`. This can also happen in `eventfs_create_events_dir`, if `tracefs_get_inode` fails. Other failure paths are handled differently, and `ei` might be null.
I double-checked to see if an RCU reader could potentially access this uninitialized list head, but `ei` isn't linked into any data structures yet. It's only in the allocation path and is not accessible by other threads at this point.
The reproducer itself uses operations that require elevated privileges: creating cgroups, setting memory limits, and, crucially, mounting `tracefs`. So, mounting `tracefs` and creating a directory within `tracefs/instances` often requires `CAP_SYS_ADMIN` in the user namespace, unless root is running the process. So, this isn't triggerable from an unprivileged process unless tracefs is configured differently, for example in a user namespace.
In short, it's a harmless warning in a restricted situation and unlikely to be exploitable.
|
| 21/2 |
2026/08/21 02:51 |
tool |
grepper |
0m
Error:
Args: map[Expression:FS_USERNS_MOUNT PathPrefix:fs/tracefs/]
Results:
|
| 22/2 |
2026/08/21 02:51 |
llm |
expert |
0m
Model:
Tokens:
input: 21459
output: 36
thoughts: 36
Thoughts: Okay, here's my take on those thoughts, framed from an expert's perspective:
**Diving into Tracefs's Namespace Support**
Alright, so I'm digging into tracefs's implementation details. My initial hunch is right: it doesn't seem to have direct support for `FS_USERNS_MOUNT`, at least not explicitly. I need to be sure about this because that's critical for the isolation I'm trying to achieve.
Okay, let's zero in on `fs/tracefs/inode.c`. That's where the heart of the tracefs filesystem's inode handling lives. I'm focusing on the `tracefs_type` structure or any relevant structures within that file; I need to understand how it's mounting the file system. Knowing how the type is set will provide insight into whether namespaces are handled at all and where the potential gaps lie if there aren't already explicit namespace details, and allow me to determine the best path to address any limitations.
|
| 23/2 |
2026/08/21 02:51 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:fs/tracefs/inode.c Name:tracefs_type]
Results: map[SourceCode: SourceFile:]
|
| 24/2 |
2026/08/21 02:51 |
llm |
expert |
0m
Model:
Tokens:
input: 21767
output: 37
thoughts: 11
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person:
**Deep Dive on Filesystem Type Tracing**
Alright, time to dive in. My immediate thought is, "Let's check `trace_fs_type`". Given the context, I'm assuming we're dealing with a system analysis or debugging scenario involving filesystem operations. My instinct is to zero in on this tracepoint because it's *the* place to observe filesystem type activity at a granular level. I anticipate this tracepoint will give me a wealth of information about exactly what filesystem types are being mounted, accessed, and potentially causing problems. I’m thinking mount options, major/minor device numbers – hopefully everything that will help me diagnose any issues at hand. I'm keen to ensure it's functioning as expected, and ideally that I'm seeing the specific events I'm targeting. I want to see if it's returning expected output given how the system is currently configured.
|
| 25/2 |
2026/08/21 02:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/tracefs/inode.c Name:trace_fs_type]
Results: map[SourceCode: 517: static struct file_system_type trace_fs_type = {
518: .owner = THIS_MODULE,
519: .name = "tracefs",
520: .init_fs_context = tracefs_init_fs_context,
521: .parameters = tracefs_param_specs,
522: .kill_sb = kill_anon_super,
523: };
SourceFile:fs/tracefs/inode.c]
|
| 26/2 |
2026/08/21 02:51 |
llm |
expert |
0m
Model:
Tokens:
input: 22177
output: 55
thoughts: 249
Thoughts: **My Analysis of Tracefs Vulnerability**
Okay, so I'm looking at this and it's clear the system *doesn't* have `FS_USERNS_MOUNT` set. That immediately flags something—mounting `tracefs` will require `CAP_SYS_ADMIN` in the initial user namespace. Now, hold on, if `tracefs` is *already* mounted by root, like it typically is at `/sys/kernel/tracing`, can a regular user actually create a directory within the `/sys/kernel/tracing/instances/` subdirectory? I should really check the permissions on that directory to be sure.
Right, `/sys/kernel/tracing/instances` is almost always owned by root, and the permissions are usually `drwxr-xr-x`. That means a non-privileged user generally *can't* create directories there. However, if some clever system administrator has tweaked those permissions or the ownership to allow a specific user or group to mess around with trace instances, then that user *could* potentially trigger this scenario. Interesting.
And then there's the reproducer. It's using `mkdirat` to create a cgroup and set memory limits. That also requires root privileges or the right cgroup delegation. But the core problem seems to be an actual memory allocation failure when `eventfs_create_events_dir` gets called. Now, I should probably check where exactly that's called because it happens when creating a new trace instance, right?
|
| 27/2 |
2026/08/21 02:51 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:fs/tracefs/event_inode.c IncludeSnippetLines:0 Name:eventfs_create_events_dir SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:create_event_toplevel_files SourceFile:kernel/trace/trace_events.c SourceLine:4593]] TruncatedOutput:false]
|
| 28/2 |
2026/08/21 02:51 |
llm |
expert |
0m
Model:
Tokens:
input: 22870
output: 41
thoughts: 14
Thoughts: Here's a summary of my thought process, as if I were the one thinking it:
**Checking `create_event_toplevel_files`**
Alright, time to dive into `create_event_toplevel_files`. I need to refresh my memory on what this function is actually doing. Is it still structured the way I expect, or has there been a modification I'm not aware of? I'll probably want to double-check its inputs and outputs, paying close attention to any edge cases that might have been recently introduced or updated. Specifically, I'm thinking about the way it handles concurrency, or any potential race conditions. Has the underlying file structure changed at all? I need to quickly run through the test suite associated with this function to confirm it is still functioning as expected. It's crucial to ensure this function is robust, particularly with event file creation being central to the current architecture. Let's start by quickly reviewing the code and then move on to those tests. Time to get to work.
|
| 29/2 |
2026/08/21 02:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/trace/trace_events.c Name:create_event_toplevel_files]
Results: map[SourceCode:4545: /* Expects to have event_mutex held when called */
4546: static int
4547: create_event_toplevel_files(struct dentry *parent, struct trace_array *tr)
4548: {
4549: struct eventfs_inode *e_events;
4550: struct dentry *entry;
4551: int nr_entries;
4552: static struct eventfs_entry events_entries[] = {
4553: {
4554: .name = "header_page",
4555: .callback = events_callback,
4556: },
4557: {
4558: .name = "header_event",
4559: .callback = events_callback,
4560: },
4561: #define NR_RO_TOP_ENTRIES 2
4562: /* Readonly files must be above this line and counted by NR_RO_TOP_ENTRIES. */
4563: {
4564: .name = "enable",
4565: .callback = events_callback,
4566: },
4567: };
4568:
4569: if (!trace_array_is_readonly(tr)) {
4570: entry = trace_create_file("set_event", TRACE_MODE_WRITE, parent,
4571: tr, &ftrace_set_event_fops);
4572: if (!entry)
4573: return -ENOMEM;
4574:
4575: /* There are not as crucial, just warn if they are not created */
4576: trace_create_file("show_event_filters", TRACE_MODE_READ, parent, tr,
4577: &ftrace_show_event_filters_fops);
4578:
4579: trace_create_file("show_event_triggers", TRACE_MODE_READ, parent, tr,
4580: &ftrace_show_event_triggers_fops);
4581:
4582: trace_create_file("set_event_pid", TRACE_MODE_WRITE, parent,
4583: tr, &ftrace_set_event_pid_fops);
4584:
4585: trace_create_file("set_event_notrace_pid",
4586: TRACE_MODE_WRITE, parent, tr,
4587: &ftrace_set_event_notrace_pid_fops);
4588: nr_entries = ARRAY_SIZE(events_entries);
4589: } else {
4590: nr_entries = NR_RO_TOP_ENTRIES;
4591: }
4592:
4593: e_events = eventfs_create_events_dir("events", parent, events_entries,
4594: nr_entries, tr);
4595: if (IS_ERR(e_events)) {
4596: pr_warn("Could not create tracefs 'events' directory\n");
4597: return -ENOMEM;
4598: }
4599:
4600: tr->event_dir = e_events;
4601:
4602: return 0;
4603: }
SourceFile:kernel/trace/trace_events.c]
|
| 30/2 |
2026/08/21 02:51 |
llm |
expert |
0m
Model:
Tokens:
input: 24070
output: 54
thoughts: 193
Thoughts: **My Assessment of the Tracefs Bug**
Okay, so I've been looking into this `eventfs_create_events_dir` issue. From what I can gather, this function is called when a new trace instance is created, which, in turn, is the act of creating that `events` directory. The wrinkle here is that creating a trace instance involves a `mkdir` operation within the `instances/` directory, and that, naturally, requires either root privileges or some specific delegation.
The root of the problem seems to be a `WARN_ON_ONCE` triggering on an uninitialized list head. Classic memory allocation failure scenario. However, the good news is that this doesn't appear to be critical in terms of traditional vulnerabilities. There's no risk of memory corruption, no risk of a system crash, and it doesn't even amount to a denial-of-service attack, other than the fact that there is a warning. It's not exploitable in any practical sense. Considering the setup required, it's also not accessible from unprivileged processes or user namespaces, since tracefs cannot be mounted within a user namespace, and the whole `instances/` directory is root-owned.
But, just to be absolutely certain, let's take another look at the call stack, to see if there's any other way that `eventfs_create_events_dir` is called. It looks like it's also triggered from `create_event_toplevel_files`, which itself is called from `event_trace_add_tracer`.
|
| 31/2 |
2026/08/21 02:51 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:kernel/trace/trace_events.c IncludeSnippetLines:0 Name:create_event_toplevel_files SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:early_event_add_tracer SourceFile:kernel/trace/trace_events.c SourceLine:4651] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:event_trace_add_tracer SourceFile:kernel/trace/trace_events.c SourceLine:4624]] TruncatedOutput:false]
|
| 32/2 |
2026/08/21 02:51 |
llm |
expert |
0m
Model:
Tokens:
input: 24774
output: 66
thoughts: 2936
Thoughts: **Analysis of the Tracefs Event Directory Creation Vulnerability**
Okay, let's break this down systematically. The core of the issue seems to be a `WARN_ON_ONCE` within the `free_ei` function. This function is triggered during a failure path when creating a trace instance's event directory, specifically in `eventfs_create_events_dir`. The problem stems from `tracefs_get_inode` failing, likely due to an `ENOMEM` (out-of-memory) condition.
My initial thought was the path of execution: `trace_array_create_dir` -> `trace_array_create_systems` -> `trace_array_create` -> `instance_mkdir`, which ultimately translates to a `mkdir` operation in the `instances/` directory. However, since `instances/` is root-owned, it requires root privileges. This means that a user doesn't have the ability to trigger the path. The eventfs related function call is only triggered by `create_event_toplevel_files`. Also, `tracefs` itself cannot be mounted in a user namespace because `FS_USERNS_MOUNT` is not set.
The `WARN_ON_ONCE` occurs because the `ei->children` list head isn't initialized before `cleanup_ei` is called and, subsequently, before `free_ei` is called. The warning checks if `list_empty(&ei->children)` is true, but in the failure path, this check *will* be true because `INIT_LIST_HEAD` hasn't been called.
I double-checked `free_ei`'s function to determine whether there is any other usage of the `ei->children` member. The code dereferences `ei->children` only when performing `list_empty`. Because `list_empty` just reads `head->next`, and `head->next` is NULL, and compares it to `head`. The uninitialized `ei->children` is just a `struct list_head`, which is two pointers. Since it was allocated with `kzalloc_obj`, it's all zeros. This means the pointer dereference is safe. Furthermore, the `ei` isn't accessible to SRCU readers because it's not yet linked into the trace instance's directory structure.
I looked at the code to determine whether the `eventfs_remove_rec` function could reach `ei->children`. This only happens to an `ei` that was successfully created, which *should* have had `ei->children` initialized. In the failure path, the code only calls `cleanup_ei`, which calls `free_ei`. Also, I tried to verify how a user can reach `tracefs_get_inode`, but because `tracefs` cannot be mounted by an unprivileged user, and `instances/` is root-owned, I determined that this is impossible.
Because I could not determine how an unprivileged user can trigger this code, the vulnerability is not exploitable and doesn't represent a denial-of-service risk, or any other type of attack vector. It is a benign, although undesirable, warning. So, everything is false: no exploit, no DoS, no unprivileged access, no user namespace access, etc. The code cleans up properly, and the only side effect is the warning itself.
|
| 33/2 |
2026/08/21 02:52 |
tool |
set-results |
0m
Args: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 34/2 |
2026/08/21 02:52 |
llm |
expert |
0m
Model:
Tokens:
input: 28554
output: 555
thoughts: 198
Thoughts: **My Assessment of the Tracefs Bug**
Okay, the analysis is done, time to put together the final report. Here's what I've found: we've got a `WARN_ON_ONCE` situation popping up in `free_ei()`. It's a classic case – the `ei->children` list head isn't being initialized correctly when `tracefs_get_inode()` fails, specifically because of a memory allocation issue. I suspect a cgroup memory limit is the culprit.
Now, the thing to remember is `ei->children` *should* be zeroed out with `kzalloc`, but we are seeing the warning. `list_empty()` is just checking `head->next == head`, and even though the list head is allocated, it is not initialized, so `head` is not `NULL`.
The good news is, from what I've seen, that uninitialized list head isn't actually *used* or dereferenced anywhere in the failure path. The memory is cleaned up properly. This is important.
So, while it's a bug that needs fixing, it doesn't appear exploitable. It won't cause a denial of service. The access constraints of this tracefs code are also encouraging. Since mounting tracefs and creating directories within `instances/` requires root privileges (`CAP_SYS_ADMIN`), and it's not accessible from unprivileged processes or user namespaces, the window for misuse is very, very small. It’s a minor issue.
|
| 35/1 |
2026/08/21 02:52 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the security impact:
**Bug Mechanism:**
The warning is triggered in `fs/tracefs/event_inode.c` at `free_ei()` when
checking `WARN_ON_ONCE(!list_empty(&ei->children))`.
During the creation of a new trace instance, `eventfs_create_events_dir()`
allocates a new root eventfs inode (`ei`) via `alloc_root_ei()`. This allocation
uses `kzalloc`, meaning the memory is zeroed out. The initialization of the
`ei->children` list head (`INIT_LIST_HEAD(&ei->children)`) is done later in the
function, *after* a call to `tracefs_get_inode()`.
If `tracefs_get_inode()` fails (e.g., due to an out-of-memory condition caused
by a cgroup memory limit, as seen in the reproducer), the code jumps to the
`fail` label and calls `cleanup_ei(ei)`. This eventually calls `free_ei(ei)`,
which checks if the `ei->children` list is empty.
Because the list head was never initialized and is still all zeros, `head->next`
is `NULL`. The `list_empty()` function checks if `head->next == head`. Since
`NULL` is not equal to the address of the list head, `list_empty()` returns
false, triggering the `WARN_ON_ONCE`.
**Exploitability & Impact:**
This is a harmless warning. The uninitialized list head is not dereferenced (no
NULL pointer dereference occurs because `list_empty` only reads the `next`
pointer). The `ei` structure is not yet linked into any global or parent data
structures, so no other threads or RCU readers can access it. After the warning,
the memory is properly freed via `call_srcu` and `kfree`. It does not cause
memory corruption, crashes, or denial of service.
**Accessibility:**
The bug is triggered by creating a new trace instance (creating a directory
inside the tracefs `instances/` directory).
- Tracefs does not have the `FS_USERNS_MOUNT` flag, meaning it cannot be mounted
from an unprivileged user namespace; it requires `CAP_SYS_ADMIN` in the initial
namespace.
- The `instances/` directory is owned by root and has restricted permissions, so
unprivileged users cannot create directories inside it.
Therefore, this bug cannot be reached by unprivileged processes or from within
user namespaces.]
|