| 0/0 |
2026/05/29 23:41 |
flow |
assessment-security |
54m
Results: map[DenialOfService:true Explanation:**Bug Analysis:**
The bug is a Use-After-Free (UAF) in the VFS path walk code when interacting
with the `bpf` pseudo-filesystem (`bpffs`).
The root cause is that `bpffs` frees its inodes immediately in
`bpf_destroy_inode` using `free_inode_nonrcu()`, without waiting for an RCU
grace period. However, `bpffs` supports symlinks, and the VFS path walk can
encounter these symlinks in RCU walk mode (`LOOKUP_RCU`).
If a symlink in `bpffs` is unlinked concurrently with an RCU path walk, the path
walk can access the freed `inode` and its `i_link` pointer in `pick_link()`
before the dentry sequence counter (`d_seq`) is re-checked. This leads to a UAF
read of the `inode` (specifically `inode->i_flags` via `IS_PRIVATE`) and the
`i_link` string.
**Exploitability:**
The UAF is primarily a read UAF. The path walk reads `inode->i_flags` and
`inode->i_link`. Since the inode is allocated from a dedicated slab cache
(`inode_cache`) with a constructor (`inode_init_once`), an attacker cannot use
generic heap spraying techniques (like `msg_msg` or `setxattr`) to overwrite the
freed object with arbitrary data. The object can only be reallocated as another
`struct inode`, which will be safely initialized by the kernel.
This prevents forging `inode->i_op` or `inode->i_link` to hijack control flow.
The worst-case scenario is a NULL pointer dereference (e.g., if the inode is
reallocated as a regular file with no `get_link` operation) or an out-of-bounds
read of the freed string, both of which result in a Denial of Service (DoS) but
not privilege escalation.
**Accessibility:**
The bug is **not accessible to unprivileged users**.
1. The `bpf` filesystem cannot be mounted by unprivileged users, even within a
user namespace. The `bpf_fill_super` function explicitly requires
`CAP_SYS_ADMIN` in the initial user namespace (`init_user_ns`).
2. The default mount of `bpffs` at `/sys/fs/bpf` (e.g., by systemd) has `0700`
permissions, restricting access strictly to root.
Therefore, unprivileged users cannot create or unlink symlinks in `bpffs` to
trigger the race condition.
**Conclusion:**
The bug is a Denial of Service (DoS) vulnerability that is only reachable by
privileged users (root). It is not exploitable for privilege escalation and
cannot be triggered by unprivileged users, user namespaces, or remote/peripheral
vectors. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/05/29 23:41 |
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 <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef __NR_bpf
#define __NR_bpf 321
#endif
#ifndef __NR_execveat
#define __NR_execveat 322
#endif
#ifndef __NR_fsconfig
#define __NR_fsconfig 431
#endif
#ifndef __NR_fsmount
#define __NR_fsmount 432
#endif
#ifndef __NR_fsopen
#define __NR_fsopen 430
#endif
#define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
#define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))
static long syz_open_procfs(volatile long a0, volatile long a1)
{
char buf[128];
memset(buf, 0, sizeof(buf));
if (a0 == 0) {
snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1);
} else if (a0 == -1) {
snprintf(buf, sizeof(buf), "/proc/thread-self/%s", (char*)a1);
} else {
snprintf(buf, sizeof(buf), "/proc/self/task/%d/%s", (int)a0, (char*)a1);
}
int fd = open(buf, O_RDWR);
if (fd == -1)
fd = open(buf, O_RDONLY);
return fd;
}
uint64_t r[6] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// syz_open_procfs$namespace arguments: [
// pid: pid (resource)
// file: ptr[in, buffer] {
// buffer: {6e 73 2f 70 69 64 5f 66 6f 72 5f 63 68 69 6c 64 72 65 6e 00} (length 0x14)
// }
// ]
// returns fd_namespace
memcpy((void*)0x200000000300, "ns/pid_for_children\000", 20);
syz_open_procfs(/*pid=*/-1, /*file=*/0x200000000300);
// syz_open_procfs$namespace arguments: [
// pid: pid (resource)
// file: ptr[in, buffer] {
// buffer: {6e 73 2f 70 69 64 5f 66 6f 72 5f 63 68 69 6c 64 72 65 6e 00} (length 0x14)
// }
// ]
// returns fd_namespace
memcpy((void*)0x200000000300, "ns/pid_for_children\000", 20);
res = -1;
res = syz_open_procfs(/*pid=*/-1, /*file=*/0x200000000300);
if (res != -1)
r[0] = res;
// ioctl$SIOCSIFHWADDR arguments: [
// fd: fd_tun (resource)
// cmd: const = 0x8914 (4 bytes)
// arg: nil
// ]
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x8914, /*arg=*/0ul);
// bpf$MAP_UPDATE_ELEM_TAIL_CALL arguments: [
// cmd: const = 0x2 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0ul, /*size=*/0ul);
// ioctl$sock_ipv6_tunnel_SIOCGETTUNNEL arguments: [
// fd: sock_udp6 (resource)
// cmd: const = 0x89f0 (4 bytes)
// arg: ptr[inout, ifreq_dev_t[ipv6_tunnel_names, ptr[inout, ip6_tnl_parm2]]] {
// ifreq_dev_t[ipv6_tunnel_names, ptr[inout, ip6_tnl_parm2]] {
// ifr_ifrn: buffer: {69 70 36 74 6e 6c 30 00 00 00 00 00 00 00 00 00} (length 0x10)
// elem: nil
// pad = 0x0 (16 bytes)
// }
// }
// ]
memcpy((void*)0x200000000400, "ip6tnl0\000\000\000\000\000\000\000\000\000", 16);
*(uint64_t*)0x200000000410 = 0;
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x89f0, /*arg=*/0x200000000400ul);
// fsopen arguments: [
// type: ptr[in, buffer] {
// buffer: {62 70 66 00} (length 0x4)
// }
// flags: fsopen_flags = 0x0 (8 bytes)
// ]
// returns fd_fscontext
memcpy((void*)0x200000000100, "bpf\000", 4);
res = syscall(__NR_fsopen, /*type=*/0x200000000100ul, /*flags=*/0ul);
if (res != -1)
r[1] = res;
// 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[1], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*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[1], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*aux=*/0ul);
// fsmount arguments: [
// fs_fd: fd_fscontext (resource)
// flags: fsmount_flags = 0x0 (8 bytes)
// attr_flags: fsmount_attr_flags = 0x0 (8 bytes)
// ]
// returns fd
res = syscall(__NR_fsmount, /*fs_fd=*/r[1], /*flags=*/0ul, /*attr_flags=*/0ul);
if (res != -1)
r[2] = res;
// symlinkat arguments: [
// old: ptr[in, buffer] {
// buffer: {2e 00} (length 0x2)
// }
// newfd: fd_dir (resource)
// new: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8)
// }
// ]
memcpy((void*)0x200000000000, ".\000", 2);
memcpy((void*)0x200000000140, "./file0\000", 8);
syscall(__NR_symlinkat, /*old=*/0x200000000000ul, /*newfd=*/r[2], /*new=*/0x200000000140ul);
// unlinkat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 2f 2e 2e 2f 66 69 6c 65 30 2f 66 69 6c 65 30 00} (length 0x17)
// }
// flags: unlinkat_flags = 0x0 (8 bytes)
// ]
memcpy((void*)0x2000000001c0, "./file0/../file0/file0\000", 23);
syscall(__NR_unlinkat, /*fd=*/r[2], /*path=*/0x2000000001c0ul, /*flags=*/0ul);
// unlinkat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 2f 2e 2e 2f 66 69 6c 65 30 2f 66 69 6c 65 30 00} (length 0x17)
// }
// flags: unlinkat_flags = 0x0 (8 bytes)
// ]
memcpy((void*)0x2000000001c0, "./file0/../file0/file0\000", 23);
syscall(__NR_unlinkat, /*fd=*/r[2], /*path=*/0x2000000001c0ul, /*flags=*/0ul);
// bpf$MAP_LOOKUP_ELEM arguments: [
// cmd: const = 0x1 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_bpf, /*cmd=*/1ul, /*arg=*/0ul, /*size=*/0ul);
// bpf$MAP_UPDATE_CONST_STR arguments: [
// cmd: const = 0x2 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0ul, /*size=*/0ul);
// bpf$OBJ_GET_MAP arguments: [
// cmd: const = 0x7 (8 bytes)
// arg: ptr[in, bpf_obj_get] {
// union bpf_obj_get {
// o_path: bpf_obj_get_o_path {
// path: nil
// fd: const = 0x0 (4 bytes)
// file_flags: bpf_obj_get_flags = 0x10 (4 bytes)
// path_fd: fd (resource)
// pad = 0x0 (4 bytes)
// }
// }
// }
// size: len = 0x18 (8 bytes)
// ]
// returns fd_bpf_map
*(uint64_t*)0x200000000800 = 0;
*(uint32_t*)0x200000000808 = 0;
*(uint32_t*)0x20000000080c = 0x10;
*(uint32_t*)0x200000000810 = r[0];
res = syscall(__NR_bpf, /*cmd=*/7ul, /*arg=*/0x200000000800ul, /*size=*/0x18ul);
if (res != -1)
r[3] = res;
// bpf$MAP_CREATE_CONST_STR arguments: [
// cmd: const = 0x0 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
// returns fd_bpf_const_str_map
syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0ul, /*size=*/0ul);
// openat$cgroup_ro arguments: [
// fd: fd_cgroup (resource)
// file: ptr[in, buffer] {
// buffer: {62 6c 6b 69 6f 2e 62 66 71 2e 69 6f 5f 77 61 69 74 5f 74 69 6d 65 00} (length 0x17)
// }
// flags: const = 0x275a (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000200, "blkio.bfq.io_wait_time\000", 23);
syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000200ul, /*flags=*/0x275a, /*mode=*/0);
// fsopen arguments: [
// type: ptr[in, buffer] {
// buffer: {72 61 6d 66 73 00} (length 0x6)
// }
// flags: fsopen_flags = 0x0 (8 bytes)
// ]
// returns fd_fscontext
memcpy((void*)0x200000000100, "ramfs\000", 6);
res = syscall(__NR_fsopen, /*type=*/0x200000000100ul, /*flags=*/0ul);
if (res != -1)
r[4] = res;
// fsmount arguments: [
// fs_fd: fd_fscontext (resource)
// flags: fsmount_flags = 0x0 (8 bytes)
// attr_flags: fsmount_attr_flags = 0x0 (8 bytes)
// ]
// returns fd
res = syscall(__NR_fsmount, /*fs_fd=*/r[4], /*flags=*/0ul, /*attr_flags=*/0ul);
if (res != -1)
r[5] = res;
// execveat$binfmt arguments: [
// dirfd: fd_dir (resource)
// file: ptr_binfmt_file (resource)
// argv: nil
// envp: nil
// flags: at_flags = 0x0 (8 bytes)
// ]
syscall(__NR_execveat, /*dirfd=*/r[5], /*file=*/0ul, /*argv=*/0ul, /*envp=*/0ul, /*flags=*/0ul);
// bpf$BPF_PROG_WITH_BTFID_LOAD arguments: [
// cmd: const = 0x5 (8 bytes)
// arg: ptr[in, bpf_prog_with_btfid] {
// union bpf_prog_with_btfid {
// bpf_tracing: bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], fd_bpf_prog[opt]] {
// type: const = 0x1a (4 bytes)
// ninsn: bytesize8 = 0x29 (4 bytes)
// insns: ptr[in, bpf_instructions] {
// union bpf_instructions {
// raw: array[bpf_insn] {
// union bpf_insn {
// tail_call: bpf_insn_tail_call {
// insn1: bpf_insn_map_fd_t[const[BPF_REG_2, int8:4], tail_call_map] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x1 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: tail_call_map (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_3, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn3: bpf_insn_call_helper_t[const[BPF_FUNC_tail_call, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0xc (4 bytes)
// }
// insn4: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_0, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x0 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// }
// }
// union bpf_insn {
// alu: bpf_insn_alu_t[bpf_alu_insn, bpf_alu_source, bpf_alu_op, flags[bpf_reg, int8:4], flags[bpf_reg, int8:4], flags[bpf_insn_offsets, int16], flags[bpf_insn_immediates, int32]] {
// code_class: bpf_alu_insn = 0x4 (0 bytes)
// code_s: bpf_alu_source = 0x0 (0 bytes)
// code_op: bpf_alu_op = 0x4 (1 bytes)
// dst: bpf_reg = 0x6 (0 bytes)
// src: bpf_reg = 0x1 (1 bytes)
// off: bpf_insn_offsets = 0x1 (2 bytes)
// imm: bpf_insn_immediates = 0x4 (4 bytes)
// }
// }
// union bpf_insn {
// initr0: bpf_insn_init_r0 {
// code: const = 0x18 (1 bytes)
// dst: const = 0x0 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x10000 (4 bytes)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: int32 = 0x80000001 (4 bytes)
// }
// }
// union bpf_insn {
// map_idx_val: bpf_insn_map_idx_value {
// code: const = 0x18 (1 bytes)
// dst: bpf_reg = 0x2 (0 bytes)
// src: const = 0x6 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x7 (4 bytes)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: int32 = 0x29 (4 bytes)
// }
// }
// union bpf_insn {
// snprintf: bpf_insn_snprintf {
// insn1: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_8, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x8 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], const[-8, int16], const[0, int32]] {
// code_class: int8 = 0x3 (0 bytes)
// code_size: int8 = 0x3 (0 bytes)
// code_mode: int8 = 0x3 (1 bytes)
// dst: const = 0xa (0 bytes)
// src: const = 0x8 (1 bytes)
// off: const = 0xfff8 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn3: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_8, int8:4], const[0, int8:4], const[0, int16], int32] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x8 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x0 (4 bytes)
// }
// insn4: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], const[-16, int16], const[0, int32]] {
// code_class: int8 = 0x3 (0 bytes)
// code_size: int8 = 0x3 (0 bytes)
// code_mode: int8 = 0x3 (1 bytes)
// dst: const = 0xa (0 bytes)
// src: const = 0x8 (1 bytes)
// off: const = 0xfff0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn5: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, const[BPF_REG_1, int8:4], const[BPF_REG_10, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x1 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x1 (0 bytes)
// src: const = 0xa (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn6: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, const[BPF_REG_1, int8:4], const[0, int8:4], const[0, int16], const[-8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0x0 (1 bytes)
// dst: const = 0x1 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0xfffffff8 (4 bytes)
// }
// insn7: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, const[BPF_REG_4, int8:4], const[BPF_REG_10, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x1 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x4 (0 bytes)
// src: const = 0xa (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn8: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, const[BPF_REG_4, int8:4], const[0, int8:4], const[0, int16], const[-16, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0x0 (1 bytes)
// dst: const = 0x4 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0xfffffff0 (4 bytes)
// }
// insn9: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_2, int8:4], const[0, int8:4], const[0, int16], const[8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x8 (4 bytes)
// }
// insn10: bpf_insn_map_value_t[const[BPF_REG_3, int8:4], bpf_frozen_const_str, const[0, int32]] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x2 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: bpf_frozen_const_str (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn11: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_5, int8:4], const[0, int8:4], const[0, int16], const[8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x5 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x8 (4 bytes)
// }
// insn12: bpf_insn_call_helper_t[const[BPF_FUNC_snprintf, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0xa5 (4 bytes)
// }
// }
// }
// union bpf_insn {
// exit: bpf_insn_exit {
// code: const = 0x95 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// }
// union bpf_insn {
// map_idx_val: bpf_insn_map_idx_value {
// code: const = 0x18 (1 bytes)
// dst: bpf_reg = 0x2 (0 bytes)
// src: const = 0x6 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x8 (4 bytes)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: int32 = 0xf (4 bytes)
// }
// }
// union bpf_insn {
// tail_call: bpf_insn_tail_call {
// insn1: bpf_insn_map_fd_t[const[BPF_REG_2, int8:4], tail_call_map] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x1 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: tail_call_map (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_3, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn3: bpf_insn_call_helper_t[const[BPF_FUNC_tail_call, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0xc (4 bytes)
// }
// insn4: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_0, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x0 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// }
// }
// union bpf_insn {
// generic: bpf_insn_generic {
// code: int8 = 0xe8 (1 bytes)
// dst: int8 = 0x2 (0 bytes)
// src: int8 = 0x0 (1 bytes)
// off: int16 = 0x5 (2 bytes)
// imm: int32 = 0x1ce (4 bytes)
// }
// }
// union bpf_insn {
// ringbuf_output: bpf_insn_ringbuf_output {
// insn1: bpf_insn_map_fd_t[const[BPF_REG_1, int8:4], tail_call_map] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x1 (0 bytes)
// src: const = 0x1 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: tail_call_map (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_8, int8:4], const[0, int8:4], const[0, int16], int32] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x8 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x2 (4 bytes)
// }
// insn3: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], const[-8, int16], const[0, int32]] {
// code_class: int8 = 0x3 (0 bytes)
// code_size: int8 = 0x3 (0 bytes)
// code_mode: int8 = 0x3 (1 bytes)
// dst: const = 0xa (0 bytes)
// src: const = 0x8 (1 bytes)
// off: const = 0xfff8 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn4: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, const[BPF_REG_2, int8:4], const[BPF_REG_10, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x1 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0xa (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn5: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, const[BPF_REG_2, int8:4], const[0, int8:4], const[0, int16], const[-8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0x0 (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0xfffffff8 (4 bytes)
// }
// insn6: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_3, int8:4], const[0, int8:4], const[0, int16], const[8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x8 (4 bytes)
// }
// insn7: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_4, int8:4], const[0, int8:4], const[0, int16], flags[bpf_ringbuf_wakeup_flags, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x4 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: bpf_ringbuf_wakeup_flags = 0x2 (4 bytes)
// }
// insn8: bpf_insn_call_helper_t[const[BPF_FUNC_ringbuf_output, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0x82 (4 bytes)
// }
// }
// }
// }
// }
// }
// license: ptr[in, buffer] {
// buffer: {73 79 7a 6b 61 6c 6c 65 72 00} (length 0xa)
// }
// loglev: int32 = 0x81 (4 bytes)
// logsize: len = 0x0 (4 bytes)
// log: nil
// kern_version: bpf_kern_version = 0x41000 (4 bytes)
// flags: bpf_prog_load_flags = 0x1e (4 bytes)
// prog_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// prog_ifindex: ifindex (resource)
// expected_attach_type: bpf_tracing_attach_types = 0x1c (4 bytes)
// btf_fd: fd_btf (resource)
// func_info_rec_size: const = 0x8 (4 bytes)
// func_info: ptr[in, bpf_func_info] {
// bpf_func_info {
// insn_off: int32 = 0x4 (4 bytes)
// type_id: int32 = 0x2 (4 bytes)
// }
// }
// func_info_cnt: len = 0x8 (4 bytes)
// line_info_rec_size: const = 0x10 (4 bytes)
// line_info: ptr[in, bpf_line_info] {
// bpf_line_info {
// insn_off: int32 = 0x2 (4 bytes)
// file_name_off: int32 = 0x10 (4 bytes)
// line_off: int32 = 0x1 (4 bytes)
// line_col: int32 = 0x45 (4 bytes)
// }
// }
// line_info_cnt: len = 0x10 (4 bytes)
// attach_btf_id: int32 = 0xbf70 (4 bytes)
// attach_prog_fd: fd_bpf_prog (resource)
// core_relo_cnt: len = 0x1 (4 bytes)
// fd_array: ptr[in, array[fd_bpf_map]] {
// array[fd_bpf_map] {
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// }
// }
// core_relos: ptr[in, array[bpf_core_relo]] {
// array[bpf_core_relo] {
// bpf_core_relo {
// insn_off: int32 = 0x5 (4 bytes)
// type_id: int32 = 0x5 (4 bytes)
// access_str_off: int32 = 0x8 (4 bytes)
// kind: bpf_core_relo_kind = 0x7 (4 bytes)
// }
// }
// }
// core_relo_rec_size: const = 0x10 (4 bytes)
// log_true_size: int32 = 0x2 (4 bytes)
// prog_token_fd: union _bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], fd_bpf_prog[opt]]_prog_token_fd_wrapper {
// void: buffer: {} (length 0x0)
// }
// pad: union _bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], fd_bpf_prog[opt]]_pad_wrapper {
// value: const = 0x0 (4 bytes)
// }
// }
// }
// }
// size: len = 0x94 (8 bytes)
// ]
// returns fd_bpf_prog_with_btfid
*(uint32_t*)0x200000000a40 = 0x1a;
*(uint32_t*)0x200000000a44 = 0x29;
*(uint64_t*)0x200000000a48 = 0x200000000180;
*(uint8_t*)0x200000000180 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000181, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000181, 1, 4, 4);
*(uint16_t*)0x200000000182 = 0;
*(uint32_t*)0x200000000184 = -1;
*(uint8_t*)0x200000000188 = 0;
*(uint8_t*)0x200000000189 = 0;
*(uint16_t*)0x20000000018a = 0;
*(uint32_t*)0x20000000018c = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000190, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000190, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000190, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000191, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000191, 0, 4, 4);
*(uint16_t*)0x200000000192 = 0;
*(uint32_t*)0x200000000194 = 0;
*(uint8_t*)0x200000000198 = 0x85;
*(uint8_t*)0x200000000199 = 0;
*(uint16_t*)0x20000000019a = 0;
*(uint32_t*)0x20000000019c = 0xc;
STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a1, 0, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a1, 0, 4, 4);
*(uint16_t*)0x2000000001a2 = 0;
*(uint32_t*)0x2000000001a4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 4, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 4, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a9, 6, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a9, 1, 4, 4);
*(uint16_t*)0x2000000001aa = 1;
*(uint32_t*)0x2000000001ac = 4;
*(uint8_t*)0x2000000001b0 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x2000000001b1, 0, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001b1, 0, 4, 4);
*(uint16_t*)0x2000000001b2 = 0;
*(uint32_t*)0x2000000001b4 = 0x10000;
*(uint8_t*)0x2000000001b8 = 0;
*(uint8_t*)0x2000000001b9 = 0;
*(uint16_t*)0x2000000001ba = 0;
*(uint32_t*)0x2000000001bc = 0x80000001;
*(uint8_t*)0x2000000001c0 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x2000000001c1, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001c1, 6, 4, 4);
*(uint16_t*)0x2000000001c2 = 0;
*(uint32_t*)0x2000000001c4 = 7;
*(uint8_t*)0x2000000001c8 = 0;
*(uint8_t*)0x2000000001c9 = 0;
*(uint16_t*)0x2000000001ca = 0;
*(uint32_t*)0x2000000001cc = 0x29;
STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d1, 8, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d1, 0, 4, 4);
*(uint16_t*)0x2000000001d2 = 0;
*(uint32_t*)0x2000000001d4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 3, 2);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 5, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d9, 0xa, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d9, 8, 4, 4);
*(uint16_t*)0x2000000001da = 0xfff8;
*(uint32_t*)0x2000000001dc = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e1, 8, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e1, 0, 4, 4);
*(uint16_t*)0x2000000001e2 = 0;
*(uint32_t*)0x2000000001e4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 3, 2);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 5, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e9, 0xa, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e9, 8, 4, 4);
*(uint16_t*)0x2000000001ea = 0xfff0;
*(uint32_t*)0x2000000001ec = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 1, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f1, 1, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f1, 0xa, 4, 4);
*(uint16_t*)0x2000000001f2 = 0;
*(uint32_t*)0x2000000001f4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 0, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f9, 1, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f9, 0, 4, 4);
*(uint16_t*)0x2000000001fa = 0;
*(uint32_t*)0x2000000001fc = 0xfffffff8;
STORE_BY_BITMASK(uint8_t, , 0x200000000200, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000200, 1, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000200, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000201, 4, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000201, 0xa, 4, 4);
*(uint16_t*)0x200000000202 = 0;
*(uint32_t*)0x200000000204 = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000208, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000208, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000208, 0, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000209, 4, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000209, 0, 4, 4);
*(uint16_t*)0x20000000020a = 0;
*(uint32_t*)0x20000000020c = 0xfffffff0;
STORE_BY_BITMASK(uint8_t, , 0x200000000210, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000210, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000210, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000211, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000211, 0, 4, 4);
*(uint16_t*)0x200000000212 = 0;
*(uint32_t*)0x200000000214 = 8;
*(uint8_t*)0x200000000218 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000219, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000219, 2, 4, 4);
*(uint16_t*)0x20000000021a = 0;
*(uint32_t*)0x20000000021c = -1;
*(uint8_t*)0x200000000220 = 0;
*(uint8_t*)0x200000000221 = 0;
*(uint16_t*)0x200000000222 = 0;
*(uint32_t*)0x200000000224 = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000228, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000228, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000228, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000229, 5, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000229, 0, 4, 4);
*(uint16_t*)0x20000000022a = 0;
*(uint32_t*)0x20000000022c = 8;
*(uint8_t*)0x200000000230 = 0x85;
*(uint8_t*)0x200000000231 = 0;
*(uint16_t*)0x200000000232 = 0;
*(uint32_t*)0x200000000234 = 0xa5;
*(uint8_t*)0x200000000238 = 0x95;
*(uint8_t*)0x200000000239 = 0;
*(uint16_t*)0x20000000023a = 0;
*(uint32_t*)0x20000000023c = 0;
*(uint8_t*)0x200000000240 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000241, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000241, 6, 4, 4);
*(uint16_t*)0x200000000242 = 0;
*(uint32_t*)0x200000000244 = 8;
*(uint8_t*)0x200000000248 = 0;
*(uint8_t*)0x200000000249 = 0;
*(uint16_t*)0x20000000024a = 0;
*(uint32_t*)0x20000000024c = 0xf;
*(uint8_t*)0x200000000250 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000251, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000251, 1, 4, 4);
*(uint16_t*)0x200000000252 = 0;
*(uint32_t*)0x200000000254 = -1;
*(uint8_t*)0x200000000258 = 0;
*(uint8_t*)0x200000000259 = 0;
*(uint16_t*)0x20000000025a = 0;
*(uint32_t*)0x20000000025c = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000260, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000260, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000260, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000261, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000261, 0, 4, 4);
*(uint16_t*)0x200000000262 = 0;
*(uint32_t*)0x200000000264 = 0;
*(uint8_t*)0x200000000268 = 0x85;
*(uint8_t*)0x200000000269 = 0;
*(uint16_t*)0x20000000026a = 0;
*(uint32_t*)0x20000000026c = 0xc;
STORE_BY_BITMASK(uint8_t, , 0x200000000270, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000270, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000270, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000271, 0, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000271, 0, 4, 4);
*(uint16_t*)0x200000000272 = 0;
*(uint32_t*)0x200000000274 = 0;
*(uint8_t*)0x200000000278 = 0xe8;
STORE_BY_BITMASK(uint8_t, , 0x200000000279, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000279, 0, 4, 4);
*(uint16_t*)0x20000000027a = 5;
*(uint32_t*)0x20000000027c = 0x1ce;
*(uint8_t*)0x200000000280 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000281, 1, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000281, 1, 4, 4);
*(uint16_t*)0x200000000282 = 0;
*(uint32_t*)0x200000000284 = -1;
*(uint8_t*)0x200000000288 = 0;
*(uint8_t*)0x200000000289 = 0;
*(uint16_t*)0x20000000028a = 0;
*(uint32_t*)0x20000000028c = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000290, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000290, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000290, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000291, 8, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000291, 0, 4, 4);
*(uint16_t*)0x200000000292 = 0;
*(uint32_t*)0x200000000294 = 2;
STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 3, 2);
STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 5, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000299, 0xa, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000299, 8, 4, 4);
*(uint16_t*)0x20000000029a = 0xfff8;
*(uint32_t*)0x20000000029c = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 1, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a1, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a1, 0xa, 4, 4);
*(uint16_t*)0x2000000002a2 = 0;
*(uint32_t*)0x2000000002a4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 0, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a9, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a9, 0, 4, 4);
*(uint16_t*)0x2000000002aa = 0;
*(uint32_t*)0x2000000002ac = 0xfffffff8;
STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b1, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b1, 0, 4, 4);
*(uint16_t*)0x2000000002b2 = 0;
*(uint32_t*)0x2000000002b4 = 8;
STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b9, 4, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b9, 0, 4, 4);
*(uint16_t*)0x2000000002ba = 0;
*(uint32_t*)0x2000000002bc = 2;
*(uint8_t*)0x2000000002c0 = 0x85;
*(uint8_t*)0x2000000002c1 = 0;
*(uint16_t*)0x2000000002c2 = 0;
*(uint32_t*)0x2000000002c4 = 0x82;
*(uint64_t*)0x200000000a50 = 0x200000000340;
memcpy((void*)0x200000000340, "syzkaller\000", 10);
*(uint32_t*)0x200000000a58 = 0x81;
*(uint32_t*)0x200000000a5c = 0;
*(uint64_t*)0x200000000a60 = 0;
*(uint32_t*)0x200000000a68 = 0x41000;
*(uint32_t*)0x200000000a6c = 0x1e;
memset((void*)0x200000000a70, 0, 16);
*(uint32_t*)0x200000000a80 = 0;
*(uint32_t*)0x200000000a84 = 0x1c;
*(uint32_t*)0x200000000a88 = -1;
*(uint32_t*)0x200000000a8c = 8;
*(uint64_t*)0x200000000a90 = 0x200000000600;
*(uint32_t*)0x200000000600 = 4;
*(uint32_t*)0x200000000604 = 2;
*(uint32_t*)0x200000000a98 = 8;
*(uint32_t*)0x200000000a9c = 0x10;
*(uint64_t*)0x200000000aa0 = 0x200000000640;
*(uint32_t*)0x200000000640 = 2;
*(uint32_t*)0x200000000644 = 0x10;
*(uint32_t*)0x200000000648 = 1;
*(uint32_t*)0x20000000064c = 0x45;
*(uint32_t*)0x200000000aa8 = 0x10;
*(uint32_t*)0x200000000aac = 0xbf70;
*(uint32_t*)0x200000000ab0 = -1;
*(uint32_t*)0x200000000ab4 = 1;
*(uint64_t*)0x200000000ab8 = 0x2000000009c0;
*(uint32_t*)0x2000000009c0 = r[2];
*(uint32_t*)0x2000000009c4 = -1;
*(uint32_t*)0x2000000009c8 = -1;
*(uint32_t*)0x2000000009cc = r[3];
*(uint32_t*)0x2000000009d0 = -1;
*(uint32_t*)0x2000000009d4 = -1;
*(uint32_t*)0x2000000009d8 = -1;
*(uint32_t*)0x2000000009dc = r[5];
*(uint32_t*)0x2000000009e0 = -1;
*(uint64_t*)0x200000000ac0 = 0x200000000a00;
*(uint32_t*)0x200000000a00 = 5;
*(uint32_t*)0x200000000a04 = 5;
*(uint32_t*)0x200000000a08 = 8;
*(uint32_t*)0x200000000a0c = 7;
*(uint32_t*)0x200000000ac8 = 0x10;
*(uint32_t*)0x200000000acc = 2;
*(uint32_t*)0x200000000ad0 = 0;
syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000a40ul, /*size=*/0x94ul);
return 0;
}
]
|
| 2/1 |
2026/05/29 23:41 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/0a2d2406965b48ddaf344179001bc441683a7b09]
|
| 3/1 |
2026/05/29 23:41 |
action |
kernel-builder |
25m
Results: map[KernelObj:/app/workdir/cache/build/be826b089f6577c98ad5aaefb462cfea1357c22a]
|
| 4/1 |
2026/05/30 00:06 |
action |
codesearch-prepare |
22m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/05/30 00:28 |
agent |
expert |
6m
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 or elevated privileges.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a 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.
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:
==================================================================
BUG: KASAN: slab-use-after-free in security_inode_follow_link+0x277/0x280 security/security.c:1819
Read of size 4 at addr ffff8880393e0004 by task syz.0.594/8610
CPU: 3 UID: 0 PID: 8610 Comm: syz.0.594 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
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x13d/0x4b0 mm/kasan/report.c:482
kasan_report+0xdf/0x1d0 mm/kasan/report.c:595
security_inode_follow_link+0x277/0x280 security/security.c:1819
pick_link+0x433/0x13c0 fs/namei.c:2049
step_into_slowpath+0x9ba/0xf90 fs/namei.c:2123
step_into fs/namei.c:2148 [inline]
walk_component fs/namei.c:2284 [inline]
link_path_walk+0xf28/0x1cc0 fs/namei.c:2652
path_parentat fs/namei.c:2856 [inline]
__filename_parentat+0x213/0x740 fs/namei.c:2880
filename_parentat fs/namei.c:2898 [inline]
filename_unlinkat+0xf7/0x730 fs/namei.c:5537
__do_sys_unlinkat fs/namei.c:5597 [inline]
__se_sys_unlinkat fs/namei.c:5589 [inline]
__x64_sys_unlinkat+0xc0/0x130 fs/namei.c:5589
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f60b0f9ce59
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:00007f60b1dc9028 EFLAGS: 00000246 ORIG_RAX: 0000000000000107
RAX: ffffffffffffffda RBX: 00007f60b1215fa0 RCX: 00007f60b0f9ce59
RDX: 0000000000000000 RSI: 00002000000001c0 RDI: 0000000000000006
RBP: 00007f60b1032d6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f60b1216038 R14: 00007f60b1215fa0 R15: 00007ffddfc81a28
</TASK>
Allocated by task 8610:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
unpoison_slab_object mm/kasan/common.c:340 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:366
kasan_slab_alloc include/linux/kasan.h:253 [inline]
slab_post_alloc_hook mm/slub.c:4570 [inline]
slab_alloc_node mm/slub.c:4899 [inline]
kmem_cache_alloc_lru_noprof+0x246/0x6e0 mm/slub.c:4918
alloc_inode+0x183/0x250 fs/inode.c:347
new_inode+0x22/0x1c0 fs/inode.c:1179
bpf_get_inode kernel/bpf/inode.c:117 [inline]
bpf_get_inode kernel/bpf/inode.c:102 [inline]
bpf_symlink+0x69/0x240 kernel/bpf/inode.c:391
vfs_symlink fs/namei.c:5643 [inline]
vfs_symlink+0x178/0x4d0 fs/namei.c:5622
filename_symlinkat+0x2a6/0x560 fs/namei.c:5668
__do_sys_symlinkat fs/namei.c:5688 [inline]
__se_sys_symlinkat fs/namei.c:5683 [inline]
__x64_sys_symlinkat+0x9c/0xe0 fs/namei.c:5683
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 8611:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:253 [inline]
__kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2689 [inline]
slab_free mm/slub.c:6251 [inline]
kmem_cache_free+0x127/0x6c0 mm/slub.c:6378
destroy_inode+0xcb/0x1c0 fs/inode.c:394
evict+0x599/0xad0 fs/inode.c:865
iput_final fs/inode.c:1960 [inline]
iput.part.0+0x605/0xf50 fs/inode.c:2009
iput+0x35/0x40 fs/inode.c:1975
filename_unlinkat+0x466/0x730 fs/namei.c:5572
__do_sys_unlinkat fs/namei.c:5597 [inline]
__se_sys_unlinkat fs/namei.c:5589 [inline]
__x64_sys_unlinkat+0xc0/0x130 fs/namei.c:5589
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff8880393e0000
which belongs to the cache inode_cache of size 1088
The buggy address is located 4 bytes inside of
freed 1088-byte region [ffff8880393e0000, ffff8880393e0440)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x393e0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff88803ce9f201
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff888100090000 dead000000000100 dead000000000122
raw: 0000000000000000 00000008001a001a 00000000f5000000 ffff88803ce9f201
head: 00fff00000000040 ffff888100090000 dead000000000100 dead000000000122
head: 0000000000000000 00000008001a001a 00000000f5000000 ffff88803ce9f201
head: 00fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_RECLAIMABLE|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5753, tgid 5753 (syz-execprog), ts 103858448509, free_ts 0
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1853
prep_new_page mm/page_alloc.c:1861 [inline]
get_page_from_freelist+0x11a6/0x3410 mm/page_alloc.c:3941
__alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5221
alloc_slab_page mm/slub.c:3278 [inline]
allocate_slab mm/slub.c:3467 [inline]
new_slab+0xa6/0x6c0 mm/slub.c:3525
refill_objects+0x277/0x420 mm/slub.c:7272
refill_sheaf mm/slub.c:2816 [inline]
__pcs_replace_empty_main+0x375/0x650 mm/slub.c:4652
alloc_from_pcs mm/slub.c:4750 [inline]
slab_alloc_node mm/slub.c:4884 [inline]
kmem_cache_alloc_lru_noprof+0x485/0x6e0 mm/slub.c:4918
alloc_inode+0x183/0x250 fs/inode.c:347
iget_locked+0x1d9/0x6d0 fs/inode.c:1474
kernfs_get_inode+0x46/0x470 fs/kernfs/inode.c:252
kernfs_iop_lookup+0x1a7/0x2d0 fs/kernfs/dir.c:1274
lookup_open.isra.0+0x631/0x11b0 fs/namei.c:4484
open_last_lookups fs/namei.c:4611 [inline]
path_openat+0xa98/0x31a0 fs/namei.c:4855
do_file_open+0x20e/0x430 fs/namei.c:4887
do_sys_openat2+0x10d/0x1e0 fs/open.c:1364
do_sys_open fs/open.c:1370 [inline]
__do_sys_openat fs/open.c:1386 [inline]
__se_sys_openat fs/open.c:1381 [inline]
__x64_sys_openat+0x12d/0x210 fs/open.c:1381
page_owner free stack trace missing
Memory state around the buggy address:
ffff8880393dff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880393dff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880393e0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880393e0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880393e0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
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 <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef __NR_bpf
#define __NR_bpf 321
#endif
#ifndef __NR_execveat
#define __NR_execveat 322
#endif
#ifndef __NR_fsconfig
#define __NR_fsconfig 431
#endif
#ifndef __NR_fsmount
#define __NR_fsmount 432
#endif
#ifndef __NR_fsopen
#define __NR_fsopen 430
#endif
#define BITMASK(bf_off,bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
#define STORE_BY_BITMASK(type,htobe,addr,val,bf_off,bf_len) *(type*)(addr) = htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))
static long syz_open_procfs(volatile long a0, volatile long a1)
{
char buf[128];
memset(buf, 0, sizeof(buf));
if (a0 == 0) {
snprintf(buf, sizeof(buf), "/proc/self/%s", (char*)a1);
} else if (a0 == -1) {
snprintf(buf, sizeof(buf), "/proc/thread-self/%s", (char*)a1);
} else {
snprintf(buf, sizeof(buf), "/proc/self/task/%d/%s", (int)a0, (char*)a1);
}
int fd = open(buf, O_RDWR);
if (fd == -1)
fd = open(buf, O_RDONLY);
return fd;
}
uint64_t r[6] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// syz_open_procfs$namespace arguments: [
// pid: pid (resource)
// file: ptr[in, buffer] {
// buffer: {6e 73 2f 70 69 64 5f 66 6f 72 5f 63 68 69 6c 64 72 65 6e 00} (length 0x14)
// }
// ]
// returns fd_namespace
memcpy((void*)0x200000000300, "ns/pid_for_children\000", 20);
syz_open_procfs(/*pid=*/-1, /*file=*/0x200000000300);
// syz_open_procfs$namespace arguments: [
// pid: pid (resource)
// file: ptr[in, buffer] {
// buffer: {6e 73 2f 70 69 64 5f 66 6f 72 5f 63 68 69 6c 64 72 65 6e 00} (length 0x14)
// }
// ]
// returns fd_namespace
memcpy((void*)0x200000000300, "ns/pid_for_children\000", 20);
res = -1;
res = syz_open_procfs(/*pid=*/-1, /*file=*/0x200000000300);
if (res != -1)
r[0] = res;
// ioctl$SIOCSIFHWADDR arguments: [
// fd: fd_tun (resource)
// cmd: const = 0x8914 (4 bytes)
// arg: nil
// ]
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x8914, /*arg=*/0ul);
// bpf$MAP_UPDATE_ELEM_TAIL_CALL arguments: [
// cmd: const = 0x2 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0ul, /*size=*/0ul);
// ioctl$sock_ipv6_tunnel_SIOCGETTUNNEL arguments: [
// fd: sock_udp6 (resource)
// cmd: const = 0x89f0 (4 bytes)
// arg: ptr[inout, ifreq_dev_t[ipv6_tunnel_names, ptr[inout, ip6_tnl_parm2]]] {
// ifreq_dev_t[ipv6_tunnel_names, ptr[inout, ip6_tnl_parm2]] {
// ifr_ifrn: buffer: {69 70 36 74 6e 6c 30 00 00 00 00 00 00 00 00 00} (length 0x10)
// elem: nil
// pad = 0x0 (16 bytes)
// }
// }
// ]
memcpy((void*)0x200000000400, "ip6tnl0\000\000\000\000\000\000\000\000\000", 16);
*(uint64_t*)0x200000000410 = 0;
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0x89f0, /*arg=*/0x200000000400ul);
// fsopen arguments: [
// type: ptr[in, buffer] {
// buffer: {62 70 66 00} (length 0x4)
// }
// flags: fsopen_flags = 0x0 (8 bytes)
// ]
// returns fd_fscontext
memcpy((void*)0x200000000100, "bpf\000", 4);
res = syscall(__NR_fsopen, /*type=*/0x200000000100ul, /*flags=*/0ul);
if (res != -1)
r[1] = res;
// 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[1], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*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[1], /*cmd=*/6ul, /*key=*/0ul, /*value=*/0ul, /*aux=*/0ul);
// fsmount arguments: [
// fs_fd: fd_fscontext (resource)
// flags: fsmount_flags = 0x0 (8 bytes)
// attr_flags: fsmount_attr_flags = 0x0 (8 bytes)
// ]
// returns fd
res = syscall(__NR_fsmount, /*fs_fd=*/r[1], /*flags=*/0ul, /*attr_flags=*/0ul);
if (res != -1)
r[2] = res;
// symlinkat arguments: [
// old: ptr[in, buffer] {
// buffer: {2e 00} (length 0x2)
// }
// newfd: fd_dir (resource)
// new: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8)
// }
// ]
memcpy((void*)0x200000000000, ".\000", 2);
memcpy((void*)0x200000000140, "./file0\000", 8);
syscall(__NR_symlinkat, /*old=*/0x200000000000ul, /*newfd=*/r[2], /*new=*/0x200000000140ul);
// unlinkat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 2f 2e 2e 2f 66 69 6c 65 30 2f 66 69 6c 65 30 00} (length 0x17)
// }
// flags: unlinkat_flags = 0x0 (8 bytes)
// ]
memcpy((void*)0x2000000001c0, "./file0/../file0/file0\000", 23);
syscall(__NR_unlinkat, /*fd=*/r[2], /*path=*/0x2000000001c0ul, /*flags=*/0ul);
// unlinkat arguments: [
// fd: fd_dir (resource)
// path: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 2f 2e 2e 2f 66 69 6c 65 30 2f 66 69 6c 65 30 00} (length 0x17)
// }
// flags: unlinkat_flags = 0x0 (8 bytes)
// ]
memcpy((void*)0x2000000001c0, "./file0/../file0/file0\000", 23);
syscall(__NR_unlinkat, /*fd=*/r[2], /*path=*/0x2000000001c0ul, /*flags=*/0ul);
// bpf$MAP_LOOKUP_ELEM arguments: [
// cmd: const = 0x1 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_bpf, /*cmd=*/1ul, /*arg=*/0ul, /*size=*/0ul);
// bpf$MAP_UPDATE_CONST_STR arguments: [
// cmd: const = 0x2 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_bpf, /*cmd=*/2ul, /*arg=*/0ul, /*size=*/0ul);
// bpf$OBJ_GET_MAP arguments: [
// cmd: const = 0x7 (8 bytes)
// arg: ptr[in, bpf_obj_get] {
// union bpf_obj_get {
// o_path: bpf_obj_get_o_path {
// path: nil
// fd: const = 0x0 (4 bytes)
// file_flags: bpf_obj_get_flags = 0x10 (4 bytes)
// path_fd: fd (resource)
// pad = 0x0 (4 bytes)
// }
// }
// }
// size: len = 0x18 (8 bytes)
// ]
// returns fd_bpf_map
*(uint64_t*)0x200000000800 = 0;
*(uint32_t*)0x200000000808 = 0;
*(uint32_t*)0x20000000080c = 0x10;
*(uint32_t*)0x200000000810 = r[0];
res = syscall(__NR_bpf, /*cmd=*/7ul, /*arg=*/0x200000000800ul, /*size=*/0x18ul);
if (res != -1)
r[3] = res;
// bpf$MAP_CREATE_CONST_STR arguments: [
// cmd: const = 0x0 (8 bytes)
// arg: nil
// size: len = 0x0 (8 bytes)
// ]
// returns fd_bpf_const_str_map
syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0ul, /*size=*/0ul);
// openat$cgroup_ro arguments: [
// fd: fd_cgroup (resource)
// file: ptr[in, buffer] {
// buffer: {62 6c 6b 69 6f 2e 62 66 71 2e 69 6f 5f 77 61 69 74 5f 74 69 6d 65 00} (length 0x17)
// }
// flags: const = 0x275a (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000200, "blkio.bfq.io_wait_time\000", 23);
syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000200ul, /*flags=*/0x275a, /*mode=*/0);
// fsopen arguments: [
// type: ptr[in, buffer] {
// buffer: {72 61 6d 66 73 00} (length 0x6)
// }
// flags: fsopen_flags = 0x0 (8 bytes)
// ]
// returns fd_fscontext
memcpy((void*)0x200000000100, "ramfs\000", 6);
res = syscall(__NR_fsopen, /*type=*/0x200000000100ul, /*flags=*/0ul);
if (res != -1)
r[4] = res;
// fsmount arguments: [
// fs_fd: fd_fscontext (resource)
// flags: fsmount_flags = 0x0 (8 bytes)
// attr_flags: fsmount_attr_flags = 0x0 (8 bytes)
// ]
// returns fd
res = syscall(__NR_fsmount, /*fs_fd=*/r[4], /*flags=*/0ul, /*attr_flags=*/0ul);
if (res != -1)
r[5] = res;
// execveat$binfmt arguments: [
// dirfd: fd_dir (resource)
// file: ptr_binfmt_file (resource)
// argv: nil
// envp: nil
// flags: at_flags = 0x0 (8 bytes)
// ]
syscall(__NR_execveat, /*dirfd=*/r[5], /*file=*/0ul, /*argv=*/0ul, /*envp=*/0ul, /*flags=*/0ul);
// bpf$BPF_PROG_WITH_BTFID_LOAD arguments: [
// cmd: const = 0x5 (8 bytes)
// arg: ptr[in, bpf_prog_with_btfid] {
// union bpf_prog_with_btfid {
// bpf_tracing: bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], fd_bpf_prog[opt]] {
// type: const = 0x1a (4 bytes)
// ninsn: bytesize8 = 0x29 (4 bytes)
// insns: ptr[in, bpf_instructions] {
// union bpf_instructions {
// raw: array[bpf_insn] {
// union bpf_insn {
// tail_call: bpf_insn_tail_call {
// insn1: bpf_insn_map_fd_t[const[BPF_REG_2, int8:4], tail_call_map] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x1 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: tail_call_map (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_3, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn3: bpf_insn_call_helper_t[const[BPF_FUNC_tail_call, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0xc (4 bytes)
// }
// insn4: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_0, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x0 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// }
// }
// union bpf_insn {
// alu: bpf_insn_alu_t[bpf_alu_insn, bpf_alu_source, bpf_alu_op, flags[bpf_reg, int8:4], flags[bpf_reg, int8:4], flags[bpf_insn_offsets, int16], flags[bpf_insn_immediates, int32]] {
// code_class: bpf_alu_insn = 0x4 (0 bytes)
// code_s: bpf_alu_source = 0x0 (0 bytes)
// code_op: bpf_alu_op = 0x4 (1 bytes)
// dst: bpf_reg = 0x6 (0 bytes)
// src: bpf_reg = 0x1 (1 bytes)
// off: bpf_insn_offsets = 0x1 (2 bytes)
// imm: bpf_insn_immediates = 0x4 (4 bytes)
// }
// }
// union bpf_insn {
// initr0: bpf_insn_init_r0 {
// code: const = 0x18 (1 bytes)
// dst: const = 0x0 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x10000 (4 bytes)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: int32 = 0x80000001 (4 bytes)
// }
// }
// union bpf_insn {
// map_idx_val: bpf_insn_map_idx_value {
// code: const = 0x18 (1 bytes)
// dst: bpf_reg = 0x2 (0 bytes)
// src: const = 0x6 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x7 (4 bytes)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: int32 = 0x29 (4 bytes)
// }
// }
// union bpf_insn {
// snprintf: bpf_insn_snprintf {
// insn1: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_8, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x8 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], const[-8, int16], const[0, int32]] {
// code_class: int8 = 0x3 (0 bytes)
// code_size: int8 = 0x3 (0 bytes)
// code_mode: int8 = 0x3 (1 bytes)
// dst: const = 0xa (0 bytes)
// src: const = 0x8 (1 bytes)
// off: const = 0xfff8 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn3: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_8, int8:4], const[0, int8:4], const[0, int16], int32] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x8 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x0 (4 bytes)
// }
// insn4: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], const[-16, int16], const[0, int32]] {
// code_class: int8 = 0x3 (0 bytes)
// code_size: int8 = 0x3 (0 bytes)
// code_mode: int8 = 0x3 (1 bytes)
// dst: const = 0xa (0 bytes)
// src: const = 0x8 (1 bytes)
// off: const = 0xfff0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn5: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, const[BPF_REG_1, int8:4], const[BPF_REG_10, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x1 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x1 (0 bytes)
// src: const = 0xa (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn6: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, const[BPF_REG_1, int8:4], const[0, int8:4], const[0, int16], const[-8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0x0 (1 bytes)
// dst: const = 0x1 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0xfffffff8 (4 bytes)
// }
// insn7: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, const[BPF_REG_4, int8:4], const[BPF_REG_10, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x1 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x4 (0 bytes)
// src: const = 0xa (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn8: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, const[BPF_REG_4, int8:4], const[0, int8:4], const[0, int16], const[-16, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0x0 (1 bytes)
// dst: const = 0x4 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0xfffffff0 (4 bytes)
// }
// insn9: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_2, int8:4], const[0, int8:4], const[0, int16], const[8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x8 (4 bytes)
// }
// insn10: bpf_insn_map_value_t[const[BPF_REG_3, int8:4], bpf_frozen_const_str, const[0, int32]] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x2 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: bpf_frozen_const_str (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn11: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_5, int8:4], const[0, int8:4], const[0, int16], const[8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x5 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x8 (4 bytes)
// }
// insn12: bpf_insn_call_helper_t[const[BPF_FUNC_snprintf, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0xa5 (4 bytes)
// }
// }
// }
// union bpf_insn {
// exit: bpf_insn_exit {
// code: const = 0x95 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// }
// union bpf_insn {
// map_idx_val: bpf_insn_map_idx_value {
// code: const = 0x18 (1 bytes)
// dst: bpf_reg = 0x2 (0 bytes)
// src: const = 0x6 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x8 (4 bytes)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: int32 = 0xf (4 bytes)
// }
// }
// union bpf_insn {
// tail_call: bpf_insn_tail_call {
// insn1: bpf_insn_map_fd_t[const[BPF_REG_2, int8:4], tail_call_map] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x1 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: tail_call_map (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_3, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn3: bpf_insn_call_helper_t[const[BPF_FUNC_tail_call, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0xc (4 bytes)
// }
// insn4: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_0, int8:4], const[0, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x0 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// }
// }
// union bpf_insn {
// generic: bpf_insn_generic {
// code: int8 = 0xe8 (1 bytes)
// dst: int8 = 0x2 (0 bytes)
// src: int8 = 0x0 (1 bytes)
// off: int16 = 0x5 (2 bytes)
// imm: int32 = 0x1ce (4 bytes)
// }
// }
// union bpf_insn {
// ringbuf_output: bpf_insn_ringbuf_output {
// insn1: bpf_insn_map_fd_t[const[BPF_REG_1, int8:4], tail_call_map] {
// code: const = 0x18 (1 bytes)
// dst: const = 0x1 (0 bytes)
// src: const = 0x1 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: tail_call_map (resource)
// code2: const = 0x0 (1 bytes)
// regs2: const = 0x0 (1 bytes)
// off2: const = 0x0 (2 bytes)
// imm2: const = 0x0 (4 bytes)
// }
// insn2: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_8, int8:4], const[0, int8:4], const[0, int16], int32] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x8 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: int32 = 0x2 (4 bytes)
// }
// insn3: bpf_insn_ldst_t[BPF_STX, BPF_DW0, BPF_MEM0, const[BPF_REG_10, int8:4], const[BPF_REG_8, int8:4], const[-8, int16], const[0, int32]] {
// code_class: int8 = 0x3 (0 bytes)
// code_size: int8 = 0x3 (0 bytes)
// code_mode: int8 = 0x3 (1 bytes)
// dst: const = 0xa (0 bytes)
// src: const = 0x8 (1 bytes)
// off: const = 0xfff8 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn4: bpf_insn_alu_t[BPF_ALU64, BPF_X0, BPF_MOV0, const[BPF_REG_2, int8:4], const[BPF_REG_10, int8:4], const[0, int16], const[0, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x1 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0xa (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x0 (4 bytes)
// }
// insn5: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_ADD0, const[BPF_REG_2, int8:4], const[0, int8:4], const[0, int16], const[-8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0x0 (1 bytes)
// dst: const = 0x2 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0xfffffff8 (4 bytes)
// }
// insn6: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_3, int8:4], const[0, int8:4], const[0, int16], const[8, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x3 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: const = 0x8 (4 bytes)
// }
// insn7: bpf_insn_alu_t[BPF_ALU64, BPF_K0, BPF_MOV0, const[BPF_REG_4, int8:4], const[0, int8:4], const[0, int16], flags[bpf_ringbuf_wakeup_flags, int32]] {
// code_class: int8 = 0x7 (0 bytes)
// code_s: int8 = 0x0 (0 bytes)
// code_op: int8 = 0xb (1 bytes)
// dst: const = 0x4 (0 bytes)
// src: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// imm: bpf_ringbuf_wakeup_flags = 0x2 (4 bytes)
// }
// insn8: bpf_insn_call_helper_t[const[BPF_FUNC_ringbuf_output, int32]] {
// code: const = 0x85 (1 bytes)
// regs: const = 0x0 (1 bytes)
// off: const = 0x0 (2 bytes)
// func: const = 0x82 (4 bytes)
// }
// }
// }
// }
// }
// }
// license: ptr[in, buffer] {
// buffer: {73 79 7a 6b 61 6c 6c 65 72 00} (length 0xa)
// }
// loglev: int32 = 0x81 (4 bytes)
// logsize: len = 0x0 (4 bytes)
// log: nil
// kern_version: bpf_kern_version = 0x41000 (4 bytes)
// flags: bpf_prog_load_flags = 0x1e (4 bytes)
// prog_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// prog_ifindex: ifindex (resource)
// expected_attach_type: bpf_tracing_attach_types = 0x1c (4 bytes)
// btf_fd: fd_btf (resource)
// func_info_rec_size: const = 0x8 (4 bytes)
// func_info: ptr[in, bpf_func_info] {
// bpf_func_info {
// insn_off: int32 = 0x4 (4 bytes)
// type_id: int32 = 0x2 (4 bytes)
// }
// }
// func_info_cnt: len = 0x8 (4 bytes)
// line_info_rec_size: const = 0x10 (4 bytes)
// line_info: ptr[in, bpf_line_info] {
// bpf_line_info {
// insn_off: int32 = 0x2 (4 bytes)
// file_name_off: int32 = 0x10 (4 bytes)
// line_off: int32 = 0x1 (4 bytes)
// line_col: int32 = 0x45 (4 bytes)
// }
// }
// line_info_cnt: len = 0x10 (4 bytes)
// attach_btf_id: int32 = 0xbf70 (4 bytes)
// attach_prog_fd: fd_bpf_prog (resource)
// core_relo_cnt: len = 0x1 (4 bytes)
// fd_array: ptr[in, array[fd_bpf_map]] {
// array[fd_bpf_map] {
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// fd_bpf_map (resource)
// }
// }
// core_relos: ptr[in, array[bpf_core_relo]] {
// array[bpf_core_relo] {
// bpf_core_relo {
// insn_off: int32 = 0x5 (4 bytes)
// type_id: int32 = 0x5 (4 bytes)
// access_str_off: int32 = 0x8 (4 bytes)
// kind: bpf_core_relo_kind = 0x7 (4 bytes)
// }
// }
// }
// core_relo_rec_size: const = 0x10 (4 bytes)
// log_true_size: int32 = 0x2 (4 bytes)
// prog_token_fd: union _bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], fd_bpf_prog[opt]]_prog_token_fd_wrapper {
// void: buffer: {} (length 0x0)
// }
// pad: union _bpf_prog_t[const[BPF_PROG_TYPE_TRACING, int32], flags[bpf_tracing_attach_types, int32], int32[0:BTF_ID_MAX], fd_bpf_prog[opt]]_pad_wrapper {
// value: const = 0x0 (4 bytes)
// }
// }
// }
// }
// size: len = 0x94 (8 bytes)
// ]
// returns fd_bpf_prog_with_btfid
*(uint32_t*)0x200000000a40 = 0x1a;
*(uint32_t*)0x200000000a44 = 0x29;
*(uint64_t*)0x200000000a48 = 0x200000000180;
*(uint8_t*)0x200000000180 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000181, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000181, 1, 4, 4);
*(uint16_t*)0x200000000182 = 0;
*(uint32_t*)0x200000000184 = -1;
*(uint8_t*)0x200000000188 = 0;
*(uint8_t*)0x200000000189 = 0;
*(uint16_t*)0x20000000018a = 0;
*(uint32_t*)0x20000000018c = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000190, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000190, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000190, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000191, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000191, 0, 4, 4);
*(uint16_t*)0x200000000192 = 0;
*(uint32_t*)0x200000000194 = 0;
*(uint8_t*)0x200000000198 = 0x85;
*(uint8_t*)0x200000000199 = 0;
*(uint16_t*)0x20000000019a = 0;
*(uint32_t*)0x20000000019c = 0xc;
STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a1, 0, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a1, 0, 4, 4);
*(uint16_t*)0x2000000001a2 = 0;
*(uint32_t*)0x2000000001a4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 4, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a8, 4, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a9, 6, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001a9, 1, 4, 4);
*(uint16_t*)0x2000000001aa = 1;
*(uint32_t*)0x2000000001ac = 4;
*(uint8_t*)0x2000000001b0 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x2000000001b1, 0, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001b1, 0, 4, 4);
*(uint16_t*)0x2000000001b2 = 0;
*(uint32_t*)0x2000000001b4 = 0x10000;
*(uint8_t*)0x2000000001b8 = 0;
*(uint8_t*)0x2000000001b9 = 0;
*(uint16_t*)0x2000000001ba = 0;
*(uint32_t*)0x2000000001bc = 0x80000001;
*(uint8_t*)0x2000000001c0 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x2000000001c1, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001c1, 6, 4, 4);
*(uint16_t*)0x2000000001c2 = 0;
*(uint32_t*)0x2000000001c4 = 7;
*(uint8_t*)0x2000000001c8 = 0;
*(uint8_t*)0x2000000001c9 = 0;
*(uint16_t*)0x2000000001ca = 0;
*(uint32_t*)0x2000000001cc = 0x29;
STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d1, 8, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d1, 0, 4, 4);
*(uint16_t*)0x2000000001d2 = 0;
*(uint32_t*)0x2000000001d4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 3, 2);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d8, 3, 5, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d9, 0xa, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001d9, 8, 4, 4);
*(uint16_t*)0x2000000001da = 0xfff8;
*(uint32_t*)0x2000000001dc = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e1, 8, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e1, 0, 4, 4);
*(uint16_t*)0x2000000001e2 = 0;
*(uint32_t*)0x2000000001e4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 3, 2);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e8, 3, 5, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e9, 0xa, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001e9, 8, 4, 4);
*(uint16_t*)0x2000000001ea = 0xfff0;
*(uint32_t*)0x2000000001ec = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 1, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f1, 1, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f1, 0xa, 4, 4);
*(uint16_t*)0x2000000001f2 = 0;
*(uint32_t*)0x2000000001f4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f8, 0, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f9, 1, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000001f9, 0, 4, 4);
*(uint16_t*)0x2000000001fa = 0;
*(uint32_t*)0x2000000001fc = 0xfffffff8;
STORE_BY_BITMASK(uint8_t, , 0x200000000200, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000200, 1, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000200, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000201, 4, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000201, 0xa, 4, 4);
*(uint16_t*)0x200000000202 = 0;
*(uint32_t*)0x200000000204 = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000208, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000208, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000208, 0, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000209, 4, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000209, 0, 4, 4);
*(uint16_t*)0x20000000020a = 0;
*(uint32_t*)0x20000000020c = 0xfffffff0;
STORE_BY_BITMASK(uint8_t, , 0x200000000210, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000210, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000210, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000211, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000211, 0, 4, 4);
*(uint16_t*)0x200000000212 = 0;
*(uint32_t*)0x200000000214 = 8;
*(uint8_t*)0x200000000218 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000219, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000219, 2, 4, 4);
*(uint16_t*)0x20000000021a = 0;
*(uint32_t*)0x20000000021c = -1;
*(uint8_t*)0x200000000220 = 0;
*(uint8_t*)0x200000000221 = 0;
*(uint16_t*)0x200000000222 = 0;
*(uint32_t*)0x200000000224 = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000228, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000228, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000228, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000229, 5, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000229, 0, 4, 4);
*(uint16_t*)0x20000000022a = 0;
*(uint32_t*)0x20000000022c = 8;
*(uint8_t*)0x200000000230 = 0x85;
*(uint8_t*)0x200000000231 = 0;
*(uint16_t*)0x200000000232 = 0;
*(uint32_t*)0x200000000234 = 0xa5;
*(uint8_t*)0x200000000238 = 0x95;
*(uint8_t*)0x200000000239 = 0;
*(uint16_t*)0x20000000023a = 0;
*(uint32_t*)0x20000000023c = 0;
*(uint8_t*)0x200000000240 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000241, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000241, 6, 4, 4);
*(uint16_t*)0x200000000242 = 0;
*(uint32_t*)0x200000000244 = 8;
*(uint8_t*)0x200000000248 = 0;
*(uint8_t*)0x200000000249 = 0;
*(uint16_t*)0x20000000024a = 0;
*(uint32_t*)0x20000000024c = 0xf;
*(uint8_t*)0x200000000250 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000251, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000251, 1, 4, 4);
*(uint16_t*)0x200000000252 = 0;
*(uint32_t*)0x200000000254 = -1;
*(uint8_t*)0x200000000258 = 0;
*(uint8_t*)0x200000000259 = 0;
*(uint16_t*)0x20000000025a = 0;
*(uint32_t*)0x20000000025c = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000260, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000260, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000260, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000261, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000261, 0, 4, 4);
*(uint16_t*)0x200000000262 = 0;
*(uint32_t*)0x200000000264 = 0;
*(uint8_t*)0x200000000268 = 0x85;
*(uint8_t*)0x200000000269 = 0;
*(uint16_t*)0x20000000026a = 0;
*(uint32_t*)0x20000000026c = 0xc;
STORE_BY_BITMASK(uint8_t, , 0x200000000270, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000270, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000270, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000271, 0, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000271, 0, 4, 4);
*(uint16_t*)0x200000000272 = 0;
*(uint32_t*)0x200000000274 = 0;
*(uint8_t*)0x200000000278 = 0xe8;
STORE_BY_BITMASK(uint8_t, , 0x200000000279, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000279, 0, 4, 4);
*(uint16_t*)0x20000000027a = 5;
*(uint32_t*)0x20000000027c = 0x1ce;
*(uint8_t*)0x200000000280 = 0x18;
STORE_BY_BITMASK(uint8_t, , 0x200000000281, 1, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000281, 1, 4, 4);
*(uint16_t*)0x200000000282 = 0;
*(uint32_t*)0x200000000284 = -1;
*(uint8_t*)0x200000000288 = 0;
*(uint8_t*)0x200000000289 = 0;
*(uint16_t*)0x20000000028a = 0;
*(uint32_t*)0x20000000028c = 0;
STORE_BY_BITMASK(uint8_t, , 0x200000000290, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000290, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x200000000290, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000291, 8, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000291, 0, 4, 4);
*(uint16_t*)0x200000000292 = 0;
*(uint32_t*)0x200000000294 = 2;
STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 3, 2);
STORE_BY_BITMASK(uint8_t, , 0x200000000298, 3, 5, 3);
STORE_BY_BITMASK(uint8_t, , 0x200000000299, 0xa, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x200000000299, 8, 4, 4);
*(uint16_t*)0x20000000029a = 0xfff8;
*(uint32_t*)0x20000000029c = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 1, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a1, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a1, 0xa, 4, 4);
*(uint16_t*)0x2000000002a2 = 0;
*(uint32_t*)0x2000000002a4 = 0;
STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a8, 0, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a9, 2, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002a9, 0, 4, 4);
*(uint16_t*)0x2000000002aa = 0;
*(uint32_t*)0x2000000002ac = 0xfffffff8;
STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b0, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b1, 3, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b1, 0, 4, 4);
*(uint16_t*)0x2000000002b2 = 0;
*(uint32_t*)0x2000000002b4 = 8;
STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 7, 0, 3);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 0, 3, 1);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b8, 0xb, 4, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b9, 4, 0, 4);
STORE_BY_BITMASK(uint8_t, , 0x2000000002b9, 0, 4, 4);
*(uint16_t*)0x2000000002ba = 0;
*(uint32_t*)0x2000000002bc = 2;
*(uint8_t*)0x2000000002c0 = 0x85;
*(uint8_t*)0x2000000002c1 = 0;
*(uint16_t*)0x2000000002c2 = 0;
*(uint32_t*)0x2000000002c4 = 0x82;
*(uint64_t*)0x200000000a50 = 0x200000000340;
memcpy((void*)0x200000000340, "syzkaller\000", 10);
*(uint32_t*)0x200000000a58 = 0x81;
*(uint32_t*)0x200000000a5c = 0;
*(uint64_t*)0x200000000a60 = 0;
*(uint32_t*)0x200000000a68 = 0x41000;
*(uint32_t*)0x200000000a6c = 0x1e;
memset((void*)0x200000000a70, 0, 16);
*(uint32_t*)0x200000000a80 = 0;
*(uint32_t*)0x200000000a84 = 0x1c;
*(uint32_t*)0x200000000a88 = -1;
*(uint32_t*)0x200000000a8c = 8;
*(uint64_t*)0x200000000a90 = 0x200000000600;
*(uint32_t*)0x200000000600 = 4;
*(uint32_t*)0x200000000604 = 2;
*(uint32_t*)0x200000000a98 = 8;
*(uint32_t*)0x200000000a9c = 0x10;
*(uint64_t*)0x200000000aa0 = 0x200000000640;
*(uint32_t*)0x200000000640 = 2;
*(uint32_t*)0x200000000644 = 0x10;
*(uint32_t*)0x200000000648 = 1;
*(uint32_t*)0x20000000064c = 0x45;
*(uint32_t*)0x200000000aa8 = 0x10;
*(uint32_t*)0x200000000aac = 0xbf70;
*(uint32_t*)0x200000000ab0 = -1;
*(uint32_t*)0x200000000ab4 = 1;
*(uint64_t*)0x200000000ab8 = 0x2000000009c0;
*(uint32_t*)0x2000000009c0 = r[2];
*(uint32_t*)0x2000000009c4 = -1;
*(uint32_t*)0x2000000009c8 = -1;
*(uint32_t*)0x2000000009cc = r[3];
*(uint32_t*)0x2000000009d0 = -1;
*(uint32_t*)0x2000000009d4 = -1;
*(uint32_t*)0x2000000009d8 = -1;
*(uint32_t*)0x2000000009dc = r[5];
*(uint32_t*)0x2000000009e0 = -1;
*(uint64_t*)0x200000000ac0 = 0x200000000a00;
*(uint32_t*)0x200000000a00 = 5;
*(uint32_t*)0x200000000a04 = 5;
*(uint32_t*)0x200000000a08 = 8;
*(uint32_t*)0x200000000a0c = 7;
*(uint32_t*)0x200000000ac8 = 0x10;
*(uint32_t*)0x200000000acc = 2;
*(uint32_t*)0x200000000ad0 = 0;
syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x200000000a40ul, /*size=*/0x94ul);
return 0;
}
Reply: **Bug Analysis:**
The bug is a Use-After-Free (UAF) in the VFS path walk code when interacting with the `bpf` pseudo-filesystem (`bpffs`).
The root cause is that `bpffs` frees its inodes immediately in `bpf_destroy_inode` using `free_inode_nonrcu()`, without waiting for an RCU grace period. However, `bpffs` supports symlinks, and the VFS path walk can encounter these symlinks in RCU walk mode (`LOOKUP_RCU`).
If a symlink in `bpffs` is unlinked concurrently with an RCU path walk, the path walk can access the freed `inode` and its `i_link` pointer in `pick_link()` before the dentry sequence counter (`d_seq`) is re-checked. This leads to a UAF read of the `inode` (specifically `inode->i_flags` via `IS_PRIVATE`) and the `i_link` string.
**Exploitability:**
The UAF is primarily a read UAF. The path walk reads `inode->i_flags` and `inode->i_link`. Since the inode is allocated from a dedicated slab cache (`inode_cache`) with a constructor (`inode_init_once`), an attacker cannot use generic heap spraying techniques (like `msg_msg` or `setxattr`) to overwrite the freed object with arbitrary data. The object can only be reallocated as another `struct inode`, which will be safely initialized by the kernel.
This prevents forging `inode->i_op` or `inode->i_link` to hijack control flow. The worst-case scenario is a NULL pointer dereference (e.g., if the inode is reallocated as a regular file with no `get_link` operation) or an out-of-bounds read of the freed string, both of which result in a Denial of Service (DoS) but not privilege escalation.
**Accessibility:**
The bug is **not accessible to unprivileged users**.
1. The `bpf` filesystem cannot be mounted by unprivileged users, even within a user namespace. The `bpf_fill_super` function explicitly requires `CAP_SYS_ADMIN` in the initial user namespace (`init_user_ns`).
2. The default mount of `bpffs` at `/sys/fs/bpf` (e.g., by systemd) has `0700` permissions, restricting access strictly to root.
Therefore, unprivileged users cannot create or unlink symlinks in `bpffs` to trigger the race condition.
**Conclusion:**
The bug is a Denial of Service (DoS) vulnerability that is only reachable by privileged users (root). It is not exploitable for privilege escalation and cannot be triggered by unprivileged users, user namespaces, or remote/peripheral vectors.
|
| 6/2 |
2026/05/30 00:28 |
llm |
expert |
0m
Model:
Tokens:
input: 30770
output: 36
thoughts: 801
Thoughts: **Analyzing a KASAN Slab-Use-After-Free Vulnerability**
Okay, so I've got a KASAN report here, specifically a slab-use-after-free in `security_inode_follow_link`. The interesting part is the read of size 4 at `ffff8880393e0004`. Let's dig into the stack trace to understand the execution flow.
It seems the issue is triggered within `security_inode_follow_link`, then passes through `pick_link`, `step_into_slowpath`, the `walk_component` inline function within `step_into`, and ultimately bubbles up through `link_path_walk`, `path_parentat`, `__filename_parentat`, `filename_parentat`, and finally, the `filename_unlinkat` function. The culprit seems to stem from a call to `unlinkat`.
Now, looking at the object allocation, it was handled by task 8610 in `bpf_symlink`. That's important; it's an inode allocated in `bpf_symlink` and specifically allocated at `bpf_symlink` itself. This is critical because that's what's being freed. The allocation occurs as the inode is created using `alloc_inode` and `new_inode` and subsequently linked with the `bpf_symlink` method, which calls `vfs_symlink` and eventually `filename_symlinkat`.
The object is being freed by task 8611. The freeing process begins with `destroy_inode`, leading into `evict`, `iput_final`, and ultimately via `iput` to the `filename_unlinkat` function again. This reinforces that the `filename_unlinkat` function, or something downstream, is likely causing a double-free or an improper free.
So, here's my understanding: We're dealing with an inode allocated in `bpf_symlink` that is then freed, and later accessed. This Use-After-Free occurs when the system follows a symlink during an `unlinkat` operation. My primary focus should be `security_inode_follow_link` and how it handles the symlink traversal and specifically the inode. I'll need to scrutinize how the security checks interact with the inode lifecycle during that process. Let's see how `security_inode_follow_link` is implemented.
|
| 7/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:security/security.c Name:security_inode_follow_link]
Results: map[SourceCode:1805: /**
1806: * security_inode_follow_link() - Check if following a symbolic link is allowed
1807: * @dentry: link dentry
1808: * @inode: link inode
1809: * @rcu: true if in RCU-walk mode
1810: *
1811: * Check permission to follow a symbolic link when looking up a pathname. If
1812: * @rcu is true, @inode is not stable.
1813: *
1814: * Return: Returns 0 if permission is granted.
1815: */
1816: int security_inode_follow_link(struct dentry *dentry, struct inode *inode,
1817: bool rcu)
1818: {
1819: if (unlikely(IS_PRIVATE(inode)))
1820: return 0;
1821: return call_int_hook(inode_follow_link, dentry, inode, rcu);
1822: }
SourceFile:security/security.c]
|
| 8/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 32434
output: 19
thoughts: 51
Thoughts: **Analyzing a UAF Issue**
Okay, so I'm tracking down this User-After-Free (UAF) issue. The trace points me directly to `security/security.c:1819`, specifically the `IS_PRIVATE(inode)` call. Right, that function, if I recall, is essentially checking `inode->i_flags`. Let's just double-check the definition of `IS_PRIVATE` to make absolutely sure there aren't any subtle gotchas I'm missing. Time to dive into that macro. Gotta be precise here, these memory corruption bugs can be tricky.
|
| 9/2 |
2026/05/30 00:29 |
tool |
grepper |
0m
Args: map[Expression:#define IS_PRIVATE]
Results: map[Output:include/linux/fs.h=2096=extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
--
include/linux/fs.h-2169-
include/linux/fs.h:2170:#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
include/linux/fs.h-2171-#define IS_IMA(inode) ((inode)->i_flags & S_IMA)
]
|
| 10/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 32773
output: 33
thoughts: 28
Thoughts: Okay, here's my interpretation of that thought process, assuming I'm an expert in file system internals:
**Investigating a Potential Race Condition with Inode Allocation**
Alright, I'm tracing through this code. I see a read happening on `inode->i_flags`. That's standard - lots of operations touch the inode's flags to understand its current state. But then, *bam*, the inode is freed. That's the critical point that immediately throws up a red flag in my mind. The question immediately becomes how `pick_link` gets the inode. I need to figure out the path the code takes to retrieve the inode. Is it possible for `pick_link` to use the inode *after* it has been freed? If that's the case then this is a race condition. It's a classic scenario where one thread or process is checking a value, then another thread comes along and invalidates that value before the first thread gets to act on it. Specifically, the "what" that is invalidated. The first thread may then be acting on a value that is no longer valid, i.e., dereferencing a freed inode. This is something I need to drill down into immediately. I'm going to start digging into the call stack of `pick_link` to understand the codepath, and see if it is plausible. If it is, this is a serious bug that could lead to crashes, data corruption, or even a security vulnerability. Time to get my hands dirty.
|
| 11/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/namei.c Name:pick_link]
Results: map[SourceCode:2003: static noinline const char *pick_link(struct nameidata *nd, struct path *link,
2004: struct inode *inode, int flags)
2005: {
2006: struct saved *last;
2007: const char *res;
2008: int error;
2009:
2010: if (nd->flags & LOOKUP_RCU) {
2011: /* make sure that d_is_symlink from step_into_slowpath() matches the inode */
2012: if (read_seqcount_retry(&link->dentry->d_seq, nd->next_seq))
2013: return ERR_PTR(-ECHILD);
2014: } else {
2015: if (link->mnt == nd->path.mnt)
2016: mntget(link->mnt);
2017: }
2018:
2019: error = reserve_stack(nd, link);
2020: if (unlikely(error)) {
2021: if (!(nd->flags & LOOKUP_RCU))
2022: path_put(link);
2023: return ERR_PTR(error);
2024: }
2025: last = nd->stack + nd->depth++;
2026: last->link = *link;
2027: clear_delayed_call(&last->done);
2028: last->seq = nd->next_seq;
2029:
2030: if (flags & WALK_TRAILING) {
2031: error = may_follow_link(nd, inode);
2032: if (unlikely(error))
2033: return ERR_PTR(error);
2034: }
2035:
2036: if (unlikely(nd->flags & LOOKUP_NO_SYMLINKS) ||
2037: unlikely(link->mnt->mnt_flags & MNT_NOSYMFOLLOW))
2038: return ERR_PTR(-ELOOP);
2039:
2040: if (unlikely(atime_needs_update(&last->link, inode))) {
2041: if (nd->flags & LOOKUP_RCU) {
2042: if (!try_to_unlazy(nd))
2043: return ERR_PTR(-ECHILD);
2044: }
2045: touch_atime(&last->link);
2046: cond_resched();
2047: }
2048:
2049: error = security_inode_follow_link(link->dentry, inode,
2050: nd->flags & LOOKUP_RCU);
2051: if (unlikely(error))
2052: return ERR_PTR(error);
2053:
2054: res = READ_ONCE(inode->i_link);
2055: if (!res) {
2056: const char * (*get)(struct dentry *, struct inode *,
2057: struct delayed_call *);
2058: get = inode->i_op->get_link;
2059: if (nd->flags & LOOKUP_RCU) {
2060: res = get(NULL, inode, &last->done);
2061: if (res == ERR_PTR(-ECHILD) && try_to_unlazy(nd))
2062: res = get(link->dentry, inode, &last->done);
2063: } else {
2064: res = get(link->dentry, inode, &last->done);
2065: }
2066: if (!res)
2067: goto all_done;
2068: if (IS_ERR(res))
2069: return res;
2070: }
2071: if (*res == '/') {
2072: error = nd_jump_root(nd);
2073: if (unlikely(error))
2074: return ERR_PTR(error);
2075: while (unlikely(*++res == '/'))
2076: ;
2077: }
2078: if (*res)
2079: return res;
2080: all_done: // pure jump
2081: put_link(nd);
2082: return NULL;
2083: }
SourceFile:fs/namei.c]
|
| 12/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 34372
output: 36
thoughts: 16
Thoughts: Okay, here's my interpretation of that.
**Analyzing the Function Call Flow**
Alright, let's break this down. It seems I'm dealing with a scenario where the function `pick_link` is being called from within `step_into_slowpath`. This means `step_into_slowpath` is somehow dependent on the functionality provided by `pick_link`. I need to figure out the roles of these functions and how they relate to the bigger picture. Is `pick_link` making a critical decision that `step_into_slowpath` needs to use? Is it a helper function, or is it performing a fundamental operation that `step_into_slowpath` depends on? Understanding their interaction is key to fully grasp the execution flow. I need to dig deeper into the context and determine the specific purpose of each function to fully grasp what is happening here.
|
| 13/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/namei.c Name:step_into_slowpath]
Results: map[SourceCode:2085: /*
2086: * Do we need to follow links? We _really_ want to be able
2087: * to do this check without having to look at inode->i_op,
2088: * so we keep a cache of "no, this doesn't need follow_link"
2089: * for the common case.
2090: *
2091: * NOTE: dentry must be what nd->next_seq had been sampled from.
2092: */
2093: static noinline const char *step_into_slowpath(struct nameidata *nd, int flags,
2094: struct dentry *dentry)
2095: {
2096: struct path path;
2097: struct inode *inode;
2098: int err;
2099:
2100: err = handle_mounts(nd, dentry, &path);
2101: if (unlikely(err < 0))
2102: return ERR_PTR(err);
2103: inode = path.dentry->d_inode;
2104: if (likely(!d_is_symlink(path.dentry)) ||
2105: ((flags & WALK_TRAILING) && !(nd->flags & LOOKUP_FOLLOW)) ||
2106: (flags & WALK_NOFOLLOW)) {
2107: /* not a symlink or should not follow */
2108: if (nd->flags & LOOKUP_RCU) {
2109: if (read_seqcount_retry(&path.dentry->d_seq, nd->next_seq))
2110: return ERR_PTR(-ECHILD);
2111: if (unlikely(!inode))
2112: return ERR_PTR(-ENOENT);
2113: } else {
2114: dput(nd->path.dentry);
2115: if (nd->path.mnt != path.mnt)
2116: mntput(nd->path.mnt);
2117: }
2118: nd->path = path;
2119: nd->inode = inode;
2120: nd->seq = nd->next_seq;
2121: return NULL;
2122: }
2123: return pick_link(nd, &path, inode, flags);
2124: }
SourceFile:fs/namei.c]
|
| 14/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 35275
output: 32
thoughts: 350
Thoughts: **Analyzing a Potential Race Condition in the Kernel's Path Lookup**
Okay, let's break this down. I'm looking at how the kernel handles symbolic links during path lookups, specifically the `step_into_slowpath` function, which calls `handle_mounts` and then grabs the inode with `path.dentry->d_inode`. If a symlink is encountered, `pick_link` gets involved. Here's where it gets interesting. I'm concerned about a potential race condition. The primary issue I see is that the `inode` might be freed, but here's the kicker: `nd->flags & LOOKUP_RCU` could be set, indicating read-copy-update (RCU) protection.
So, `inode` might be read without a lock if `LOOKUP_RCU` is in play. But `pick_link` checks this using `read_seqcount_retry`... it does this to ensure that the symlink itself hasn't changed since `step_into_slowpath`. The check ensures that the dentry is still valid. If `read_seqcount_retry` returns false, all's good, `link->dentry` hasn't changed. But here's the rub - what if the inode has been unlinked? Could this lead to problems?
Specifically, if the `dentry` was unlinked, its `d_inode` could be set to `NULL`, and that would bump the sequence number, which would then be detectable by `read_seqcount_retry` which would prevent the race. So, `dentry` changes are tracked. But the key is that it's RCU protected. The dentry, even if unlinked, will be valid until the RCU grace period is over. Then, if the dentry is freed, its sequence number will be bumped. But, and this is the core of the problem, what about if the dentry is *reallocated*?
No, the RCU guarantees protect the `dentry`. But what about the `inode`? That's what I'm really getting at. It *could* be freed if it's freed via RCU. Is that the case? That's the question. I need to trace *how* `inode` is freed in this scenario. Is the inode also RCU protected, just like `dentry`? That's the key to understanding the potential race condition.
|
| 15/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/inode.c Name:destroy_inode]
Results: map[SourceCode: 387: static void destroy_inode(struct inode *inode)
388: {
389: const struct super_operations *ops = inode->i_sb->s_op;
390:
391: BUG_ON(!list_empty(&inode->i_lru));
392: __destroy_inode(inode);
393: if (ops->destroy_inode) {
394: ops->destroy_inode(inode);
395: if (!ops->free_inode)
396: return;
397: }
398: inode->free_inode = ops->free_inode;
399: call_rcu(&inode->i_rcu, i_callback);
400: }
SourceFile:fs/inode.c]
|
| 16/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 36414
output: 52
thoughts: 194
Thoughts: **Analyzing the Inode Destruction Process**
Okay, so I'm looking at `destroy_inode` and it's calling `call_rcu` with `i_callback` if the filesystem's `free_inode` operation is defined. That's standard, but let me check the call stack for the `free` operation... Ah, here it is: `destroy_inode` on line 394 in `fs/inode.c`, then `evict`, then `iput_final`, and finally `iput`. Line 394 is where `ops->destroy_inode(inode)` gets called, which makes sense. Now, let's see. My current train of thought is to check what the `bpf` filesystem does to free inodes, and I remember `bpf_symlink` creates an inode. It might be helpful to examine the `bpf` filesystem's specific implementation of `destroy_inode`, since it's a relatively new subsystem.
|
| 17/2 |
2026/05/30 00:29 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:kernel/bpf/inode.c IncludeSnippetLines:0 Name:destroy_inode SourceTreePrefix:kernel/bpf]
Results: map[References:<nil> TruncatedOutput:false]
|
| 18/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 36888
output: 27
thoughts: 20
Thoughts: Okay, here's the summary, rendered as your internal thought process:
**Diving into the BPF Inode Operations**
Right, let's get down to brass tacks. I need to take a look at the `super_operations` struct. Specifically, I'm focusing on its implementation within `kernel/bpf/inode.c`. That's where the BPF-specific inode functionality is defined, and I'm guessing that's the heart of whatever issue I'm troubleshooting. Time to verify my assumptions! Let's hope the source is readable and well-commented. I'm expecting to find the key hooks for BPF programs interacting with inodes in there.
|
| 19/2 |
2026/05/30 00:29 |
tool |
codesearch-file-index |
0m
Args: map[SourceFile:kernel/bpf/inode.c]
Results: map[Entities:[map[Kind:function Name:__get_prog_inode] map[Kind:function Name:bpf_any_get] map[Kind:function Name:bpf_any_put] map[Kind:function Name:bpf_dentry_finalize] map[Kind:function Name:bpf_destroy_inode] map[Kind:function Name:bpf_fd_probe_obj] map[Kind:function Name:bpf_fill_super] map[Kind:function Name:bpf_free_fc] map[Kind:function Name:bpf_get_inode] map[Kind:function Name:bpf_get_tree] map[Kind:function Name:bpf_init] map[Kind:function Name:bpf_init_fs_context] map[Kind:function Name:bpf_inode_type] map[Kind:function Name:bpf_iter_link_pin_kernel] map[Kind:function Name:bpf_kill_super] map[Kind:function Name:bpf_lookup] map[Kind:function Name:bpf_mkdir] map[Kind:function Name:bpf_mklink] map[Kind:function Name:bpf_mkmap] map[Kind:function Name:bpf_mkobj_ops] map[Kind:function Name:bpf_mkprog] map[Kind:function Name:bpf_obj_do_get] map[Kind:function Name:bpf_obj_do_pin] map[Kind:function Name:bpf_obj_get_user] map[Kind:function Name:bpf_obj_pin_user] map[Kind:function Name:bpf_parse_param] map[Kind:function Name:bpf_preload_mod_get] map[Kind:function Name:bpf_preload_mod_put] map[Kind:function Name:bpf_prog_get_type_path] map[Kind:function Name:bpf_show_options] map[Kind:function Name:bpf_symlink] map[Kind:function Name:bpffs_map_open] map[Kind:function Name:bpffs_map_release] map[Kind:function Name:bpffs_obj_open] map[Kind:function Name:find_bpffs_btf_enums] map[Kind:function Name:find_btf_enum_const] map[Kind:function Name:map_iter] map[Kind:function Name:map_iter_alloc] map[Kind:function Name:map_iter_free] map[Kind:function Name:map_seq_next] map[Kind:function Name:map_seq_show] map[Kind:function Name:map_seq_start] map[Kind:function Name:map_seq_stop] map[Kind:function Name:populate_bpffs] map[Kind:function Name:seq_file_to_map] map[Kind:function Name:seq_print_delegate_opts] map[Kind:struct Name:bpffs_btf_enums] map[Kind:struct Name:map_iter] map[Kind:global_variable Name:__UNIQUE_ID_addressable_bpf_init_1415] map[Kind:global_variable Name:__UNIQUE_ID_addressable_bpf_preload_ops_1413] map[Kind:global_variable Name:__UNIQUE_ID_addressable_bpf_prog_get_type_path_1412] map[Kind:global_variable Name:__gendwarfksyms_ptr_bpf_preload_ops] map[Kind:global_variable Name:__gendwarfksyms_ptr_bpf_prog_get_type_path] map[Kind:global_variable Name:bpf_context_ops] map[Kind:global_variable Name:bpf_dir_iops] map[Kind:global_variable Name:bpf_fs_parameters] map[Kind:global_variable Name:bpf_fs_type] map[Kind:global_variable Name:bpf_link_iops] map[Kind:global_variable Name:bpf_map_iops] map[Kind:global_variable Name:bpf_preload_lock] map[Kind:global_variable Name:bpf_prog_iops] map[Kind:global_variable Name:bpf_super_ops] map[Kind:global_variable Name:bpffs_map_fops] map[Kind:global_variable Name:bpffs_map_seq_ops] map[Kind:global_variable Name:bpffs_obj_fops] map[Kind:enum Name:bpf_type]]]
|
| 20/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 38340
output: 38
thoughts: 21
Thoughts: Here's my take on those thoughts:
**Analyzing bpf_super_ops and bpf_destroy_inode**
Alright, let's dive in. My immediate focus is on those two function names: `bpf_super_ops` and `bpf_destroy_inode`. Knowing my area, I immediately see the implications. `bpf_super_ops`... that's the BPF-specific superblock operations structure. I need to refresh myself on how BPF interacts with the filesystem layer. What operations are we defining there? Likely things like mounting, umounting, and file system statistics. I'll need to double-check the implementations of those function pointers within that structure. What methods are we defining, and how are they implemented within the kernel? Are there any potential gotchas or optimizations I can spot?
Then there's `bpf_destroy_inode`. Ah, this is critical for resource management. That's the function responsible for cleaning up an inode associated with a BPF program or map, right? Memory leaks are the enemy, so I need to understand its behavior thoroughly. What happens to the BPF program or map data itself when this function is called? Are all related resources properly freed, including any associated memory or file descriptors? What are the implications of a poorly implemented `bpf_destroy_inode`? Could it lead to resource exhaustion or, worse, vulnerabilities? I need to check its interaction with garbage collection, reference counting, and any associated locking mechanisms. A poorly written destruction function could cripple the system. It's time to dig into the source code and review the surrounding context carefully.
|
| 21/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_super_ops]
Results: map[SourceCode: 776: const struct super_operations bpf_super_ops = {
777: .statfs = simple_statfs,
778: .drop_inode = inode_just_drop,
779: .show_options = bpf_show_options,
780: .destroy_inode = bpf_destroy_inode,
781: };
SourceFile:kernel/bpf/inode.c]
|
| 22/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 38876
output: 38
thoughts: 12
Thoughts: Okay, let's dive into this. Here's how I'd approach summarizing the prompt from an expert's perspective:
**Investigating `bpf_destroy_inode`**
Alright, so the task at hand is to scrutinize `bpf_destroy_inode`. Knowing my field, my immediate thought is to understand why this function specifically. Is it a potential area of concern within the kernel's BPF (Berkeley Packet Filter) subsystem? Are we looking for resource leaks, security vulnerabilities, or unexpected side effects related to inode management? My experience tells me that inode destruction within a BPF context can be tricky, especially with complex BPF programs interacting with file systems. I would begin by checking its actual implementation, and any documentation related to it. Then, I would look for related functions and data structures. Let's see what we can find.
|
| 23/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_destroy_inode]
Results: map[SourceCode: 765: static void bpf_destroy_inode(struct inode *inode)
766: {
767: enum bpf_type type;
768:
769: if (S_ISLNK(inode->i_mode))
770: kfree(inode->i_link);
771: if (!bpf_inode_type(inode, &type))
772: bpf_any_put(inode->i_private, type);
773: free_inode_nonrcu(inode);
774: }
SourceFile:kernel/bpf/inode.c]
|
| 24/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 39292
output: 37
thoughts: 371
Thoughts: **My Analysis of the BPF Inode Destruction and RCU Walk Vulnerability**
Okay, so `bpf_destroy_inode` calls `free_inode_nonrcu(inode)`. Right off the bat, I see a potential issue. It's *not* using RCU to free the inode. This is important. But then, `bpf_symlink` creates a symlink within the bpf filesystem. Now, the problem potentially lies with `step_into_slowpath`, which can be invoked during an RCU walk (i.e., with `LOOKUP_RCU` set). If `LOOKUP_RCU` is true, the `inode` is accessed without a read lock β it's read locklessly.
Here's the rub: if we unlink the symlink and destroy its inode, `free_inode_nonrcu` immediately frees that inode. Then, `pick_link` gets called. `pick_link` then calls `security_inode_follow_link(link->dentry, inode, nd->flags & LOOKUP_RCU)`, which accesses `inode->i_flags` (specifically through `IS_PRIVATE(inode)`). This is a textbook use-after-free scenario. The inode is freed without RCU synchronization, but it's later accessed within an RCU walk. It's a classic race.
The next thing I must clarify is whether the `bpf` filesystem *allows* RCU walks. And yes, VFS walks *all* filesystems in RCU mode if it can. Therefore, if a filesystem frees inodes outside of RCU, it must either not support RCU walks for those inodes, or it must use RCU to free them! Essentially, `free_inode_nonrcu` is only safe if there's no way that the inode can be accessed via an RCU walk. And typically, symlinks can be followed in RCU walk mode if `inode->i_link` is set and `inode->i_op->get_link` isn't needed, or if `get_link` supports RCU walk. With the `bpf` filesystem, `bpf_symlink` *does* set `inode->i_link`. The puzzle is almost complete!
|
| 25/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_symlink]
Results: map[SourceCode: 382: static int bpf_symlink(struct mnt_idmap *idmap, struct inode *dir,
383: struct dentry *dentry, const char *target)
384: {
385: char *link = kstrdup(target, GFP_USER | __GFP_NOWARN);
386: struct inode *inode;
387:
388: if (!link)
389: return -ENOMEM;
390:
391: inode = bpf_get_inode(dir->i_sb, dir, S_IRWXUGO | S_IFLNK);
392: if (IS_ERR(inode)) {
393: kfree(link);
394: return PTR_ERR(inode);
395: }
396:
397: inode->i_op = &simple_symlink_inode_operations;
398: inode->i_link = link;
399:
400: bpf_dentry_finalize(dentry, inode, dir);
401: return 0;
402: }
SourceFile:kernel/bpf/inode.c]
|
| 26/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 40530
output: 38
thoughts: 18
Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue:
**Thinking About bpf_symlink and inode Operations**
Right, so `bpf_symlink` leverages `simple_symlink_inode_operations`. That immediately tells me a few things. Firstly, it means we're dealing with a pretty straightforward, "vanilla" symlink implementation here. No fancy custom inode handling or anything particularly out-of-the-ordinary from an operational perspective. It's likely built upon the standard symlink infrastructure the kernel already provides. The focus is probably on the BPF-specific aspects, rather than reinventing the symlink wheel. I'd expect that the symlink creation, reading the target, and resolving it will behave just like other symlinks. It's the _data_ that's written into that symlink that is crucial for BPF's uses. This confirms my initial expectations.
|
| 27/2 |
2026/05/30 00:29 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/libfs.c Name:simple_symlink_inode_operations]
Results: map[SourceCode:1714: const struct inode_operations simple_symlink_inode_operations = {
1715: .get_link = simple_get_link,
1716: };
SourceFile:fs/libfs.c]
|
| 28/2 |
2026/05/30 00:29 |
llm |
expert |
0m
Model:
Tokens:
input: 40862
output: 38
thoughts: 1112
Thoughts: **Analysis of a Potential Use-After-Free Vulnerability in the BPF Filesystem**
Okay, let's break this down. My initial thought was that `simple_get_link` just returns `inode->i_link`. Straightforward. Then, because `inode->i_link` is set, `pick_link` reads and follows that link. But wait, `pick_link` calls `security_inode_follow_link` with the `inode` pointer. If the `inode` was freed by `free_inode_nonrcu` before this call happens, we've got a problem β `inode` points to freed memory!
The core of the issue stems from `bpf_destroy_inode` using `free_inode_nonrcu`. Why? Because the `bpf_super_ops` doesn't define a `.free_inode` function. Delving into `destroy_inode` in `fs/inode.c`, the code shows that if a `.destroy_inode` function *is* defined but `.free_inode` is *not*, it just *returns* after calling the destroy function. So, `bpf_destroy_inode` calls `free_inode_nonrcu`, and then `destroy_inode` returns without the `call_rcu` needed for safe memory reclamation. This is a classic RCU issue.
Bingo! This looks like a bug in the `bpf` filesystem. It supports symlinks, but it frees inodes directly, without using RCU. This becomes a race condition: symlinks can be encountered during an RCU path walk, and if the symlink is unlinked and its inode is evicted, it's freed immediately. A concurrent RCU path walk might have already picked up the `dentry` and its `d_inode`, and then, when calling `pick_link`, the code accesses that freed `inode`.
Now, let's see if this is exploitable. It's a use-after-free of a `struct inode`. These inodes are typically between 600 and 1000 bytes, using `inode_cache` which is 1088 bytes. The UAF read occurs with `IS_PRIVATE(inode)`, which accesses `inode->i_flags`. If `IS_PRIVATE` is true, `security_inode_follow_link` returns. Otherwise, it calls a hook, which is likely to access `inode` again. Things like SELinux or AppArmor will read `inode->i_security`. The attacker could potentially control the data here. However, `security_inode_follow_link` is just a permission check.
Wait, what *else* does `pick_link` do with the `inode`? It reads `inode->i_link`. If that's NULL, it then accesses `inode->i_op->get_link`! *That's* the key. This means control flow hijacking is possible. The code is: `get = inode->i_op->get_link;` and then `res = get(NULL, inode, &last->done);`.
If an attacker reallocates the 1088-byte slab object with controlled data (e.g., using `setxattr` or `msg_msg`), they can set `inode->i_op` to a fake `inode_operations` struct and then set `get_link` to point to an arbitrary kernel address. *That* gives direct RIP control β a complete control flow hijack.
Therefore, this is a highly exploitable vulnerability, leading to privilege escalation!
Finally, let's confirm the prerequisites. We need to check if the `bpf` filesystem is accessible to unprivileged users. The reproducer uses `syscall(__NR_fsopen, /*type=*/0x200000000100ul, /*flags=*/0ul);` where type is bpf. So, can an unprivileged user mount the `bpf` filesystem? We need to verify `bpf_fs_type`.
|
| 29/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_fs_type]
Results: map[SourceCode:1074: static struct file_system_type bpf_fs_type = {
1075: .owner = THIS_MODULE,
1076: .name = "bpf",
1077: .init_fs_context = bpf_init_fs_context,
1078: .parameters = bpf_fs_parameters,
1079: .kill_sb = bpf_kill_super,
1080: .fs_flags = FS_USERNS_MOUNT,
1081: };
SourceFile:kernel/bpf/inode.c]
|
| 30/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 43055
output: 40
thoughts: 91
Thoughts: **Investigating BPF Filesystem and User Namespaces**
Okay, so `bpf_fs_type` has the `FS_USERNS_MOUNT` flag set. That immediately tells me this filesystem *can* be mounted by a non-root user within a user namespace. Interesting. My next question is: Does the `unprivileged_bpf_disabled` kernel parameter have any effect here? Is it properly checked during the mount process?
Let's dig in a bit. It looks like the mounting process for `bpf_fs_type` doesn't actually consult `unprivileged_bpf_disabled`. That's⦠unexpected. Alright, I need to understand *why* this is the case, and what the implications are. My attention now turns to `bpf_init_fs_context`. I'll start looking there to see what's happening during the filesystem initialization and context setup. Hopefully, I can find the connection and figure out the impact of this behavior.
|
| 31/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_init_fs_context]
Results: map[SourceCode:1040: /*
1041: * Set up the filesystem mount context.
1042: */
1043: static int bpf_init_fs_context(struct fs_context *fc)
1044: {
1045: struct bpf_mount_opts *opts;
1046:
1047: opts = kzalloc_obj(struct bpf_mount_opts);
1048: if (!opts)
1049: return -ENOMEM;
1050:
1051: opts->mode = S_IRWXUGO;
1052: opts->uid = current_fsuid();
1053: opts->gid = current_fsgid();
1054:
1055: /* start out with no BPF token delegation enabled */
1056: opts->delegate_cmds = 0;
1057: opts->delegate_maps = 0;
1058: opts->delegate_progs = 0;
1059: opts->delegate_attachs = 0;
1060:
1061: fc->s_fs_info = opts;
1062: fc->ops = &bpf_context_ops;
1063: return 0;
1064: }
SourceFile:kernel/bpf/inode.c]
|
| 32/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 43773
output: 39
thoughts: 170
Thoughts: **Initial Concerns About BPF Filesystem Vulnerability**
Okay, so I'm looking at this code and immediately I see something that raises a flag: `bpf_init_fs_context` has no capability checks. That means an unprivileged user, if they can get into a user namespace, could potentially mount a BPF filesystem without any restrictions. My immediate thought is, what can they *do* once they have that mount? The core of the issue must lie there.
Hmm, wait a second... how *exactly* does the user create a symlink in the BPF filesystem? I see the reproducer uses `symlinkat` and points to an area in memory. I see:
```c
syscall(__NR_symlinkat, /*old=*/0x200000000000ul, /*newfd=*/r[2], /*new=*/0x200000000140ul);
```
Okay, so they're using `symlinkat`. That triggers something in me. Does the `bpf` filesystem *even* support `symlinkat`? That's the crucial question. Let me go directly to the file operations. The next step is clearly to check `bpf_dir_iops` and see what it has to say about the implementation.
|
| 33/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_dir_iops]
Results: map[SourceCode: 404: static const struct inode_operations bpf_dir_iops = {
405: .lookup = bpf_lookup,
406: .mkdir = bpf_mkdir,
407: .symlink = bpf_symlink,
408: .rmdir = simple_rmdir,
409: .rename = simple_rename,
410: .link = simple_link,
411: .unlink = simple_unlink,
412: };
SourceFile:kernel/bpf/inode.c]
|
| 34/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 44445
output: 38
thoughts: 381
Thoughts: **Analyzing a Potential Kernel Vulnerability in the BPF Filesystem**
Okay, so I'm looking at the `bpf_dir_iops` struct and it looks like it uses `bpf_symlink` for `.symlink` and `simple_unlink` for `.unlink`. This immediately triggers something β an unprivileged user, if they could, would be able to mount a `bpf` filesystem, create a symlink, and then unlink it. This is interesting. From there, it is possible to trigger RCU path walks on the symlink.
My concern now is whether `simple_unlink` frees the inode immediately, or if there's a delay. Hmm, `simple_unlink` does call `drop_nlink(inode)`. That means when the dentry is dropped, the inode gets evicted. With RCU path walks, that dentry *might* still be valid and, importantly, the inode pointer is read locklessly from `dentry->d_inode`. If the dentry is unlinked, `d_delete` will be called. I am thinking, even if `d_delete` is called, an RCU path walk could still potentially access the dentry and its inode before the RCU grace period expires.
Ah, but then I remember that `bpf_destroy_inode` uses `free_inode_nonrcu(inode)`. Which means the inode gets freed immediately. Which confirms my suspicion: the RCU path walk would be accessing a *freed* inode. Thatβs a potential problem.
Now, a critical question: can an unprivileged process even mount the `bpf` filesystem without a user namespace? Let me check⦠I know `mount` requires `CAP_SYS_ADMIN`, so no, that's not possible. But what about systems that *already* have it mounted? Most systems have it mounted at `/sys/fs/bpf`. And the permissions are typically `rwx------` (root only) or sometimes `rwxrwxrwt` with the sticky bit, like `/tmp`. This would mean only root, or an unprivileged user who has created a file or directory under the bpf file system, could trigger the issue. Let me verify the default permissions of the root directory of the `bpf` filesystem to confirm.
|
| 35/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_fill_super]
Results: map[SourceCode: 997: static int bpf_fill_super(struct super_block *sb, struct fs_context *fc)
998: {
999: static const struct tree_descr bpf_rfiles[] = { { "" } };
1000: struct bpf_mount_opts *opts = sb->s_fs_info;
1001: struct inode *inode;
1002: int ret;
1003:
1004: /* Mounting an instance of BPF FS requires privileges */
1005: if (fc->user_ns != &init_user_ns && !capable(CAP_SYS_ADMIN))
1006: return -EPERM;
1007:
1008: ret = simple_fill_super(sb, BPF_FS_MAGIC, bpf_rfiles);
1009: if (ret)
1010: return ret;
1011:
1012: sb->s_op = &bpf_super_ops;
1013:
1014: inode = sb->s_root->d_inode;
1015: inode->i_uid = opts->uid;
1016: inode->i_gid = opts->gid;
1017: inode->i_op = &bpf_dir_iops;
1018: inode->i_mode &= ~S_IALLUGO;
1019: populate_bpffs(sb->s_root);
1020: inode->i_mode |= S_ISVTX | opts->mode;
1021: return 0;
1022: }
SourceFile:kernel/bpf/inode.c]
|
| 36/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 45811
output: 40
thoughts: 874
Thoughts: **Analyzing BPF Filesystem Mounting Restrictions**
Okay, first things first, I see this code:
```c
/* Mounting an instance of BPF FS requires privileges */
if (fc->user_ns != &init_user_ns && !capable(CAP_SYS_ADMIN))
return -EPERM;
```
Right, so `bpf_fill_super` explicitly checks for `capable(CAP_SYS_ADMIN)` if we're *not* in the initial user namespace. My immediate thought is, hang on, doesn't `capable(CAP_SYS_ADMIN)` check for that capability in the *init* user namespace? Yes, it does. Therefore, an unprivileged user can't mount a BPF filesystem even if they're inside a user namespace. Let me just confirm that.
Okay, let me re-read that conditional very carefully:
```c
if (fc->user_ns != &init_user_ns && !capable(CAP_SYS_ADMIN))
return -EPERM;
```
If the mount context (`fc->user_ns`) isn't the initial user namespace, then it needs `CAP_SYS_ADMIN` in the *init* user namespace. That's because `capable()` checks `init_user_ns`. So a user in a namespace *without* `CAP_SYS_ADMIN` in the `init_user_ns` will just get `-EPERM`. Let's double check that... yep, `capable(CAP_SYS_ADMIN)` *always* checks the `init_user_ns`.
Now, what if `fc->user_ns` *is* the `init_user_ns`? In that case the check is bypassed. But even there, you *still* need `CAP_SYS_ADMIN` because that's checked by the VFS to mount to begin with.
The reproducer I'm looking at uses `fsopen("bpf")` and `fsmount()`. Let's see what that looks like:
```c
// syz_open_procfs$namespace arguments: [
// pid: pid (resource)
// file: ptr[in, buffer] {
// buffer: {6e 73 2f 70 69 64 5f 66 6f 72 5f 63 68 69 6c 64 72 65 6e 00} (length 0x14)
// }
// ]
// returns fd_namespace
memcpy((void*)0x200000000300, "ns/pid_for_children\000", 20);
syz_open_procfs(/*pid=*/-1, /*file=*/0x200000000300);
```
Ah, right. The reproducer doesn't call `unshare(CLONE_NEWUSER)`. It just calls `fsopen("bpf")`. However, syzkaller might run the reproducer as root! "UID: 0 PID: 8610 Comm: syz.0.594 Not tainted syzkaller #0 PREEMPT(full)". Yes! Syzkaller runs as root in the VM. That's why this isn't triggering the `-EPERM`...
So the reproducer *is* running as root. Now, the question is, can an unprivileged user trigger this? If the BPF filesystem is already mounted, what are the file permissions? The default mode is `S_ISVTX | opts->mode`. `opts->mode` defaults to `S_IRWXUGO` from `bpf_init_fs_context`:
```c
opts->mode = S_IRWXUGO;
```
Therefore, the root directory of the BPF filesystem will have permissions `S_ISVTX | S_IRWXUGO`, meaning `rwxrwxrwt`, which includes the sticky bit.
This means *any* user can create files and directories under `/sys/fs/bpf`! Now, time to verify this and see if that's really the case.
|
| 37/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_init_fs_context]
Results: map[SourceCode:1040: /*
1041: * Set up the filesystem mount context.
1042: */
1043: static int bpf_init_fs_context(struct fs_context *fc)
1044: {
1045: struct bpf_mount_opts *opts;
1046:
1047: opts = kzalloc_obj(struct bpf_mount_opts);
1048: if (!opts)
1049: return -ENOMEM;
1050:
1051: opts->mode = S_IRWXUGO;
1052: opts->uid = current_fsuid();
1053: opts->gid = current_fsgid();
1054:
1055: /* start out with no BPF token delegation enabled */
1056: opts->delegate_cmds = 0;
1057: opts->delegate_maps = 0;
1058: opts->delegate_progs = 0;
1059: opts->delegate_attachs = 0;
1060:
1061: fc->s_fs_info = opts;
1062: fc->ops = &bpf_context_ops;
1063: return 0;
1064: }
SourceFile:kernel/bpf/inode.c]
|
| 38/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 48030
output: 37
thoughts: 261
Thoughts: **My Assessment of `/sys/fs/bpf` Security**
Okay, so I'm looking at this code and I see `opts->mode = S_IRWXUGO;`, which is essentially `0777`. Then, `bpf_fill_super` sets the root inode's mode to `S_ISVTX | opts->mode`. That means the root directory of the `bpf` filesystem ends up as `01777` (rwxrwxrwt). Immediately, alarm bells are going off. This implies *any* user can create files and symlinks within `/sys/fs/bpf` if it's mounted. That's a pretty open door.
The next question is, is `/sys/fs/bpf` mounted by default? Given my experience, I know systemd usually handles a lot of these mounts, and yes, it does mount `/sys/fs/bpf` by default on typical distributions. So, that potential vulnerability is active by default.
But hold on, let's drill down a bit deeper, specifically regarding symlinks, I have a feeling `bpf_symlink` is key here. I need to understand what permissions checks are in place. The code shows `bpf_symlink` is actually calling `vfs_symlink`, which is crucial. `vfs_symlink` then calls `may_create`. Since the directory is `01777`, `may_create` will allow the symlink to be created by *any* user. That confirms my initial concern. There doesn't appear to be any other access controls in `bpf_symlink`. This all appears to be a major security issue.
|
| 39/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_symlink]
Results: map[SourceCode: 382: static int bpf_symlink(struct mnt_idmap *idmap, struct inode *dir,
383: struct dentry *dentry, const char *target)
384: {
385: char *link = kstrdup(target, GFP_USER | __GFP_NOWARN);
386: struct inode *inode;
387:
388: if (!link)
389: return -ENOMEM;
390:
391: inode = bpf_get_inode(dir->i_sb, dir, S_IRWXUGO | S_IFLNK);
392: if (IS_ERR(inode)) {
393: kfree(link);
394: return PTR_ERR(inode);
395: }
396:
397: inode->i_op = &simple_symlink_inode_operations;
398: inode->i_link = link;
399:
400: bpf_dentry_finalize(dentry, inode, dir);
401: return 0;
402: }
SourceFile:kernel/bpf/inode.c]
|
| 40/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 49037
output: 34
thoughts: 1029
Thoughts: **Use-After-Free Vulnerability in BPF Filesystem Symlink Handling**
Okay, let's break this down. No obvious checks on this one, meaning an unprivileged user can create a symlink in `/sys/fs/bpf`. They can also unlink their own symlink because they own it and the directory has the sticky bit. Crucially, they *can* trigger an RCU path walk by concurrently opening or stat'ing the symlink while unlinking it. Wait, is `/sys/fs/bpf` accessible to unprivileged users? Yes, it is mounted and accessible. Need to double-check that `bpf_symlink` itself isn't restrictedβ¦Nope, looks like we can just use `symlink(2)`. It looks like `bpf_dir_iops` has `.symlink = bpf_symlink`. No specific limitations on `symlink(2)` in the `bpf` filesystem. `bpf_symlink` just allocates an inode and sets `i_link`.
Ah, but wait, the critical part is in `bpf_destroy_inode`. If the inode is a symlink, `kfree(inode->i_link)` is called. Then `free_inode_nonrcu(inode)` is called immediately. So *both* `inode->i_link` and `inode` itself are freed immediately. Now, if a concurrent RCU path walk is in `pick_link`, specifically in the `READ_ONCE(inode->i_link)` access...Boom! `security_inode_follow_link` accesses `inode->i_flags`. Then `READ_ONCE(inode->i_link)` accesses `inode->i_link`. The returned `res` is pointing to the freed `link` string!
And, even worse, `res` is returned to `walk_component` which then uses `res` as the path to walk! This is a use-after-free of the string, and if overwritten, it can redirect the path to an arbitrary location! Crucially, the *inode* itself is freed. If an attacker can overwrite the freed `inode`, they can do several bad things: They can corrupt `inode->i_link`, OR they can overwrite `inode->i_op` with a fake `inode_operations` structure, hijacking control flow when `get_link` is called. Ah, but that `get_link` hijack only happens if `inode->i_link` is NULL!
However, the attacker overwrites the freed `inode` and sets `i_link` to NULL, and `i_op` to a fake pointer, they can hijack control flow!
The vulnerability relies on the inode object being freed and re-used before the RCU pathwalk finishes. I need to know where the inode itself comes from. Let me check the reportβ¦ Ah, itβs allocated from the `inode_cache`, which is a dedicated cache for inodes, size 1088. This means an attacker can likely spray this cache by creating many inodes (files, pipes, etc.). I need to find out whether objects in `inode_cache` are re-initialized by the allocator. The report does not detail this, so further investigation is required here.
|
| 41/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/inode.c Name:inode_init_once]
Results: map[SourceCode: 495: /*
496: * These are initializations that only need to be done
497: * once, because the fields are idempotent across use
498: * of the inode, so let the slab aware of that.
499: */
500: void inode_init_once(struct inode *inode)
501: {
502: memset(inode, 0, sizeof(*inode));
503: INIT_HLIST_NODE(&inode->i_hash);
504: INIT_LIST_HEAD(&inode->i_devices);
505: INIT_LIST_HEAD(&inode->i_io_list);
506: INIT_LIST_HEAD(&inode->i_wb_list);
507: INIT_LIST_HEAD(&inode->i_lru);
508: INIT_LIST_HEAD(&inode->i_sb_list);
509: __address_space_init_once(&inode->i_data);
510: i_size_ordered_init(inode);
511: }
SourceFile:fs/inode.c]
|
| 42/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 51110
output: 34
thoughts: 41
Thoughts: Okay, here's my interpretation of those thoughts, presented as a personal thought process, as requested:
**Understanding Inode Initialization**
Alright, let me get this straight in my head. So, `inode_init_once` gets called. Now, I *know* that's related to slab allocation, right? That makes sense. It's the point where the inode gets *created* in the slab. That's the *initial* setup, the foundation. Okay, got it.
But then, when an inode is freed, and crucially *reallocated* later β which is the lifecycle, really, in a system with memory reuse β `alloc_inode` is what's responsible, and *that* calls `inode_init_always`. So, `inode_init_always` is used for initialization and re-initialization. Got it. This makes logical sense within a system's allocation and deallocation lifecycle of inodes and their place within a slab allocator. This seems like a careful optimization for inode management.
|
| 43/2 |
2026/05/30 00:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/inode.c Name:inode_init_always]
Results: map[SourceCode:2934: static inline int inode_init_always(struct super_block *sb, struct inode *inode)
2935: {
2936: return inode_init_always_gfp(sb, inode, GFP_NOFS);
2937: }
SourceFile:include/linux/fs.h]
|
| 44/2 |
2026/05/30 00:30 |
llm |
expert |
0m
Model:
Tokens:
input: 51502
output: 37
thoughts: 14
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into inode_init_always_gfp**
Okay, let's take a look at `inode_init_always_gfp`. I know this function is critical for inode initialization, particularly when we're dealing with memory allocation flags. I need to refresh my understanding of how it interacts with the `gfp_t` flag passed to it. I'm wondering if it ensures the inode's data structures are properly initialized regardless of allocation strategy, right down to the fundamental locking primitives. I need to see how it handles different allocation contexts, what the implications are for performance in various scenarios, and if there are any potential race conditions I should be on the lookout for, particularly in highly concurrent workloads. I'm also curious if any recent commits have modified this area and if so, how those changes might have impacted the existing memory allocation model. This function is a foundation, so a solid understanding here is key.
|
| 45/2 |
2026/05/30 00:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/inode.c Name:inode_init_always_gfp]
Results: map[SourceCode: 217: /**
218: * inode_init_always_gfp - perform inode structure initialisation
219: * @sb: superblock inode belongs to
220: * @inode: inode to initialise
221: * @gfp: allocation flags
222: *
223: * These are initializations that need to be done on every inode
224: * allocation as the fields are not initialised by slab allocation.
225: * If there are additional allocations required @gfp is used.
226: */
227: int inode_init_always_gfp(struct super_block *sb, struct inode *inode, gfp_t gfp)
228: {
229: static const struct inode_operations empty_iops;
230: static const struct file_operations no_open_fops = {.open = no_open};
231: struct address_space *const mapping = &inode->i_data;
232:
233: inode->i_sb = sb;
234: inode->i_blkbits = sb->s_blocksize_bits;
235: inode->i_flags = 0;
236: inode_state_assign_raw(inode, 0);
237: atomic64_set(&inode->i_sequence, 0);
238: atomic_set(&inode->i_count, 1);
239: inode->i_op = &empty_iops;
240: inode->i_fop = &no_open_fops;
241: inode->i_ino = 0;
242: inode->__i_nlink = 1;
243: inode->i_opflags = 0;
244: if (sb->s_xattr)
245: inode->i_opflags |= IOP_XATTR;
246: if (sb->s_type->fs_flags & FS_MGTIME)
247: inode->i_opflags |= IOP_MGTIME;
248: i_uid_write(inode, 0);
249: i_gid_write(inode, 0);
250: atomic_set(&inode->i_writecount, 0);
251: inode->i_size = 0;
252: inode->i_write_hint = WRITE_LIFE_NOT_SET;
253: inode->i_blocks = 0;
254: inode->i_bytes = 0;
255: inode->i_generation = 0;
256: inode->i_pipe = NULL;
257: inode->i_cdev = NULL;
258: inode->i_link = NULL;
259: inode->i_dir_seq = 0;
260: inode->i_rdev = 0;
261: inode->dirtied_when = 0;
262:
263: #ifdef CONFIG_CGROUP_WRITEBACK
264: inode->i_wb_frn_winner = 0;
265: inode->i_wb_frn_avg_time = 0;
266: inode->i_wb_frn_history = 0;
267: #endif
268:
269: spin_lock_init(&inode->i_lock);
270: lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key);
271:
272: init_rwsem(&inode->i_rwsem);
273: lockdep_set_class(&inode->i_rwsem, &sb->s_type->i_mutex_key);
274:
275: atomic_set(&inode->i_dio_count, 0);
276:
277: mapping->a_ops = &empty_aops;
278: mapping->host = inode;
279: mapping->flags = 0;
280: mapping->wb_err = 0;
281: atomic_set(&mapping->i_mmap_writable, 0);
282: #ifdef CONFIG_READ_ONLY_THP_FOR_FS
283: atomic_set(&mapping->nr_thps, 0);
284: #endif
285: mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE);
286: mapping->writeback_index = 0;
287: init_rwsem(&mapping->invalidate_lock);
288: lockdep_set_class_and_name(&mapping->invalidate_lock,
289: &sb->s_type->invalidate_lock_key,
290: "mapping.invalidate_lock");
291: if (sb->s_iflags & SB_I_STABLE_WRITES)
292: mapping_set_stable_writes(mapping);
293: inode->i_private = NULL;
294: inode->i_mapping = mapping;
295: INIT_HLIST_HEAD(&inode->i_dentry); /* buggered by rcu freeing */
296: #ifdef CONFIG_FS_POSIX_ACL
297: inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
298: #endif
299:
300: #ifdef CONFIG_FSNOTIFY
301: inode->i_fsnotify_mask = 0;
302: #endif
303: inode->i_flctx = NULL;
304:
305: if (unlikely(security_inode_alloc(inode, gfp)))
306: return -ENOMEM;
307:
308: this_cpu_inc(nr_inodes);
309:
310: return 0;
311: }
SourceFile:fs/inode.c]
|
| 46/2 |
2026/05/30 00:31 |
llm |
expert |
0m
Model:
Tokens:
input: 53412
output: 36
thoughts: 1783
Thoughts: **Analysis of an Inode Reallocation Vulnerability**
Okay, so here's the breakdown of this potential vulnerability in inode handling. If an attacker can trigger the freeing of an inode and then cause it to be reallocated with another one, there's a potential NULL pointer dereference situation that could lead to a denial of service. The core issue revolves around how the `pick_link` function interacts with the `inode` structure after the reallocation.
Initially, if a freed inode is reallocated (say, by creating a new file), the system sets `inode->i_link` to NULL and `inode->i_op` to `&empty_iops`. Because `empty_iops` has no `get_link` function, `inode->i_op->get_link` will be NULL. Then, `pick_link` attempts to dereference this NULL pointer, resulting in a crash. This means a simple reallocation of the freed inode into a new file can be used to trigger the crash.
The critical question is, can the attacker control the reallocation? Since the `inode_cache` uses a constructor (`inode_init_once`), which implies it's not merged with other caches like `kmalloc`, the attacker can *only* reallocate the freed memory as another `struct inode`. This is an important limitation, because it means we're dealing with a kernel-managed object. It also rules out other exploits that use cache spraying techniques that may target general kernel allocations.
The attacker *could* potentially influence the contents of the reallocated inode by choosing the filesystem to create the new inode in. For example, creating a symlink in a different filesystem, like `tmpfs` or `bpf`, can set the `inode->i_op` to that filesystem's symlink operations and `inode->i_link` to a controlled target.
This is where it gets interesting: if the new inode is a symlink, `pick_link` will read `inode->i_link` to determine the symlink target. This could allow for redirection of a path walk. But this path walk occurs in the attacker's context.
What if the target is another user's path (e.g. root)? This could allow an attacker to make a path follow a symlink to somewhere they don't have access to. However, this is unlikely to provide new privileges, because the attacker could have created the symlink anyway!
So, what about reallocating as a regular file or directory? If a regular file gets allocated to this inode, the `get_link` will be null, and we're back to that NULL pointer dereference and denial of service.
The interesting case is when the new inode is a symlink that uses a `get_link` method instead of the `i_link` pointer, as we see with some file systems. In this case, `get_link` is called with the *old* `dentry` and the *new* `inode`. If `get_link` uses the `inode`, this might work. But if it relies on the `dentry`, there could be confusion because they belong to different filesystems. However, this is unlikely to provide any control flow hijack. It doesn't appear the attacker can inject *arbitrary* data.
The attacker is limited by the fact that the `inode_cache` is isolated. This means spraying methods are out of the picture. The attacker can only place valid `struct inode` objects created by the kernel. The attacker can't forge `inode->i_op`, so the `get_link` function *should* be the one associated with the filesystem of the newly allocated inode (e.g., if it's an ext4 inode, `get_link` should be `ext4_get_link`). The same applies to the `inode->i_link` pointer - it will be either NULL or a valid kernel string.
So, realistically, control flow hijacking is NOT possible, the worst-case scenario is a NULL pointer dereference or type confusion that leads to a crash. Specifically, `get_link` could be confused by being given a `dentry` from the original, freed object's filesystem and the new `inode`. So the real concern is that `get_link` might access `dentry->d_sb` or `dentry->d_fsdata` and get confused. So, the only exploitable issue is likely to be a type confusion, where `get_link` expects a specific inode type but receives another one (though both are valid inodes).
In summary, while there is a potential for NULL pointer dereferences and/or type confusion bugs, due to the nature of the `inode_cache`, control flow hijacking through this vulnerability appears unlikely. The attacker is limited to reallocating a kernel-managed inode, meaning the
|
| 47/2 |
2026/05/30 00:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/shmem.c Name:shmem_get_link]
Results: map[SourceCode:4148: static const char *shmem_get_link(struct dentry *dentry, struct inode *inode,
4149: struct delayed_call *done)
4150: {
4151: struct folio *folio = NULL;
4152: int error;
4153:
4154: if (!dentry) {
4155: folio = filemap_get_folio(inode->i_mapping, 0);
4156: if (IS_ERR(folio))
4157: return ERR_PTR(-ECHILD);
4158: if (PageHWPoison(folio_page(folio, 0)) ||
4159: !folio_test_uptodate(folio)) {
4160: folio_put(folio);
4161: return ERR_PTR(-ECHILD);
4162: }
4163: } else {
4164: error = shmem_get_folio(inode, 0, 0, &folio, SGP_READ);
4165: if (error)
4166: return ERR_PTR(error);
4167: if (!folio)
4168: return ERR_PTR(-ECHILD);
4169: if (PageHWPoison(folio_page(folio, 0))) {
4170: folio_unlock(folio);
4171: folio_put(folio);
4172: return ERR_PTR(-ECHILD);
4173: }
4174: folio_unlock(folio);
4175: }
4176: set_delayed_call(done, shmem_put_link, folio);
4177: return folio_address(folio);
4178: }
SourceFile:mm/shmem.c]
|
| 48/2 |
2026/05/30 00:31 |
llm |
expert |
0m
Model:
Tokens:
input: 56750
output: 39
thoughts: 63
Thoughts: Okay, here's my understanding, thinking through this myself:
**Regarding `shmem_get_link` and Potential Issues**
Alright, so I was looking at `shmem_get_link`. It seems, from what I'm seeing, that it *doesn't* actually use the `dentry` at all, except as a quick check for NULL. Interesting. It's really only working with the `inode` directly, which makes things a lot cleaner in this context. That means, theoretically, it should be able to handle this perfectly fine. It should simply be able to grab the symlink target associated with the `tmpfs` inode, and return it without any trouble. Seems pretty straightforward from the `shmem` side of things.
Now, that's assuming `shmem_get_link` is the whole story. I need to consider the bigger picture. The obvious next question, the one I *really* need to answer before I move forward, is... what about `ext4_get_link`? That's the one I *really* need to focus on next.
|
| 49/2 |
2026/05/30 00:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/symlink.c Name:ext4_get_link]
Results: map[SourceCode: 73: static const char *ext4_get_link(struct dentry *dentry, struct inode *inode,
74: struct delayed_call *callback)
75: {
76: struct buffer_head *bh;
77: char *inline_link;
78:
79: /*
80: * Create a new inlined symlink is not supported, just provide a
81: * method to read the leftovers.
82: */
83: if (ext4_has_inline_data(inode)) {
84: if (!dentry)
85: return ERR_PTR(-ECHILD);
86:
87: inline_link = ext4_read_inline_link(inode);
88: if (!IS_ERR(inline_link))
89: set_delayed_call(callback, kfree_link, inline_link);
90: return inline_link;
91: }
92:
93: if (!dentry) {
94: bh = ext4_getblk(NULL, inode, 0, EXT4_GET_BLOCKS_CACHED_NOWAIT);
95: if (IS_ERR_OR_NULL(bh))
96: return ERR_PTR(-ECHILD);
97: if (!ext4_buffer_uptodate(bh)) {
98: brelse(bh);
99: return ERR_PTR(-ECHILD);
100: }
101: } else {
102: bh = ext4_bread(NULL, inode, 0, 0);
103: if (IS_ERR(bh))
104: return ERR_CAST(bh);
105: if (!bh) {
106: EXT4_ERROR_INODE(inode, "bad symlink.");
107: return ERR_PTR(-EFSCORRUPTED);
108: }
109: }
110:
111: set_delayed_call(callback, ext4_free_link, bh);
112: nd_terminate_link(bh->b_data, inode->i_size,
113: inode->i_sb->s_blocksize - 1);
114: return bh->b_data;
115: }
SourceFile:fs/ext4/symlink.c]
|
| 50/2 |
2026/05/30 00:31 |
llm |
expert |
0m
Model:
Tokens:
input: 57751
output: 21
thoughts: 49
Thoughts: Okay, here's my take on those thoughts, framed as my own:
**Contemplating `get_link` Implementations**
Hmm, interesting observation about `ext4_get_link`. It really just uses the `dentry` to verify if it is NULL. Beyond that, it's all about the `inode`. I've seen a few implementations that are pretty similar, but the reliance on the `inode` here seems pretty consistent, as I'd expect.
I wonder, though, are there any `get_link` implementations, in other filesystems perhaps, that actually lean heavily on the `dentry`? It's making me curious about whether there are different design trade-offs in use, or maybe some particularly unusual file systems, or even some corner cases. I'll need to dig around a bit to see if anything jumps out. It's not a common pattern, at least not that I've seen.
|
| 51/2 |
2026/05/30 00:31 |
tool |
grepper |
0m
Error:
Args: map[Expression:get_link.*dentry->]
Results:
|
| 52/2 |
2026/05/30 00:31 |
llm |
expert |
0m
Model:
Tokens:
input: 58036
output: 23
thoughts: 27
Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, and delivered as a first-person summary:
**Considering `get_link` Implementation Details**
Alright, I'm diving back into this `get_link` function. My initial approach isn't quite clicking, and I need to consider alternative methods of extracting the information I need from this dentry. I'm thinking, perhaps, I should try accessing the superblock through `dentry->d_sb`. That might give me a different angle on the underlying filesystem structure, which could be helpful in resolving the symbolic link. Alternatively, `dentry->d_name` is also worth a shot. The name component could hold valuable clues regarding the target link location, I could use it as another parameter in the lookup. I'm going to start with the former, and work my way down the list.
|
| 53/2 |
2026/05/30 00:31 |
tool |
grepper |
0m
Error:
Args: map[Expression:get_link.*dentry->d_]
Results:
|
| 54/2 |
2026/05/30 00:31 |
llm |
expert |
0m
Model:
Tokens:
input: 58285
output: 41
thoughts: 1588
Thoughts: **Analysis of Potential Kernel Vulnerability in `get_link` Implementation**
Okay, so I've been digging into how `get_link` functions, specifically thinking about potential vulnerabilities. It looks like the standard implementations don't use `dentry` directly, except as a boolean for RCU mode. This is good because it eliminates a whole class of attacks involving mismatched `dentry` structures.
The key thought that sparked my attention was: what if we reallocate the inode as a file that *doesn't* have a `get_link` function associated with it? In that scenario, `inode->i_op->get_link` would be `NULL`. Then in the code:
```c
res = READ_ONCE(inode->i_link);
if (!res) {
get = inode->i_op->get_link;
if (nd->flags & LOOKUP_RCU) {
res = get(NULL, inode, &last->done);
```
the subsequent `get(NULL, inode, &last->done)` call would trigger a classic NULL pointer dereference, which leads to an Oops and potentially DoS (denial of service) via a kernel panic, if `panic_on_oops` is set. Even if `panic_on_oops` is not set, a constant trigger of this will lead to a DoS by resource exhaustion. However, I can't see a clear path to privilege escalation here, it's just a denial of service.
The next thing I considered was whether the attacker can control the contents of the reallocated `inode`. I was wondering if `inode_cache` would have `SLAB_ACCOUNT` enabled, which would let an attacker use something like `msg_msg` to spray. But no, the `msg_msg` is allocated using kmalloc which uses separate kmalloc caches, so I'm not able to merge caches with different constructors, which is the key here. So, `inode_cache` is dedicated to `struct inode` objects. The fields of the `inode` are initialized by `inode_init_always_gfp`. I thought I might be able to control some fields by choosing the filesystem and file type, but I couldn't insert arbitrary pointers into `inode->i_op` or `inode->i_link` as those point to valid kernel structures. So no control flow hijacking here.
Then, I shifted my focus to `security_inode_follow_link`. Specifically:
```c
if (unlikely(IS_PRIVATE(inode)))
return 0;
return call_int_hook(inode_follow_link, dentry, inode, rcu);
```
My reasoning went like this: If the attacker reallocates the inode as a different inode, then `IS_PRIVATE(inode)` will read the new inode's `i_flags`, and if it's not private, then the LSM hook is called. The LSM hook like SELinux will then read `inode->i_security`. So:
```c
static int selinux_inode_follow_link(struct dentry *dentry, struct inode *inode,
bool rcu)
{
const struct cred *cred = current_cred();
struct inode_security_struct *isec;
u32 sid;
if (rcu)
return -ECHILD;
isec = selinux_inode(inode);
```
I suddenly realized that if SELinux is enabled, `selinux_inode_follow_link` returns `-ECHILD` if `rcu` is true! This means that if SELinux is active, the `security_inode_follow_link` will return `-ECHILD`. This means the code path will return `ERR_PTR(-ECHILD)` and drop out of RCU mode. This code then runs again without RCU and reads `dentry->d_inode`.
Here's the interesting part: Because the attacker unlinked the symlink, `dentry->d_inode` might now be NULL! So, the follow-up code will likely return ENOENT (or a similar error) and *not* attempt the UAF read!
```c
if (unlikely(res == ERR_PTR(-ECHILD))) {
res = step_into_slowpath(nd, flags, dentry);
```
If `dentry->d_inode` is NULL:
```c
if (likely(!d_is_symlink(path.dentry)) || ...) {
nd->path = path;
nd->inode = inode; // NULL
nd->seq = nd->next_seq;
return
|
| 55/2 |
2026/05/30 00:31 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:security/apparmor/lsm.c Name:apparmor_inode_follow_link]
Results: map[SourceCode: SourceFile:]
|
| 56/2 |
2026/05/30 00:31 |
llm |
expert |
0m
Model:
Tokens:
input: 60960
output: 44
thoughts: 17
Thoughts: Okay, here's my interpretation of those thoughts, crafted with the understanding that I'm speaking to a fellow expert:
**Addressing a Security Gap**
Hmm, so it seems we're looking at a potential weakness in AppArmor. It doesn't seem to have implemented the `inode_follow_link` operation, or at least, that's what's been identified. Now, that's a key function in handling symbolic links, especially in the context of file access control. Not having explicit control over `inode_follow_link` is a pretty big blind spot. It could leave us vulnerable to unexpected behavior or even exploits that leverage link traversal to access restricted files.
The immediate follow-up question, of course, is what alternatives or mitigations are in place. If AppArmor doesn't handle that precisely, the next immediate thought is to check Smack. Does Smack implement it? If not, then what does it use to manage symbolic links? Are there any significant differences? What's the threat model there? We'll need to dig into the details of Smack's implementation to see if it provides adequate protections or introduces its own complexities. Without a direct equivalent to `inode_follow_link` in AppArmor, or a comparable mechanism in Smack, weβve got a real problem to address and the implications should be fully understood.
|
| 57/2 |
2026/05/30 00:31 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:security/smack/smack_lsm.c Name:smack_inode_follow_link]
Results: map[SourceCode: SourceFile:]
|
| 58/2 |
2026/05/30 00:31 |
llm |
expert |
0m
Model:
Tokens:
input: 61324
output: 41
thoughts: 3
Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience:
**Internal Inquiry: Tomoyo?**
Hmm, "Tomoyo." That single wordβ¦ it immediately brings up a specific set of associations. My mind races. Is this a reference to the anime character, Tomoyo Daidouji? If so, the context would be pivotal β what aspect of her character, her abilities, or her relationships are relevant? Perhaps it's a completely different Tomoyo, maybe someone in my network or a case study I encountered years ago. The question itself is lacking significant details, so I have to begin hypothesizing based on the limited information I have. I need more input: is this related to research, personal contacts, a programming project? The lack of context is frustrating, but it forces me to engage in rapid, critical thinking to narrow down potential avenues of inquiry. It's a bit of an intellectual puzzle, isn't it? Without further data, my response must involve a series of exploratory questions to clarify the intent.
|
| 59/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:security/tomoyo/tomoyo.c Name:tomoyo_inode_follow_link]
Results: map[SourceCode: SourceFile:]
|
| 60/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 61607
output: 19
thoughts: 174
Thoughts: **My Analysis of a Potential UAF Vulnerability**
Okay, so I'm digging into this code and trying to understand a potential use-after-free issue. Let me see... If SELinux is disabled, then the `security_inode_follow_link` function returns 0. That's the baseline, no security checks. Now, `pick_link` moves on to `READ_ONCE(inode->i_link)`. Here's where it gets interesting. If the `inode` structure was freed and *hasn't* been reallocated, then `inode->i_link` is reading from freed memory. That's already a huge red flag.
If KASAN is active, the kernel will detect the use-after-free read immediately and crash, which is great for development but doesn't solve the issue. However, if KASAN is disabled, which is the more likely scenario in production, it'll happily read whatever garbage is in that memory location. And because the memory has been freed, the contents is extremely concerning. It will contain slab freelist pointers!
Aha! If the object is on the slab freelist, then the first 8 bytes (or perhaps the middle 8 bytes depending on the `SLAB_FREELIST_HARDENED` configuration) will contain the freelist pointer. This means the read from the freed memory is likely interpreted as a pointer, not just random garbage. Now, the key question is: Where exactly is `i_link` located within the `struct inode`? That will define what this vulnerable pointer will lead to.
|
| 61/2 |
2026/05/30 00:32 |
tool |
codesearch-struct-layout |
0m
Args:
Results: map[Fields:[map[Name:i_mode OffsetBits:0 SizeBits:16] map[Name:i_opflags OffsetBits:16 SizeBits:16] map[Name:i_flags OffsetBits:32 SizeBits:32] map[Name:i_acl OffsetBits:64 SizeBits:64] map[Name:i_default_acl OffsetBits:128 SizeBits:64] map[Name:i_uid OffsetBits:192 SizeBits:32] map[Name:i_gid OffsetBits:224 SizeBits:32] map[Name:i_op OffsetBits:256 SizeBits:64] map[Name:i_sb OffsetBits:320 SizeBits:64] map[Name:i_mapping OffsetBits:384 SizeBits:64] map[Name:i_security OffsetBits:448 SizeBits:64] map[Name:i_ino OffsetBits:512 SizeBits:64] map[Name: OffsetBits:576 SizeBits:32] map[Name:i_rdev OffsetBits:608 SizeBits:32] map[Name:i_size OffsetBits:640 SizeBits:64] map[Name:i_atime_sec OffsetBits:704 SizeBits:64] map[Name:i_mtime_sec OffsetBits:768 SizeBits:64] map[Name:i_ctime_sec OffsetBits:832 SizeBits:64] map[Name:i_atime_nsec OffsetBits:896 SizeBits:32] map[Name:i_mtime_nsec OffsetBits:928 SizeBits:32] map[Name:i_ctime_nsec OffsetBits:960 SizeBits:32] map[Name:i_generation OffsetBits:992 SizeBits:32] map[Name:i_lock OffsetBits:1024 SizeBits:512] map[Name:i_bytes OffsetBits:1536 SizeBits:16] map[Name:i_blkbits OffsetBits:1552 SizeBits:8] map[Name:i_write_hint OffsetBits:1560 SizeBits:8] map[Name:i_blocks OffsetBits:1600 SizeBits:64] map[Name:i_state OffsetBits:1664 SizeBits:32] map[Name:i_rwsem OffsetBits:1728 SizeBits:1152] map[Name:dirtied_when OffsetBits:2880 SizeBits:64] map[Name:dirtied_time_when OffsetBits:2944 SizeBits:64] map[Name:i_hash OffsetBits:3008 SizeBits:128] map[Name:i_io_list OffsetBits:3136 SizeBits:128] map[Name:i_wb OffsetBits:3264 SizeBits:64] map[Name:i_wb_frn_winner OffsetBits:3328 SizeBits:32] map[Name:i_wb_frn_avg_time OffsetBits:3360 SizeBits:16] map[Name:i_wb_frn_history OffsetBits:3376 SizeBits:16] map[Name:i_lru OffsetBits:3392 SizeBits:128] map[Name:i_sb_list OffsetBits:3520 SizeBits:128] map[Name:i_wb_list OffsetBits:3648 SizeBits:128] map[Name: OffsetBits:3776 SizeBits:128] map[Name:i_version OffsetBits:3904 SizeBits:64] map[Name:i_sequence OffsetBits:3968 SizeBits:64] map[Name:i_count OffsetBits:4032 SizeBits:32] map[Name:i_dio_count OffsetBits:4064 SizeBits:32] map[Name:i_writecount OffsetBits:4096 SizeBits:32] map[Name:i_readcount OffsetBits:4128 SizeBits:32] map[Name: OffsetBits:4160 SizeBits:64] map[Name:i_flctx OffsetBits:4224 SizeBits:64] map[Name:i_data OffsetBits:4288 SizeBits:4032] map[Name: OffsetBits:8320 SizeBits:128] map[Name: OffsetBits:8448 SizeBits:64] map[Name:i_fsnotify_mask OffsetBits:8512 SizeBits:32] map[Name:i_fsnotify_marks OffsetBits:8576 SizeBits:64] map[Name:i_private OffsetBits:8640 SizeBits:64]]]
|
| 62/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 63395
output: 32
thoughts: 44
Thoughts: Okay, here's my interpretation of that thought process, from an expert's perspective:
**Diving into the `i_link` Mystery**
Alright, hang on a second. I see that `i_link` is nestled within an anonymous union. That immediately flags a red flag β a situation like that often necessitates a deeper look at how itβs used to infer its functionality. I need to understand its context. Where am I most likely to find the definition and usage of this? Right, `fs/inode.c` seems like a prime candidate for the implementation details. Alternatively, the header file `include/linux/fs.h` is where the core data structures are defined; Iβll probably find the declaration of that anonymous union there. Let's see whatβs going on... I need to find its origin and purpose.
|
| 63/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/linux/fs.h Name:inode]
Results: map[SourceCode: 762: /*
763: * Keep mostly read-only and often accessed (especially for
764: * the RCU path lookup and 'stat' data) fields at the beginning
765: * of the 'struct inode'
766: */
767: struct inode {
768: umode_t i_mode;
769: unsigned short i_opflags;
770: unsigned int i_flags;
771: #ifdef CONFIG_FS_POSIX_ACL
772: struct posix_acl *i_acl;
773: struct posix_acl *i_default_acl;
774: #endif
775: kuid_t i_uid;
776: kgid_t i_gid;
777:
778: const struct inode_operations *i_op;
779: struct super_block *i_sb;
780: struct address_space *i_mapping;
781:
782: #ifdef CONFIG_SECURITY
783: void *i_security;
784: #endif
785:
786: /* Stat data, not accessed from path walking */
787: u64 i_ino;
788: /*
789: * Filesystems may only read i_nlink directly. They shall use the
790: * following functions for modification:
791: *
792: * (set|clear|inc|drop)_nlink
793: * inode_(inc|dec)_link_count
794: */
795: union {
796: const unsigned int i_nlink;
797: unsigned int __i_nlink;
798: };
799: dev_t i_rdev;
800: loff_t i_size;
801: time64_t i_atime_sec;
802: time64_t i_mtime_sec;
803: time64_t i_ctime_sec;
804: u32 i_atime_nsec;
805: u32 i_mtime_nsec;
806: u32 i_ctime_nsec;
807: u32 i_generation;
808: spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
809: unsigned short i_bytes;
810: u8 i_blkbits;
811: enum rw_hint i_write_hint;
812: blkcnt_t i_blocks;
813:
814: #ifdef __NEED_I_SIZE_ORDERED
815: seqcount_t i_size_seqcount;
816: #endif
817:
818: /* Misc */
819: struct inode_state_flags i_state;
820: /* 32-bit hole */
821: struct rw_semaphore i_rwsem;
822:
823: unsigned long dirtied_when; /* jiffies of first dirtying */
824: unsigned long dirtied_time_when;
825:
826: struct hlist_node i_hash;
827: struct list_head i_io_list; /* backing dev IO list */
828: #ifdef CONFIG_CGROUP_WRITEBACK
829: struct bdi_writeback *i_wb; /* the associated cgroup wb */
830:
831: /* foreign inode detection, see wbc_detach_inode() */
832: int i_wb_frn_winner;
833: u16 i_wb_frn_avg_time;
834: u16 i_wb_frn_history;
835: #endif
836: struct list_head i_lru; /* inode LRU list */
837: struct list_head i_sb_list;
838: struct list_head i_wb_list; /* backing dev writeback list */
839: union {
840: struct hlist_head i_dentry;
841: struct rcu_head i_rcu;
842: };
843: atomic64_t i_version;
844: atomic64_t i_sequence; /* see futex */
845: atomic_t i_count;
846: atomic_t i_dio_count;
847: atomic_t i_writecount;
848: #if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING)
849: atomic_t i_readcount; /* struct files open RO */
850: #endif
851: union {
852: const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
853: void (*free_inode)(struct inode *);
854: };
855: struct file_lock_context *i_flctx;
856: struct address_space i_data;
857: union {
858: struct list_head i_devices;
859: int i_linklen;
860: };
861: union {
862: struct pipe_inode_info *i_pipe;
863: struct cdev *i_cdev;
864: char *i_link;
865: unsigned i_dir_seq;
866: };
867:
868:
869: #ifdef CONFIG_FSNOTIFY
870: __u32 i_fsnotify_mask; /* all events this inode cares about */
871: /* 32-bit hole reserved for expanding i_fsnotify_mask */
872: struct fsnotify_mark_connector __rcu *i_fsnotify_marks;
873: #endif
874:
875: void *i_private; /* fs or device private pointer */
876: } __randomize_layout;
SourceFile:include/linux/fs.h]
|
| 64/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 65447
output: 33
thoughts: 1530
Thoughts: **Analyzing a Potential Use-After-Free Vulnerability in Symlink Handling**
Okay, let's break this down. My initial thought process was: the `i_link` pointer is conveniently located at the very end of the `inode` struct, after a large `address_space` struct. I see its offset is around 1056 bytes, and the slab object size is 1088 bytes. That means the freelist pointer, which usually sits at the beginning or middle of the object, won't overwrite `i_link`. Excellent! This means that `i_link` retains its old value even after the object is freed.
Now, if `i_link` holds its old value post-freeing, then `READ_ONCE(inode->i_link)` is reading an *old* pointer. That old pointer points to the string allocated during `bpf_symlink`. However, `bpf_destroy_inode` *also* `kfree`s the string itself using `kfree(inode->i_link)`. So `READ_ONCE(inode->i_link)` will be returning a pointer to a freed string! The vulnerable function `pick_link` then returns this pointer, and `walk_component` uses it as the path: `name = res;` where `res` is the freed pointer, resulting in `link_path_walk` reading from this freed string. Clearly, it's a Use-After-Free (UAF) of the string.
The string was allocated using `kstrdup` with `GFP_USER`, which makes it attacker-controlled in terms of the string's size. The attacker can control the size of the symlink target. Meaning they can control the string's allocation within different `kmalloc-*` caches, from small to large. They free the string. They can reallocate the string with controlled data using `setxattr` or `msg_msg`. Then `link_path_walk` reads the attacker-controlled string as the path. This allows the attacker to redirect the path walk. But... wait a minute. The attacker *already* controls the symlink target. Creating a symlink pointing to the attacker's path does the same thing. So, no new capabilities gained!
Hold on, is there memory corruption at play here? After analyzing the code, it looks like `link_path_walk` *only* reads the string, until it finds a null terminator. It doesn't write to it. If the string is reallocated, it reads the attacker-controlled data. If it's not reallocated, it reads freed memory, potentially containing a freelist pointer. If the freed memory contains a freelist pointer, it might be interpreted as a path. Since freelist pointers are kernel addresses (or at least obfuscated pointers), they probably won't resolve as a valid path. Essentially, an ENOENT error would be likely. So, no memory corruption, no control flow hijack, and no privilege escalation. It's just a read UAF.
Wait! Let me re-examine the implications around `IS_PRIVATE(inode)`. This uses `inode->i_flags`. Now, `i_flags` is at offset 4 bytes. The freelist pointer might overwrite the initial 8 bytes if it's at offset 0. So, `i_flags` *will* be overwritten by the freelist pointer. So, `IS_PRIVATE` checks `inode->i_flags & S_PRIVATE`. `S_PRIVATE` is bit 7, with a value of 128. If the freelist pointer happens to have this bit set, `IS_PRIVATE` returns true, and `security_inode_follow_link` returns 0. If not, it falls back to a call hook that interacts with LSM and SELinux. Still, no memory corruption.
Okay, is there *any* write UAF here? I've got to carefully consider whether `pick_link` or `step_into_slowpath` are doing any writes to `inode`. I see `atime_needs_update` and it reads `inode->i_flags`. If it decides the atime needs updating it drops out of RCU mode. If this step succeeds, it calls `touch_atime`. *That's* where it gets interesting! `touch_atime` uses `path->dentry->d_inode`. Now, since the `dentry` has been unlinked and `d_delete` called on it, `d_inode` is NULL (negative dentry). With `d_inode` NULL, `touch_atime` will crash with a NULL pointer dereference. We got it! A crash.
|
| 65/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/inode.c Name:touch_atime]
Results: map[SourceCode:2248: void touch_atime(const struct path *path)
2249: {
2250: struct vfsmount *mnt = path->mnt;
2251: struct inode *inode = d_inode(path->dentry);
2252:
2253: if (!atime_needs_update(path, inode))
2254: return;
2255:
2256: if (!sb_start_write_trylock(inode->i_sb))
2257: return;
2258:
2259: if (mnt_get_write_access(mnt) != 0)
2260: goto skip_update;
2261: /*
2262: * File systems can error out when updating inodes if they need to
2263: * allocate new space to modify an inode (such is the case for
2264: * Btrfs), but since we touch atime while walking down the path we
2265: * really don't care if we failed to update the atime of the file,
2266: * so just ignore the return value.
2267: * We may also fail on filesystems that have the ability to make parts
2268: * of the fs read only, e.g. subvolumes in Btrfs.
2269: */
2270: if (inode->i_op->update_time)
2271: inode->i_op->update_time(inode, FS_UPD_ATIME, 0);
2272: else
2273: generic_update_time(inode, FS_UPD_ATIME, 0);
2274: mnt_put_write_access(mnt);
2275: skip_update:
2276: sb_end_write(inode->i_sb);
2277: }
SourceFile:fs/inode.c]
|
| 66/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 68533
output: 33
thoughts: 297
Thoughts: **My Analysis of a Potential Kernel Vulnerability**
Okay, so I'm looking at this `atime_needs_update` function in the file system code, and the first thing that jumps out at me is a potential NULL pointer dereference. If that `inode` pointer is NULL, and we call `atime_needs_update(path, inode)`, the code will try to access `inode->i_flags`, and it's going to crash, plain and simple.
Right, so that's a crash, but let me think, where is `atime_needs_update` being called? Ah, it's called in `pick_link`. If `atime_needs_update` returns `true`, then the code is going to leave RCU mode and call `touch_atime`. This means it will call `touch_atime` with a NULL `inode`. And boom, NULL pointer dereference, a denial-of-service, nothing too exciting.
But hold on, it can be worse. What if `d_delete` hasn't been called yet? Then `d_inode` will still be pointing to the freed inode. I can see the potential for a use-after-free, if we somehow have a race condition. Let's dig deeper: when `touch_atime` calls the inode operations, it could end up calling `inode->i_op->update_time` or `generic_update_time`. If that happens, then we might write to `inode->i_atime_sec` or other similar fields. It would be a read UAF! Wait, the call to `d_delete` *must* happen before `bpf_destroy_inode`, right? I need to go look at `simple_unlink` to check this.
|
| 67/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/libfs.c Name:simple_unlink]
Results: map[SourceCode: 805: int simple_unlink(struct inode *dir, struct dentry *dentry)
806: {
807: __simple_unlink(dir, dentry);
808: d_make_discardable(dentry);
809: return 0;
810: }
SourceFile:fs/libfs.c]
|
| 68/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 69360
output: 34
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Digging into the `__simple_unlink` Function**
Right, let's dive into this `__simple_unlink` function. My initial thought is to understand its role. It's likely a streamlined or optimized version of a core unlinking operation, perhaps specifically designed for a specific file system or a particular edge case, or maybe to bypass some error checking for performance. I need to figure out *why* this is the *simple* version, compared to a potentially more comprehensive or "robust" implementation. Is it optimized for speed at the cost of safety? Or is it part of a layered approach where more sophisticated unlink operations are called only when needed? My priority is to understand the trade-offs at play. Does it deal with hard links differently? What about permissions checks or potential race conditions? Is it thread-safe? The design choices here are key. I need to mentally trace the execution path and identify any potential vulnerabilities that might exist in a "simple" unlink. Let's see what it's doing under the hood.
|
| 69/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/libfs.c Name:__simple_unlink]
Results: map[SourceCode: 787: void __simple_unlink(struct inode *dir, struct dentry *dentry)
788: {
789: struct inode *inode = d_inode(dentry);
790:
791: inode_set_mtime_to_ts(dir,
792: inode_set_ctime_to_ts(dir, inode_set_ctime_current(inode)));
793: drop_nlink(inode);
794: }
SourceFile:fs/libfs.c]
|
| 70/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 69806
output: 34
thoughts: 56
Thoughts: Okay, here's my understanding, thinking through the process as if I were considering these points myself:
**Unlinking and Dentries: A Quick Mental Walkthrough**
Alright, so `simple_unlink`, specifically, is responsible for decreasing the link count of an inode by calling `drop_nlink(inode)`. I've got that part. And it does something else too, it tells the dentry to be discarded, or made discardable, with `d_make_discardable(dentry)`. Interesting. But wait a second, I thought the dentry was *also* supposed to be deleted! That's where things get subtle. It looks like `simple_unlink` *doesn't* actually call `d_delete(dentry)` itself. I need to be careful with that point, it has potential for locking issues. Hmm... *That's* curious. It looks like `vfs_unlink` does the `d_delete` call. Okay, that distinction is important, it helps me understand the overall flow better. I'll need to keep that difference in mind.
|
| 71/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/namei.c Name:vfs_unlink]
Results: map[SourceCode:5447: /**
5448: * vfs_unlink - unlink a filesystem object
5449: * @idmap: idmap of the mount the inode was found from
5450: * @dir: parent directory
5451: * @dentry: victim
5452: * @delegated_inode: returns victim inode, if the inode is delegated.
5453: *
5454: * The caller must hold dir->i_rwsem exclusively.
5455: *
5456: * If vfs_unlink discovers a delegation, it will return -EWOULDBLOCK and
5457: * return a reference to the inode in delegated_inode. The caller
5458: * should then break the delegation on that inode and retry. Because
5459: * breaking a delegation may take a long time, the caller should drop
5460: * dir->i_rwsem before doing so.
5461: *
5462: * Alternatively, a caller may pass NULL for delegated_inode. This may
5463: * be appropriate for callers that expect the underlying filesystem not
5464: * to be NFS exported.
5465: *
5466: * If the inode has been found through an idmapped mount the idmap of
5467: * the vfsmount must be passed through @idmap. This function will then take
5468: * care to map the inode according to @idmap before checking permissions.
5469: * On non-idmapped mounts or if permission checking is to be performed on the
5470: * raw inode simply pass @nop_mnt_idmap.
5471: */
5472: int vfs_unlink(struct mnt_idmap *idmap, struct inode *dir,
5473: struct dentry *dentry, struct delegated_inode *delegated_inode)
5474: {
5475: struct inode *target = dentry->d_inode;
5476: int error = may_delete_dentry(idmap, dir, dentry, false);
5477:
5478: if (error)
5479: return error;
5480:
5481: if (!dir->i_op->unlink)
5482: return -EPERM;
5483:
5484: inode_lock(target);
5485: if (IS_SWAPFILE(target))
5486: error = -EPERM;
5487: else if (is_local_mountpoint(dentry))
5488: error = -EBUSY;
5489: else {
5490: error = security_inode_unlink(dir, dentry);
5491: if (!error) {
5492: error = try_break_deleg(dir, delegated_inode);
5493: if (error)
5494: goto out;
5495: error = try_break_deleg(target, delegated_inode);
5496: if (error)
5497: goto out;
5498: error = dir->i_op->unlink(dir, dentry);
5499: if (!error) {
5500: dont_mount(dentry);
5501: detach_mounts(dentry);
5502: }
5503: }
5504: }
5505: out:
5506: inode_unlock(target);
5507:
5508: /* We don't d_delete() NFS sillyrenamed files--they still exist. */
5509: if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) {
5510: fsnotify_unlink(dir, dentry);
5511: } else if (!error) {
5512: fsnotify_link_count(target);
5513: d_delete_notify(dir, dentry);
5514: }
5515:
5516: return error;
5517: }
SourceFile:fs/namei.c]
|
| 72/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 71248
output: 33
thoughts: 239
Thoughts: **My Analysis of the `vfs_unlink` Path**
Okay, let's break this down. `vfs_unlink` triggers `d_delete_notify(dir, dentry)`. That much is clear. `d_delete_notify` then kicks off `d_delete(dentry)`. This is where it gets interesting. I need to understand the sequencing and impact.
The code snippet shows `d_delete` appears to set `dentry->d_inode = NULL` if the dentry has an associated inode and it's not a directory. My initial thought was: hold on, this looks like itβs dropping the inode reference, but isn't that a problem? The unlink operation, as I recall, happens *before* `d_delete`. Specifically, `dir->i_op->unlink` is called first, which subsequently decrements the `nlink` count.
My mental model is that when `nlink` hits zero, the inode should be evicted when the last reference is dropped. This is a crucial point. If `d_delete` were to directly drop the reference too early, we could have a race condition or premature inode eviction.
Wait a second⦠No. `d_delete` doesn't *just* set `dentry->d_inode = NULL`. I need to look closer. `d_delete` actually calls `dentry_unlink_inode(dentry)`, which then, importantly, calls `iput(inode)`. Right, that's it! `iput(inode)` is called *inside* `d_delete`. That makes all the difference. That handles the decrement of the inode's reference count. Excellent. This makes perfect sense; `iput` takes care of the final reference drop and eviction when the link count is zero. Okay, let's just confirm the code in `d_delete` to be certain.
|
| 73/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/dcache.c Name:d_delete]
Results: map[SourceCode:2584: void d_delete(struct dentry * dentry)
2585: {
2586: struct inode *inode = dentry->d_inode;
2587:
2588: spin_lock(&inode->i_lock);
2589: spin_lock(&dentry->d_lock);
2590: /*
2591: * Are we the only user?
2592: */
2593: if (dentry->d_lockref.count == 1) {
2594: if (dentry_negative_policy)
2595: __d_drop(dentry);
2596: dentry->d_flags &= ~DCACHE_CANT_MOUNT;
2597: dentry_unlink_inode(dentry);
2598: } else {
2599: __d_drop(dentry);
2600: spin_unlock(&dentry->d_lock);
2601: spin_unlock(&inode->i_lock);
2602: }
2603: }
SourceFile:fs/dcache.c]
|
| 74/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 72242
output: 36
thoughts: 121
Thoughts: Okay, here's my interpretation of this logic, phrased as a personal thought process:
**Dentry Unlinking Logic β Clarification**
Right, so `d_delete` is the critical function here. It only calls `dentry_unlink_inode(dentry)` if and only if the reference count on the dentry, specifically `dentry->d_lockref.count`, is exactly 1. I'm focusing on that precise condition. Now, my initial thought was that if the count was greater than one, perhaps due to an RCU path walk or some other concurrent operation, the unlink wouldn't happen.
However, I've just had a clarifying thought - wait, RCU path walks *do not* increment `d_lockref.count`! That's the whole point of RCU. So, if we are dealing with an RCU path walk then count *will* be 1. It's a completely safe read.
Therefore, because the count *will* be 1, `dentry_unlink_inode(dentry)` gets called, as expected, to actually remove the underlying inode. That clears up the confusion.
|
| 75/2 |
2026/05/30 00:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/dcache.c Name:dentry_unlink_inode]
Results: map[SourceCode: 446: /*
447: * Release the dentry's inode, using the filesystem
448: * d_iput() operation if defined.
449: */
450: static void dentry_unlink_inode(struct dentry * dentry)
451: __releases(dentry->d_lock)
452: __releases(dentry->d_inode->i_lock)
453: {
454: struct inode *inode = dentry->d_inode;
455:
456: raw_write_seqcount_begin(&dentry->d_seq);
457: __d_clear_type_and_inode(dentry);
458: hlist_del_init(&dentry->d_alias);
459: /*
460: * dentry becomes negative, so the space occupied by ->d_alias
461: * belongs to ->waiters now; we could use __hlist_del() instead
462: * of hlist_del_init(), if not for the stunt pulled by nfs
463: * dummy root dentries - positive dentry *not* included into
464: * the alias list of its inode. Open-coding hlist_del_init()
465: * and removing zeroing would be too clumsy...
466: */
467: dentry->waiters = NULL;
468: raw_write_seqcount_end(&dentry->d_seq);
469: spin_unlock(&dentry->d_lock);
470: spin_unlock(&inode->i_lock);
471: if (!inode->i_nlink)
472: fsnotify_inoderemove(inode);
473: if (dentry->d_op && dentry->d_op->d_iput)
474: dentry->d_op->d_iput(dentry, inode);
475: else
476: iput(inode);
477: }
SourceFile:fs/dcache.c]
|
| 76/2 |
2026/05/30 00:32 |
llm |
expert |
0m
Model:
Tokens:
input: 73226
output: 44
thoughts: 2203
Thoughts: **Analyzing a Potential Race Condition in the Kernel's RCU Path Walk**
Alright, let's break this down. It seems we have a tricky race condition here involving how the kernel handles RCU-protected path walks and inode unlinking. The core issue revolves around `dentry_unlink_inode`, `pick_link`, and the `dentry->d_seq` sequence counter.
My initial thought is, when `dentry_unlink_inode` clears the dentry and frees the inode, it increments `dentry->d_seq` *before* the inode is truly gone. This sequence counter modification is designed for RCU synchronization. Now, `pick_link`, crucial in resolving symbolic links, checks this `d_seq` *at the beginning* to ensure the dentry hasn't been modified since a previous read (using `read_seqcount_retry`). If the dentry *has* been modified, it returns an error, preventing us from continuing the walk down that path.
However, the syzbot report throws a wrench into this. The stack trace points towards a potential UAF in `security_inode_follow_link`, called within `pick_link`. This means somehow, the RCU mechanism designed to protect us has failed. I need to understand what has gone wrong.
I'm starting to see the flaw: the RCU protection is broken because of `bpf_destroy_inode`, which uses `free_inode_nonrcu`. `free_inode_nonrcu` calls `free_inode` with `GFP_ATOMIC`, and this frees the inode memory immediately, violating the RCU guarantee, and the RCU path walk access this freed memory.
So, the race is:
1. `pick_link` calls `read_seqcount_retry`, checking the value of `dentry->d_seq`.
2. `dentry_unlink_inode` runs, which increments `dentry->d_seq`.
3. `read_seqcount_retry` *succeeds*, because it only compares the current `d_seq` against the one read previously, and it hasn't changed.
4. `pick_link` proceeds, and `security_inode_follow_link` (and others) will use the now-freed `inode` pointer.
This is a TOCTOU (Time-of-Check-to-Time-of-Use) vulnerability. The RCU's intent to protect the inode has been circumvented because the `bpf_destroy_inode` frees the inode immediately, before the RCU grace period is over.
Now, the important question: Can this be exploited?
* We can reliably trigger the UAF with the unlink/path walk race.
* The UAF read occurs in `security_inode_follow_link`. If SELinux is disabled, it reads the symlink's `i_link` field. This can then either leak kernel memory (if the inode isn't re-allocated) or crash the kernel.
* If `inode->i_link` is NULL (i.e., a regular file) it calls `inode->i_op->get_link`. This can result in a NULL pointer dereference, causing a DoS.
* Additionally, if `atime_needs_update` is true, then `touch_atime` will cause a UAF (NULL pointer dereference).
Can we escalate this to memory corruption or control flow hijack? I believe that hijacking is highly unlikely. We can't control the `i_op` in a meaningful way because the only thing we can control is how the freed inode is reallocated. We can't place arbitrary pointers into `i_op` because it's initialized from known `inode_operations` structures.
Can we corrupt memory? I'm not convinced. The analysis so far indicates writes to the freed `inode` memory are unlikely. `touch_atime`'s write is safe because `d_inode` will either point to a valid inode or will be NULL; it won't point to a freed inode. Similarly, the LSM hooks in `inode_follow_link` don't seem to offer write primitives.
In conclusion, this is a DoS vulnerability. It's a textbook race condition circumventing RCU protections due to the immediate freeing of the inode. Although it's unlikely to lead to control flow hijack, it will crash the kernel. This is a significant issue.
|
| 77/2 |
2026/05/30 00:33 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:security/smack/smack_lsm.c Name:smack_inode_follow_link]
Results: map[SourceCode: SourceFile:]
|
| 78/2 |
2026/05/30 00:33 |
llm |
expert |
0m
Model:
Tokens:
input: 76453
output: 39
thoughts: 2986
Thoughts: **Analysis of a Potential Use-After-Free Vulnerability in `inode_follow_link`**
Okay, so I'm diving into this `inode_follow_link` thing, and it looks like there *might* be a UAF here. First off, I'm dismissing Smack and looking at IMA/EVM, but they don't seem to hook `inode_follow_link`. BPF LSM does, though. If a BPF LSM program's attached to `inode_follow_link`, it gets the `inode` pointer. But the problem is that BPF LSM programs are tracing programs; they can read, but typically can't *write* kernel memory without helpers, which aren't available in this context. And the verifier definitely blocks writing to the `inode` in an LSM program, so that's a dead end.
Then I checked `pick_link` and `step_into_slowpath`, the function that handles symlink resolution, to see if there's any other way to write to the `inode`. In `pick_link`, the code looks like this: if `try_to_unlazy` succeeds, it might use the freed inode. Okay, so if `try_to_unlazy` drops out of RCU mode, it *could* be using a freed inode, if the inode got freed and reallocated in the time between the original `inode` dereference and the call to `get()`. Specifically, if `try_to_unlazy` succeeded, then the `get` method of the freed inode is called! If `get` is shmem_get_link, it uses the inode. It might update inode->i_mapping or similar. But if the inode was reallocated as another type of inode like `ext4`, there would be a type confusion! But, wait, that can't happen, because the `get` method is actually fetched from the same inode. So if the inode gets reallocated, the `inode->i_op->get_link` pointer is the right type.
So no type confusion here. The only thing that *could* be wrong is if the `inode` wasn't reallocated after being freed. In that case, `inode->i_op` reads from freed memory, and if that memory contains a freelist pointer, `get` ends up being a garbage pointer, causing a jump to a garbage address! But `i_op` is located at offset 32 bytes in `struct inode` and so isn't overwritten. So the old value is `&simple_symlink_inode_operations`, so `get` will be `simple_get_link`, which returns `inode->i_link`. The interesting part is that `bpf_destroy_inode` *kfree*s `inode->i_link` but *doesn't* set it to NULL, so `READ_ONCE(inode->i_link)` will return the old (freed) pointer! Thus the `get_link` will *not* be called. It will just return the freed pointer.
If an attacker reallocates the inode and sets `i_link` to NULL, then `get_link` is called. But it's valid, because the `inode` is valid at that point. If they reallocate it, and it has `i_link != NULL`, it returns the *new* valid string. So, a UAF only happens if the `inode` is *not* reallocated. In this case, `READ_ONCE(inode->i_link)` reads the freed string, `pick_link` returns the freed pointer, `link_path_walk` reads the freed string. So, it's a read UAF of the inode, and a read UAF of the string, but *only* read, no corruption. No control flow hijack, no privilege escalation.
But can this read-only UAF become an exploit? If `link_path_walk` reads the freed string, and the attacker reallocates the string, they control the path walk. However, they already control the symlink target. So that doesn't help. If they reallocate the string with non-null-terminated data, `link_path_walk` reads out of bounds, potentially a crash (DoS).
What about `try_to_unlazy`? If it's called, it drops out of RCU mode, and the code uses the freed inode. However, `try_to_unlazy_next` ultimately calls `unlazy_walk`. Because `dentry_unlink_inode` increased the d_seq count, `read_seqcount_retry` will retry and fail. So it will detect the sequence change and abort the path walk! It won't even use the freed
|
| 79/2 |
2026/05/30 00:33 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_file_iops]
Results: map[SourceCode: SourceFile:]
|
| 80/2 |
2026/05/30 00:33 |
llm |
expert |
0m
Model:
Tokens:
input: 80524
output: 39
thoughts: 22
Thoughts: Here's my thought process, as if I were considering this myself:
**Investigating `i_op` in the BPF Filesystem**
Okay, so I'm diving into the `bpf` filesystem, and I need to figure out how `i_op` behaves with a regular file. Specifically, I want to understand what the function pointers within the `i_op` structure are set to when dealing with a regular file within this context. I'll need to trace the initialization path and see what handlers are plugged in. I'm already pretty familiar with the general kernel VFS structure, so this should just be a matter of isolating the relevant code paths within the `bpf` filesystem's implementation. Essentially, I'm trying to determine the specific operations (e.g., read, write, open, close) that the BPF filesystem defines for regular files and how it leverages these operations to interact with BPF programs. I expect there to be some interesting interaction with BPF program execution and data access here.
|
| 81/2 |
2026/05/30 00:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_mkobj_ops]
Results: map[SourceCode: 328: static int bpf_mkobj_ops(struct dentry *dentry, umode_t mode, void *raw,
329: const struct inode_operations *iops,
330: const struct file_operations *fops)
331: {
332: struct inode *dir = dentry->d_parent->d_inode;
333: struct inode *inode = bpf_get_inode(dir->i_sb, dir, mode);
334: if (IS_ERR(inode))
335: return PTR_ERR(inode);
336:
337: inode->i_op = iops;
338: inode->i_fop = fops;
339: inode->i_private = raw;
340:
341: bpf_dentry_finalize(dentry, inode, dir);
342: return 0;
343: }
SourceFile:kernel/bpf/inode.c]
|
| 82/2 |
2026/05/30 00:33 |
llm |
expert |
0m
Model:
Tokens:
input: 81090
output: 56
thoughts: 34
Thoughts: Okay, here's my interpretation of that thought process, from an expert's perspective:
**Diving into BPF Object Operations**
Right, so I'm digging into `bpf_mkobj_ops`. It's pretty straightforward, the function's job is to hook up the inode operations (`i_op`) for a BPF map or program. The key question that pops into my head is, "Okay, which `iops` are being assigned here?" That's the critical piece. What specific set of inode operations are we talking about when it comes to a BPF map or program? We need to know this to really understand how these BPF objects interact with the filesystem layer. I need to refresh myself, are they standard file operations? Do we have our own bespoke set? This is where the magic happens, at the interface! Gotta remember exactly how the iops implement the BPF object's interaction with the filesystem.
|
| 83/2 |
2026/05/30 00:33 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:kernel/bpf/inode.c IncludeSnippetLines:0 Name:bpf_mkobj_ops SourceTreePrefix:kernel/bpf]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:bpf_iter_link_pin_kernel SourceFile:kernel/bpf/inode.c SourceLine:425] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:bpf_mklink SourceFile:kernel/bpf/inode.c SourceLine:364] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:bpf_mkmap SourceFile:kernel/bpf/inode.c SourceLine:355] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:bpf_mkprog SourceFile:kernel/bpf/inode.c SourceLine:347]] TruncatedOutput:false]
|
| 84/2 |
2026/05/30 00:33 |
llm |
expert |
0m
Model:
Tokens:
input: 81604
output: 37
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 `bpf_mkprog`**
Right, let's get down to brass tacks. Time to take a look at `bpf_mkprog`. I want to dive into this. Need to see what's really happening under the hood. I know the basics, the high-level idea, but I want to get granular. What are the specific implementation details, the edge cases they've accounted for, and the optimization strategies. Let's see how they're handling program creation, verification (I *really* want to see the verification intricacies), and any potential limitations. Always good to refresh, and perhaps uncover something new.
|
| 85/2 |
2026/05/30 00:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_mkprog]
Results: map[SourceCode: 345: static int bpf_mkprog(struct dentry *dentry, umode_t mode, void *arg)
346: {
347: return bpf_mkobj_ops(dentry, mode, arg, &bpf_prog_iops,
348: &bpffs_obj_fops);
349: }
SourceFile:kernel/bpf/inode.c]
|
| 86/2 |
2026/05/30 00:33 |
llm |
expert |
0m
Model:
Tokens:
input: 81945
output: 39
thoughts: 13
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience and written in the first person:
**Investigating `bpf_prog_iops`**
Okay, so I'm thinking, let's dive into `bpf_prog_iops`. I've been seeing some interesting behavior recently, and I suspect there might be something happening related to the underlying program operations, or perhaps some interaction with the vfs layer. I need to refresh my understanding of how this structure is utilized and ensure there aren't any gotchas I'm overlooking in my current investigations. Specifically, I'm concerned about the interactions with potentially non-standard eBPF programs, or maybe the handling of specific attach types and their influence on the IO path. Let's see if there's any odd concurrency, race conditions, or memory management concerns associated with this data structure, I've got to ensure the code surrounding it holds up.
|
| 87/2 |
2026/05/30 00:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/bpf/inode.c Name:bpf_prog_iops]
Results: map[SourceCode: 98: static const struct inode_operations bpf_prog_iops = { };
SourceFile:kernel/bpf/inode.c]
|
| 88/2 |
2026/05/30 00:33 |
llm |
expert |
0m
Model:
Tokens:
input: 82249
output: 21
thoughts: 1813
Thoughts: **Vulnerability Analysis: NULL Pointer Dereference in BPF Filesystem**
Okay, so here's what I've got. The `bpf_prog_iops` struct is empty, which means the `get_link` function pointer is NULL. The core of this issue lies in the way symlinks are handled in the BPF filesystem. If an attacker can reallocate a freed symlink inode as a BPF program inode by pinning a BPF program, then `inode->i_op` will be set to `&bpf_prog_iops`. Consequently, `inode->i_link` is initialized to NULL. The critical point is that `pick_link` will attempt to read `inode->i_op->get_link`, which resolves to NULL. Then, it will dereference the NULL function pointer and causes a kernel oops.
The key question is whether an unprivileged user can trigger this. Initially, I thought that if `/sys/fs/bpf` was mounted and accessible, then they could. However, I need to revisit the ability to mount in a user namespace. Let me check the code again.
Right, the code in `bpf_fill_super` checks for `CAP_SYS_ADMIN` using `capable(CAP_SYS_ADMIN)`. If it is NOT the `init_user_ns`, this check is performed. Since an unprivileged user creating a user namespace won't have `CAP_SYS_ADMIN` in `init_user_ns`, the mounting will fail with `-EPERM`. This is a crucial detail! So, they can't mount it themselves, they'd have to use an already mounted `bpf` fs.
Is `/sys/fs/bpf` mounted by default? Yes, systemd mounts it. What are its permissions? Typically `0700` is the default. This is restrictive. Running `ls -ld /sys/fs/bpf` on a standard Linux system confirms this. This means unprivileged users cannot create symlinks or pin programs there. However, it is possible that an administrator could manually change the permissions. I need to keep that in mind but evaluate this with the default configurations.
The syzbot reproducer uses `fsopen("bpf")` and `fsmount()`. It doesn't use the default `/sys/fs/bpf` but mounts a new instance. Wait, syzkaller runs as root! It can mount it. Can an unprivileged user do the same? Remember that an unprivileged user creates a user namespace. The check in `bpf_fill_super` will prevent that due to the `CAP_SYS_ADMIN` requirements. An unprivileged user is blocked from mounting the bpf filesystem.
If unprivileged, `fsopen` would fail because it needs `CAP_SYS_ADMIN` in the current user namespace. If I created a new user namespace, `fsopen("bpf")` would call `bpf_init_fs_context`. Then `fsconfig` will call `bpf_fill_super`. In `bpf_fill_super`, since it is a NEW user namespace, it calls `capable(CAP_SYS_ADMIN)`. Since unprivileged in `init_user_ns`, this returns `FALSE`. Therefore, it returns `-EPERM`.
So, the conclusion is that an unprivileged user CANNOT mount `bpf` fs in *any* way! This is a very strong protection. The vulnerability is NOT accessible from unprivileged processes or user namespaces. It is only accessible to processes with `CAP_SYS_ADMIN` in `init_user_ns` i.e., root. So, this isn't a *security* vulnerability in terms of privilege escalation; root already has all the privileges. It could be a denial-of-service, but root can already DoS.
Can an unprivileged user use `bpf()` syscall to create the symlink? No, `bpf_symlink` is only called by `vfs_symlink` (the `symlink` syscall). The unprivileged users can not call it because they do not have the ability to create it.
Let me double check if `capable(CAP_SYS_ADMIN)` is the only check. Even if `unprivileged_bpf_disabled` is `0`, `CAP_SYS_ADMIN` is required if mounting in a new user namespace. What if root created a directory with different permissions? If root explicitly granted access, yes, an unprivileged user could. But, by default, `/sys/fs/bpf` is `0700`.
Okay, is there any other filesystem that uses the same `free_inode_nonrcu(inode)` calls after calling a BPF functions? The vulnerability stems from this `free_inode_nonrcu
|
| 89/2 |
2026/05/30 00:34 |
tool |
grepper |
0m
Args: map[Expression:free_inode_nonrcu]
Results: map[Output:Documentation/filesystems/porting.rst=823=Rules for inode destruction:
--
Documentation/filesystems/porting.rst-827- * combination of NULL ->destroy_inode and NULL ->free_inode is
Documentation/filesystems/porting.rst:828: treated as NULL/free_inode_nonrcu, to preserve the compatibility.
Documentation/filesystems/porting.rst-829-
--
fs/configfs/mount.c=30=static void configfs_free_inode(struct inode *inode)
--
fs/configfs/mount.c-33- kfree(inode->i_link);
fs/configfs/mount.c:34: free_inode_nonrcu(inode);
fs/configfs/mount.c-35-}
--
fs/inode.c=312=EXPORT_SYMBOL(inode_init_always_gfp);
fs/inode.c-313-
fs/inode.c:314:void free_inode_nonrcu(struct inode *inode)
fs/inode.c-315-{
--
fs/inode.c-317-}
fs/inode.c:318:EXPORT_SYMBOL(free_inode_nonrcu);
fs/inode.c-319-
fs/inode.c=320=static void i_callback(struct rcu_head *head)
--
fs/inode.c-325- else
fs/inode.c:326: free_inode_nonrcu(inode);
fs/inode.c-327-}
--
fs/pipe.c=1454=static const struct super_operations pipefs_ops = {
fs/pipe.c:1455: .destroy_inode = free_inode_nonrcu,
fs/pipe.c-1456- .statfs = simple_statfs,
--
include/linux/fs.h=3017=extern struct inode *new_inode(struct super_block *sb);
include/linux/fs.h:3018:extern void free_inode_nonrcu(struct inode *inode);
include/linux/fs.h-3019-extern int setattr_should_drop_suidgid(struct mnt_idmap *, struct inode *);
--
kernel/bpf/inode.c=765=static void bpf_destroy_inode(struct inode *inode)
--
kernel/bpf/inode.c-772- bpf_any_put(inode->i_private, type);
kernel/bpf/inode.c:773: free_inode_nonrcu(inode);
kernel/bpf/inode.c-774-}
--
security/apparmor/apparmorfs.c=223=static void aafs_free_inode(struct inode *inode)
--
security/apparmor/apparmorfs.c-226- kfree(inode->i_link);
security/apparmor/apparmorfs.c:227: free_inode_nonrcu(inode);
security/apparmor/apparmorfs.c-228-}
--
security/inode.c=30=static void securityfs_free_inode(struct inode *inode)
--
security/inode.c-33- kfree_const(inode->i_link);
security/inode.c:34: free_inode_nonrcu(inode);
security/inode.c-35-}
]
|
| 90/2 |
2026/05/30 00:34 |
llm |
expert |
0m
Model:
Tokens:
input: 85961
output: 38
thoughts: 123
Thoughts: **Examining `configfs_free_inode`**
Okay, let's take a look at `configfs_free_inode`. Ah, right, `configfs` deals with symlinks, so that `kfree(inode->i_link)` makes perfect sense, freeing the allocated memory for the symbolic link target. Then it calls `free_inode_nonrcu` which I assume is standard practice. Now, I need to make sure I understand how this function is *used*. Is `configfs_free_inode` assigned to the `.free_inode` inode operation, or is it `.destroy_inode`? Or both? I need to clarify that. Right, time to check `configfs_s_ops` and figure out where this function is actually plugged into the filesystem operations.
|
| 91/2 |
2026/05/30 00:34 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:fs/configfs/mount.c Name:configfs_s_ops]
Results: map[SourceCode: SourceFile:]
|
| 92/2 |
2026/05/30 00:34 |
llm |
expert |
0m
Model:
Tokens:
input: 86313
output: 55
thoughts: 14
Thoughts: Here's my thought process, as if I were considering this myself:
**Investigating `configfs_free_inode` References**
Alright, time to dig into this. My first thought is to check every single instance where `configfs_free_inode` is referenced in the code. I need to understand how it's being used, particularly its entry points, its context, and any potential side effects. I want to see if there are any obvious red flags, like calls that might be mishandling resources or perhaps are unexpectedly complex. I'm looking for where this function gets invoked and how the arguments are passed. Is there any possibility of a double free, or memory corruption here? This is the usual suspects kind of stuff. I'm going to scan the source, grep through, and maybe even use a static analyzer if necessary to make sure I get a good, comprehensive overview of this function's role. Essentially, I need to build a mental map of this function's behavior within the broader `configfs` framework.
|
| 93/2 |
2026/05/30 00:34 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:fs/configfs/mount.c IncludeSnippetLines:0 Name:configfs_free_inode SourceTreePrefix:fs/configfs]
Results: map[References:<nil> TruncatedOutput:false]
|
| 94/2 |
2026/05/30 00:34 |
llm |
expert |
0m
Model:
Tokens:
input: 86616
output: 38
thoughts: 25
Thoughts: Here's my thought process, summarized as if I were considering this myself:
**Investigating a Potential Memory Leak in configfs**
Okay, hold on a second. Before I get too deep into this memory leak hunt, I need to make absolutely sure I've ruled out the obvious first. Let me just double-check that `configfs_free_inode` function in `fs/configfs/mount.c`. It's a key spot for inode management within the configfs implementation, and a common place for subtle leaks to hide if resource cleanup isn't done correctly during unmounting or inode destruction. I really should confirm that the inode freeing is handled properly there, ensuring we're not inadvertently leaving dangling references or allocated memory behind. This is a crucial first step; I'd rather catch something simple early than go on a wild goose chase.
|
| 95/2 |
2026/05/30 00:34 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/configfs/mount.c Name:configfs_free_inode]
Results: map[SourceCode: 30: static void configfs_free_inode(struct inode *inode)
31: {
32: if (S_ISLNK(inode->i_mode))
33: kfree(inode->i_link);
34: free_inode_nonrcu(inode);
35: }
SourceFile:fs/configfs/mount.c]
|
| 96/2 |
2026/05/30 00:34 |
llm |
expert |
0m
Model:
Tokens:
input: 86974
output: 20
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Assessment of Application**
Alright, so the initial prompt is pretty straightforward. My first instinct, given my experience, is to immediately assess the *scope* of the subject being discussed. The statement, on its own, is vague. My expertise naturally leads me to ask myself, "Where exactly is 'it' used? What contexts are we considering?" I'm mentally cataloging the potential applications, the relevant industries, or perhaps the specific methodologies involved. It's a quick, internal scan to determine the *relevant* knowledge base I should be drawing upon. Essentially, I need to know the domain before I can provide any meaningful insight.
|
| 97/2 |
2026/05/30 00:34 |
tool |
grepper |
0m
Args: map[Expression:configfs_free_inode]
Results: map[Output:fs/configfs/mount.c=27=static int configfs_mnt_count = 0;
--
fs/configfs/mount.c-29-
fs/configfs/mount.c:30:static void configfs_free_inode(struct inode *inode)
fs/configfs/mount.c-31-{
--
fs/configfs/mount.c=37=static const struct super_operations configfs_ops = {
--
fs/configfs/mount.c-39- .drop_inode = inode_just_drop,
fs/configfs/mount.c:40: .free_inode = configfs_free_inode,
fs/configfs/mount.c-41-};
]
|
| 98/2 |
2026/05/30 00:34 |
llm |
expert |
0m
Model:
Tokens:
input: 87350
output: 33
thoughts: 5298
Thoughts: **Analysis of the BPF Filesystem Inode Freeing Vulnerability**
Okay, so I've been digging into this inode freeing issue in the BPF filesystem (`bpffs`). The key seems to be how inodes are destroyed. I see that the `configfs` uses RCU correctly, setting `.free_inode` which triggers the `call_rcu` in `destroy_inode`. Other filesystems like `securityfs` and `aafs` also follow this pattern, which is good.
However, `bpffs` is different. It's using `.destroy_inode = bpf_destroy_inode` and *not* `.free_inode`, which means it doesn't use RCU by default. `bpf_destroy_inode` calls `free_inode_nonrcu` directly, which skips the RCU protection. This is the root cause. This is because `bpf_any_put` might sleep or take locks, which are unsafe in an RCU callback. They should use `.destroy_inode` to do blocking work and then set `.free_inode` to `free_inode_nonrcu`!
The consequence of this is a potential Use-After-Free (UAF) issue. A process can start a path walk, and while the kernel is traversing a symlink, the symlink is unlinked, resulting in a use-after-free read on the `inode` data. The bug is triggered when using `stat` on a symlink.
I've checked the BPF filesystem code, and because of the hardcoded security checks, it appears that unprivileged users *cannot* mount `bpffs`. The mount operation requires `CAP_SYS_ADMIN` in the `init_user_ns`. The default `/sys/fs/bpf` directory also has restrictive permissions (0700). Even if a container runtime mounts it, the user inside the container needs `CAP_SYS_ADMIN` in `init_user_ns` to do so.
Even if an unprivileged user gets access to `bpffs`, the exploit is not trivial. An unprivileged user creates a symlink to another destination, starts a path walk on it, and unlinks it. Then, `link_path_walk` tries to read `inode->i_link`, while that `inode` has already been freed. This results in a NULL pointer dereference. This would allow an attacker to cause a DoS (Denial of Service). This bug is not directly exploitable for privilege escalation.
I also considered if the inode could be reallocated as a BPF map. But the iops are empty, so that doesn't provide a direct path to privilege escalation. Furthermore, if a map is unpinned, it calls `bpf_destroy_inode` and leads to the same issue.
The conclusion is this: the vulnerability is a DoS, specifically triggered by a symlink UAF in `bpffs`. The bug is not exploitable for privilege escalation and is not accessible by default to unprivileged users, user namespaces, or any other remote or peripheral trigger. It's really only a root-level DoS vulnerability.
|
| 99/2 |
2026/05/30 00:35 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/socket.c Name:sockfs_ops]
Results: map[SourceCode: 385: static const struct super_operations sockfs_ops = {
386: .alloc_inode = sock_alloc_inode,
387: .free_inode = sock_free_inode,
388: .evict_inode = sock_evict_inode,
389: .statfs = simple_statfs,
390: };
SourceFile:net/socket.c]
|
| 100/2 |
2026/05/30 00:35 |
llm |
expert |
0m
Model:
Tokens:
input: 93487
output: 66
thoughts: 942
Thoughts: **Analyzing the bpffs Filesystem Inode Management**
Okay, let's break this down. It seems the issue revolves around how `bpffs` handles inode destruction, specifically symlinks, in relation to RCU (Read-Copy-Update). My initial thought was that `bpffs` was unique in its use of `free_inode_nonrcu` for symlinks, while other filesystems like `sockfs`, `configfs`, `securityfs`, and `apparmorfs` all seemingly used RCU, either directly or indirectly, through their respective `.free_inode` handlers. However, `configfs`, `securityfs`, and `apparmorfs` all use RCU, even if they call `free_inode_nonrcu` in their `.free_inode` implementation. So, it really is only `bpffs` that stands out.
The real problem lies in `bpffs` using `.destroy_inode` and `free_inode_nonrcu`. I had to confirm this. After confirming, the fix should be to change `bpf_super_ops` to use `.free_inode` instead of `.destroy_inode`, or to use `call_rcu` in `bpf_destroy_inode`.
But then, I remembered `bpf_destroy_inode` calls `bpf_any_put`, and if that function sleeps, it can't be called from an RCU callback. Therefore, `.destroy_inode` *must* be used, but the inode itself should still be freed via RCU. I got it: use `.free_inode = free_inode_nonrcu` after the `bpf_any_put` to ensure the inode is freed via RCU.
Okay, let's analyze if this is possible. If `.free_inode = free_inode_nonrcu` is set, `destroy_inode` is still going to be called, which means the following should be done:
1. `ops->destroy_inode(inode)` is called
2. `inode->free_inode = ops->free_inode;`
3. `call_rcu(&inode->i_rcu, i_callback);`
In this case, `bpf_destroy_inode` should *not* call `free_inode_nonrcu`. It should only call `bpf_any_put` and `kfree(inode->i_link)`.
But wait! `kfree(inode->i_link)` immediately frees the string pointed to by `i_link`! This means `READ_ONCE(inode->i_link)` will be reading freed memory. So `kfree(inode->i_link)` also needs to be delayed via RCU! Or, we could just clear `inode->i_link`.
If we clear `inode->i_link` to `NULL`, `READ_ONCE` will return NULL. Then, `pick_link` will call `get_link`. For `bpffs` symlinks, `get_link` is `simple_get_link`, which just returns `inode->i_link` which is now NULL. `pick_link` will then return NULL, which causes the path walk to stop. This is fine and safe.
This is fine, but many filesystems use `simple_symlink_inode_operations`. That means if `i_link` is freed, it must be done via RCU, or the filesystem should use `simple_symlink_inode_operations` correctly. Filesystems that use `simple_symlink_inode_operations` typically allocate and free the string in `.free_inode` (which is RCU-delayed). Wait... `kfree` *isn't* RCU-delayed; I should use `kfree_rcu` or free the string in the RCU callback.
So, this confirms the bug is a real UAF (Use-After-Free). However, it's not exploitable for privilege escalation, and it's not reachable by unprivileged users. This is a denial of service. The questions are: Exploitable: False, DenialOfService: True, Unprivileged: False, UserNamespace: False, VMGuestTrigger: False, VMHostTrigger: False, NetworkTrigger: False, RemoteTrigger: False, PeripheralTrigger: False, FilesystemTrigger: False.
|
| 101/2 |
2026/05/30 00:35 |
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]
|
| 102/2 |
2026/05/30 00:35 |
llm |
expert |
0m
Model:
Tokens:
input: 95500
output: 615
thoughts: 509
Thoughts: **My Assessment of the Vulnerability**
Okay, the analysis is complete, and it's time to craft the final response. Here's what I've distilled: the core issue is a Use-After-Free (UAF) bug. Specifically, it's rooted in the VFS path walk code when it's interacting with the `bpffs` (bpf pseudo-filesystem). The problem lies in how `bpffs` handles inode destruction. It's using `free_inode_nonrcu()` in `bpf_destroy_inode` to free its inodes immediately. The thing is, this happens without waiting for an RCU (Read-Copy-Update) grace period. Now, `bpffs` supports symlinks, and the VFS path walk can encounter these symlinks when it is in RCU walk mode (`LOOKUP_RCU`).
The vulnerability is exposed when there's concurrent unlinking of a symlink in `bpffs` and an RCU path walk. The RCU path walk ends up accessing the freed `inode` and its `i_link` pointer. This happens because the sequence counter (`d_seq`) check isn't re-done before the walk continues, and the freed memory is accessed. This leads to a UAF read.
Exploitability-wise, it's predominantly a read UAF. The path walk is reading `inode->i_flags` (through `IS_PRIVATE`) and `inode->i_link`. I'm seeing that the inode's allocated from a dedicated slab cache (`inode_cache`) with a constructor. That means that an attacker *can't* spray arbitrary data into the freed object. It's only reallocated as another `struct inode`. This essentially blocks attempts to forge `inode->i_op` or `inode->i_link` for control flow hijacking. The absolute worst-case scenario would be a NULL pointer dereference (if the inode gets reallocated as a regular file with no `get_link` operation) or an out-of-bounds read of the freed string. Both result in Denial of Service (DoS), but no privilege escalation.
Now, access... here's the kicker. The `bpf` filesystem isn't mountable by unprivileged users, even in a user namespace. `bpf_fill_super` demands `CAP_SYS_ADMIN` in the initial user namespace (`init_user_ns`). Plus, the default mount location, `/sys/fs/bpf`, has `0700` permissions. So, no unprivileged user can create or unlink symlinks in `bpffs` to trigger this.
So, the bottom line? It's a DoS vulnerability. It's only reachable by privileged users (root). It's not exploitable for privilege escalation and unprivileged users or user namespaces can't trigger it.
|
| 103/1 |
2026/05/30 00:35 |
action |
format-explanation |
0m
Results: map[Explanation:**Bug Analysis:**
The bug is a Use-After-Free (UAF) in the VFS path walk code when interacting
with the `bpf` pseudo-filesystem (`bpffs`).
The root cause is that `bpffs` frees its inodes immediately in
`bpf_destroy_inode` using `free_inode_nonrcu()`, without waiting for an RCU
grace period. However, `bpffs` supports symlinks, and the VFS path walk can
encounter these symlinks in RCU walk mode (`LOOKUP_RCU`).
If a symlink in `bpffs` is unlinked concurrently with an RCU path walk, the path
walk can access the freed `inode` and its `i_link` pointer in `pick_link()`
before the dentry sequence counter (`d_seq`) is re-checked. This leads to a UAF
read of the `inode` (specifically `inode->i_flags` via `IS_PRIVATE`) and the
`i_link` string.
**Exploitability:**
The UAF is primarily a read UAF. The path walk reads `inode->i_flags` and
`inode->i_link`. Since the inode is allocated from a dedicated slab cache
(`inode_cache`) with a constructor (`inode_init_once`), an attacker cannot use
generic heap spraying techniques (like `msg_msg` or `setxattr`) to overwrite the
freed object with arbitrary data. The object can only be reallocated as another
`struct inode`, which will be safely initialized by the kernel.
This prevents forging `inode->i_op` or `inode->i_link` to hijack control flow.
The worst-case scenario is a NULL pointer dereference (e.g., if the inode is
reallocated as a regular file with no `get_link` operation) or an out-of-bounds
read of the freed string, both of which result in a Denial of Service (DoS) but
not privilege escalation.
**Accessibility:**
The bug is **not accessible to unprivileged users**.
1. The `bpf` filesystem cannot be mounted by unprivileged users, even within a
user namespace. The `bpf_fill_super` function explicitly requires
`CAP_SYS_ADMIN` in the initial user namespace (`init_user_ns`).
2. The default mount of `bpffs` at `/sys/fs/bpf` (e.g., by systemd) has `0700`
permissions, restricting access strictly to root.
Therefore, unprivileged users cannot create or unlink symlinks in `bpffs` to
trigger the race condition.
**Conclusion:**
The bug is a Denial of Service (DoS) vulnerability that is only reachable by
privileged users (root). It is not exploitable for privilege escalation and
cannot be triggered by unprivileged users, user namespaces, or remote/peripheral
vectors.]
|