Skip to content

io_uring_setup

Intro

io_uring_setup - Setup/initialize an io_uring instance.

Description

The io_uring_setup() syscall sets up the io_uring instance associated with the file descriptor returned by the io_uring_get_fd() syscall. It returns -1 on error, or 0 on success. The io_uring_setup() syscall is used to configure various options on the io_uring instance, such as the sq_ring_size (the size of the submission queue ring in number of elements), cq_ring_size (the size of the completion queue ring in number of elements), flags (various IORING_SETUP_* flags, see below for a list), and other parameters.

The io_uring_setup() syscall is used for initializing and configuring the io_uring instance. The caller should fill in the io_uring_params structure pointed to by the p argument, with the desired parameter values prior to calling io_uring_setup().

Arguments

  • entries:unsigned int[K] - Number of sq and cq entries, must be a power of 2, and size must be >= IORING_MIN_ENTRIES and <= IORING_MAX_ENTRIES. This argument is required.
  • p:struct io_uring_params*[K] - Points to struct io_uring_params containing various options. Optional unless the IORING_SETUP_PARAM_* flags are set.

Available Tags

  • K - Originated from kernel-space.
  • U - Originated from user space (for example, pointer to user space memory used to get it)
  • TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
  • OPT - Optional argument - might not always be available (passed with null value)

Hooks

system_call_after_io_uring_setup

Type

Kprobe + Kretprobe

Purpose

To trace the return value of the io_uring_setup syscall.

Example Use Case

The io_uring_setup syscall can be used to collect latency data for a particular request. By hooking the io_uring_setup syscall and instrumenting the request with a tracepoint, one can measure the time elapsed between a request being submitted and the completion being returned by the io_uring.

Issues

N/A

  • io_uring_get_fd - get a file descriptor from an io_uring instance.
  • io_uring_enter - submit IO requests to an io_uring instance.

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.