| 0/0 |
2026/09/18 00:33 |
flow |
assessment-security |
26m
Results: map[DenialOfService:true Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the vulnerability:
**Bug Mechanism:**
The bug is triggered when an unprivileged user uses `io_uring` to write to the
Smack LSM pseudo-filesystem file `/sys/fs/smackfs/relabel-self`.
The `smk_write_relabel_self()` function handles writes to this file and calls
`commit_creds()` to apply a new Smack label to the current task. However,
`io_uring` worker threads execute requests on behalf of the submitter and use
`override_creds()` to temporarily assume the submitter's credentials.
When `commit_creds()` is called, it explicitly forbids being called while
credentials are in an overridden state by checking `BUG_ON(task->cred != old)`.
In the provided reproducer, two consecutive write requests are submitted:
1. During the first request, the `io_uring` worker thread still shares the exact
same credential structure as the submitter, so `override_creds()` does not
create a mismatch. `commit_creds()` succeeds and permanently changes the worker
thread's base credentials.
2. During the second request, the worker thread's base credentials now differ
from the submitter's credentials. `io_uring` calls `override_creds()` to
temporarily switch to the submitter's credentials, putting the worker thread
into an overridden state (`task->cred != task->real_cred`). When
`smk_write_relabel_self()` calls `commit_creds()` this time, the `BUG_ON`
assertion fails, causing a kernel panic.
**Exploitability:**
This bug is **not exploitable** for privilege escalation or memory corruption.
The `BUG_ON` macro causes a hard kernel panic, halting execution immediately.
Furthermore, the credential modifications prior to the crash do not grant any
elevated capabilities or cause any reference counting imbalances
(use-after-free).
**Denial of Service:**
This bug results in a **Denial of Service (DoS)** because any unprivileged user
can intentionally trigger the `BUG_ON` assertion to crash the system.
**Accessibility:**
The bug is **accessible from unprivileged processes** and **user namespaces**.
The `/sys/fs/smackfs/relabel-self` file is created with `0666`
(`S_IRUGO|S_IWUGO`) permissions, meaning it is globally writable. Additionally,
`io_uring` is available to unprivileged users by default in most kernel
configurations. The only prerequisite is that the Smack LSM must be enabled and
its filesystem mounted. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/09/18 00:33 |
action |
syz-repro-to-c-repro |
0m
Results: map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef __NR_getsockopt
#define __NR_getsockopt 209
#endif
#ifndef __NR_io_uring_enter
#define __NR_io_uring_enter 426
#endif
#ifndef __NR_io_uring_setup
#define __NR_io_uring_setup 425
#endif
#ifndef __NR_mmap
#define __NR_mmap 222
#endif
#ifndef __NR_mprotect
#define __NR_mprotect 226
#endif
#ifndef __NR_openat
#define __NR_openat 56
#endif
#ifndef __NR_sendmsg
#define __NR_sendmsg 211
#endif
#ifndef __NR_socket
#define __NR_socket 198
#endif
#define SIZEOF_IO_URING_SQE 64
#define SIZEOF_IO_URING_CQE 16
#define IORING_SETUP_SQE128 (1U << 10)
#define IORING_SETUP_CQE32 (1U << 11)
struct io_sqring_offsets {
uint32_t head;
uint32_t tail;
uint32_t ring_mask;
uint32_t ring_entries;
uint32_t flags;
uint32_t dropped;
uint32_t array;
uint32_t resv1;
uint64_t user_addr;
};
struct io_cqring_offsets {
uint32_t head;
uint32_t tail;
uint32_t ring_mask;
uint32_t ring_entries;
uint32_t overflow;
uint32_t cqes;
uint32_t flags;
uint32_t resv1;
uint64_t user_addr;
};
struct io_uring_params {
uint32_t sq_entries;
uint32_t cq_entries;
uint32_t flags;
uint32_t sq_thread_cpu;
uint32_t sq_thread_idle;
uint32_t features;
uint32_t resv[4];
struct io_sqring_offsets sq_off;
struct io_cqring_offsets cq_off;
};
static long io_uring_sqe_size(struct io_uring_params* params)
{
return SIZEOF_IO_URING_SQE << !!(params->flags & IORING_SETUP_SQE128);
}
static long io_uring_cqe_size(struct io_uring_params* params)
{
return SIZEOF_IO_URING_CQE << !!(params->flags & IORING_SETUP_CQE32);
}
#define IORING_OFF_SQ_RING 0ULL
#define IORING_OFF_SQES 0x10000000ULL
static long syz_io_uring_setup(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4)
{
uint32_t entries = (uint32_t)a0;
struct io_uring_params* setup_params = (struct io_uring_params*)a1;
void** ring_params_ptr_out = (void**)a2;
void** ring_ptr_out = (void**)a3;
void** sqes_ptr_out = (void**)a4;
uint32_t fd_io_uring = syscall(__NR_io_uring_setup, entries, setup_params);
*ring_params_ptr_out = (void*)setup_params;
uint32_t sq_ring_sz = setup_params->sq_off.array + setup_params->sq_entries * sizeof(uint32_t);
uint32_t cq_ring_sz = setup_params->cq_off.cqes + setup_params->cq_entries * io_uring_cqe_size(setup_params);
uint32_t ring_sz = sq_ring_sz > cq_ring_sz ? sq_ring_sz : cq_ring_sz;
*ring_ptr_out = mmap(0, ring_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQ_RING);
uint32_t sqes_sz = setup_params->sq_entries * io_uring_sqe_size(setup_params);
*sqes_ptr_out = mmap(0, sqes_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQES);
uint32_t* array = (uint32_t*)((uintptr_t)*ring_ptr_out + setup_params->sq_off.array);
for (uint32_t index = 0; index < setup_params->sq_entries; index++)
array[index] = index;
return fd_io_uring;
}
static long syz_io_uring_submit(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
struct io_uring_params* params = (struct io_uring_params*)a0;
char* ring_ptr = (char*)a1;
char* sqes_ptr = (char*)a2;
char* sqe = (char*)a3;
uint32_t sq_ring_mask = *(uint32_t*)(ring_ptr + params->sq_off.ring_mask);
uint32_t* sq_tail_ptr = (uint32_t*)(ring_ptr + params->sq_off.tail);
uint32_t sq_tail = *sq_tail_ptr & sq_ring_mask;
uint32_t sqe_size = io_uring_sqe_size(params);
char* sqe_dest = sqes_ptr + sq_tail * sqe_size;
memcpy(sqe_dest, sqe, sqe_size);
uint32_t sq_tail_next = *sq_tail_ptr + 1;
__atomic_store_n(sq_tail_ptr, sq_tail_next, __ATOMIC_RELEASE);
return 0;
}
uint64_t r[6] = {0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x0};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// openat$smackfs_relabel_self arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 73 79 73 2f 66 73 2f 73 6d 61 63 6b 66 73 2f 72 65 6c 61 62 65 6c 2d 73 65 6c 66 00} (length 0x1d)
// }
// flags: const = 0x2 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_smackfs_labels_list
memcpy((void*)0x20000000, "/sys/fs/smackfs/relabel-self\000", 29);
syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000000ul, /*flags=*/2, /*mode=*/0);
// syz_io_uring_setup arguments: [
// entries: int32 = 0x34b8 (4 bytes)
// params: ptr[inout, io_uring_params] {
// io_uring_params {
// sq_entries: int32 = 0x0 (4 bytes)
// cq_entries: int32 = 0xc3b1 (4 bytes)
// flags: io_uring_setup_flags = 0x800 (4 bytes)
// sq_thread_cpu: int32 = 0x1 (4 bytes)
// sq_thread_idle: int32 = 0x82 (4 bytes)
// features: int32 = 0x0 (4 bytes)
// wq_fd: fd_io_uring (resource)
// resv: buffer: {00 00 00 00 00 00 00 00 00 00 00 00} (length 0xc)
// sq_off: io_sqring_offsets {
// head: int32 = 0x0 (4 bytes)
// tail: int32 = 0x0 (4 bytes)
// ring_mask: int32 = 0x0 (4 bytes)
// ring_entries: int32 = 0x0 (4 bytes)
// flags: int32 = 0x0 (4 bytes)
// dropped: int32 = 0x0 (4 bytes)
// array: int32 = 0x0 (4 bytes)
// resv1: int32 = 0x0 (4 bytes)
// user_addr: int64 = 0x0 (8 bytes)
// }
// cq_off: io_cqring_offsets {
// head: int32 = 0x0 (4 bytes)
// tail: int32 = 0x0 (4 bytes)
// ring_mask: int32 = 0x0 (4 bytes)
// ring_entries: int32 = 0x0 (4 bytes)
// overflow: int32 = 0x0 (4 bytes)
// cqes: int32 = 0x0 (4 bytes)
// flags: int32 = 0x0 (4 bytes)
// resv1: int32 = 0x0 (4 bytes)
// user_addr: int64 = 0x0 (8 bytes)
// }
// }
// }
// ring_params_ptr: ptr[out, ring_params_ptr] {
// ring_params_ptr (resource)
// }
// ring_ptr: ptr[out, ring_ptr] {
// ring_ptr (resource)
// }
// sqes_ptr: ptr[out, sqes_ptr] {
// sqes_ptr (resource)
// }
// ]
// returns fd_io_uring
*(uint32_t*)0x20000544 = 0xc3b1;
*(uint32_t*)0x20000548 = 0x800;
*(uint32_t*)0x2000054c = 1;
*(uint32_t*)0x20000550 = 0x82;
*(uint32_t*)0x20000558 = 0;
memset((void*)0x2000055c, 0, 12);
res = -1;
res = syz_io_uring_setup(/*entries=*/0x34b8, /*params=*/0x20000540, /*ring_params_ptr=*/0x20000180, /*ring_ptr=*/0x20000140, /*sqes_ptr=*/0x20000100);
if (res != -1) {
r[0] = res;
r[1] = *(uint64_t*)0x20000180;
r[2] = *(uint64_t*)0x20000140;
r[3] = *(uint64_t*)0x20000100;
}
// sendmsg$DEVLINK_CMD_RATE_SET arguments: [
// fd: sock_nl_generic (resource)
// msg: ptr[in, msghdr_netlink[netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]]] {
// msghdr_netlink[netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]] {
// addr: nil
// addrlen: len = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// vec: ptr[in, iovec[in, netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]]] {
// iovec[in, netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]] {
// addr: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// }
// }
// len: len = 0x14 (8 bytes)
// }
// }
// vlen: const = 0x1 (8 bytes)
// ctrl: const = 0x0 (8 bytes)
// ctrllen: const = 0x0 (8 bytes)
// f: send_flags = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// }
// f: send_flags = 0x0 (8 bytes)
// ]
*(uint64_t*)0x20000040 = 0;
*(uint32_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0x20000580;
*(uint64_t*)0x20000580 = 0x20000340;
*(uint64_t*)0x20000588 = 0x14;
*(uint64_t*)0x20000058 = 1;
*(uint64_t*)0x20000060 = 0;
*(uint64_t*)0x20000068 = 0;
*(uint32_t*)0x20000070 = 0;
syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x20000040ul, /*f=*/0ul);
// socket$inet6_sctp arguments: [
// domain: const = 0xa (8 bytes)
// type: sctp_socket_type = 0x1 (8 bytes)
// proto: const = 0x84 (4 bytes)
// ]
// returns sock_sctp6
res = syscall(__NR_socket, /*domain=*/0xaul, /*type=SOCK_STREAM*/1ul, /*proto=*/0x84);
if (res != -1)
r[4] = res;
// getsockopt$inet_sctp6_SCTP_SOCKOPT_CONNECTX3 arguments: [
// fd: sock_sctp6 (resource)
// level: const = 0x84 (4 bytes)
// opt: const = 0x6f (4 bytes)
// val: ptr[inout, sctp_getaddrs_old] {
// sctp_getaddrs_old {
// assoc_id: assoc_id (resource)
// addr_num: bytesize = 0x10 (4 bytes)
// addrs: ptr[in, array[sockaddr_sctp]] {
// array[sockaddr_sctp] {
// union sockaddr_sctp {
// in: sockaddr_in {
// family: const = 0x2 (2 bytes)
// port: int16be = 0x4e21 (2 bytes)
// addr: union ipv4_addr {
// private: int32be = 0xa010100 (4 bytes)
// }
// pad = 0x0 (8 bytes)
// }
// }
// }
// }
// }
// }
// len: nil
// ]
*(uint32_t*)0x20000280 = 0;
*(uint32_t*)0x20000284 = 0x10;
*(uint64_t*)0x20000288 = 0x20000000;
*(uint16_t*)0x20000000 = 2;
*(uint16_t*)0x20000002 = htobe16(0x4e21);
*(uint32_t*)0x20000004 = htobe32(0xa010100);
syscall(__NR_getsockopt, /*fd=*/r[4], /*level=*/0x84, /*opt=*/0x6f, /*val=*/0x20000280ul, /*len=*/0ul);
// getsockopt$inet_sctp6_SCTP_MAX_BURST arguments: [
// fd: sock_sctp6 (resource)
// level: const = 0x84 (4 bytes)
// opt: const = 0x83 (4 bytes)
// val: ptr[out, sctp_max_burst] {
// union sctp_max_burst {
// assoc_value: sctp_assoc_value {
// assoc_id: assoc_id (resource)
// assoc_value: int32 = 0x0 (4 bytes)
// }
// }
// }
// len: ptr[inout, len] {
// len = 0x8 (4 bytes)
// }
// ]
*(uint32_t*)0x20000080 = 8;
res = syscall(__NR_getsockopt, /*fd=*/r[4], /*level=*/0x84, /*opt=*/0x83, /*val=*/0x20000000ul, /*len=*/0x20000080ul);
if (res != -1)
r[5] = *(uint32_t*)0x20000000;
// getsockopt$inet_sctp_SCTP_AUTH_ACTIVE_KEY arguments: [
// fd: sock_sctp (resource)
// level: const = 0x84 (4 bytes)
// opt: const = 0x18 (4 bytes)
// val: ptr[inout, sctp_authkeyid] {
// sctp_authkeyid {
// scact_assoc_id: assoc_id (resource)
// scact_keynumber: int16 = 0x3 (2 bytes)
// pad = 0x0 (2 bytes)
// }
// }
// len: nil
// ]
*(uint32_t*)0x20000040 = r[5];
*(uint16_t*)0x20000044 = 3;
syscall(__NR_getsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x84, /*opt=*/0x18, /*val=*/0x20000040ul, /*len=*/0ul);
// mprotect arguments: [
// addr: VMA[0xf000]
// len: len = 0xf000 (8 bytes)
// prot: mmap_prot = 0x9 (8 bytes)
// ]
syscall(__NR_mprotect, /*addr=*/0x20000000ul, /*len=*/0xf000ul, /*prot=PROT_SEM|PROT_READ*/9ul);
// syz_io_uring_submit arguments: [
// ring_params_ptr: ring_params_ptr (resource)
// ring_ptr: ring_ptr (resource)
// sqes_ptr: sqes_ptr (resource)
// sqe: ptr[in, io_uring_sqe_u] {
// union io_uring_sqe_u {
// IORING_OP_CLOSE: io_uring_sqe[IORING_OP_CLOSE, const[0, int16], fd, const[0, int64], const[0, int64], const[0, int32], const[0, int32], sqe_user_data_not_openat, io_uring_sqe_close_misc] {
// opcode: const = 0x13 (1 bytes)
// flags: iosqe_flags = 0x48 (1 bytes)
// ioprio: const = 0x0 (2 bytes)
// fd: fd (resource)
// off: const = 0x0 (8 bytes)
// addr: const = 0x0 (8 bytes)
// len: const = 0x0 (4 bytes)
// misc_flags: const = 0x0 (4 bytes)
// user_data: sqe_user_data_not_openat = 0x0 (8 bytes)
// misc: io_uring_sqe_close_misc {
// buf_index_unused: const = 0x0 (2 bytes)
// ioring_personality_id_unused: const = 0x0 (2 bytes)
// file_index: int32 = 0x0 (4 bytes)
// addr3_unused: const = 0x0 (8 bytes)
// }
// pad = 0x0 (8 bytes)
// }
// }
// }
// ]
*(uint8_t*)0x20000040 = 0x13;
*(uint8_t*)0x20000041 = 0x48;
*(uint16_t*)0x20000042 = 0;
*(uint32_t*)0x20000044 = r[0];
*(uint64_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0;
*(uint32_t*)0x20000058 = 0;
*(uint32_t*)0x2000005c = 0;
*(uint64_t*)0x20000060 = 0;
*(uint16_t*)0x20000068 = 0;
*(uint16_t*)0x2000006a = 0;
*(uint32_t*)0x2000006c = 0;
*(uint64_t*)0x20000070 = 0;
syz_io_uring_submit(/*ring_params_ptr=*/r[1], /*ring_ptr=*/r[2], /*sqes_ptr=*/r[3], /*sqe=*/0x20000040);
// io_uring_enter arguments: [
// fd: fd_io_uring (resource)
// to_submit: int32 = 0x1 (4 bytes)
// min_complete: int32 = 0x1 (4 bytes)
// flags: io_uring_enter_flags = 0x1 (8 bytes)
// sigmask: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1, /*min_complete=*/1, /*flags=IORING_ENTER_GETEVENTS*/1ul, /*sigmask=*/0ul, /*size=*/0ul);
// syz_io_uring_submit arguments: [
// ring_params_ptr: ring_params_ptr (resource)
// ring_ptr: ring_ptr (resource)
// sqes_ptr: sqes_ptr (resource)
// sqe: ptr[in, io_uring_sqe_u] {
// union io_uring_sqe_u {
// IORING_OP_CLOSE: io_uring_sqe[IORING_OP_CLOSE, const[0, int16], fd, const[0, int64], const[0, int64], const[0, int32], const[0, int32], sqe_user_data_not_openat, io_uring_sqe_close_misc] {
// opcode: const = 0x13 (1 bytes)
// flags: iosqe_flags = 0x48 (1 bytes)
// ioprio: const = 0x0 (2 bytes)
// fd: fd (resource)
// off: const = 0x0 (8 bytes)
// addr: const = 0x0 (8 bytes)
// len: const = 0x0 (4 bytes)
// misc_flags: const = 0x0 (4 bytes)
// user_data: sqe_user_data_not_openat = 0x0 (8 bytes)
// misc: io_uring_sqe_close_misc {
// buf_index_unused: const = 0x0 (2 bytes)
// ioring_personality_id_unused: const = 0x0 (2 bytes)
// file_index: int32 = 0x0 (4 bytes)
// addr3_unused: const = 0x0 (8 bytes)
// }
// pad = 0x0 (8 bytes)
// }
// }
// }
// ]
*(uint8_t*)0x20000040 = 0x13;
*(uint8_t*)0x20000041 = 0x48;
*(uint16_t*)0x20000042 = 0;
*(uint32_t*)0x20000044 = r[0];
*(uint64_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0;
*(uint32_t*)0x20000058 = 0;
*(uint32_t*)0x2000005c = 0;
*(uint64_t*)0x20000060 = 0;
*(uint16_t*)0x20000068 = 0;
*(uint16_t*)0x2000006a = 0;
*(uint32_t*)0x2000006c = 0;
*(uint64_t*)0x20000070 = 0;
syz_io_uring_submit(/*ring_params_ptr=*/r[1], /*ring_ptr=*/r[2], /*sqes_ptr=*/r[3], /*sqe=*/0x20000040);
// io_uring_enter arguments: [
// fd: fd_io_uring (resource)
// to_submit: int32 = 0x1 (4 bytes)
// min_complete: int32 = 0x1 (4 bytes)
// flags: io_uring_enter_flags = 0x1 (8 bytes)
// sigmask: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1, /*min_complete=*/1, /*flags=IORING_ENTER_GETEVENTS*/1ul, /*sigmask=*/0ul, /*size=*/0ul);
return 0;
}
]
|
| 2/1 |
2026/09/18 00:33 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/e4df1e35f73e8871a0bb5986e0a3f7f88903d380]
|
| 3/1 |
2026/09/18 00:33 |
action |
kernel-builder |
13m
Results: map[KernelObj:/app/workdir/cache/build/e78a09dd5a90e64939cd016d4e96a862bbba2a2e]
|
| 4/1 |
2026/09/18 00:46 |
action |
codesearch-prepare |
0m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/09/18 00:46 |
agent |
expert |
13m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
------------[ cut here ]------------
kernel BUG at kernel/cred.c:376!
Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
Modules linked in:
CPU: 0 UID: 0 PID: 4923 Comm: iou-wrk-4922 Not tainted syzkaller #0 PREEMPT
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/14/2026
pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : commit_creds+0x888/0x8d4 kernel/cred.c:376
lr : commit_creds+0x888/0x8d4 kernel/cred.c:376
sp : ffff800098287850
x29: ffff800098287860 x28: ffff0000d05e08c8 x27: ffff0000d05e0000
x26: dfff800000000000 x25: dfff800000000000 x24: ffff700013050f18
x23: ffff0000c7e6bac8 x22: ffff0000d05e08d0 x21: ffff0000d2bb7000
x20: ffff0000d2bb7000 x19: ffff0000d2bb7300 x18: 1fffe00035b9ec28
x17: ffff8000818fd3bc x16: ffff8000816109b4 x15: ffff800080391038
x14: ffff8000815de4b4 x13: 0000000000000001 x12: 0000000000000000
x11: 0000000000000000 x10: ffff600018fcd751 x9 : 0000000000000000
x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000004 x3 : ffff800080391048
x2 : 0000000000000000 x1 : ffff0000d05e0000 x0 : 0000000000000000
Call trace:
commit_creds+0x888/0x8d4 kernel/cred.c:376 (P)
smk_write_relabel_self+0x398/0x418 security/smack/smackfs.c:2709
loop_rw_iter+0x3c0/0x5c0 include/linux/uio.h:-1
io_write+0xd50/0x1364 io_uring/rw.c:1170
__io_issue_sqe+0x134/0x364 io_uring/io_uring.c:1386
io_issue_sqe+0x94/0x8f0 io_uring/io_uring.c:1409
io_wq_submit_work+0x4c4/0x690 io_uring/io_uring.c:1525
io_worker_handle_work+0x640/0xeb8 io_uring/io-wq.c:659
io_wq_worker+0x830/0xb44 io_uring/io-wq.c:752
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:838
Code: 91009280 9420ad5a 17fffe51 940b1fa2 (d4210000)
---[ end trace 0000000000000000 ]---
It is reproducible with the followint program.
Keep in mind that it may lack the precise threading, sandboxing, and some arguments of a working reproducer.
But it should give an idea of the involved syscalls.
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef __NR_getsockopt
#define __NR_getsockopt 209
#endif
#ifndef __NR_io_uring_enter
#define __NR_io_uring_enter 426
#endif
#ifndef __NR_io_uring_setup
#define __NR_io_uring_setup 425
#endif
#ifndef __NR_mmap
#define __NR_mmap 222
#endif
#ifndef __NR_mprotect
#define __NR_mprotect 226
#endif
#ifndef __NR_openat
#define __NR_openat 56
#endif
#ifndef __NR_sendmsg
#define __NR_sendmsg 211
#endif
#ifndef __NR_socket
#define __NR_socket 198
#endif
#define SIZEOF_IO_URING_SQE 64
#define SIZEOF_IO_URING_CQE 16
#define IORING_SETUP_SQE128 (1U << 10)
#define IORING_SETUP_CQE32 (1U << 11)
struct io_sqring_offsets {
uint32_t head;
uint32_t tail;
uint32_t ring_mask;
uint32_t ring_entries;
uint32_t flags;
uint32_t dropped;
uint32_t array;
uint32_t resv1;
uint64_t user_addr;
};
struct io_cqring_offsets {
uint32_t head;
uint32_t tail;
uint32_t ring_mask;
uint32_t ring_entries;
uint32_t overflow;
uint32_t cqes;
uint32_t flags;
uint32_t resv1;
uint64_t user_addr;
};
struct io_uring_params {
uint32_t sq_entries;
uint32_t cq_entries;
uint32_t flags;
uint32_t sq_thread_cpu;
uint32_t sq_thread_idle;
uint32_t features;
uint32_t resv[4];
struct io_sqring_offsets sq_off;
struct io_cqring_offsets cq_off;
};
static long io_uring_sqe_size(struct io_uring_params* params)
{
return SIZEOF_IO_URING_SQE << !!(params->flags & IORING_SETUP_SQE128);
}
static long io_uring_cqe_size(struct io_uring_params* params)
{
return SIZEOF_IO_URING_CQE << !!(params->flags & IORING_SETUP_CQE32);
}
#define IORING_OFF_SQ_RING 0ULL
#define IORING_OFF_SQES 0x10000000ULL
static long syz_io_uring_setup(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4)
{
uint32_t entries = (uint32_t)a0;
struct io_uring_params* setup_params = (struct io_uring_params*)a1;
void** ring_params_ptr_out = (void**)a2;
void** ring_ptr_out = (void**)a3;
void** sqes_ptr_out = (void**)a4;
uint32_t fd_io_uring = syscall(__NR_io_uring_setup, entries, setup_params);
*ring_params_ptr_out = (void*)setup_params;
uint32_t sq_ring_sz = setup_params->sq_off.array + setup_params->sq_entries * sizeof(uint32_t);
uint32_t cq_ring_sz = setup_params->cq_off.cqes + setup_params->cq_entries * io_uring_cqe_size(setup_params);
uint32_t ring_sz = sq_ring_sz > cq_ring_sz ? sq_ring_sz : cq_ring_sz;
*ring_ptr_out = mmap(0, ring_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQ_RING);
uint32_t sqes_sz = setup_params->sq_entries * io_uring_sqe_size(setup_params);
*sqes_ptr_out = mmap(0, sqes_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQES);
uint32_t* array = (uint32_t*)((uintptr_t)*ring_ptr_out + setup_params->sq_off.array);
for (uint32_t index = 0; index < setup_params->sq_entries; index++)
array[index] = index;
return fd_io_uring;
}
static long syz_io_uring_submit(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
struct io_uring_params* params = (struct io_uring_params*)a0;
char* ring_ptr = (char*)a1;
char* sqes_ptr = (char*)a2;
char* sqe = (char*)a3;
uint32_t sq_ring_mask = *(uint32_t*)(ring_ptr + params->sq_off.ring_mask);
uint32_t* sq_tail_ptr = (uint32_t*)(ring_ptr + params->sq_off.tail);
uint32_t sq_tail = *sq_tail_ptr & sq_ring_mask;
uint32_t sqe_size = io_uring_sqe_size(params);
char* sqe_dest = sqes_ptr + sq_tail * sqe_size;
memcpy(sqe_dest, sqe, sqe_size);
uint32_t sq_tail_next = *sq_tail_ptr + 1;
__atomic_store_n(sq_tail_ptr, sq_tail_next, __ATOMIC_RELEASE);
return 0;
}
uint64_t r[6] = {0xffffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x0};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// openat$smackfs_relabel_self arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 73 79 73 2f 66 73 2f 73 6d 61 63 6b 66 73 2f 72 65 6c 61 62 65 6c 2d 73 65 6c 66 00} (length 0x1d)
// }
// flags: const = 0x2 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_smackfs_labels_list
memcpy((void*)0x20000000, "/sys/fs/smackfs/relabel-self\000", 29);
syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000000ul, /*flags=*/2, /*mode=*/0);
// syz_io_uring_setup arguments: [
// entries: int32 = 0x34b8 (4 bytes)
// params: ptr[inout, io_uring_params] {
// io_uring_params {
// sq_entries: int32 = 0x0 (4 bytes)
// cq_entries: int32 = 0xc3b1 (4 bytes)
// flags: io_uring_setup_flags = 0x800 (4 bytes)
// sq_thread_cpu: int32 = 0x1 (4 bytes)
// sq_thread_idle: int32 = 0x82 (4 bytes)
// features: int32 = 0x0 (4 bytes)
// wq_fd: fd_io_uring (resource)
// resv: buffer: {00 00 00 00 00 00 00 00 00 00 00 00} (length 0xc)
// sq_off: io_sqring_offsets {
// head: int32 = 0x0 (4 bytes)
// tail: int32 = 0x0 (4 bytes)
// ring_mask: int32 = 0x0 (4 bytes)
// ring_entries: int32 = 0x0 (4 bytes)
// flags: int32 = 0x0 (4 bytes)
// dropped: int32 = 0x0 (4 bytes)
// array: int32 = 0x0 (4 bytes)
// resv1: int32 = 0x0 (4 bytes)
// user_addr: int64 = 0x0 (8 bytes)
// }
// cq_off: io_cqring_offsets {
// head: int32 = 0x0 (4 bytes)
// tail: int32 = 0x0 (4 bytes)
// ring_mask: int32 = 0x0 (4 bytes)
// ring_entries: int32 = 0x0 (4 bytes)
// overflow: int32 = 0x0 (4 bytes)
// cqes: int32 = 0x0 (4 bytes)
// flags: int32 = 0x0 (4 bytes)
// resv1: int32 = 0x0 (4 bytes)
// user_addr: int64 = 0x0 (8 bytes)
// }
// }
// }
// ring_params_ptr: ptr[out, ring_params_ptr] {
// ring_params_ptr (resource)
// }
// ring_ptr: ptr[out, ring_ptr] {
// ring_ptr (resource)
// }
// sqes_ptr: ptr[out, sqes_ptr] {
// sqes_ptr (resource)
// }
// ]
// returns fd_io_uring
*(uint32_t*)0x20000544 = 0xc3b1;
*(uint32_t*)0x20000548 = 0x800;
*(uint32_t*)0x2000054c = 1;
*(uint32_t*)0x20000550 = 0x82;
*(uint32_t*)0x20000558 = 0;
memset((void*)0x2000055c, 0, 12);
res = -1;
res = syz_io_uring_setup(/*entries=*/0x34b8, /*params=*/0x20000540, /*ring_params_ptr=*/0x20000180, /*ring_ptr=*/0x20000140, /*sqes_ptr=*/0x20000100);
if (res != -1) {
r[0] = res;
r[1] = *(uint64_t*)0x20000180;
r[2] = *(uint64_t*)0x20000140;
r[3] = *(uint64_t*)0x20000100;
}
// sendmsg$DEVLINK_CMD_RATE_SET arguments: [
// fd: sock_nl_generic (resource)
// msg: ptr[in, msghdr_netlink[netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]]] {
// msghdr_netlink[netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]] {
// addr: nil
// addrlen: len = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// vec: ptr[in, iovec[in, netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]]] {
// iovec[in, netlink_msg_t[genl_devlink_family_id, genlmsghdr_t[DEVLINK_CMD_RATE_SET], devlink_nl_rate_set_policy]] {
// addr: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// }
// }
// len: len = 0x14 (8 bytes)
// }
// }
// vlen: const = 0x1 (8 bytes)
// ctrl: const = 0x0 (8 bytes)
// ctrllen: const = 0x0 (8 bytes)
// f: send_flags = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// }
// f: send_flags = 0x0 (8 bytes)
// ]
*(uint64_t*)0x20000040 = 0;
*(uint32_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0x20000580;
*(uint64_t*)0x20000580 = 0x20000340;
*(uint64_t*)0x20000588 = 0x14;
*(uint64_t*)0x20000058 = 1;
*(uint64_t*)0x20000060 = 0;
*(uint64_t*)0x20000068 = 0;
*(uint32_t*)0x20000070 = 0;
syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x20000040ul, /*f=*/0ul);
// socket$inet6_sctp arguments: [
// domain: const = 0xa (8 bytes)
// type: sctp_socket_type = 0x1 (8 bytes)
// proto: const = 0x84 (4 bytes)
// ]
// returns sock_sctp6
res = syscall(__NR_socket, /*domain=*/0xaul, /*type=SOCK_STREAM*/1ul, /*proto=*/0x84);
if (res != -1)
r[4] = res;
// getsockopt$inet_sctp6_SCTP_SOCKOPT_CONNECTX3 arguments: [
// fd: sock_sctp6 (resource)
// level: const = 0x84 (4 bytes)
// opt: const = 0x6f (4 bytes)
// val: ptr[inout, sctp_getaddrs_old] {
// sctp_getaddrs_old {
// assoc_id: assoc_id (resource)
// addr_num: bytesize = 0x10 (4 bytes)
// addrs: ptr[in, array[sockaddr_sctp]] {
// array[sockaddr_sctp] {
// union sockaddr_sctp {
// in: sockaddr_in {
// family: const = 0x2 (2 bytes)
// port: int16be = 0x4e21 (2 bytes)
// addr: union ipv4_addr {
// private: int32be = 0xa010100 (4 bytes)
// }
// pad = 0x0 (8 bytes)
// }
// }
// }
// }
// }
// }
// len: nil
// ]
*(uint32_t*)0x20000280 = 0;
*(uint32_t*)0x20000284 = 0x10;
*(uint64_t*)0x20000288 = 0x20000000;
*(uint16_t*)0x20000000 = 2;
*(uint16_t*)0x20000002 = htobe16(0x4e21);
*(uint32_t*)0x20000004 = htobe32(0xa010100);
syscall(__NR_getsockopt, /*fd=*/r[4], /*level=*/0x84, /*opt=*/0x6f, /*val=*/0x20000280ul, /*len=*/0ul);
// getsockopt$inet_sctp6_SCTP_MAX_BURST arguments: [
// fd: sock_sctp6 (resource)
// level: const = 0x84 (4 bytes)
// opt: const = 0x83 (4 bytes)
// val: ptr[out, sctp_max_burst] {
// union sctp_max_burst {
// assoc_value: sctp_assoc_value {
// assoc_id: assoc_id (resource)
// assoc_value: int32 = 0x0 (4 bytes)
// }
// }
// }
// len: ptr[inout, len] {
// len = 0x8 (4 bytes)
// }
// ]
*(uint32_t*)0x20000080 = 8;
res = syscall(__NR_getsockopt, /*fd=*/r[4], /*level=*/0x84, /*opt=*/0x83, /*val=*/0x20000000ul, /*len=*/0x20000080ul);
if (res != -1)
r[5] = *(uint32_t*)0x20000000;
// getsockopt$inet_sctp_SCTP_AUTH_ACTIVE_KEY arguments: [
// fd: sock_sctp (resource)
// level: const = 0x84 (4 bytes)
// opt: const = 0x18 (4 bytes)
// val: ptr[inout, sctp_authkeyid] {
// sctp_authkeyid {
// scact_assoc_id: assoc_id (resource)
// scact_keynumber: int16 = 0x3 (2 bytes)
// pad = 0x0 (2 bytes)
// }
// }
// len: nil
// ]
*(uint32_t*)0x20000040 = r[5];
*(uint16_t*)0x20000044 = 3;
syscall(__NR_getsockopt, /*fd=*/(intptr_t)-1, /*level=*/0x84, /*opt=*/0x18, /*val=*/0x20000040ul, /*len=*/0ul);
// mprotect arguments: [
// addr: VMA[0xf000]
// len: len = 0xf000 (8 bytes)
// prot: mmap_prot = 0x9 (8 bytes)
// ]
syscall(__NR_mprotect, /*addr=*/0x20000000ul, /*len=*/0xf000ul, /*prot=PROT_SEM|PROT_READ*/9ul);
// syz_io_uring_submit arguments: [
// ring_params_ptr: ring_params_ptr (resource)
// ring_ptr: ring_ptr (resource)
// sqes_ptr: sqes_ptr (resource)
// sqe: ptr[in, io_uring_sqe_u] {
// union io_uring_sqe_u {
// IORING_OP_CLOSE: io_uring_sqe[IORING_OP_CLOSE, const[0, int16], fd, const[0, int64], const[0, int64], const[0, int32], const[0, int32], sqe_user_data_not_openat, io_uring_sqe_close_misc] {
// opcode: const = 0x13 (1 bytes)
// flags: iosqe_flags = 0x48 (1 bytes)
// ioprio: const = 0x0 (2 bytes)
// fd: fd (resource)
// off: const = 0x0 (8 bytes)
// addr: const = 0x0 (8 bytes)
// len: const = 0x0 (4 bytes)
// misc_flags: const = 0x0 (4 bytes)
// user_data: sqe_user_data_not_openat = 0x0 (8 bytes)
// misc: io_uring_sqe_close_misc {
// buf_index_unused: const = 0x0 (2 bytes)
// ioring_personality_id_unused: const = 0x0 (2 bytes)
// file_index: int32 = 0x0 (4 bytes)
// addr3_unused: const = 0x0 (8 bytes)
// }
// pad = 0x0 (8 bytes)
// }
// }
// }
// ]
*(uint8_t*)0x20000040 = 0x13;
*(uint8_t*)0x20000041 = 0x48;
*(uint16_t*)0x20000042 = 0;
*(uint32_t*)0x20000044 = r[0];
*(uint64_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0;
*(uint32_t*)0x20000058 = 0;
*(uint32_t*)0x2000005c = 0;
*(uint64_t*)0x20000060 = 0;
*(uint16_t*)0x20000068 = 0;
*(uint16_t*)0x2000006a = 0;
*(uint32_t*)0x2000006c = 0;
*(uint64_t*)0x20000070 = 0;
syz_io_uring_submit(/*ring_params_ptr=*/r[1], /*ring_ptr=*/r[2], /*sqes_ptr=*/r[3], /*sqe=*/0x20000040);
// io_uring_enter arguments: [
// fd: fd_io_uring (resource)
// to_submit: int32 = 0x1 (4 bytes)
// min_complete: int32 = 0x1 (4 bytes)
// flags: io_uring_enter_flags = 0x1 (8 bytes)
// sigmask: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1, /*min_complete=*/1, /*flags=IORING_ENTER_GETEVENTS*/1ul, /*sigmask=*/0ul, /*size=*/0ul);
// syz_io_uring_submit arguments: [
// ring_params_ptr: ring_params_ptr (resource)
// ring_ptr: ring_ptr (resource)
// sqes_ptr: sqes_ptr (resource)
// sqe: ptr[in, io_uring_sqe_u] {
// union io_uring_sqe_u {
// IORING_OP_CLOSE: io_uring_sqe[IORING_OP_CLOSE, const[0, int16], fd, const[0, int64], const[0, int64], const[0, int32], const[0, int32], sqe_user_data_not_openat, io_uring_sqe_close_misc] {
// opcode: const = 0x13 (1 bytes)
// flags: iosqe_flags = 0x48 (1 bytes)
// ioprio: const = 0x0 (2 bytes)
// fd: fd (resource)
// off: const = 0x0 (8 bytes)
// addr: const = 0x0 (8 bytes)
// len: const = 0x0 (4 bytes)
// misc_flags: const = 0x0 (4 bytes)
// user_data: sqe_user_data_not_openat = 0x0 (8 bytes)
// misc: io_uring_sqe_close_misc {
// buf_index_unused: const = 0x0 (2 bytes)
// ioring_personality_id_unused: const = 0x0 (2 bytes)
// file_index: int32 = 0x0 (4 bytes)
// addr3_unused: const = 0x0 (8 bytes)
// }
// pad = 0x0 (8 bytes)
// }
// }
// }
// ]
*(uint8_t*)0x20000040 = 0x13;
*(uint8_t*)0x20000041 = 0x48;
*(uint16_t*)0x20000042 = 0;
*(uint32_t*)0x20000044 = r[0];
*(uint64_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0;
*(uint32_t*)0x20000058 = 0;
*(uint32_t*)0x2000005c = 0;
*(uint64_t*)0x20000060 = 0;
*(uint16_t*)0x20000068 = 0;
*(uint16_t*)0x2000006a = 0;
*(uint32_t*)0x2000006c = 0;
*(uint64_t*)0x20000070 = 0;
syz_io_uring_submit(/*ring_params_ptr=*/r[1], /*ring_ptr=*/r[2], /*sqes_ptr=*/r[3], /*sqe=*/0x20000040);
// io_uring_enter arguments: [
// fd: fd_io_uring (resource)
// to_submit: int32 = 0x1 (4 bytes)
// min_complete: int32 = 0x1 (4 bytes)
// flags: io_uring_enter_flags = 0x1 (8 bytes)
// sigmask: nil
// size: len = 0x0 (8 bytes)
// ]
syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1, /*min_complete=*/1, /*flags=IORING_ENTER_GETEVENTS*/1ul, /*sigmask=*/0ul, /*size=*/0ul);
return 0;
}
Reply: Based on the analysis of the bug report and the kernel source code, here is the assessment of the vulnerability:
**Bug Mechanism:**
The bug is triggered when an unprivileged user uses `io_uring` to write to the Smack LSM pseudo-filesystem file `/sys/fs/smackfs/relabel-self`.
The `smk_write_relabel_self()` function handles writes to this file and calls `commit_creds()` to apply a new Smack label to the current task. However, `io_uring` worker threads execute requests on behalf of the submitter and use `override_creds()` to temporarily assume the submitter's credentials.
When `commit_creds()` is called, it explicitly forbids being called while credentials are in an overridden state by checking `BUG_ON(task->cred != old)`.
In the provided reproducer, two consecutive write requests are submitted:
1. During the first request, the `io_uring` worker thread still shares the exact same credential structure as the submitter, so `override_creds()` does not create a mismatch. `commit_creds()` succeeds and permanently changes the worker thread's base credentials.
2. During the second request, the worker thread's base credentials now differ from the submitter's credentials. `io_uring` calls `override_creds()` to temporarily switch to the submitter's credentials, putting the worker thread into an overridden state (`task->cred != task->real_cred`). When `smk_write_relabel_self()` calls `commit_creds()` this time, the `BUG_ON` assertion fails, causing a kernel panic.
**Exploitability:**
This bug is **not exploitable** for privilege escalation or memory corruption. The `BUG_ON` macro causes a hard kernel panic, halting execution immediately. Furthermore, the credential modifications prior to the crash do not grant any elevated capabilities or cause any reference counting imbalances (use-after-free).
**Denial of Service:**
This bug results in a **Denial of Service (DoS)** because any unprivileged user can intentionally trigger the `BUG_ON` assertion to crash the system.
**Accessibility:**
The bug is **accessible from unprivileged processes** and **user namespaces**. The `/sys/fs/smackfs/relabel-self` file is created with `0666` (`S_IRUGO|S_IWUGO`) permissions, meaning it is globally writable. Additionally, `io_uring` is available to unprivileged users by default in most kernel configurations. The only prerequisite is that the Smack LSM must be enabled and its filesystem mounted.
|
| 6/2 |
2026/09/18 00:46 |
llm |
expert |
0m
Model:
Tokens:
input: 14689
output: 33
thoughts: 358
Thoughts: **Kernel Credential Bug Analysis**
Okay, so I've got a kernel bug, a *very* specific one, apparently. It's screaming from `kernel/cred.c:376`. Right away, my expert instincts kick in, and I know this is a critical spot, the core of credential management. Let's dig into that call trace, it's the breadcrumb trail I need to follow.
Right, `commit_creds` is the culprit, or at least the start of it. That function is in `kernel/cred.c`, exactly where the error is reported. Seems the issue is happening during credential commit, which makes sense, as a faulty change to the credentials of a task or process can lead to significant problems.
Itβs triggered by `smk_write_relabel_self`, which means we're dealing with SELinux or Smack (likely Smack, considering the path in the trace) writing a new label to itself. Okay, security context re-labeling is a common source of these kinds of issues.
Now it looks like this is happening as part of an `io_uring` operation. I see `io_write`, `__io_issue_sqe`, and then `io_wq_submit_work`, which means we're dealing with I/O submission and queuing. That means a write operation is being submitted through `io_uring`, and for some reason, the security context relabeling is failing, causing the credential commit to crash.
My gut feeling is that this has something to do with how Smack handles relabeling within `io_uring` contexts. There's a potential race condition here, or maybe a conflict between the security policy and the asynchronous nature of `io_uring`. I'll have to examine `smackfs.c:2709` and that specific part of `kernel/cred.c` to see precisely what's going on during the credential commit when a Smack-related write relabel is triggered during I/O submission. Time to start digging!
|
| 7/2 |
2026/09/18 00:47 |
tool |
read-file |
0m
Args: map[File:kernel/cred.c FirstLine:360 LineCount:40]
Results: map[Contents: 360: * updated. This function may not be called if the subjective credentials are
361: * in an overridden state.
362: *
363: * This function eats the caller's reference to the new credentials.
364: *
365: * Always returns 0 thus allowing this function to be tail-called at the end
366: * of, say, sys_setgid().
367: */
368: int commit_creds(struct cred *new)
369: {
370: struct task_struct *task = current;
371: const struct cred *old = task->real_cred;
372:
373: kdebug("commit_creds(%p{%ld})", new,
374: atomic_long_read(&new->usage));
375:
376: BUG_ON(task->cred != old);
377: BUG_ON(atomic_long_read(&new->usage) < 1);
378:
379: get_cred(new); /* we will require a ref for the subj creds too */
380:
381: /* dumpability changes */
382: if (!uid_eq(old->euid, new->euid) ||
383: !gid_eq(old->egid, new->egid) ||
384: !uid_eq(old->fsuid, new->fsuid) ||
385: !gid_eq(old->fsgid, new->fsgid) ||
386: !cred_cap_issubset(old, new)) {
387: /* mm-less tasks share init_task's exec_state */
388: if (task->mm)
389: task_exec_state_set_dumpable(suid_dumpable);
390: task->pdeath_signal = 0;
391: /*
392: * If a task drops privileges and becomes nondumpable,
393: * the dumpability change must become visible before
394: * the credential change; otherwise, a __ptrace_may_access()
395: * racing with this change may be able to attach to a task it
396: * shouldn't be able to attach to (as if the task had dropped
397: * privileges without becoming nondumpable).
398: * Pairs with a read barrier in __ptrace_may_access().
399: */
]
|
| 8/2 |
2026/09/18 00:47 |
llm |
expert |
0m
Model:
Tokens:
input: 16213
output: 39
thoughts: 307
Thoughts: **Debugging a Credential Issue in io_uring and Smackfs**
Okay, so I've got a `BUG_ON` triggering, specifically `BUG_ON(task->cred != old);` where `old = task->real_cred;`. This immediately tells me that the task's current credentials (`task->cred`) don't match its real (original) credentials (`task->real_cred`). The issue occurs when `commit_creds` is called while the task's credentials are in an overridden state. The comment in the code even explicitly states that `commit_creds` shouldn't be called in this overridden credential scenario.
The call trace is key here. It leads me from `commit_creds` to `smk_write_relabel_self` in `security/smack/smackfs.c:2709`. Further up, `smk_write_relabel_self` is being called via `loop_rw_iter` from `io_write` in `io_uring/rw.c:1170`. This suggests `io_uring` is the culprit. My understanding is that `io_uring` uses `override_creds()` to temporarily change the credentials of its worker threads to match those of the submitting task's, and this is to perform the actual I/O. So, when `io_uring` does a write to `/sys/fs/smackfs/relabel-self`, the worker thread indeed has overridden credentials. Now, if `smk_write_relabel_self` then calls `commit_creds()`, it's triggering that `BUG_ON` because the credentials are still overridden, contradicting the function's expected behavior. I need to take a closer look at `smk_write_relabel_self` now.
|
| 9/2 |
2026/09/18 00:47 |
tool |
read-file |
0m
Args: map[File:security/smack/smackfs.c FirstLine:2680 LineCount:50]
Results: map[Contents:2680:
2681: /*
2682: * No partial write.
2683: * Enough data must be present.
2684: */
2685: if (*ppos != 0)
2686: return -EINVAL;
2687: if (count == 0 || count > PAGE_SIZE)
2688: return -EINVAL;
2689:
2690: data = memdup_user_nul(buf, count);
2691: if (IS_ERR(data))
2692: return PTR_ERR(data);
2693:
2694: rc = smk_parse_label_list(data, &list_tmp);
2695: kfree(data);
2696:
2697: if (!rc || (rc == -EINVAL && list_empty(&list_tmp))) {
2698: struct cred *new;
2699: struct task_smack *tsp;
2700:
2701: new = prepare_creds();
2702: if (!new) {
2703: rc = -ENOMEM;
2704: goto out;
2705: }
2706: tsp = smack_cred(new);
2707: smk_destroy_label_list(&tsp->smk_relabel);
2708: list_splice(&list_tmp, &tsp->smk_relabel);
2709: commit_creds(new);
2710: return count;
2711: }
2712: out:
2713: smk_destroy_label_list(&list_tmp);
2714: return rc;
2715: }
2716:
2717: static const struct file_operations smk_relabel_self_ops = {
2718: .open = smk_open_relabel_self,
2719: .read = seq_read,
2720: .llseek = seq_lseek,
2721: .write = smk_write_relabel_self,
2722: .release = seq_release,
2723: };
2724:
2725: /**
2726: * smk_read_ptrace - read() for /smack/ptrace
2727: * @filp: file pointer, not actually used
2728: * @buf: where to put the result
2729: * @count: maximum to send along
]
|
| 10/2 |
2026/09/18 00:47 |
llm |
expert |
0m
Model:
Tokens:
input: 17657
output: 39
thoughts: 240
Thoughts: **Analyzing a Kernel Panic in io_uring and SMACKFS**
Okay, so I'm looking at this kernel issue. From what I understand, `smk_write_relabel_self` calls `commit_creds(new)`, and that's the trigger. This is a known problem: you can't just call `commit_creds` when `task->cred` isn't equal to `task->real_cred`. That's a classic mistake. Now, `io_uring` gets involved because it uses `override_creds` to run operations with the submitter's credentials. So, when `io_uring` attempts a write to `relabel-self`, it's operating under those overridden credentials. And bam, `smk_write_relabel_self` gets called and tries to `commit_creds()`, which leads straight to the `BUG_ON(task->cred != old)` condition.
The important question now is, is this actually exploitable? Well, it's a `BUG_ON`, so it results in a kernel panic. That, at a minimum, is a Denial of Service. My next thought is: can an unprivileged user trigger this? I saw something about mounting smackfs, but that's a distraction. The reproducer just opens `/sys/fs/smackfs/relabel-self`. The key is accessibility! Does an unprivileged user even have access to this thing? Now I need to check the permissions of `/sys/fs/smackfs/relabel-self`. That's where the investigation needs to focus.
|
| 11/2 |
2026/09/18 00:47 |
tool |
read-file |
0m
Error:
Args: map[File:security/smack/smackfs.c FirstLine:2960 LineCount:50]
Results:
|
| 12/2 |
2026/09/18 00:47 |
llm |
expert |
0m
Model:
Tokens:
input: 18322
output: 39
thoughts: 10
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**SmackFS Initialization Deep Dive**
Okay, let's get down to brass tacks. I need to make absolutely sure the SmackFS initialization is behaving as expected. No assumptions here, I'm going to meticulously verify each step. I'll be looking for potential race conditions, edge cases, and any deviations from the established design. Are all the necessary data structures being allocated and populated correctly? Is the security context being set up appropriately from the get-go? I need to check for any memory leaks or unexpected behavior during resource allocation. My primary concern right now is the foundation - if this isn't rock solid, everything built on top will be unstable. I'm thinking specifically aboutβ¦ well, letβs dig into the code and see exactly what's happening. Iβll be paying close attention to the initialization sequence, error handling, and any potential issues stemming from concurrent access during this critical phase. It's time to put on my debugging hat and get to work.
|
| 13/2 |
2026/09/18 00:47 |
tool |
read-file |
0m
Args: map[File:security/smack/smackfs.c FirstLine:2900 LineCount:50]
Results: map[Contents:2900: * Do not register smackfs if Smack wasn't enabled
2901: * on boot. We can not put this method normally under the
2902: * smack_init() code path since the security subsystem get
2903: * initialized before the vfs caches.
2904: *
2905: * Returns true if we were not chosen on boot or if
2906: * we were chosen and filesystem registration succeeded.
2907: */
2908: int __init init_smk_fs(void)
2909: {
2910: int err;
2911: int rc;
2912: struct netlbl_audit nai;
2913:
2914: if (smack_enabled == 0)
2915: return 0;
2916:
2917: err = smk_init_sysfs();
2918: if (err)
2919: printk(KERN_ERR "smackfs: sysfs mountpoint problem.\n");
2920:
2921: err = register_filesystem(&smk_fs_type);
2922: if (!err) {
2923: smackfs_mount = kern_mount(&smk_fs_type);
2924: if (IS_ERR(smackfs_mount)) {
2925: printk(KERN_ERR "smackfs: could not mount!\n");
2926: err = PTR_ERR(smackfs_mount);
2927: smackfs_mount = NULL;
2928: }
2929: }
2930:
2931: smk_netlabel_audit_set(&nai);
2932: (void) netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, &nai);
2933: (void) smk_cipso_doi(SMACK_CIPSO_DOI_DEFAULT,
2934: GFP_KERNEL | __GFP_NOFAIL);
2935: smk_unlbl_ambient(NULL);
2936:
2937: rc = smack_populate_secattr(&smack_known_floor);
2938: if (err == 0 && rc < 0)
2939: err = rc;
2940: rc = smack_populate_secattr(&smack_known_hat);
2941: if (err == 0 && rc < 0)
2942: err = rc;
2943: rc = smack_populate_secattr(&smack_known_huh);
2944: if (err == 0 && rc < 0)
2945: err = rc;
2946: rc = smack_populate_secattr(&smack_known_star);
2947: if (err == 0 && rc < 0)
2948: err = rc;
2949: rc = smack_populate_secattr(&smack_known_web);
]
|
| 14/2 |
2026/09/18 00:47 |
llm |
expert |
0m
Model:
Tokens:
input: 19407
output: 31
thoughts: 14
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Tracing the Genesis of `relabel-self`**
Okay, so I need to understand the origins of this `relabel-self` operation. My initial focus is pinpointing its creation. It's a common practice: the very first line where it's instantiated, or declared, is where I'll find my key. I'll be able to work backward from there to understand the motivations, inputs, and overall design decisions that led to its implementation. Depending on the context, this could involve searching the codebase for the declaration itself, or the first call that *defines* this function. I know this approach is often the quickest path to unraveling the purpose of complex processes within a program.
|
| 15/2 |
2026/09/18 00:47 |
tool |
grepper |
0m
Args: map[Expression:"relabel-self" PathPrefix:security/smack/]
Results: map[Output:security/smack/smackfs.c=2640=static const struct seq_operations relabel_self_seq_ops = {
--
security/smack/smackfs.c-2649- * @inode: inode structure representing file
security/smack/smackfs.c:2650: * @file: "relabel-self" file pointer
security/smack/smackfs.c-2651- *
--
security/smack/smackfs.c=2789=static int smk_fill_super(struct super_block *sb, struct fs_context *fc)
--
security/smack/smackfs.c-2843- [SMK_RELABEL_SELF] = {
security/smack/smackfs.c:2844: "relabel-self", &smk_relabel_self_ops,
security/smack/smackfs.c-2845- S_IRUGO|S_IWUGO},
]
|
| 16/2 |
2026/09/18 00:47 |
llm |
expert |
0m
Model:
Tokens:
input: 19873
output: 46
thoughts: 532
Thoughts: **Analyzing the SmackFS Vulnerability**
Okay, so `S_IRUGO|S_IWUGO` β that screams "world-writable" (0666) file permissions. This means any user, even unprivileged ones, can mess with `/sys/fs/smackfs/relabel-self`. And, if they use `io_uring` to do it, we've got a problem. The `BUG_ON` in `commit_creds()` gets triggered.
Wait a sec, is Smack actually enabled by default? The reproducer just tries to open `/sys/fs/smackfs/relabel-self`. If Smack's off, that file's not even there. But if it *is* enabled, it's open season for unprivileged users. The bug report says `kernel BUG at kernel/cred.c:376!`. The "Modules linked in" shows a `syzkaller` taint, which is a big flag. The `UID: 0` is less critical here, as the problem is with unprivileged users. This looks like a Denial of Service, specifically a kernel panic.
Can we exploit this *beyond* a DoS? No, a `BUG_ON` is a hard stop, so no privilege escalation or memory corruption. Is it accessible from unprivileged processes? Yep, world-writable. User namespaces? Definitely, since it's unprivileged access. VM Guest, Host, Network, Peripheral, Malicious Filesystem? No to all of those. Local syscall bug, that's what we've got.
Let's quickly confirm `io_uring` is available to unprivileged users. Usually, `io_uring_setup` is fair game unless `kernel.io_uring_disabled` is set via `sysctl`. The default is typically 0 or 2, which means it is often accessible (1 would disable it for unprivileged users). Assuming that's the case, we're good.
Is there any *other* way to trigger this? Is there another filesystem that calls `commit_creds()` in its `write` handler? `smk_write_relabel_self` is the culprit here. Are there others? That's the key question, is this a Smack-specific issue, or something more widespread.
|
| 17/2 |
2026/09/18 00:47 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:kernel/cred.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__do_sys_capset SourceFile:kernel/capability.c SourceLine:258] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__do_sys_landlock_restrict_self SourceFile:security/landlock/syscalls.c SourceLine:698] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setfsgid SourceFile:kernel/sys.c SourceLine:980] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setfsuid SourceFile:kernel/sys.c SourceLine:936] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setgid SourceFile:kernel/sys.c SourceLine:508] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setregid SourceFile:kernel/sys.c SourceLine:462] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setresgid SourceFile:kernel/sys.c SourceLine:865] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setresuid SourceFile:kernel/sys.c SourceLine:776] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setreuid SourceFile:kernel/sys.c SourceLine:628] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__sys_setuid SourceFile:kernel/sys.c SourceLine:691] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:begin_new_exec SourceFile:fs/exec.c SourceLine:1294] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:call_usermodehelper_exec_async SourceFile:kernel/umh.c SourceLine:104] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:cap_prctl_drop SourceFile:security/commoncap.c SourceLine:1283] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:cap_task_prctl SourceFile:security/commoncap.c SourceLine:1376] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:cap_task_prctl SourceFile:security/commoncap.c SourceLine:1397] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:cap_task_prctl SourceFile:security/commoncap.c SourceLine:1408] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:cap_task_prctl SourceFile:security/commoncap.c SourceLine:1434] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:commit_nsset SourceFile:kernel/nsproxy.c SourceLine:543] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:do_setattr SourceFile:security/smack/smack_lsm.c SourceLine:3860] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:install_process_keyring SourceFile:security/keys/process_keys.c SourceLine:306] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:install_session_keyring SourceFile:security/keys/process_keys.c SourceLine:371] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:install_thread_keyring SourceFile:security/keys/process_keys.c SourceLine:259] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:join_session_keyring SourceFile:security/keys/process_keys.c SourceLine:856] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:join_session_keyring SourceFile:security/keys/process_keys.c SourceLine:890] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:key_change_session_keyring SourceFile:security/keys/process_keys.c SourceLine:954] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:keyctl_change_reqkey_auth SourceFile:security/keys/keyctl.c SourceLine:1161] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:keyctl_set_reqkey_keyring SourceFile:security/keys/keyctl.c SourceLine:1448] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ksys_unshare SourceFile:kernel/fork.c SourceLine:3330] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:restrict_one_thread SourceFile:security/landlock/tsync.c SourceLine:152] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:set_current_groups SourceFile:kernel/groups.c SourceLine:152] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:smk_write_relabel_self SourceFile:security/smack/smackfs.c SourceLine:2709] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__UNIQUE_ID_addressable_commit_creds_700 SourceFile:kernel/cred.c SourceLine:440] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_commit_creds SourceFile:kernel/cred.c SourceLine:440] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:__gendwarfksyms_ptr_commit_creds SourceFile:kernel/cred.c SourceLine:440]] TruncatedOutput:false]
|
| 18/2 |
2026/09/18 00:47 |
llm |
expert |
0m
Model:
Tokens:
input: 22723
output: 41
thoughts: 66
Thoughts: **Analyzing Potential Privilege Escalation**
Okay, so I'm focusing on potential security vulnerabilities here. It looks like `smk_write_relabel_self` is the *only* function in the `write` handler that I need to be concerned about. That seems straightforward... but wait, I know `commit_creds()` calls are critical and could be a point of privilege escalation. And, `do_setattr` in `security/smack/smack_lsm.c` *also* calls `commit_creds()`. That adds a whole new dimension. I need to investigate `do_setattr` thoroughly now to see if there's any dangerous interaction or unintended behavior when used with the SMACK LSM and the relabel functionality. This has now become more complex than originally thought.
|
| 19/2 |
2026/09/18 00:47 |
tool |
read-file |
0m
Args: map[File:security/smack/smack_lsm.c FirstLine:3840 LineCount:40]
Results: map[Contents:3840: return -EPERM;
3841: in_relabel:
3842: ;
3843: }
3844:
3845: skp = smk_import_valid_label(value, label_len, GFP_KERNEL);
3846: if (IS_ERR(skp))
3847: return PTR_ERR(skp);
3848:
3849: new = prepare_creds();
3850: if (new == NULL)
3851: return -ENOMEM;
3852:
3853: tsp = smack_cred(new);
3854: tsp->smk_task = skp;
3855: /*
3856: * process can change its label only once
3857: */
3858: smk_destroy_label_list(&tsp->smk_relabel);
3859:
3860: commit_creds(new);
3861: return 0;
3862: }
3863:
3864: /**
3865: * smack_setselfattr - Set a Smack process attribute
3866: * @attr: which attribute to set
3867: * @ctx: buffer containing the data
3868: * @size: size of @ctx
3869: * @flags: reserved, must be zero
3870: *
3871: * Fill the passed user space @ctx with the details of the requested
3872: * attribute.
3873: *
3874: * Returns 0 on success, an error code otherwise.
3875: */
3876: static int smack_setselfattr(unsigned int attr, struct lsm_ctx *ctx,
3877: u32 size, u32 flags)
3878: {
3879: if (attr != LSM_ATTR_CURRENT)
]
|
| 20/2 |
2026/09/18 00:47 |
llm |
expert |
0m
Model:
Tokens:
input: 23542
output: 33
thoughts: 679
Thoughts: **Analyzing a Credential Vulnerability with io_uring and Smack**
Okay, let's break this down. It seems the problem lies in how `io_uring` interacts with the Security Management Layer (LSM), specifically the Smack LSM and the `setselfattr` hook.
So, `do_setattr` gets called through `smack_setselfattr`, which is linked to `lsm_set_self_attr` (via the syscall `setselfattr`). My initial thought is, does `io_uring` even support `lsm_set_self_attr` directly? No, it's pretty limited to I/O syscalls, which makes sense. However, `smk_write_relabel_self` *is* a write operation on a file, and that *is* supported by `io_uring`. Ah, thatβs where things get interesting.
The bug then is that this `smk_write_relabel_self` function calls `commit_creds()`. The problem is that `commit_creds()` is written assuming itβs being called in the context of the task, but `io_uring` is running it from a worker thread with potentially overridden credentials. This triggers the `BUG_ON(task->cred != old)` check inside `commit_creds()`.
Let's think about the fallout. If that `BUG_ON` wasn't there, what would happen? It would effectively change the worker thread's *subjective* credentials. `io_uring` does restore credentials after the operation, but... hold on. `commit_creds()` modifies both `task->real_cred` and `task->cred`. If it changes `task->real_cred` of the worker thread, it could permanently affect that thread. Even though `io_uring` restores `task->cred`, it would be to the *new* credentials now. Ultimately though, the crash is the more immediate issue due to the `BUG_ON`. A `BUG_ON` in production is a panic, thatβs a Denial of Service.
Now, are there other ways to hit this? Could we trigger this through `cachefiles` or `overlayfs`, which also override credentials? What about writing to `/sys/fs/smackfs/relabel-self` via overlayfs? Overlayfs does override credentials when writing to the upper directory. But wait, `/sys/fs/smackfs/relabel-self` is a sysfs/kernfs file, it can't be part of an overlayfs upperdir. Ah, but it can be opened and written to using `io_uring`? Yes, that is how the reproducer is doing it.
So, is it exploitable? Itβs a `BUG_ON`, which means a panic, so thatβs a DoS. But could we bypass the `BUG_ON`? Probably not, a `BUG_ON` is hard. However, are there configurations where `BUG_ON` *doesn't* panic? `CONFIG_BUG` is almost always enabled, but if disabled, the `BUG_ON` turns into a no-op. If that happens, then `commit_creds()` *will* change the worker thread's `task->real_cred` and `task->cred`. After this, `io_uring` will then call `revert_creds()`, which should restore `task->cred` to the *original* `task->real_cred`. But we just set `task->real_cred` to the new creds! So, `revert_creds` will restore `task->cred` to the *new* credentials! This looks exploitable for privilege escalation if the kernel is compiled with `CONFIG_BUG=n`. Okay, need to check `revert_creds()` now.
|
| 21/2 |
2026/09/18 00:48 |
tool |
read-file |
0m
Args: map[File:kernel/cred.c FirstLine:520 LineCount:40]
Results: map[Contents: 520: */
521: if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->uid))
522: return 0;
523:
524: if (!(new_ucounts = alloc_ucounts(new->user_ns, new->uid)))
525: return -EAGAIN;
526:
527: new->ucounts = new_ucounts;
528: put_ucounts(old_ucounts);
529:
530: return 0;
531: }
532:
533: /*
534: * initialise the credentials stuff
535: */
536: void __init cred_init(void)
537: {
538: /* allocate a slab in which we can store credentials */
539: cred_jar = KMEM_CACHE(cred,
540: SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
541: }
542:
543: /**
544: * prepare_kernel_cred - Prepare a set of credentials for a kernel service
545: * @daemon: A userspace daemon to be used as a reference
546: *
547: * Prepare a set of credentials for a kernel service. This can then be used to
548: * override a task's own credentials so that work can be done on behalf of that
549: * task that requires a different subjective context.
550: *
551: * @daemon is used to provide a base cred, with the security data derived from
552: * that; if this is "&init_task", they'll be set to 0, no groups, full
553: * capabilities, and no keys.
554: *
555: * The caller may change these controls afterwards if desired.
556: *
557: * Returns the new credentials or NULL if out of memory.
558: */
559: struct cred *prepare_kernel_cred(struct task_struct *daemon)
]
|
| 22/2 |
2026/09/18 00:48 |
llm |
expert |
1m
Model:
Tokens:
input: 25693
output: 34
thoughts: 11
Thoughts: Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:
**Hunting for `revert_creds`**
Alright, let's get down to it. My initial thought process is laser-focused: I need to locate where `revert_creds` is used, defined, or otherwise relevant within the system. This could be a variable, a function, a configuration parameter β the specifics aren't clear yet, but the goal is the same. I'm implicitly assuming a context here, probably related to credential management, potentially a role-based access control, or some type of privileged operation. I need to understand its behavior and where it is relevant. This initial focus is a common starting point for troubleshooting, security analysis, or even just code navigation within a large codebase. Itβs the starting point for understanding how this part of the system is meant to work. From here, I can trace its lineage and understand its interaction with the rest of the application.
|
| 23/2 |
2026/09/18 00:49 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/cred.c Name:revert_creds]
Results: map[SourceCode: 186: static inline const struct cred *revert_creds(const struct cred *revert_cred)
187: {
188: return rcu_replace_pointer(current->cred, revert_cred, 1);
189: }
SourceFile:include/linux/cred.h]
|
| 24/2 |
2026/09/18 00:49 |
llm |
expert |
0m
Model:
Tokens:
input: 26046
output: 33
thoughts: 33
Thoughts: Here's my understanding, as if I were thinking it through:
**Deconstructing Credential Management**
Okay, let me break this down. My initial observation is that `revert_creds` is, fundamentally, a simple operation. It just assigns `revert_cred` (which I assume is a pre-existing credential structure) to the current task's `current->cred` field. That's straightforward enough. No complex manipulations, no deep dives into security contexts β just a direct reassignment.
Now, the interesting bit, the potentially more complex piece, is what `override_creds` does. I need to keep looking at that to get a complete picture. The whole design is starting to come into focus, however. This is how the system handles credential switching.
|
| 25/2 |
2026/09/18 00:49 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/cred.c Name:override_creds]
Results: map[SourceCode: 181: static inline const struct cred *override_creds(const struct cred *override_cred)
182: {
183: return rcu_replace_pointer(current->cred, override_cred, 1);
184: }
SourceFile:include/linux/cred.h]
|
| 26/2 |
2026/09/18 00:49 |
llm |
expert |
1m
Model:
Tokens:
input: 26376
output: 33
thoughts: 63
Thoughts: Okay, here's my interpretation of that code snippet, presented as a summary of my thought process:
**io_uring Credential Management: Potential Conundrums**
Alright, so `io_uring` is using a credential override mechanism, specifically `override_creds` and `revert_creds`. Classic pattern, of course, to temporarily elevate or modify the credentials associated with a particular I/O request (`req->creds`). This is standard practice for operations requiring elevated privileges, sandboxing, or impersonation of another user or group. The code snippet looks straightforward: save the old credentials, do the necessary work, and then carefully restore the original credentials using `revert_creds`.
The crucial question that immediately pops into my head, though, is what happens if `commit_creds` is called *within* the "do work" section? It's not explicitly prevented by the snippet, and that's where things get interesting and potentially problematic. If a `commit_creds` call occurs inside that region, the intended restoration via `revert_creds` may not function as expected, as `commit_creds` changes the credentials in the middle. We'd have a case of potential double-freeing or at least corruption of some sort. This requires a much more complete picture of the surrounding `io_uring` implementation. Are there locking mechanisms to safeguard against this concurrent manipulation of credentials? If not, we have a security hole. The `revert_creds` call might become a no-op, or worse, trigger memory corruption if it tries to undo something that's already changed. This is where the intricacies of the underlying kernel data structures and memory management become critical.
|
| 27/2 |
2026/09/18 00:50 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/cred.c Name:commit_creds]
Results: map[SourceCode: 354: /**
355: * commit_creds - Install new credentials upon the current task
356: * @new: The credentials to be assigned
357: *
358: * Install a new set of credentials to the current task, using RCU to replace
359: * the old set. Both the objective and the subjective credentials pointers are
360: * updated. This function may not be called if the subjective credentials are
361: * in an overridden state.
362: *
363: * This function eats the caller's reference to the new credentials.
364: *
365: * Always returns 0 thus allowing this function to be tail-called at the end
366: * of, say, sys_setgid().
367: */
368: int commit_creds(struct cred *new)
369: {
370: struct task_struct *task = current;
371: const struct cred *old = task->real_cred;
372:
373: kdebug("commit_creds(%p{%ld})", new,
374: atomic_long_read(&new->usage));
375:
376: BUG_ON(task->cred != old);
377: BUG_ON(atomic_long_read(&new->usage) < 1);
378:
379: get_cred(new); /* we will require a ref for the subj creds too */
380:
381: /* dumpability changes */
382: if (!uid_eq(old->euid, new->euid) ||
383: !gid_eq(old->egid, new->egid) ||
384: !uid_eq(old->fsuid, new->fsuid) ||
385: !gid_eq(old->fsgid, new->fsgid) ||
386: !cred_cap_issubset(old, new)) {
387: /* mm-less tasks share init_task's exec_state */
388: if (task->mm)
389: task_exec_state_set_dumpable(suid_dumpable);
390: task->pdeath_signal = 0;
391: /*
392: * If a task drops privileges and becomes nondumpable,
393: * the dumpability change must become visible before
394: * the credential change; otherwise, a __ptrace_may_access()
395: * racing with this change may be able to attach to a task it
396: * shouldn't be able to attach to (as if the task had dropped
397: * privileges without becoming nondumpable).
398: * Pairs with a read barrier in __ptrace_may_access().
399: */
400: smp_wmb();
401: }
402:
403: /* alter the thread keyring */
404: if (!uid_eq(new->fsuid, old->fsuid))
405: key_fsuid_changed(new);
406: if (!gid_eq(new->fsgid, old->fsgid))
407: key_fsgid_changed(new);
408:
409: /* do it
410: * RLIMIT_NPROC limits on user->processes have already been checked
411: * in set_user().
412: */
413: if (new->user != old->user || new->user_ns != old->user_ns)
414: inc_rlimit_ucounts(new->ucounts, UCOUNT_RLIMIT_NPROC, 1);
415:
416: rcu_assign_pointer(task->real_cred, new);
417: rcu_assign_pointer(task->cred, new);
418: if (new->user != old->user || new->user_ns != old->user_ns)
419: dec_rlimit_ucounts(old->ucounts, UCOUNT_RLIMIT_NPROC, 1);
420: if (new->user_ns != old->user_ns)
421: switch_cred_namespaces(old, new);
422:
423: /* send notifications */
424: if (!uid_eq(new->uid, old->uid) ||
425: !uid_eq(new->euid, old->euid) ||
426: !uid_eq(new->suid, old->suid) ||
427: !uid_eq(new->fsuid, old->fsuid))
428: proc_id_connector(task, PROC_EVENT_UID);
429:
430: if (!gid_eq(new->gid, old->gid) ||
431: !gid_eq(new->egid, old->egid) ||
432: !gid_eq(new->sgid, old->sgid) ||
433: !gid_eq(new->fsgid, old->fsgid))
434: proc_id_connector(task, PROC_EVENT_GID);
435:
436: /* release the old obj and subj refs both */
437: put_cred_many(old, 2);
438: return 0;
439: }
SourceFile:kernel/cred.c]
|
| 28/2 |
2026/09/18 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 28364
output: 59
thoughts: 393
Thoughts: **My Analysis of a Potential Kernel Panic**
Okay, so here's what I've got: if that `BUG_ON` wasn't present in the kernel code, `commit_creds` would update `task->real_cred` and `task->cred`. Then, `io_uring` would call `revert_creds`, which sets `task->cred` back to the original `old_cred`. The end result is that the worker thread would have `task->real_cred = new` and `task->cred = old_cred`. That's a mismatch, and it *should* be a problem... but because of the `BUG_ON`, it just triggers a kernel panic.
So, the question is, can this be exploited? It's a `BUG_ON`, right? That means it's a hard panic. In a production environment, that's a straight-up Denial of Service. So, exploitable? No, not really... it's just a crash. Is it unprivileged? Yes, any user can use `io_uring` and write to `/sys/fs/smackfs/relabel-self`.
But hang on... does `/sys/fs/smackfs/relabel-self` even *exist* if Smack isn't enabled? Ah, right, `init_smk_fs` returns 0 if `smack_enabled == 0`, so the filesystem isn't registered. It *only* exists if Smack is active. And since many distributions allow you to choose your LSM at boot, if Smack is the enabled LSM, this *is* a DoS.
Hmm, I wonder if there are other files in the Smack file system that call `commit_creds`. We already checked `codesearch-find-references` for `commit_creds` and found `smk_write_relabel_self`. Are there any other LSMs that might do this? AppArmor? SELinux? I should check SELinux.
|
| 29/2 |
2026/09/18 00:50 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:security/selinux/selinuxfs.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:security/selinux/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 30/2 |
2026/09/18 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 29267
output: 56
thoughts: 16
Thoughts: Okay, here's my interpretation of those thoughts, summarized from an expert's perspective:
**Security Context Investigation**
Alright, so I'm thinking about how we handle privilege escalation and security in this system. My mind immediately jumps to SELinux. It's the go-to for mandatory access control, but wait... I'm pretty sure I remember something crucial β SELinux doesn't directly call `commit_creds`. That means it's relying on something else, a different mechanism to enforce its access control policies at that crucial point. That raises a significant question about the architecture and how these permissions are actually applied.
My train of thought quickly moves on to AppArmor. Is this a potential point of interaction between that mechanism and privilege escalation? AppArmor is another major player in Linux security, and it's another possible point to focus on in this investigation. I need to understand how the permissions are being checked and enforced. What are the key attack vectors and is there something the user can do to bypass the protection to achieve their goal.
|
| 31/2 |
2026/09/18 00:50 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:security/apparmor/apparmorfs.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:security/apparmor/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 32/2 |
2026/09/18 00:50 |
llm |
expert |
0m
Model:
Tokens:
input: 29576
output: 28
thoughts: 250
Thoughts: **My Current Assessment of Credential Overrides**
Okay, so AppArmor isn't the culprit here; it doesn't utilize `commit_creds` in this context. This is looking specifically like a Smack issue then. I need to think through other potential mechanisms that *could* trigger `commit_creds` with credentials that have been overridden.
Let's see, what about `cachefiles`? That definitely overrides credentials during I/O operations to its backing filesystem. But, if the *backing* filesystem itself were smackfs... hmm, no. That's a dead end. `cachefiles` needs a real, block-based filesystem that supports xattrs and all that, usually ext4 or xfs. Smackfs is a pseudo-filesystem. So it won't write to smackfs.
Alright, what about `overlayfs`? That's another contender since it overrides credentials when writing to the upper directory. Can smackfs even *be* an upper directory, though? No, overlayfs also mandates a directory on a filesystem with xattr support. Smackfs doesn't support that either, so no go.
Okay, let's switch gears. What about `nfsd`? That overrides credentials when processing requests. Can `nfsd` even *export* smackfs? Pseudo-filesystems are usually out of the question unless they expose `export_operations`. Time to check if smackfs has `export_operations` now.
|
| 33/2 |
2026/09/18 00:51 |
tool |
grepper |
0m
Error:
Args: map[Expression:export_operations PathPrefix:security/smack/]
Results:
|
| 34/2 |
2026/09/18 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 30176
output: 39
thoughts: 399
Thoughts: **Kernel Panic via io_uring and Smackfs: A Deep Dive**
Okay, so the initial answer was a simple "no," but let's dig deeper. The question is can `unshare` be used with `io_uring` to achieve some kind of privilege escalation? No dice, and the same goes for `setuid`, `keyctl`, and `landlock_restrict_self`. `io_uring` just doesn't expose those syscalls, which is what I suspected.
Alright, so if not those, the primary avenue here has got to be `smk_write_relabel_self` triggered via `io_uring`. Ah, wait... `io_uring` does support `IORING_OP_WRITE` and `IORING_OP_WRITEV`, which is important for the `loop_rw_iter` reproducer using `io_write` used in the reproducer. Looks like we've got ourselves a solid Denial of Service (DoS) vulnerability. A kernel panic, no less.
So here's the breakdown of the situation:
* Exploitable? Nope, it triggers a `BUG_ON`, causing a kernel panic.
* DoS? Absolutely. Kernel panic, game over.
* Accessible From Unprivileged Processes? Yes! `io_uring` is accessible, and the `/sys/fs/smackfs/relabel-self` file is world-writable (0666).
* User Namespaces? Yes, unprivileged userspace, no problem.
* Triggered remotely or from a guest VM? No.
* Triggered via network or peripheral? No.
* Malicious filesystem? No.
Wait, hold on a second... are we absolutely sure about the permissions on `relabel-self`? Time to double-check that `security/smack/smackfs.c` source code again. Gotta make sure we have all the facts straight before we proceed.
|
| 35/2 |
2026/09/18 00:51 |
tool |
read-file |
0m
Args: map[File:security/smack/smackfs.c FirstLine:2840 LineCount:20]
Results: map[Contents:2840: [SMK_NET6ADDR] = {
2841: "ipv6host", &smk_net6addr_ops, S_IRUGO|S_IWUSR},
2842: #endif /* CONFIG_IPV6 */
2843: [SMK_RELABEL_SELF] = {
2844: "relabel-self", &smk_relabel_self_ops,
2845: S_IRUGO|S_IWUGO},
2846: /* last one */
2847: {""}
2848: };
2849:
2850: rc = simple_fill_super(sb, SMACK_MAGIC, smack_files);
2851: if (rc != 0) {
2852: printk(KERN_ERR "%s failed %d while creating inodes\n",
2853: __func__, rc);
2854: return rc;
2855: }
2856:
2857: return 0;
2858: }
2859:
]
|
| 36/2 |
2026/09/18 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 31336
output: 32
thoughts: 249
Thoughts: **Analyzing Potential Security Implications**
Okay, so `S_IRUGO|S_IWUGO`, that's `0666`, meaning anyone can write to it. That's a red flag, but let's dig deeper. First, I need to check for other `BUG_ON` instances within `commit_creds`. Ah, here's one: `BUG_ON(atomic_long_read(&new->usage) < 1);`. But, it's not being triggered in this scenario.
So, is there another way to exploit this? If the `BUG_ON` triggers a panic, it's essentially a denial-of-service, a DoS, which is bad, but not as bad as privilege escalation or memory corruption. Unfortunately, there's no way to catch a kernel panic or continue execution after a `BUG_ON`.
Let me quickly verify something else. I'm going to double-check `io_uring` and if it's accessible to unprivileged users. Yes, `io_uring_setup` is available to unprivileged users by default in most kernels, though some distros restrict it with `kernel.io_uring_disabled` via sysctl. However, I am assuming we are at default sysctl values. The default in upstream kernel is `0` (enabled for all) or `2` (disabled for all, but actually the default in `io_uring/io_uring.c` is `0`).
|
| 37/2 |
2026/09/18 00:51 |
tool |
grepper |
0m
Args: map[Expression:sysctl_io_uring_disabled PathPrefix:io_uring/]
Results: map[Output:io_uring/io_uring.c=128=static struct workqueue_struct *iou_wq __ro_after_init;
io_uring/io_uring.c-129-
io_uring/io_uring.c:130:static int __read_mostly sysctl_io_uring_disabled;
io_uring/io_uring.c-131-static int __read_mostly sysctl_io_uring_group = -1;
--
io_uring/io_uring.c=134=static const struct ctl_table kernel_io_uring_disabled_table[] = {
--
io_uring/io_uring.c-136- .procname = "io_uring_disabled",
io_uring/io_uring.c:137: .data = &sysctl_io_uring_disabled,
io_uring/io_uring.c:138: .maxlen = sizeof(sysctl_io_uring_disabled),
io_uring/io_uring.c-139- .mode = 0644,
--
io_uring/io_uring.c=3114=static inline int io_uring_allowed(void)
io_uring/io_uring.c-3115-{
io_uring/io_uring.c:3116: int disabled = READ_ONCE(sysctl_io_uring_disabled);
io_uring/io_uring.c-3117- kgid_t io_uring_group;
]
|
| 38/2 |
2026/09/18 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 32315
output: 55
thoughts: 194
Thoughts: **Analyzing the Security Implications of IO_URing and Smackfs**
Okay, let's break this down systematically. First, I need to confirm the baseline. The system default for `sysctl_io_uring_disabled` is initialized to 0. That confirms, as I expected, that `io_uring` is enabled by default. That's our starting point.
Now, on to `smackfs`. The reproducer is accessing `/sys/fs/smackfs/relabel-self`, which strongly suggests that the system relies on Smack being active and `smackfs` mounted. My experience tells me that `init_smk_fs` or a systemd unit typically handles this mounting when Smack is the active LSM. This assumption feels safe to make given the context of the reproducer. This assumption is, in my professional experience, a valid assumption for systems actively using Smack.
The next thought is whether other LSMs might be vulnerable in a similar way. I know SELinux and AppArmor were checked and they don't use `commit_creds`. So what about Tomoyo? That's the next logical step in this analysis.
|
| 39/2 |
2026/09/18 00:51 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:security/tomoyo/tomoyo.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:security/tomoyo/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 40/2 |
2026/09/18 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 32826
output: 29
thoughts: 343
Thoughts: **My Assessment of the SmackFS Credentialing Issue**
Okay, so Tomoyo isn't the problem here, as it doesn't call `commit_creds`. I need to broaden my scope and look for other potential vulnerabilities within `smackfs`. Let me check if there are any other file operations within the filesystem that *do* call `commit_creds`. I already used `codesearch-find-references` and it turned up `smk_write_relabel_self` and `do_setattr`. `do_setattr`, though, isn't a file operation; it's an LSM hook, so it doesn't really matter. That leaves `relabel-self` as the only one.
Let's re-evaluate the dimensions of the potential issue. Exploitable? No, the `BUG_ON` makes it a kernel halt. Denial of Service? Yes, definitely. Can unprivileged processes trigger it? Yes. User namespaces? Also yes. No VM guest, host, network, peripheral, or malicious filesystem triggers here. Good.
Now, wait a minute... can this be triggered *without* `io_uring`? Are there other ways to get the `task->cred != task->real_cred` condition? Let's see... `override_creds` is used in a few places: `io_uring`, which we know, but also `cachefiles`, `nfsd`, `overlayfs`, `cgroup` (sometimes), `workqueue` (sometimes), `vhost`, and `aio`. Okay, let's look at `aio`. Is `aio` using `override_creds`? That's the next step.
|
| 41/2 |
2026/09/18 00:51 |
tool |
grepper |
0m
Error:
Args: map[Expression:override_creds PathPrefix:fs/aio.c]
Results:
|
| 42/2 |
2026/09/18 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 33573
output: 29
thoughts: 11
Thoughts: Okay, here's my summary, taking on the persona you requested:
**Assessing the Situation: A Quick Dismissal and a Strategic Pivot**
Nope. That's not it. Forget it.
Okay, let's step back, and instead of continuing down this line of thinking, let's go straight to `vhost`. I'm going to start there. This is where I think I should be. This will be an easy, simple, first check.
|
| 43/2 |
2026/09/18 00:51 |
tool |
grepper |
0m
Error:
Args: map[Expression:override_creds PathPrefix:drivers/vhost/]
Results:
|
| 44/2 |
2026/09/18 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 33728
output: 30
thoughts: 11
Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person:
**Initial Assessment: Negatory**
My initial instinct is "No." It's a gut reaction, a sense that the current line of thinking isn't leading anywhere fruitful, or perhaps is missing a crucial point. Itβs an immediate filter, but not a dismissal. I need more data.
So, Iβm mentally pivoting. The immediate next step is to examine the `workqueue`. Itβs a natural choice; it's likely a critical component for distributed tasks, and I've undoubtedly had experiences with this specific type of component. I'm focusing on that, trying to remember previous interactions with it, or maybe a specific edge case that might need to be revisited. I am thinking this is probably the right direction. It's time to dig in.
|
| 45/2 |
2026/09/18 00:51 |
tool |
grepper |
0m
Error:
Args: map[Expression:override_creds PathPrefix:kernel/workqueue.c]
Results:
|
| 46/2 |
2026/09/18 00:51 |
llm |
expert |
1m
Model:
Tokens:
input: 33969
output: 29
thoughts: 11
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Initial Assessment: Negative & Investigation Begins**
Alright, that's a flat "no." Something's not right. Time to investigate. The immediate next step is to examine the `cgroup` configuration. I need to understand its current state and if it might be the source of this problem. My initial assessment is negative, but I'm prepared to delve deeper.
|
| 47/2 |
2026/09/18 00:52 |
tool |
grepper |
0m
Error:
Args: map[Expression:override_creds PathPrefix:kernel/cgroup/]
Results:
|
| 48/2 |
2026/09/18 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 34119
output: 29
thoughts: 13
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Assessing the Landscape: OverlayFS**
Nope. That initial gut feeling, that immediate negative response, is a strong indicator. I'm usually pretty quick to reject approaches that won't pan out. But, I need to back it up. Let's not be hasty and simply dismiss the obvious.
Now, let me just double-check that `fs/overlayfs` path. Gotta be sure the initial hunch is right, and that I haven't missed some obvious use case or detail. Checking that specific area is my due diligence at this stage. Better to exhaust possibilities before moving on. I need to be certain there's nothing there that warrants further consideration before moving down the list of potential alternatives.
|
| 49/2 |
2026/09/18 00:52 |
tool |
grepper |
0m
Args: map[Expression:override_creds PathPrefix:fs/overlayfs/]
Results: map[Output:fs/overlayfs/copy_up.c=727=static const struct cred *ovl_prepare_copy_up_creds(struct dentry *dentry)
--
fs/overlayfs/copy_up.c-738-
fs/overlayfs/copy_up.c:739: return override_creds(copy_up_cred);
fs/overlayfs/copy_up.c-740-}
--
fs/overlayfs/dir.c=598=static const struct cred *ovl_override_creator_creds(const struct cred *original_creds,
--
fs/overlayfs/dir.c-617-
fs/overlayfs/dir.c:618: return override_creds(no_free_ptr(override_cred));
fs/overlayfs/dir.c-619-}
--
fs/overlayfs/dir.c=648=static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
--
fs/overlayfs/dir.c-653-
fs/overlayfs/dir.c:654: scoped_class(override_creds_ovl, original_creds, dentry->d_sb) {
fs/overlayfs/dir.c-655- /*
--
fs/overlayfs/dir.c=1374=static int ovl_create_tmpfile(struct file *file, struct dentry *dentry,
--
fs/overlayfs/dir.c-1384-
fs/overlayfs/dir.c:1385: scoped_class(override_creds_ovl, original_creds, dentry->d_sb) {
fs/overlayfs/dir.c-1386- scoped_class(ovl_override_creator_creds, cred, original_creds, dentry, inode, mode) {
--
fs/overlayfs/overlayfs.h=456=struct dentry *ovl_workdir(struct dentry *dentry);
fs/overlayfs/overlayfs.h:457:const struct cred *ovl_override_creds(struct super_block *sb);
fs/overlayfs/overlayfs.h-458-
fs/overlayfs/overlayfs.h:459:EXTEND_CLASS(override_creds, _ovl, ovl_override_creds(sb), struct super_block *sb)
fs/overlayfs/overlayfs.h-460-
fs/overlayfs/overlayfs.h-461-#define with_ovl_creds(sb) \
fs/overlayfs/overlayfs.h:462: scoped_class(override_creds_ovl, __UNIQUE_ID(label), sb)
fs/overlayfs/overlayfs.h-463-
--
fs/overlayfs/params.c=46=enum ovl_opt {
--
fs/overlayfs/params.c-62- Opt_volatile,
fs/overlayfs/params.c:63: Opt_override_creds,
fs/overlayfs/params.c-64-};
--
fs/overlayfs/params.c=161=const struct fs_parameter_spec ovl_parameter_spec[] = {
--
fs/overlayfs/params.c-177- fsparam_flag("volatile", Opt_volatile),
fs/overlayfs/params.c:178: fsparam_flag_no("override_creds", Opt_override_creds),
fs/overlayfs/params.c-179- {}
--
fs/overlayfs/params.c=612=static int ovl_parse_param(struct fs_context *fc, struct fs_parameter *param)
--
fs/overlayfs/params.c-695- break;
fs/overlayfs/params.c:696: case Opt_override_creds: {
fs/overlayfs/params.c-697- const struct cred *cred = NULL;
--
fs/overlayfs/util.c=59=struct dentry *ovl_workdir(struct dentry *dentry)
--
fs/overlayfs/util.c-64-
fs/overlayfs/util.c:65:const struct cred *ovl_override_creds(struct super_block *sb)
fs/overlayfs/util.c-66-{
--
fs/overlayfs/util.c-68-
fs/overlayfs/util.c:69: return override_creds(ofs->creator_cred);
fs/overlayfs/util.c-70-}
]
|
| 50/2 |
2026/09/18 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 35462
output: 52
thoughts: 517
Thoughts: **Analyzing the Attack Surface: `io_uring` and Credential Overrides**
Okay, so I've been digging into this `override_creds` issue and how it interacts with various filesystems and security modules. My initial thought was about `overlayfs`, and whether we could somehow exploit the interaction between it and `smackfs`. But after reasoning through it, it's clear that isn't going to work. `smackfs`'s `relabel-self` is a file within a pseudo-filesystem, and `overlayfs` needs directories. So that avenue is closed.
That leaves `io_uring` as the primary vector of attack.
I started thinking about whether there are any other `BUG_ON` checks in `commit_creds`. These are critical, as they indicate a potential DoS vulnerability. The two checks I see are: `BUG_ON(task->cred != old);` and `BUG_ON(atomic_long_read(&new->usage) < 1);`. Since they're `BUG_ON`, that means we can't bypass these checks directly. It's a hard stop.
So, I need to understand if `io_uring` is accessible from unprivileged processes, and whether user namespaces come into play. A quick check reveals that `io_uring_setup` is available to unprivileged users, and it *is* accessible from user namespaces. Thatβs an important point.
Next, I wondered about `smackfs`'s accessibility. `smackfs` is mounted in the initial user namespace. If a user creates a new user namespace, they can access `/sys/fs/smackfs/relabel-self` as long as it's inherited, which means the initial mount namespace still exists. So that's another critical data point.
I expanded the attack surface by looking at other filesystems and modules. What about `cachefiles`? It also uses `override_creds`. But it needs a backing filesystem, and can `smackfs` be a backing filesystem? No, `cachefiles` requires block mapping and xattrs, which `smackfs` doesn't provide. So `cachefiles` is not a viable path.
This points back to `io_uring` as the main route.
Finally, I checked other LSMs and modules. Could `io_uring` be used to trigger this with other LSMs? I looked at SELinux, AppArmor, and Tomoyo. None of them call `commit_creds` in their file operations. `security/keys/` and `keyctl` are system calls, not file operations. Does any file in `procfs` call `commit_creds`? That's another avenue to investigate.
So, `io_uring` is the critical piece here. I need to focus on how we can trigger this via `io_uring`.
|
| 51/2 |
2026/09/18 00:52 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:fs/proc/base.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:fs/proc/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 52/2 |
2026/09/18 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 36666
output: 54
thoughts: 10
Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person:
**Navigating a Technical Crossroads**
Initially, my instinct is a firm "no". I'm probably facing a problem with multiple potential approaches, and my first reaction is a reflexive rejection of whatever initial path was being considered. It's a gut check.
Then, the mental gears start to turn. The prompt of "sysfs" flicks a switch. It gets me thinking about a lower-level, more direct method of interaction. Is the proposed solution, whatever it was, perhaps overly complex? Is the problem space suited for simpler control via the filesystem? "Sysfs" is often a powerful tool for configuration and information in the kernel space. I begin to consider it as a potentially efficient, albeit possibly more granular, alternative.
|
| 53/2 |
2026/09/18 00:52 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:fs/sysfs/file.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:fs/sysfs/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 54/2 |
2026/09/18 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 36922
output: 54
thoughts: 10
Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person:
**Navigating the Technical Landscape**
Right, so, I'm facing a potential roadblock. The initial assessment is, "No." That's the gut reaction, the immediate sense of something not quite clicking or perhaps a direct negative result to an unstated question. We're obviously at a point where a quick solution isn't apparent.
But let's not jump to conclusions. Let's dig deeper. The next thought is a shift: a specific tool comes to mind. That "What about `debugfs`?" suggests a targeted exploration. It's a signal to dive into the low-level file system debugging possibilities. We're not throwing in the towel; we're considering a more nuanced, in-depth approach. We are thinking about this.
|
| 55/2 |
2026/09/18 00:53 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:fs/debugfs/file.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:fs/debugfs/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 56/2 |
2026/09/18 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 37188
output: 55
thoughts: 10
Thoughts: Okay, here's my attempt at summarizing those thoughts from an expert's perspective, using a first-person perspective:
**Initial Assessment: A Blank Canvas?**
Hmm, "No." That's not much to go on. It implies some kind of preceding question or problem. I'm left to assume this means that whatever solution was previously suggested isn't going to work. Well, that's not exactly helpful, but it's a start. I need more information to really dig in.
My mind needs something to latch onto here. What are the possibilities? What domains am I dealing with? I need some framing context to avoid wasted effort.
Aha! **`cgroup`** pops into my mind. Could that be relevant? The fact that it sprung up immediately suggests that I have had prior interaction in that domain. It's an interesting concept, depending on the problem at hand, it could be absolutely vital, or completely irrelevant. That is a good starting point, now I need to figure out how `cgroup` might apply to the given situation. If, hypothetically, that's where the failure in the original solution lay, it is a very interesting avenue to consider.
|
| 57/2 |
2026/09/18 00:53 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:kernel/cgroup/cgroup.c IncludeSnippetLines:0 Name:commit_creds SourceTreePrefix:kernel/cgroup/]
Results: map[References:<nil> TruncatedOutput:false]
|
| 58/2 |
2026/09/18 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 37522
output: 33
thoughts: 450
Thoughts: **Analyzing Potential Exploits and Credential Management**
Okay, so I've zeroed in on `smk_write_relabel_self`. Seems like it's the lone file operation that calls `commit_creds`. Interesting. Let's see if there's any way to exploit it. I see that it calls `commit_creds(new)`, and if the `BUG_ON` wasn't present, it would effectively change the worker thread's subjective credentials. However, the `BUG_ON` *is* there, which results in a panic, and thus, a Denial of Service. This isn't what I'm looking for, so let's move on.
Now, is there any way to make the statement `task->cred == old` true for an `io_uring` worker thread? I know that these threads have both `task->real_cred` and `task->cred`. When the worker begins executing, `task->real_cred == task->cred`. Subsequently, there's a call to `override_creds(req->creds)`. This function, of course, sets `task->cred = req->creds`. So, `task->cred != task->real_cred` unless `req->creds == task->real_cred`. The million-dollar question is, when does `req->creds == task->real_cred`?
`req->creds` are the credentials of the task that submitted the SQE. What about the worker? If the worker thread happens to have the same `real_cred` as the submitter's `creds`? Worker threads are created via `io_wq_create`. They inherit the credentials from the task that created the `io_wq`. This means that `worker->real_cred` is the creator's credentials. If the submitter is the very same task, then `req->creds` would be the creator's credentials. It follows that `req->creds == worker->real_cred`. Wait a second! If `req->creds == worker->real_cred`, then `override_creds(req->creds)` will set `task->cred = req->creds`, which, as we just established, is also equal to `task->real_cred`. Therefore, `task->cred == task->real_cred`! Bingo. I need to take a closer look at `override_creds`.
|
| 59/2 |
2026/09/18 00:53 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/cred.c Name:override_creds]
Results: map[SourceCode: 181: static inline const struct cred *override_creds(const struct cred *override_cred)
182: {
183: return rcu_replace_pointer(current->cred, override_cred, 1);
184: }
SourceFile:include/linux/cred.h]
|
| 60/2 |
2026/09/18 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 38625
output: 38
thoughts: 181
Thoughts: **Analyzing a Credential Bug**
Okay, so I'm digging into this credential issue, and here's the thought process: if `override_cred` and `current->real_cred` are pointing to the same memory location, then `current->cred` should end up being identical to `current->real_cred`. That's the core premise. Now, the `BUG_ON(task->cred != old)` in `commit_creds` shouldn't trigger, right? Let's be meticulous and trace this.
So, `old = task->real_cred;` sets the stage. Then, the crucial check: `BUG_ON(task->cred != old);`. If `task->cred == task->real_cred`, this `BUG_ON` should *not* fire. But wait... the bug report specifically points to `kernel BUG at kernel/cred.c:376!` which screams that `task->cred` is *not* equal to `task->real_cred`. That's the contradiction!
Why on earth would `task->cred` and `task->real_cred` be different in a worker thread, assuming that earlier they were made equal? That's the real puzzle. Okay, let's step back and meticulously investigate `io_issue_sqe`. That's where we need to focus our attention to understand this discrepancy.
|
| 61/2 |
2026/09/18 00:53 |
tool |
read-file |
0m
Args: map[File:io_uring/io_uring.c FirstLine:1370 LineCount:50]
Results: map[Contents:1370: const struct io_issue_def *def)
1371: {
1372: const struct cred *creds = NULL;
1373: struct io_kiocb *link = NULL;
1374: int ret;
1375:
1376: if (unlikely(req->flags & REQ_ISSUE_SLOW_FLAGS)) {
1377: if ((req->flags & REQ_F_CREDS) && req->creds != current_cred())
1378: creds = override_creds(req->creds);
1379: if (req->flags & REQ_F_ARM_LTIMEOUT)
1380: link = __io_prep_linked_timeout(req);
1381: }
1382:
1383: if (!def->audit_skip)
1384: audit_uring_entry(req->opcode);
1385:
1386: ret = def->issue(req, issue_flags);
1387:
1388: if (!def->audit_skip)
1389: audit_uring_exit(!ret, ret);
1390:
1391: if (unlikely(creds || link)) {
1392: if (creds)
1393: revert_creds(creds);
1394: if (link)
1395: io_queue_linked_timeout(link);
1396: }
1397:
1398: return ret;
1399: }
1400:
1401: static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
1402: {
1403: const struct io_issue_def *def = &io_issue_defs[req->opcode];
1404: int ret;
1405:
1406: if (unlikely(!io_assign_file(req, def, issue_flags)))
1407: return -EBADF;
1408:
1409: ret = __io_issue_sqe(req, issue_flags, def);
1410:
1411: if (ret == IOU_COMPLETE) {
1412: if (issue_flags & IO_URING_F_COMPLETE_DEFER)
1413: io_req_complete_defer(req);
1414: else
1415: io_req_complete_post(req, issue_flags);
1416:
1417: return 0;
1418: }
1419:
]
|
| 62/2 |
2026/09/18 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 39868
output: 37
thoughts: 316
Thoughts: **Analyzing Credential Handling in io_uring**
Okay, so I'm looking at this bit of code: `if ((req->flags & REQ_F_CREDS) && req->creds != current_cred()) creds = override_creds(req->creds);`. My immediate thought is, if the request has credential flags set *and* the requested credentials don't match the current credentials, *then* it calls `override_creds`. Makes sense, right? If `req->creds` *are* the same as `current_cred()`, it skips the override. But hold on, `current_cred()` is basically just a wrapper for `current->cred`.
So, it boils down to: if `req->creds` isn't what the current task has as its credentials, it will override them. Let's think about this in the context of a worker thread. Initially, `current->cred` inside the worker is going to be `worker->cred`. So, if `req->creds` isn't `worker->cred`, it *still* overrides them. The question is, why would `req->creds` be different in the first place?
My first instinct is, `req->creds` is the credentials of the task that *submitted* the SQE. So, if that submitting task changes its credentials somehowβa `setuid` call, maybe, or `commit_creds`β*after* creating the `io_wq`, then `req->creds` will diverge from the worker's initial credentials. Or, what if the `io_wq` is shared between multiple tasks with different credentials?
But wait a minute, the reproducerβwhat's it doing? I recall it's calling `commit_creds` somewhere in the setup... No, it doesn't call `setuid`, that's right. The reproducer calls `syz_io_uring_setup`, then `syz_io_uring_submit`. So, what's causing `req->creds` to be different? I need to go deeper. Let me look at the `io_wq_worker` function flow...
|
| 63/2 |
2026/09/18 00:53 |
tool |
read-file |
0m
Args: map[File:io_uring/io-wq.c FirstLine:730 LineCount:50]
Results: map[Contents: 730: }
731: last_timeout = false;
732: __io_worker_idle(acct, worker);
733: raw_spin_unlock(&acct->workers_lock);
734: if (io_run_task_work())
735: continue;
736: ret = schedule_timeout(WORKER_IDLE_TIMEOUT);
737: if (signal_pending(current)) {
738: struct ksignal ksig;
739:
740: if (!get_signal(&ksig))
741: continue;
742: break;
743: }
744: if (!ret) {
745: last_timeout = true;
746: exit_mask = !cpumask_test_cpu(raw_smp_processor_id(),
747: wq->cpu_mask);
748: }
749: }
750:
751: if (test_bit(IO_WQ_BIT_EXIT, &wq->state) && io_acct_run_queue(acct))
752: io_worker_handle_work(acct, worker);
753:
754: io_worker_exit(worker);
755: return 0;
756: }
757:
758: /*
759: * Called when a worker is scheduled in. Mark us as currently running.
760: */
761: void io_wq_worker_running(struct task_struct *tsk)
762: {
763: struct io_worker *worker = tsk->worker_private;
764:
765: if (!worker)
766: return;
767: if (!test_bit(IO_WORKER_F_UP, &worker->flags))
768: return;
769: if (test_bit(IO_WORKER_F_RUNNING, &worker->flags))
770: return;
771: set_bit(IO_WORKER_F_RUNNING, &worker->flags);
772: io_wq_inc_running(worker);
773: }
774:
775: /*
776: * Called when worker is going to sleep. If there are no workers currently
777: * running and we have work pending, wake up a free one or create a new one.
778: */
779: void io_wq_worker_sleeping(struct task_struct *tsk)
]
|
| 64/2 |
2026/09/18 00:53 |
llm |
expert |
1m
Model:
Tokens:
input: 41420
output: 38
thoughts: 594
Thoughts: **Analyzing the io_uring Credential Handling**
Okay, let me break this down. My initial understanding was that `io_wq_worker` threads, spawned through `create_io_worker` and ultimately `create_io_thread`, inherit the creator's credentials. The use of `override_creds` was the key part to ensure the worker operates with the submitter's credentials, right? And I thought that if the submitter and worker share the same task, `req->creds` would be identical to `worker->cred`, therefore, `override_creds` wouldn't be called. Meaning `task->cred` would remain equal to `task->real_cred` in the worker thread, and that `BUG_ON` in `commit_creds` would be skipped.
But wait, if `override_creds` *isn't* called, `commit_creds` should then be able to freely change `task->real_cred` and `task->cred` to the new credentials, which would then be used by the `smk_write_relabel_self` function.
However, the bug report says `kernel BUG at kernel/cred.c:376!`. So, the `BUG_ON(task->cred != old)` *did* trigger. Clearly, my assumptions about the conditions under which it would trigger are wrong. This means `task->cred` *was* different from `task->real_cred`, which can only mean that `override_creds` *was* called after all.
Now, why was `override_creds` called? The logic is pretty straightforward: it's called if `req->creds != current_cred()`. So, I need to look closely at where `req->creds` is set to understand why this condition is met.
|
| 65/2 |
2026/09/18 00:54 |
tool |
read-file |
0m
Args: map[File:io_uring/io_uring.c FirstLine:2210 LineCount:50]
Results: map[Contents:2210: struct io_ring_ctx *ctx = container_of(cb, struct io_ring_ctx,
2211: poll_wq_task_work);
2212:
2213: mutex_lock(&ctx->uring_lock);
2214: ctx->int_flags |= IO_RING_F_POLL_ACTIVATED;
2215: mutex_unlock(&ctx->uring_lock);
2216:
2217: /*
2218: * Wake ups for some events between start of polling and activation
2219: * might've been lost due to loose synchronisation.
2220: */
2221: wake_up_all(&ctx->poll_wq);
2222: percpu_ref_put(&ctx->refs);
2223: }
2224:
2225: __cold void io_activate_pollwq(struct io_ring_ctx *ctx)
2226: {
2227: spin_lock(&ctx->completion_lock);
2228: /* already activated or in progress */
2229: if ((ctx->int_flags & IO_RING_F_POLL_ACTIVATED) || ctx->poll_wq_task_work.func)
2230: goto out;
2231: if (WARN_ON_ONCE(!(ctx->int_flags & IO_RING_F_TASK_COMPLETE)))
2232: goto out;
2233: if (!ctx->submitter_task)
2234: goto out;
2235: /*
2236: * with ->submitter_task only the submitter task completes requests, we
2237: * only need to sync with it, which is done by injecting a tw
2238: */
2239: init_task_work(&ctx->poll_wq_task_work, io_activate_pollwq_cb);
2240: percpu_ref_get(&ctx->refs);
2241: if (task_work_add(ctx->submitter_task, &ctx->poll_wq_task_work, TWA_SIGNAL))
2242: percpu_ref_put(&ctx->refs);
2243: out:
2244: spin_unlock(&ctx->completion_lock);
2245: }
2246:
2247: static __poll_t io_uring_poll(struct file *file, poll_table *wait)
2248: {
2249: struct io_ring_ctx *ctx = file->private_data;
2250: __poll_t mask = 0;
2251:
2252: if (unlikely(!(data_race(ctx->int_flags) & IO_RING_F_POLL_ACTIVATED)))
2253: io_activate_pollwq(ctx);
2254: /*
2255: * provides mb() which pairs with barrier from wq_has_sleeper
2256: * call in io_commit_cqring
2257: */
2258: poll_wait(file, &ctx->poll_wq, wait);
2259:
]
|
| 66/2 |
2026/09/18 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 43290
output: 38
thoughts: 11
Thoughts: Okay, here's my attempt at summarizing that thought process, keeping in mind I'm speaking to a fellow expert and using first-person perspective:
**Diving into `io_init_req`**
Right, let's take a look at `io_init_req`. My mental checklist starts running. I'm immediately thinking about how the system handles the initial I/O request. I want to see exactly how this thing gets kicked off. What are the key data structures involved? What's the sequence? Are there any obvious areas for optimization or potential bottlenecks right off the bat? This is where the rubber meets the road, so understanding the initialization flow is crucial for diagnosing any performance or stability issues down the line. I'm expecting this to touch on device configuration, resource allocation, and probably some kind of interrupt setup. I'm keen to see the details.
|
| 67/2 |
2026/09/18 00:54 |
tool |
read-file |
0m
Args: map[File:io_uring/io_uring.c FirstLine:2300 LineCount:50]
Results: map[Contents:2300: * node. It'll be removed by the end of cancellation, just ignore it.
2301: * tctx can be NULL if the queueing of this task_work raced with
2302: * work cancelation off the exec path.
2303: */
2304: if (tctx && !atomic_read(&tctx->in_cancel))
2305: io_uring_del_tctx_node((unsigned long)work->ctx);
2306: complete(&work->completion);
2307: }
2308:
2309: static __cold void io_ring_exit_work(struct work_struct *work)
2310: {
2311: struct io_ring_ctx *ctx = container_of(work, struct io_ring_ctx, exit_work);
2312: unsigned long timeout = jiffies + IO_URING_EXIT_WAIT_MAX;
2313: unsigned long interval = HZ / 20;
2314: struct io_tctx_exit exit;
2315: struct io_tctx_node *node;
2316: int ret;
2317:
2318: mutex_lock(&ctx->uring_lock);
2319: io_terminate_zcrx(ctx);
2320: mutex_unlock(&ctx->uring_lock);
2321:
2322: /*
2323: * If we're doing polled IO and end up having requests being
2324: * submitted async (out-of-line), then completions can come in while
2325: * we're waiting for refs to drop. We need to reap these manually,
2326: * as nobody else will be looking for them.
2327: */
2328: do {
2329: if (test_bit(IO_CHECK_CQ_OVERFLOW_BIT, &ctx->check_cq)) {
2330: mutex_lock(&ctx->uring_lock);
2331: io_cqring_overflow_kill(ctx);
2332: mutex_unlock(&ctx->uring_lock);
2333: }
2334:
2335: /* The SQPOLL thread never reaches this path */
2336: do {
2337: if (ctx->flags & IORING_SETUP_DEFER_TASKRUN)
2338: io_cancel_local_task_work(ctx);
2339: cond_resched();
2340: } while (io_uring_try_cancel_requests(ctx, NULL, true, false));
2341:
2342: if (ctx->sq_data) {
2343: struct io_sq_data *sqd = ctx->sq_data;
2344: struct task_struct *tsk;
2345:
2346: io_sq_thread_park(sqd);
2347: tsk = sqpoll_task_locked(sqd);
2348: if (tsk && tsk->io_uring && tsk->io_uring->io_wq)
2349: io_wq_cancel_cb(tsk->io_uring->io_wq,
]
|
| 68/2 |
2026/09/18 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 44382
output: 38
thoughts: 11
Thoughts: Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:
**Hunting for `io_init_req`**
Right, let's get down to it. Time to locate `io_init_req`. I need to figure out how this function or structure is being used, where it's defined, and what dependencies it has. This isn't just a matter of finding the declaration; I need to understand its context within the broader I/O subsystem. What other modules are interacting with this? What data structures does it influence? I'm thinking I'll start with a good search, maybe using grep (or whatever our preferred tool is) across the relevant codebase. I'll need to be mindful of potential naming conventions and variations, so I should account for potential prefixes, suffixes, or similar names. The goal is a fast and accurate investigation of the code and its usage, since I have a complex set of knowledge within the domain and I can make effective judgments about the most useful search terms.
|
| 69/2 |
2026/09/18 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:io_uring/io_uring.c Name:io_init_req]
Results: map[SourceCode:1721: static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
1722: const struct io_uring_sqe *sqe, unsigned int *left)
1723: __must_hold(&ctx->uring_lock)
1724: {
1725: const struct io_issue_def *def;
1726: unsigned int sqe_flags;
1727: int personality;
1728:
1729: req->ctx = ctx;
1730: req->opcode = READ_ONCE(sqe->opcode);
1731: /* same numerical values with corresponding REQ_F_*, safe to copy */
1732: sqe_flags = READ_ONCE(sqe->flags);
1733: req->flags = (__force io_req_flags_t) sqe_flags;
1734: req->cqe.user_data = READ_ONCE(sqe->user_data);
1735: req->file = NULL;
1736: req->tctx = current->io_uring;
1737: req->cancel_seq_set = false;
1738: req->async_data = NULL;
1739:
1740: if (unlikely(req->opcode >= IORING_OP_LAST)) {
1741: req->opcode = 0;
1742: return io_init_fail_req(req, -EINVAL);
1743: }
1744: req->opcode = array_index_nospec(req->opcode, IORING_OP_LAST);
1745:
1746: def = &io_issue_defs[req->opcode];
1747: if (def->is_128 && !(ctx->flags & IORING_SETUP_SQE128)) {
1748: /*
1749: * A 128b op on a non-128b SQ requires mixed SQE support as
1750: * well as 2 contiguous entries.
1751: */
1752: if (!(ctx->flags & IORING_SETUP_SQE_MIXED) || *left < 2 ||
1753: (unsigned)(sqe - ctx->sq_sqes) >= ctx->sq_entries - 1)
1754: return io_init_fail_req(req, -EINVAL);
1755: /*
1756: * A 128b operation on a mixed SQ uses two entries, so we have
1757: * to increment the head and cached refs, and decrement what's
1758: * left.
1759: */
1760: current->io_uring->cached_refs++;
1761: ctx->cached_sq_head++;
1762: (*left)--;
1763: }
1764:
1765: if (unlikely(sqe_flags & ~SQE_COMMON_FLAGS)) {
1766: /* enforce forwards compatibility on users */
1767: if (sqe_flags & ~SQE_VALID_FLAGS)
1768: return io_init_fail_req(req, -EINVAL);
1769: if (sqe_flags & IOSQE_BUFFER_SELECT) {
1770: if (!def->buffer_select)
1771: return io_init_fail_req(req, -EOPNOTSUPP);
1772: req->buf_index = READ_ONCE(sqe->buf_group);
1773: }
1774: if (sqe_flags & IOSQE_CQE_SKIP_SUCCESS)
1775: ctx->int_flags |= IO_RING_F_DRAIN_DISABLED;
1776: if (sqe_flags & IOSQE_IO_DRAIN) {
1777: if (ctx->int_flags & IO_RING_F_DRAIN_DISABLED)
1778: return io_init_fail_req(req, -EOPNOTSUPP);
1779: io_init_drain(ctx);
1780: }
1781: }
1782: if (unlikely(ctx->int_flags & (IO_RING_F_OP_RESTRICTED | IO_RING_F_DRAIN_ACTIVE | IO_RING_F_DRAIN_NEXT))) {
1783: if (!io_check_restriction(ctx, req, sqe_flags))
1784: return io_init_fail_req(req, -EACCES);
1785: /* knock it to the slow queue path, will be drained there */
1786: if (ctx->int_flags & IO_RING_F_DRAIN_ACTIVE)
1787: req->flags |= REQ_F_FORCE_ASYNC;
1788: /* if there is no link, we're at "next" request and need to drain */
1789: if (unlikely(ctx->int_flags & IO_RING_F_DRAIN_NEXT) && !ctx->submit_state.link.head) {
1790: ctx->int_flags &= ~IO_RING_F_DRAIN_NEXT;
1791: ctx->int_flags |= IO_RING_F_DRAIN_ACTIVE;
1792: req->flags |= REQ_F_IO_DRAIN | REQ_F_FORCE_ASYNC;
1793: }
1794: }
1795:
1796: if (!def->ioprio && sqe->ioprio)
1797: return io_init_fail_req(req, -EINVAL);
1798: if (!def->iopoll && (ctx->flags & IORING_SETUP_IOPOLL))
1799: return io_init_fail_req(req, -EINVAL);
1800:
1801: if (def->needs_file) {
1802: struct io_submit_state *state = &ctx->submit_state;
1803:
1804: req->cqe.fd = READ_ONCE(sqe->fd);
1805:
1806: /*
1807: * Plug now if we have more than 2 IO left after this, and the
1808: * target is potentially a read/write to block based storage.
1809: */
1810: if (state->need_plug && def->plug) {
1811: state->plug_started = true;
1812: state->need_plug = false;
1813: blk_start_plug_nr_ios(&state->plug, state->submit_nr);
1814: }
1815: }
1816:
1817: personality = READ_ONCE(sqe->personality);
1818: if (personality) {
1819: int ret;
1820:
1821: req->creds = xa_load(&ctx->personalities, personality);
1822: if (!req->creds)
1823: return io_init_fail_req(req, -EINVAL);
1824: get_cred(req->creds);
1825: ret = security_uring_override_creds(req->creds);
1826: if (ret) {
1827: put_cred(req->creds);
1828: return io_init_fail_req(req, ret);
1829: }
1830: req->flags |= REQ_F_CREDS;
1831: }
1832:
1833: return def->prep(req, sqe);
1834: }
SourceFile:io_uring/io_uring.c]
|
| 70/2 |
2026/09/18 00:54 |
llm |
expert |
1m
Model:
Tokens:
input: 46723
output: 37
thoughts: 282
Thoughts: **Debugging a Credential Issue**
Okay, so I'm digging into this credential issue, and it's starting to make sense. My initial thought was, "Aha! `req->creds` is only set if `personality` is set in the SQE!" But wait... if `personality` is *not* set, then `req->creds` is also *not* set. And if `req->creds` isn't set, then `REQ_F_CREDS` isn't set either. Crucially, if `REQ_F_CREDS` is *not* set, the `override_creds` function won't be called.
Let's quickly reconfirm that within the `io_issue_sqe` function... Ah, yes: `if ((req->flags & REQ_F_CREDS) && req->creds != current_cred()) creds = override_creds(req->creds);` Precisely, if `REQ_F_CREDS` is off, `override_creds` is *not* invoked. Which means `task->cred == task->real_cred` should be the case. And therefore, the `BUG_ON(task->cred != old)` condition should *not* be triggered.
But... the bug report explicitly states that it *did* trigger! That's the crux of the problem. This contradicts my current understanding. So, something else must be going on.
Okay, let's explore this further. The implication is `io_wq_worker` must have `task->cred != task->real_cred` for *some* other reason. Does the function `io_wq_worker` call `override_creds` somewhere else? Perhaps. I need to investigate where it is called. Let's start by looking at `io_worker_handle_work`.
|
| 71/2 |
2026/09/18 00:55 |
tool |
read-file |
0m
Args: map[File:io_uring/io-wq.c FirstLine:600 LineCount:50]
Results: map[Contents: 600: * Called with acct->lock held, drops it before returning
601: */
602: static void io_worker_handle_work(struct io_wq_acct *acct,
603: struct io_worker *worker)
604: __releases(&acct->lock)
605: {
606: struct io_wq *wq = worker->wq;
607:
608: do {
609: struct io_wq_work *work;
610:
611: /*
612: * If we got some work, mark us as busy. If we didn't, but
613: * the list isn't empty, it means we stalled on hashed work.
614: * Mark us stalled so we don't keep looking for work when we
615: * can't make progress, any work completion or insertion will
616: * clear the stalled flag.
617: */
618: work = io_get_next_work(acct, wq);
619: if (work) {
620: /*
621: * Make sure cancelation can find this, even before
622: * it becomes the active work. That avoids a window
623: * where the work has been removed from our general
624: * work list, but isn't yet discoverable as the
625: * current work item for this worker.
626: */
627: raw_spin_lock(&worker->lock);
628: worker->cur_work = work;
629: raw_spin_unlock(&worker->lock);
630: }
631:
632: raw_spin_unlock(&acct->lock);
633:
634: if (!work)
635: break;
636:
637: __io_worker_busy(acct, worker);
638:
639: io_assign_current_work(worker, work);
640: __set_current_state(TASK_RUNNING);
641:
642: /* handle a whole dependent link */
643: do {
644: bool do_kill = test_bit(IO_WQ_BIT_EXIT, &wq->state);
645: struct io_wq_work *next_hashed, *linked;
646: unsigned int work_flags = atomic_read(&work->flags);
647: unsigned int hash = __io_wq_is_hashed(work_flags)
648: ? __io_get_work_hash(work_flags)
649: : -1U;
]
|
| 72/2 |
2026/09/18 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 48206
output: 40
thoughts: 13
Thoughts: Okay, here's my attempt at summarizing that thought process, keeping in mind I'm speaking to a fellow expert:
**Investigating `io_assign_current_work`**
Alright, let's dive into this. The mental checklist starts with `io_assign_current_work`. My initial thought is likely focused on understanding *where* and *how* this function fits into the overall I/O processing pipeline. It's a key function so I want to ensure I have a good grasp of its behavior. I need to refresh my memory on the interactions of this function with data structures like the work queue, request descriptors, and any associated locking mechanisms. I'll probably be thinking about potential bottlenecks, races, or error conditions this function might be susceptible to. It's time to dig in and re-evaluate my mental model of this critical component.
|
| 73/2 |
2026/09/18 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:io_uring/io-wq.c Name:io_assign_current_work]
Results: map[SourceCode: 586: static void io_assign_current_work(struct io_worker *worker,
587: struct io_wq_work *work)
588: {
589: if (work) {
590: io_run_task_work();
591: cond_resched();
592: }
593:
594: raw_spin_lock(&worker->lock);
595: worker->cur_work = work;
596: raw_spin_unlock(&worker->lock);
597: }
SourceFile:io_uring/io-wq.c]
|
| 74/2 |
2026/09/18 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 48632
output: 38
thoughts: 32
Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue:
**Investigating `override_creds` in the IO Workqueue**
Hmm, something's not quite clicking. I'm trying to trace the lifecycle of `override_creds` within the IO workqueue, specifically in `io_wq`. I know it's a critical function for security context, and I'm drawing a blank on its usage within this particular context. Where the heck is it being *called*?
Alright, time to get to the source. The natural place to start looking is the `io_wq_submit_work` function. That's the entry point for most work being scheduled on the IO workqueue, so it's the logical candidate for handling credential overrides. I'll need to carefully dissect `io_wq_submit_work` and see if the function appears there, or is referenced by a function that it calls. I'll have to examine the arguments and execution path closely. Let's dig in.
|
| 75/2 |
2026/09/18 00:55 |
tool |
read-file |
0m
Args: map[File:io_uring/io_uring.c FirstLine:1500 LineCount:50]
Results: map[Contents:1500: if (req->flags & (REQ_F_MULTISHOT|REQ_F_APOLL_MULTISHOT)) {
1501: err = -EBADFD;
1502: if (!io_file_can_poll(req))
1503: goto fail;
1504: if (req->file->f_flags & O_NONBLOCK ||
1505: req->file->f_mode & FMODE_NOWAIT) {
1506: err = -ECANCELED;
1507: if (io_arm_poll_handler(req, issue_flags) != IO_APOLL_OK)
1508: goto fail;
1509: return;
1510: } else {
1511: req->flags &= ~(REQ_F_APOLL_MULTISHOT|REQ_F_MULTISHOT);
1512: }
1513: }
1514:
1515: if (req->flags & REQ_F_FORCE_ASYNC) {
1516: bool opcode_poll = def->pollin || def->pollout;
1517:
1518: if (opcode_poll && io_file_can_poll(req)) {
1519: needs_poll = true;
1520: issue_flags |= IO_URING_F_NONBLOCK;
1521: }
1522: }
1523:
1524: do {
1525: ret = io_issue_sqe(req, issue_flags);
1526: if (ret != -EAGAIN)
1527: break;
1528:
1529: /*
1530: * If REQ_F_NOWAIT is set, then don't wait or retry with
1531: * poll. -EAGAIN is final for that case.
1532: */
1533: if (req->flags & REQ_F_NOWAIT)
1534: break;
1535:
1536: /*
1537: * We can get EAGAIN for iopolled IO even though we're
1538: * forcing a sync submission from here, since we can't
1539: * wait for request slots on the block side.
1540: */
1541: if (!needs_poll) {
1542: if (!(req->flags & REQ_F_IOPOLL))
1543: break;
1544: if (io_wq_worker_stopped())
1545: break;
1546: cond_resched();
1547: continue;
1548: }
1549:
]
|
| 76/2 |
2026/09/18 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 49674
output: 39
thoughts: 299
Thoughts: **Debugging a Subtle Credential Issue**
Okay, so `io_wq_submit_work` kicks off a chain, calling `io_issue_sqe`, which then leads to `__io_issue_sqe`. Now, `__io_issue_sqe` is interesting: it has this conditional block, looking at `req->flags`. Specifically, if `REQ_ISSUE_SLOW_FLAGS` is set, and also `REQ_F_CREDS`, it will potentially call `override_creds`.
The problem is, the bug report mentioned a `BUG_ON(task->cred != old)` triggering. That's odd. If `REQ_F_CREDS` isn't set, then `override_creds` shouldn't be called, so the credentials should not be overriden at all! I thought `override_creds` was the only place this can happen. So why did this assertion fire? I need to figure out why `task->cred` is different from `old`.
Let's revisit `io_init_req`. Aha! The crucial line is `req->flags = (__force io_req_flags_t) sqe_flags;`. It looks like `req->flags` is being initialized from `sqe->flags`. And `sqe->flags` comes directly from the user. Could `sqe->flags` somehow be influencing this?
Wait, what are `sqe->flags`? They're `IOSQE_*` flags, which doesn't seem to overlap with the internal `REQ_F_CREDS`. No, hang on. `REQ_F_CREDS` is defined using `REQ_F_CREDS_BIT`, it's bitwise.
Okay, I'm getting somewhere... I think the issue is `sqe->flags` and `req->flags`, and how they are related.
|
| 77/2 |
2026/09/18 00:56 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:io_uring/io_uring.c Name:REQ_F_CREDS]
Results: map[SourceCode: SourceFile:]
|
| 78/2 |
2026/09/18 00:56 |
llm |
expert |
2m
Model:
Tokens:
input: 50443
output: 30
thoughts: 13
Thoughts: Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:
**Initiating the Credential Hunt**
Alright, the objective is clear: I need to locate where `REQ_F_CREDS` is defined or referenced within this codebase or system. It's a fairly standard first step, especially when dealing with potentially sensitive information like credentials. I'm assuming that this likely represents a request flag or a similar indicator related to credential retrieval or usage, but without the context, that's just an educated guess. My focus is going to be on a precise search.
|
| 79/2 |
2026/09/18 00:58 |
tool |
grepper |
0m
Args: map[Expression:REQ_F_CREDS PathPrefix:io_uring/]
Results: map[Output:io_uring/io_uring.c-107-#define IO_REQ_CLEAN_FLAGS (REQ_F_BUFFER_SELECTED | REQ_F_NEED_CLEANUP | \
io_uring/io_uring.c:108: REQ_F_INFLIGHT | REQ_F_CREDS | REQ_F_ASYNC_DATA)
io_uring/io_uring.c-109-
--
io_uring/io_uring.c=312=static void io_clean_op(struct io_kiocb *req)
--
io_uring/io_uring.c-324- atomic_dec(&req->tctx->inflight_tracked);
io_uring/io_uring.c:325: if (req->flags & REQ_F_CREDS)
io_uring/io_uring.c-326- put_cred(req->creds);
--
io_uring/io_uring.c=361=static void io_prep_async_work(struct io_kiocb *req)
--
io_uring/io_uring.c-364-
io_uring/io_uring.c:365: if (!(req->flags & REQ_F_CREDS)) {
io_uring/io_uring.c:366: req->flags |= REQ_F_CREDS;
io_uring/io_uring.c-367- req->creds = get_current_cred();
--
io_uring/io_uring.c=1352=static bool io_assign_file(struct io_kiocb *req, const struct io_issue_def *def,
--
io_uring/io_uring.c-1365-
io_uring/io_uring.c:1366:#define REQ_ISSUE_SLOW_FLAGS (REQ_F_CREDS | REQ_F_ARM_LTIMEOUT)
io_uring/io_uring.c-1367-
io_uring/io_uring.c=1368=static inline int __io_issue_sqe(struct io_kiocb *req,
--
io_uring/io_uring.c-1376- if (unlikely(req->flags & REQ_ISSUE_SLOW_FLAGS)) {
io_uring/io_uring.c:1377: if ((req->flags & REQ_F_CREDS) && req->creds != current_cred())
io_uring/io_uring.c-1378- creds = override_creds(req->creds);
--
io_uring/io_uring.c=1721=static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
--
io_uring/io_uring.c-1829- }
io_uring/io_uring.c:1830: req->flags |= REQ_F_CREDS;
io_uring/io_uring.c-1831- }
--
io_uring/openclose.c=275=int io_install_fixed_fd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
--
io_uring/openclose.c-292- /* ensure the task's creds are used when installing/receiving fds */
io_uring/openclose.c:293: if (req->flags & REQ_F_CREDS)
io_uring/openclose.c-294- return -EPERM;
]
|
| 80/2 |
2026/09/18 00:58 |
llm |
expert |
0m
Model:
Tokens:
input: 51498
output: 27
thoughts: 435
Thoughts: **Async IO Credential Handling Deep Dive**
Okay, so I'm looking at `io_prep_async_work` and something jumps out immediately: it's setting `REQ_F_CREDS`! That means it's handling credentials for async requests, which makes sense. I see it calls `get_current_cred()` and assigns those credentials to `req->creds`. So, when a request gets punted to `io_wq`, this function gets called, and we're capturing the submitter's credentials.
Now, that's interesting because the actual work is then handled in a worker thread within `io_wq`, specifically by `__io_issue_sqe`. Looking at the code path again, I see `req->flags` *does* have `REQ_F_CREDS`, and thus we're using the submitter's `req->creds`. Meanwhile, `current_cred()` would return the worker thread's credentials. The question I'm trying to wrap my head around is: Are these credentials potentially different?
The worker thread was created using `create_io_thread`. I need to figure out how credentials are handled during thread creation. Does the child thread inherit credentials? If it's a clone/fork, is it a copy or a shared pointer? Hold on... wait a minute! If the submitter is the *same* task that created the `io_wq` (and therefore the worker thread), then `req->creds` and `worker->cred` should be *the same pointer*! Because `get_current_cred()` is simply incrementing a refcount and returning `current->cred`. If they are the same pointer, then that `req->creds != current_cred()` check would evaluate to *false*!
In the common case, the two credentials will be identical, then we *wouldn't* call `override_creds` which would bypass the credential override path. Why would these pointers *ever* be different? That's what I need to understand. I need to go back and check the code for `create_io_thread` to be sure.
|
| 81/2 |
2026/09/18 00:58 |
tool |
grepper |
0m
Args: map[Expression:create_io_thread PathPrefix:kernel/]
Results: map[Output:kernel/fork.c=2665=struct task_struct * __init fork_idle(int cpu)
--
kernel/fork.c-2690- */
kernel/fork.c:2691:struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
kernel/fork.c-2692-{
]
|
| 82/2 |
2026/09/18 00:58 |
llm |
expert |
0m
Model:
Tokens:
input: 52520
output: 34
thoughts: 11
Thoughts: Okay, let's dive into this `create_io_thread` code. My initial thought is to just get a quick overview. What's the core functionality here? What's the primary purpose? I'm already anticipating some of the usual suspects: thread creation, resource management, error handling, and of course, the actual I/O operations themselves. Since I'm familiar with this area, I'll be looking for things like thread safety, potential race conditions, and how they've handled concurrent access to shared resources if any are used. I'll want to see how it's integrated with the larger application, too. Is it tightly coupled, or well-designed and modular? I'll probably start scanning for the main entry point, then trace execution from there. Letβs see what we've got!
|
| 83/2 |
2026/09/18 00:58 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2690 LineCount:40]
Results: map[Contents:2690: */
2691: struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node)
2692: {
2693: unsigned long flags = CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|
2694: CLONE_IO|CLONE_VM|CLONE_UNTRACED;
2695: struct kernel_clone_args args = {
2696: .flags = flags,
2697: .fn = fn,
2698: .fn_arg = arg,
2699: .io_thread = 1,
2700: .user_worker = 1,
2701: };
2702:
2703: return copy_process(NULL, 0, node, &args);
2704: }
2705:
2706: /*
2707: * Ok, this is the main fork-routine.
2708: *
2709: * It copies the process, and if successful kick-starts
2710: * it and waits for it to finish using the VM if required.
2711: */
2712: pid_t kernel_clone(struct kernel_clone_args *args)
2713: {
2714: u64 clone_flags = args->flags;
2715: struct completion vfork;
2716: struct pid *pid;
2717: struct task_struct *p;
2718: int trace = 0;
2719: pid_t nr;
2720:
2721: /*
2722: * Creating an empty mount namespace implies creating a new mount
2723: * namespace. Set this before copy_process() so that the
2724: * CLONE_NEWNS|CLONE_FS mutual exclusion check works correctly.
2725: */
2726: if (clone_flags & CLONE_EMPTY_MNTNS) {
2727: clone_flags |= CLONE_NEWNS;
2728: args->flags = clone_flags;
2729: }
]
|
| 84/2 |
2026/09/18 00:58 |
llm |
expert |
0m
Model:
Tokens:
input: 53344
output: 34
thoughts: 12
Thoughts: Okay, here's my interpretation of that process, delivered as a first-person summary, keeping in mind my expertise:
**My Understanding of the Data Flow**
Alright, so the core of the operation here hinges on the `copy_process` function. I see this as the main driver, the orchestrator, the thing that's kicking off the whole copying mechanism. Now, the key detail I'm picking up is the fact that `copy_process` *calls* `copy_creds`. This is where my understanding really gets honed in. My immediate interpretation is that `copy_creds` is likely responsible for handling the credentials aspect. I would guess this is where access tokens, authentication keys, API credentials, or whatever sensitive information is stored, gets copied. The way this is architected suggests a degree of separation of concerns. `copy_process` might be concerned with the larger data flow, file handling, network transfers, while `copy_creds` deals specifically with security and access control details. This structure suggests a thoughtful approach to minimize the scope of any potential security risks, and provides a clear mechanism for modularity and maintainability.
|
| 85/2 |
2026/09/18 00:58 |
tool |
read-file |
0m
Args: map[File:kernel/fork.c FirstLine:2160 LineCount:40]
Results: map[Contents:2160: p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? args->child_tid : NULL;
2161:
2162: ftrace_graph_init_task(p);
2163:
2164: rt_mutex_init_task(p);
2165: raw_spin_lock_init(&p->blocked_lock);
2166:
2167: lockdep_assert_irqs_enabled();
2168: #ifdef CONFIG_PROVE_LOCKING
2169: DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
2170: #endif
2171: retval = copy_creds(p, clone_flags);
2172: if (retval < 0)
2173: goto bad_fork_free;
2174:
2175: retval = -EAGAIN;
2176: if (is_rlimit_overlimit(task_ucounts(p), UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC))) {
2177: if (p->real_cred->user != INIT_USER &&
2178: !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN))
2179: goto bad_fork_cleanup_count;
2180: }
2181: current->flags &= ~PF_NPROC_EXCEEDED;
2182:
2183: /*
2184: * If multiple threads are within copy_process(), then this check
2185: * triggers too late. This doesn't hurt, the check is only there
2186: * to stop root fork bombs.
2187: */
2188: retval = -EAGAIN;
2189: if (data_race(nr_threads >= max_threads))
2190: goto bad_fork_cleanup_count;
2191:
2192: delayacct_tsk_init(p); /* Must remain after dup_task_struct() */
2193: p->flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER | PF_IDLE | PF_NO_SETAFFINITY);
2194: p->flags |= PF_FORKNOEXEC;
2195: INIT_LIST_HEAD(&p->children);
2196: INIT_LIST_HEAD(&p->sibling);
2197: rcu_copy_process(p);
2198: p->vfork_done = NULL;
2199: spin_lock_init(&p->alloc_lock);
]
|
| 86/2 |
2026/09/18 00:58 |
llm |
expert |
0m
Model:
Tokens:
input: 54339
output: 33
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Analyzing the Credential Copy Function**
Alright, time to dive into this. The initial impulse, the starting point, is to scrutinize `copy_creds`. This isn't just a generic function call; it's the core of something, probably a credentialing system, authentication, authorization, or secure data transfer. The mental gears immediately start turning, assessing the potential attack surface. What kind of credentials are we talking about? Where are they stored? How is the copy performed? Is it a direct memory copy, a serialized transfer, or something more complex? The security implications are immense, depending on implementation details. I'm already mentally running through potential vulnerabilities: buffer overflows, format string bugs, side-channel attacks, and even simple logic errors in how the copy is validated. Need to see this function's source code, and quick. Let's see how they do it.
|
| 87/2 |
2026/09/18 00:58 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/fork.c Name:copy_creds]
Results: map[SourceCode: 254: /*
255: * Copy credentials for the new process created by fork()
256: *
257: * We share if we can, but under some circumstances we have to generate a new
258: * set.
259: *
260: * The new process gets the current process's subjective credentials as its
261: * objective and subjective credentials
262: */
263: int copy_creds(struct task_struct *p, u64 clone_flags)
264: {
265: struct cred *new;
266: int ret;
267:
268: #ifdef CONFIG_KEYS_REQUEST_CACHE
269: p->cached_requested_key = NULL;
270: #endif
271:
272: if (
273: #ifdef CONFIG_KEYS
274: !p->cred->thread_keyring &&
275: #endif
276: clone_flags & CLONE_THREAD
277: ) {
278: p->real_cred = get_cred_many(p->cred, 2);
279: kdebug("share_creds(%p{%ld})",
280: p->cred, atomic_long_read(&p->cred->usage));
281: inc_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1);
282: get_cred_namespaces(p);
283: return 0;
284: }
285:
286: new = prepare_creds();
287: if (!new)
288: return -ENOMEM;
289:
290: if (clone_flags & CLONE_NEWUSER) {
291: ret = create_user_ns(new);
292: if (ret < 0)
293: goto error_put;
294: ret = set_cred_ucounts(new);
295: if (ret < 0)
296: goto error_put;
297: }
298:
299: #ifdef CONFIG_KEYS
300: /* new threads get their own thread keyrings if their parent already
301: * had one */
302: if (new->thread_keyring) {
303: key_put(new->thread_keyring);
304: new->thread_keyring = NULL;
305: if (clone_flags & CLONE_THREAD)
306: install_thread_keyring_to_cred(new);
307: }
308:
309: /* The process keyring is only shared between the threads in a process;
310: * anything outside of those threads doesn't inherit.
311: */
312: if (!(clone_flags & CLONE_THREAD)) {
313: key_put(new->process_keyring);
314: new->process_keyring = NULL;
315: }
316: #endif
317:
318: p->cred = p->real_cred = get_cred(new);
319: inc_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1);
320: get_cred_namespaces(p);
321:
322: return 0;
323:
324: error_put:
325: put_cred(new);
326: return ret;
327: }
SourceFile:kernel/cred.c]
|
| 88/2 |
2026/09/18 00:58 |
llm |
expert |
0m
Model:
Tokens:
input: 55650
output: 66
thoughts: 2220
Thoughts: **Analysis of the io_uring smk_write_relabel_self BUG**
Okay, let's break this down. `copy_creds` behaves differently based on `CLONE_THREAD` and `thread_keyring`. Because `create_io_thread` uses `CLONE_THREAD`, the worker thread shares the same credentials (`cred`) with its creator. The worker's `real_cred` also points to the same `cred`. Crucially, the request's credentials (`req->creds`) initially match the creator's.
Here's the problem: if the submitter *is* the creator, then the request's credentials are the same as the worker thread's. So, for the *first* request, the `override_creds` function is *not* called. The first request will call `commit_creds`, and that modifies the *worker's* `real_cred` and `cred` to *new* credentials from `smk_write_relabel_self`. Since the refcount is decremented properly, there should be no memory corruption.
For the *second* request, however, things are different. Since the worker thread now has different credentials, `req->creds != current_cred()` is now TRUE. Thus, `override_creds` is now called, which sets the worker's `cred` to the *submitter's* credentials while leaving `real_cred` as the new credentials. Now, if the second request calls `smk_write_relabel_self` *again*, `commit_creds` will be called with the *now-different* credentials, resulting in a `BUG_ON` because the credentials don't match.
My interpretation of the reproducer is spot on. The first request changes the worker's credentials, and the second one triggers the check.
The next question: is this exploitable? Can we leverage the change in worker credentials? No. The new credentials created by `prepare_creds()` are just Smack labels, not a privilege escalation. `io_uring` requests are controlled by `req->creds`. Changing the worker's credentials doesn't affect execution because `override_creds` will *always* set the request's credentials back to the submitter's. It's a DoS, not a vulnerability.
Let's double-check memory corruption, just to be sure. `put_cred_many` properly handles the refcounts. The worker thread gets two references to the creator's credentials during its creation, and `commit_creds` correctly releases those references (with `put_cred_many(old, 2)`. After `commit_creds`, the worker now holds two references to the new credentials. This balances the references; there's no leak or use-after-free.
So, in summary, it's a denial-of-service, plain and simple.
Key characteristics:
* Exploitable: No.
* Denial of Service: Yes.
* Unprivileged: Yes.
* User Namespace: Yes.
* Triggers: No.
This bug is a kernel panic via `BUG_ON` in `commit_creds` called by an `io_uring` worker thread with `smack_write_relabel_self`, which means it will occur in an io_uring context when Smack is enabled and smackfs is mounted. It is accessible to unprivileged users, because the relabel-self file is world writable, and `io_uring` is available to unprivileged users. There's no privilege escalation, no memory corruption, just a DoS.
|
| 89/2 |
2026/09/18 00:58 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 90/2 |
2026/09/18 00:58 |
llm |
expert |
1m
Model:
Tokens:
input: 58802
output: 566
thoughts: 444
Thoughts: **My Analysis of the `io_uring` and Smack Vulnerability**
Okay, the data is in, and I need to formulate my final response. It looks like we have a Denial of Service (DoS) situation here. Let's break it down.
The crux of the issue boils down to how `io_uring` interacts with Smack's relabeling functionality, specifically through the `/sys/fs/smackfs/relabel-self` interface. The `smk_write_relabel_self` function is the culprit. When a write is performed on that interface, it calls `commit_creds()` to change the task's Smack label.
Here's where `io_uring`'s design comes into play and creates a conflict: `io_uring` worker threads use `override_creds()` to temporarily adopt the credentials of the task that submitted the I/O request. The key is in how `commit_creds()` handles these credential changes. It includes a check, `BUG_ON(task->cred != old)`, that prevents the change when the credentials are in this overridden state.
The bug reveals itself when a user submits two *consecutive* write requests to `/sys/fs/smackfs/relabel-self` via `io_uring`. The first call succeeds without issues because the worker thread initially has the same credentials as the submitter, so `override_creds()` is either a no-op or not called. `commit_creds()` updates the base credentials of the worker thread. However, when the *second* request is made, the worker thread *now* has different base credentials than the submitter. This causes `override_creds()` to be called, putting the worker thread into its overridden state. The subsequent call to `smk_write_relabel_self` and `commit_creds()` hits the `BUG_ON` condition, and the kernel panics.
The good news is that the panic *is* the extent of the damage. This bug presents a DoS condition, but I don't see any path for privilege escalation or memory corruption. The `BUG_ON` is immediate and prevents anything more severe. The credential changes themselves don't offer any extra privileges or create any refcount imbalances that could be exploited.
Finally, the vulnerability is accessible to unprivileged users, as `/sys/fs/smackfs/relabel-self` has permissions set to `0666`, which means anyone can read and write to it. Plus, `io_uring` is, by default, accessible to unprivileged users. And, it's also available from user namespaces which broadens the surface for exploitation.
|
| 91/1 |
2026/09/18 00:59 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the vulnerability:
**Bug Mechanism:**
The bug is triggered when an unprivileged user uses `io_uring` to write to the
Smack LSM pseudo-filesystem file `/sys/fs/smackfs/relabel-self`.
The `smk_write_relabel_self()` function handles writes to this file and calls
`commit_creds()` to apply a new Smack label to the current task. However,
`io_uring` worker threads execute requests on behalf of the submitter and use
`override_creds()` to temporarily assume the submitter's credentials.
When `commit_creds()` is called, it explicitly forbids being called while
credentials are in an overridden state by checking `BUG_ON(task->cred != old)`.
In the provided reproducer, two consecutive write requests are submitted:
1. During the first request, the `io_uring` worker thread still shares the exact
same credential structure as the submitter, so `override_creds()` does not
create a mismatch. `commit_creds()` succeeds and permanently changes the worker
thread's base credentials.
2. During the second request, the worker thread's base credentials now differ
from the submitter's credentials. `io_uring` calls `override_creds()` to
temporarily switch to the submitter's credentials, putting the worker thread
into an overridden state (`task->cred != task->real_cred`). When
`smk_write_relabel_self()` calls `commit_creds()` this time, the `BUG_ON`
assertion fails, causing a kernel panic.
**Exploitability:**
This bug is **not exploitable** for privilege escalation or memory corruption.
The `BUG_ON` macro causes a hard kernel panic, halting execution immediately.
Furthermore, the credential modifications prior to the crash do not grant any
elevated capabilities or cause any reference counting imbalances
(use-after-free).
**Denial of Service:**
This bug results in a **Denial of Service (DoS)** because any unprivileged user
can intentionally trigger the `BUG_ON` assertion to crash the system.
**Accessibility:**
The bug is **accessible from unprivileged processes** and **user namespaces**.
The `/sys/fs/smackfs/relabel-self` file is created with `0666`
(`S_IRUGO|S_IWUGO`) permissions, meaning it is globally writable. Additionally,
`io_uring` is available to unprivileged users by default in most kernel
configurations. The only prerequisite is that the Smack LSM must be enabled and
its filesystem mounted.]
|