public inbox for [email protected]
 help / color / mirror / Atom feed
* [io-uring] WARNING in io_rsrc_ref_quiesce
@ 2024-06-07 17:11 chase xd
  2024-06-12  1:13 ` Pavel Begunkov
  0 siblings, 1 reply; 4+ messages in thread
From: chase xd @ 2024-06-07 17:11 UTC (permalink / raw)
  To: axboe, asml.silence, io-uring, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2720 bytes --]

Dear Linux kernel maintainers,

Syzkaller reports this previously unknown bug on Linux
6.8.0-rc3-00043-ga69d20885494-dirty #4. Seems like the bug was
silently or unintendedly fixed in the latest version.

```
------------[ cut here ]------------
do not call blocking ops when !TASK_RUNNING; state=1 set at
[<ffffffff815d2494>] prepare_to_wait+0xa4/0x380
kernel/sched/wait.c:237
WARNING: CPU: 2 PID: 397056 at kernel/sched/core.c:10099
__might_sleep+0x114/0x160 kernel/sched/core.c:10099
Modules linked in:
CPU: 2 PID: 397056 Comm: syz-executor.2 Not tainted
6.8.0-rc3-00043-ga69d20885494-dirty #50
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
RIP: 0010:__might_sleep+0x114/0x160 kernel/sched/core.c:10099
Code: 03 00 48 8d bb 50 17 00 00 48 89 fa 48 c1 ea 03 80 3c 02 00 75
37 48 8b 93 50 17 00 00 48 c7 c7 a0 55 0b 8a e8 9d d4 f4 ff 90 <0f> 0b
90 90 e9 71 ff ff ff e8 4e 28 78 00 e9 22 ff ff ff 89 34 24
RSP: 0018:ffffc9000bf5fb40 EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff888053524880 RCX: 0000000000000000
RDX: 0000000000000002 RSI: 0000000000000004 RDI: 0000000000000001
RBP: ffffffff8a0bc600 R08: 0000000000000001 R09: ffffed1017315171
R10: ffff8880b98a8b8b R11: 0000000000000000 R12: 0000000000000249
R13: 0000000000000000 R14: dffffc0000000000 R15: ffffc9000bf5fd20
FS:  00007fe4ffdcc640(0000) GS:ffff8880b9880000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa501ba3098 CR3: 0000000022b8c000 CR4: 0000000000750ef0
PKRU: 55555554
Call Trace:
 <TASK>
 __mutex_lock_common kernel/locking/mutex.c:585 [inline]
 __mutex_lock+0xb4/0x940 kernel/locking/mutex.c:752
 io_rsrc_ref_quiesce+0x590/0x940 io_uring/rsrc.c:253
 io_sqe_buffers_unregister+0xa2/0x340 io_uring/rsrc.c:799
 __io_uring_register io_uring/register.c:424 [inline]
 __do_sys_io_uring_register+0x5b9/0x2400 io_uring/register.c:613
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd8/0x270 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7fe4ff0902ed
Code: c3 e8 97 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe4ffdcc028 EFLAGS: 00000246 ORIG_RAX: 00000000000001ab
RAX: ffffffffffffffda RBX: 00007fe4ff1cbf80 RCX: 00007fe4ff0902ed
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000003
RBP: 00007fe4ff0f150e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fe4ff1cbf80 R15: 00007fe4ffdac000
 </TASK>

```

crepro is in the attachment.

Best Regards
Xdchase

[-- Attachment #2: repro.c --]
[-- Type: application/octet-stream, Size: 16887 bytes --]

// autogenerated by syzkaller (https://github.com/google/syzkaller)

#define _GNU_SOURCE

#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>

#ifndef __NR_io_uring_enter
#define __NR_io_uring_enter 426
#endif
#ifndef __NR_io_uring_register
#define __NR_io_uring_register 427
#endif
#ifndef __NR_io_uring_setup
#define __NR_io_uring_setup 425
#endif

static void sleep_ms(uint64_t ms)
{
  usleep(ms * 1000);
}

static uint64_t current_time_ms(void)
{
  struct timespec ts;
  if (clock_gettime(CLOCK_MONOTONIC, &ts))
    exit(1);
  return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
}

static bool write_file(const char* file, const char* what, ...)
{
  char buf[1024];
  va_list args;
  va_start(args, what);
  vsnprintf(buf, sizeof(buf), what, args);
  va_end(args);
  buf[sizeof(buf) - 1] = 0;
  int len = strlen(buf);
  int fd = open(file, O_WRONLY | O_CLOEXEC);
  if (fd == -1)
    return false;
  if (write(fd, buf, len) != len) {
    int err = errno;
    close(fd);
    errno = err;
    return false;
  }
  close(fd);
  return true;
}

#define SIZEOF_IO_URING_SQE 64
#define SIZEOF_IO_URING_CQE 16
#define SQ_HEAD_OFFSET 0
#define SQ_TAIL_OFFSET 64
#define SQ_RING_MASK_OFFSET 256
#define SQ_RING_ENTRIES_OFFSET 264
#define SQ_FLAGS_OFFSET 276
#define SQ_DROPPED_OFFSET 272
#define CQ_HEAD_OFFSET 128
#define CQ_TAIL_OFFSET 192
#define CQ_RING_MASK_OFFSET 260
#define CQ_RING_ENTRIES_OFFSET 268
#define CQ_RING_OVERFLOW_OFFSET 284
#define CQ_FLAGS_OFFSET 280
#define CQ_CQES_OFFSET 320

// From linux/io_uring.h
struct io_uring_cqe {
  uint64_t user_data;
  uint32_t res;
  uint32_t flags;
};

/* This is x86 specific */
#define read_barrier() __asm__ __volatile__("" ::: "memory")
#define write_barrier() __asm__ __volatile__("" ::: "memory")

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 resv2;
};

struct io_cqring_offsets {
  uint32_t head;
  uint32_t tail;
  uint32_t ring_mask;
  uint32_t ring_entries;
  uint32_t overflow;
  uint32_t cqes;
  uint64_t resv[2];
};

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;
};

#define IORING_OFF_SQ_RING 0
#define IORING_OFF_SQES 0x10000000ULL
#define IORING_SETUP_SQE128 (1U << 10)
#define IORING_SETUP_CQE32 (1U << 11)
#define IORING_SETUP_NO_SQARRAY (1U << 16)

static struct io_uring_params* io_uring_p;

static long syz_io_uring_complete(volatile long a0, volatile long a1)
{
  // syzlang: syz_io_uring_complete(ring_ptr ring_ptr)
  // C:       syz_io_uring_complete(char* ring_ptr)
  // It is not checked if the ring is empty
  // Cast to original
  long ring_ptr = a0;
  int* result_fd = (int*)a1;
  // result_fd = (int*)mmap(0, sizeof(int) * (io_uring_p->cq_entries), PROT_READ
  // | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); result_fd_cnt = (int*)mmap(0,
  // sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
  int cnt = 0;
  // head read once
  unsigned cq_head_raw = *(unsigned*)(io_uring_p->cq_off.head + ring_ptr);
  unsigned cq_ring_mask = *(unsigned*)(io_uring_p->cq_off.ring_mask + ring_ptr);
  do {

    read_barrier();
    // tail
    unsigned cq_tail_raw = *(unsigned*)(io_uring_p->cq_off.tail + ring_ptr);
    if (cq_head_raw == cq_tail_raw) {
      break;
    }
    // head != tail, retrieve cq from head
    unsigned cq_head = cq_head_raw & cq_ring_mask;
    struct io_uring_cqe* cqe;
    if ((io_uring_p->flags & IORING_SETUP_CQE32) == 0)
      cqe = (struct io_uring_cqe*)(io_uring_p->cq_off.cqes + ring_ptr +
                                   SIZEOF_IO_URING_CQE * cq_head);
    else
      cqe = (struct io_uring_cqe*)(io_uring_p->cq_off.cqes + ring_ptr +
                                   SIZEOF_IO_URING_CQE * 2 * cq_head);
    // In the descriptions (sys/linux/io_uring.txt), openat and openat2 are
    // passed with a unique range of sqe.user_data (0x12345 and 0x23456) to
    // identify the operations which produces an fd instance. Check
    // cqe.user_data, which should be the same as sqe.user_data for that
    // operation. If it falls in that unique range, return cqe.res as fd.
    // Otherwise, just return an invalid fd.
    if (cqe->user_data == 0x12345 || cqe->user_data == 0x23456)
      result_fd[cnt++] = cqe->res;
    cq_head_raw += 1;
  } while (1);
  *(unsigned*)(io_uring_p->cq_off.head + ring_ptr) = cq_head_raw;
  write_barrier();
  if (cnt == 0) {
    return -1;
  }
  return 0;
}

// Wrapper for io_uring_setup and the subsequent mmap calls that map the ring
// and the sqes
static long syz_io_uring_setup(volatile long a0, volatile long a1,
                               volatile long a2, volatile long a3)
{
  // syzlang: syz_io_uring_setup(entries int32[1:IORING_MAX_ENTRIES], params
  // ptr[inout, io_uring_params], ring_ptr ptr[out, ring_ptr], sqes_ptr ptr[out,
  // sqes_ptr]) fd_io_uring C:       syz_io_uring_setup(uint32_t entries, struct
  // io_uring_params* params, void** ring_ptr_out, void** sqes_ptr_out) //
  // returns uint32_t fd_io_uring Cast to original
  uint32_t entries = (uint32_t)a0;
  struct io_uring_params* setup_params = (struct io_uring_params*)a1;
  void** ring_ptr_out = (void**)a2;
  void** sqes_ptr_out = (void**)a3;
  // Temporarily disable IORING_SETUP_CQE32 and IORING_SETUP_SQE128 that may
  // change SIZEOF_IO_URING_CQE and SIZEOF_IO_URING_SQE. Tracking bug:
  // https://github.com/google/syzkaller/issues/4531.
  setup_params->flags &= ~(IORING_SETUP_CQE32 | IORING_SETUP_SQE128);
  uint32_t fd_io_uring = syscall(__NR_io_uring_setup, entries, setup_params);
  io_uring_p = setup_params;
  // Compute the ring sizes
  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 * SIZEOF_IO_URING_CQE;
  // Asssumed IORING_FEAT_SINGLE_MMAP, which is always the case with the current
  // implementation The implication is that the sq_ring_ptr and the cq_ring_ptr
  // are the same but the difference is in the offsets to access the fields of
  // these rings.
  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 * SIZEOF_IO_URING_SQE;
  *sqes_ptr_out = mmap(0, sqes_sz, PROT_READ | PROT_WRITE,
                       MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQES);
  return fd_io_uring;
}

static long syz_io_uring_submit(volatile long a0, volatile long a1,
                                volatile long a2)
{
  // syzlang: syz_io_uring_submit(ring_ptr ring_ptr, sqes_ptr sqes_ptr,
  // sqe ptr[in, io_uring_sqe]) C:       syz_io_uring_submit(char* ring_ptr,
  // io_uring_sqe* sqes_ptr,    io_uring_sqe* sqe) It is not checked if the ring
  // is full Cast to original
  long ring_ptr = a0; // This will be exposed to offsets in bytes
  char* sqes_ptr = (char*)a1;
  char* sqe = (char*)a2;
  unsigned sq_tail_raw = *(unsigned*)(io_uring_p->sq_off.tail + ring_ptr);
  unsigned sq_ring_mask = *(unsigned*)(io_uring_p->sq_off.ring_mask + ring_ptr);
  unsigned sq_tail = sq_tail_raw & sq_ring_mask;
  // write to current sq tail sqe
  void* sqe_dest;
  if ((io_uring_p->flags & IORING_SETUP_SQE128) == 0)
    sqe_dest = (void*)(sqes_ptr + SIZEOF_IO_URING_SQE * sq_tail);
  else {
    sqe_dest = (void*)(sqes_ptr + SIZEOF_IO_URING_SQE * sq_tail * 2);
  }

  // Write the sqe entry to its destination in sqes
  memcpy(sqe_dest, sqe, SIZEOF_IO_URING_SQE);
  // Advance the tail. Tail is a free-flowing integer and relies on natural
  // wrapping. Ensure that the kernel will never see a tail update without the
  // preceeding SQE stores being done.
  __atomic_store_n((unsigned*)(io_uring_p->sq_off.tail + ring_ptr),
                   sq_tail_raw + 1, __ATOMIC_RELEASE);
  // update sq array
  if ((io_uring_p->flags & IORING_SETUP_NO_SQARRAY) == 0)
    __atomic_store_n((unsigned*)(io_uring_p->sq_off.array + ring_ptr) + sq_tail,
                     sq_tail, __ATOMIC_RELEASE);
  // Now the application is free to call io_uring_enter() to submit the sqe
  return 0;
}

static void kill_and_wait(int pid, int* status)
{
  kill(-pid, SIGKILL);
  kill(pid, SIGKILL);
  for (int i = 0; i < 100; i++) {
    if (waitpid(-1, status, WNOHANG | __WALL) == pid)
      return;
    usleep(1000);
  }
  DIR* dir = opendir("/sys/fs/fuse/connections");
  if (dir) {
    for (;;) {
      struct dirent* ent = readdir(dir);
      if (!ent)
        break;
      if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
        continue;
      char abort[300];
      snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
               ent->d_name);
      int fd = open(abort, O_WRONLY);
      if (fd == -1) {
        continue;
      }
      if (write(fd, abort, 1) < 0) {
      }
      close(fd);
    }
    closedir(dir);
  } else {
  }
  while (waitpid(-1, status, __WALL) != pid) {
  }
}

static void setup_test()
{
  prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  setpgrp();
  write_file("/proc/self/oom_score_adj", "1000");
}

static void execute_one(void);

#define WAIT_FLAGS __WALL

static void loop(void)
{
  int iter = 0;
  for (;; iter++) {
    int pid = fork();
    if (pid < 0)
      exit(1);
    if (pid == 0) {
      setup_test();
      execute_one();
      exit(0);
    }
    int status = 0;
    uint64_t start = current_time_ms();
    for (;;) {
      if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
        break;
      sleep_ms(1);
      if (current_time_ms() - start < 5000)
        continue;
      kill_and_wait(pid, &status);
      break;
    }
  }
}

uint64_t r[5] = {0x0, 0x0, 0x0, 0xffffffffffffffff, 0x0};

void execute_one(void)
{
  intptr_t res = 0;
  *(uint32_t*)0x20000004 = 0x1ed2;
  *(uint32_t*)0x20000008 = 0;
  *(uint32_t*)0x2000000c = 1;
  *(uint32_t*)0x20000010 = 0x367;
  *(uint32_t*)0x20000018 = 0;
  memset((void*)0x2000001c, 0, 12);
  res = -1;
  res = syz_io_uring_setup(/*entries=*/0x29f3, /*params=*/0x20000000,
                           /*ring_ptr=*/0x20000080, /*sqes_ptr=*/0x200000c0);
  if (res != -1) {
    r[0] = res;
    r[1] = *(uint64_t*)0x20000080;
    r[2] = *(uint64_t*)0x200000c0;
  }
  res = syscall(__NR_open, /*file=*/0ul, /*flags=O_SYNC|O_RDWR*/ 0x101002ul,
                /*mode=S_IROTH|S_IWUSR*/ 0x84ul);
  if (res != -1)
    r[3] = res;
  syscall(__NR_open, /*file=*/0ul,
          /*flags=__O_TMPFILE|O_NOATIME|O_WRONLY*/ 0x440001ul,
          /*mode=S_IXGRP|S_IWGRP|S_IXUSR|S_IRUSR*/ 0x158ul);
  res = syscall(__NR_socket, /*domain=AF_RDS*/ 0x15ul, /*type=SOCK_STREAM*/ 1ul,
                /*proto=*/0x894);
  if (res != -1)
    r[4] = res;
  syscall(__NR_epoll_create1, /*flags=*/0ul);
  syscall(__NR_eventfd2, /*initval=*/8,
          /*flags=EFD_NONBLOCK|EFD_CLOEXEC*/ 0x80800ul);
  *(uint64_t*)0x20000340 = 0;
  *(uint64_t*)0x20000348 = 0;
  *(uint64_t*)0x20000350 = 0;
  *(uint64_t*)0x20000358 = 0;
  syscall(__NR_io_uring_register, /*fd=*/r[0], /*opcode=*/0ul,
          /*arg=*/0x20000340ul, /*nr_args=*/2ul);
  syscall(__NR_clock_gettime, /*id=*/0ul, /*tp=*/0ul);
  syscall(__NR_clock_gettime, /*id=*/0ul, /*tp=*/0ul);
  *(uint8_t*)0x20000380 = 0x21;
  *(uint8_t*)0x20000381 = 0x1c;
  *(uint16_t*)0x20000382 = 0;
  *(uint32_t*)0x20000384 = r[3];
  *(uint64_t*)0x20000388 = 0;
  *(uint64_t*)0x20000390 = 0;
  *(uint32_t*)0x20000398 = 3;
  *(uint32_t*)0x2000039c = 8;
  *(uint64_t*)0x200003a0 = 0;
  *(uint16_t*)0x200003a8 = 0;
  *(uint16_t*)0x200003aa = 0;
  *(uint32_t*)0x200003ac = r[3];
  memset((void*)0x200003b0, 0, 16);
  syz_io_uring_submit(/*ring_ptr=*/r[1], /*sqes_ptr=*/r[2], /*sqe=*/0x20000380);
  *(uint8_t*)0x20000440 = 0xb;
  *(uint8_t*)0x20000441 = 0x10;
  *(uint16_t*)0x20000442 = 0;
  *(uint32_t*)0x20000444 = 0;
  *(uint64_t*)0x20000448 = 4;
  *(uint64_t*)0x20000450 = 0x20000400;
  *(uint64_t*)0x20000400 = 0;
  *(uint64_t*)0x20000408 = 0;
  *(uint32_t*)0x20000458 = 1;
  *(uint32_t*)0x2000045c = 1;
  *(uint64_t*)0x20000460 = 1;
  *(uint16_t*)0x20000468 = 0;
  *(uint16_t*)0x2000046a = 0;
  memset((void*)0x2000046c, 0, 4);
  memset((void*)0x20000470, 0, 16);
  syz_io_uring_submit(/*ring_ptr=*/r[1], /*sqes_ptr=*/r[2], /*sqe=*/0x20000440);
  *(uint8_t*)0x20001780 = 9;
  *(uint8_t*)0x20001781 = 0xe;
  *(uint16_t*)0x20001782 = 0;
  *(uint32_t*)0x20001784 = r[4];
  *(uint64_t*)0x20001788 = 0;
  *(uint64_t*)0x20001790 = 0x20001740;
  *(uint64_t*)0x20001740 = 0;
  *(uint32_t*)0x20001748 = 0;
  *(uint64_t*)0x20001750 = 0;
  *(uint64_t*)0x20001758 = 0;
  *(uint64_t*)0x20001760 = 0;
  *(uint64_t*)0x20001768 = 0;
  *(uint32_t*)0x20001770 = 0;
  *(uint32_t*)0x20001798 = 7;
  *(uint32_t*)0x2000179c = 0x80;
  *(uint64_t*)0x200017a0 = 1;
  *(uint16_t*)0x200017a8 = 0;
  *(uint16_t*)0x200017aa = 0;
  memset((void*)0x200017ac, 0, 4);
  memset((void*)0x200017b0, 0, 16);
  syz_io_uring_submit(/*ring_ptr=*/r[1], /*sqes_ptr=*/r[2], /*sqe=*/0x20001780);
  *(uint8_t*)0x20001880 = 5;
  *(uint8_t*)0x20001881 = 1;
  *(uint16_t*)0x20001882 = 0x2007;
  *(uint32_t*)0x20001884 = r[3];
  *(uint64_t*)0x20001888 = 0x7fff;
  *(uint64_t*)0x20001890 = 0;
  *(uint32_t*)0x20001898 = 0;
  *(uint32_t*)0x2000189c = 0xa;
  *(uint64_t*)0x200018a0 = 0;
  *(uint16_t*)0x200018a8 = 0;
  *(uint16_t*)0x200018aa = 0;
  memset((void*)0x200018ac, 0, 4);
  memset((void*)0x200018b0, 0, 16);
  syz_io_uring_submit(/*ring_ptr=*/r[1], /*sqes_ptr=*/r[2], /*sqe=*/0x20001880);
  *(uint8_t*)0x20001900 = 7;
  *(uint8_t*)0x20001901 = 0xc;
  *(uint16_t*)0x20001902 = 0;
  *(uint32_t*)0x20001904 = r[3];
  *(uint64_t*)0x20001908 = 0x993;
  *(uint64_t*)0x20001910 = 2;
  *(uint16_t*)0x20001918 = 4;
  *(uint32_t*)0x2000191c = 0;
  *(uint64_t*)0x20001920 = 0;
  *(uint16_t*)0x20001928 = 0;
  *(uint16_t*)0x2000192a = 0;
  memset((void*)0x2000192c, 0, 4);
  memset((void*)0x20001930, 0, 16);
  syz_io_uring_submit(/*ring_ptr=*/r[1], /*sqes_ptr=*/r[2], /*sqe=*/0x20001900);
  *(uint8_t*)0x20001980 = 7;
  *(uint8_t*)0x20001981 = 3;
  *(uint16_t*)0x20001982 = 0;
  *(uint32_t*)0x20001984 = r[3];
  *(uint64_t*)0x20001988 = -1;
  *(uint64_t*)0x20001990 = 9;
  *(uint16_t*)0x20001998 = 1;
  *(uint32_t*)0x2000199c = 0;
  *(uint64_t*)0x200019a0 = 0;
  *(uint16_t*)0x200019a8 = 0;
  *(uint16_t*)0x200019aa = 0;
  memset((void*)0x200019ac, 0, 4);
  memset((void*)0x200019b0, 0, 16);
  syz_io_uring_submit(/*ring_ptr=*/r[1], /*sqes_ptr=*/r[2], /*sqe=*/0x20001980);
  syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/6, /*min_complete=*/6,
          /*flags=IORING_ENTER_GETEVENTS*/ 1ul, /*sigmask=*/0ul, /*size=*/0ul);
  syz_io_uring_complete(/*ring_ptr=*/r[1], /*result_fd=*/0);
  syscall(__NR_open, /*file=*/0ul,
          /*flags=__O_TMPFILE|O_TRUNC|O_NONBLOCK*/ 0x400a00ul,
          /*mode=S_IXGRP|S_IWGRP|S_IRGRP*/ 0x38ul);
  syscall(__NR_open, /*file=*/0ul, /*flags=FASYNC*/ 0x2000ul,
          /*mode=S_IRUSR*/ 0x100ul);
  syscall(__NR_socket, /*domain=AF_ATMPVC*/ 8ul, /*type=SOCK_PACKET*/ 0xaul,
          /*proto=*/0xcffb);
  syscall(__NR_epoll_create1, /*flags=EPOLL_CLOEXEC*/ 0x80000ul);
  syscall(__NR_eventfd2, /*initval=*/0x1cf3c043, /*flags=EFD_SEMAPHORE*/ 1ul);
  syscall(__NR_io_uring_register, /*fd=*/r[0], /*opcode=*/1ul, /*arg=*/0ul,
          /*nr_args=*/0ul);
  syscall(__NR_clock_gettime, /*id=*/0ul, /*tp=*/0ul);
  syz_io_uring_submit(/*ring_ptr=*/r[1], /*sqes_ptr=*/r[2], /*sqe=*/0);
  syscall(__NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1, /*min_complete=*/1,
          /*flags=IORING_ENTER_EXT_ARG|IORING_ENTER_GETEVENTS*/ 9ul,
          /*sigmask=*/0ul, /*size=*/0ul);
  syz_io_uring_complete(/*ring_ptr=*/r[1], /*result_fd=*/0);
}
int main(void)
{
  syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul,
          /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  loop();
  return 0;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-12 12:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07 17:11 [io-uring] WARNING in io_rsrc_ref_quiesce chase xd
2024-06-12  1:13 ` Pavel Begunkov
     [not found]   ` <CADZouDRNKYB6ryGF+0HP5aJECUxApq4az6WNAYvjPs703mnDWA@mail.gmail.com>
2024-06-12  6:53     ` chase xd
2024-06-12 12:39       ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox