Update to liburing 2.2.

This commit is contained in:
Richard W.M. Jones 2022-08-22 15:57:32 +01:00
parent 7a47b79fb4
commit 505577cf3f
8 changed files with 216 additions and 630 deletions

2
.gitignore vendored
View File

@ -7,3 +7,5 @@
/liburing-0.7.tar.gz.asc
/liburing-2.0.tar.gz
/liburing-2.0.tar.gz.asc
/liburing-2.2.tar.gz
/liburing-2.2.tar.gz.asc

View File

@ -1,32 +0,0 @@
From 1815337f7dbb530ae3e3bc1175d8da214cf76eb5 Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 9 Mar 2021 14:19:12 +0000
Subject: [PATCH 1/2] spec: bump version to 2.0
The shared library is now liburing.so.2 but the pkgconfig and rpm files
still say 0.7. Existing binaries link against liburing.so.1 and will not
automatically pick up the new liburing.so.2 shared library.
Update the version number in liburing.spec so
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Link: https://lore.kernel.org/r/20210309141913.262131-2-stefanha@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
liburing.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/liburing.spec b/liburing.spec
index fa4d970..8607074 100644
--- a/liburing.spec
+++ b/liburing.spec
@@ -1,5 +1,5 @@
Name: liburing
-Version: 0.7
+Version: 2.0
Release: 1%{?dist}
Summary: Linux-native io_uring I/O access library
License: (GPLv2 with exceptions and LGPLv2+) or MIT
--
2.30.2

View File

@ -0,0 +1,205 @@
From 732bf609b670631731765a585a68d14ed3fdc9b7 Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@kernel.dk>
Date: Sun, 26 Jun 2022 14:37:32 -0600
Subject: [PATCH] test/io_uring_register: kill old memfd test
It's not a useful test case and it's causing issues on weird setups,
let's just get rid of it and then we can drop the memfd_create()
configure bits as well.
Link: https://github.com/axboe/liburing/issues/620
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
configure | 20 -------
test/io_uring_register.c | 124 ---------------------------------------
2 files changed, 144 deletions(-)
diff --git a/configure b/configure
index 2c2441b..43071dd 100755
--- a/configure
+++ b/configure
@@ -367,23 +367,6 @@ if compile_prog "" "" "has_ucontext"; then
fi
print_config "has_ucontext" "$has_ucontext"
-##########################################
-# check for memfd_create(2)
-has_memfd_create="no"
-cat > $TMPC << EOF
-#include <sys/mman.h>
-int main(int argc, char **argv)
-{
- int memfd = memfd_create("test", 0);
- return 0;
-}
-EOF
-if compile_prog "-Werror=implicit-function-declaration" "" "has_memfd_create"; then
- has_memfd_create="yes"
-fi
-print_config "has_memfd_create" "$has_memfd_create"
-
-
#############################################################################
if test "$liburing_nolibc" = "yes"; then
output_sym "CONFIG_NOLIBC"
@@ -419,9 +402,6 @@ fi
if test "$array_bounds" = "yes"; then
output_sym "CONFIG_HAVE_ARRAY_BOUNDS"
fi
-if test "$has_memfd_create" = "yes"; then
- output_sym "CONFIG_HAVE_MEMFD_CREATE"
-fi
echo "CC=$cc" >> $config_host_mak
print_config "CC" "$cc"
diff --git a/test/io_uring_register.c b/test/io_uring_register.c
index e639f05..05868e1 100644
--- a/test/io_uring_register.c
+++ b/test/io_uring_register.c
@@ -31,17 +31,6 @@ static int pagesize;
static rlim_t mlock_limit;
static int devnull;
-#if !defined(CONFIG_HAVE_MEMFD_CREATE)
-#include <sys/syscall.h>
-#include <linux/memfd.h>
-
-static int memfd_create(const char *name, unsigned int flags)
-{
- return (int)syscall(SYS_memfd_create, name, flags);
-}
-#endif
-
-
static int expect_fail(int fd, unsigned int opcode, void *arg,
unsigned int nr_args, int error)
{
@@ -462,113 +451,6 @@ static int test_poll_ringfd(void)
return status;
}
-static int test_shmem(void)
-{
- const char pattern = 0xEA;
- const int len = 4096;
- struct io_uring_sqe *sqe;
- struct io_uring_cqe *cqe;
- struct io_uring ring;
- struct iovec iov;
- int memfd, ret, i;
- char *mem;
- int pipefd[2] = {-1, -1};
-
- ret = io_uring_queue_init(8, &ring, 0);
- if (ret)
- return 1;
-
- if (pipe(pipefd)) {
- perror("pipe");
- return 1;
- }
- memfd = memfd_create("uring-shmem-test", 0);
- if (memfd < 0) {
- fprintf(stderr, "memfd_create() failed %i\n", -errno);
- return 1;
- }
- if (ftruncate(memfd, len)) {
- fprintf(stderr, "can't truncate memfd\n");
- return 1;
- }
- mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, 0);
- if (!mem) {
- fprintf(stderr, "mmap failed\n");
- return 1;
- }
- for (i = 0; i < len; i++)
- mem[i] = pattern;
-
- iov.iov_base = mem;
- iov.iov_len = len;
- ret = io_uring_register_buffers(&ring, &iov, 1);
- if (ret) {
- if (ret == -EOPNOTSUPP) {
- fprintf(stdout, "memfd registration isn't supported, "
- "skip\n");
- goto out;
- }
-
- fprintf(stderr, "buffer reg failed: %d\n", ret);
- return 1;
- }
-
- /* check that we can read and write from/to shmem reg buffer */
- sqe = io_uring_get_sqe(&ring);
- io_uring_prep_write_fixed(sqe, pipefd[1], mem, 512, 0, 0);
- sqe->user_data = 1;
-
- ret = io_uring_submit(&ring);
- if (ret != 1) {
- fprintf(stderr, "submit write failed\n");
- return 1;
- }
- ret = io_uring_wait_cqe(&ring, &cqe);
- if (ret < 0 || cqe->user_data != 1 || cqe->res != 512) {
- fprintf(stderr, "reading from shmem failed\n");
- return 1;
- }
- io_uring_cqe_seen(&ring, cqe);
-
- /* clean it, should be populated with the pattern back from the pipe */
- memset(mem, 0, 512);
- sqe = io_uring_get_sqe(&ring);
- io_uring_prep_read_fixed(sqe, pipefd[0], mem, 512, 0, 0);
- sqe->user_data = 2;
-
- ret = io_uring_submit(&ring);
- if (ret != 1) {
- fprintf(stderr, "submit write failed\n");
- return 1;
- }
- ret = io_uring_wait_cqe(&ring, &cqe);
- if (ret < 0 || cqe->user_data != 2 || cqe->res != 512) {
- fprintf(stderr, "reading from shmem failed\n");
- return 1;
- }
- io_uring_cqe_seen(&ring, cqe);
-
- for (i = 0; i < 512; i++) {
- if (mem[i] != pattern) {
- fprintf(stderr, "data integrity fail\n");
- return 1;
- }
- }
-
- ret = io_uring_unregister_buffers(&ring);
- if (ret) {
- fprintf(stderr, "buffer unreg failed: %d\n", ret);
- return 1;
- }
-out:
- io_uring_queue_exit(&ring);
- close(pipefd[0]);
- close(pipefd[1]);
- munmap(mem, len);
- close(memfd);
- return 0;
-}
-
int main(int argc, char **argv)
{
int fd, ret;
@@ -621,11 +503,5 @@ int main(int argc, char **argv)
if (status)
fprintf(stderr, "FAIL\n");
- ret = test_shmem();
- if (ret) {
- fprintf(stderr, "test_shmem() failed\n");
- status |= 1;
- }
-
return status;
}
--
2.35.1

View File

@ -1,35 +0,0 @@
From a9f23f088794c9b92c1471fc86c2b3c39ab475fd Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 9 Mar 2021 14:19:13 +0000
Subject: [PATCH 2/2] spec: add explicit build dependency on make
Fedora 34 is removing make from the buildroot. An explicit dependency is
now required:
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
Adding an explicit build dependency on make seems reasonable across all
rpm-based distros. It won't hurt on distros where make is always
available in the buildroot.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Link: https://lore.kernel.org/r/20210309141913.262131-3-stefanha@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
liburing.spec | 1 +
1 file changed, 1 insertion(+)
diff --git a/liburing.spec b/liburing.spec
index 8607074..0268d23 100644
--- a/liburing.spec
+++ b/liburing.spec
@@ -7,6 +7,7 @@ Source0: https://brick.kernel.dk/snaps/%{name}-%{version}.tar.gz
Source1: https://brick.kernel.dk/snaps/%{name}-%{version}.tar.gz.asc
URL: https://git.kernel.dk/cgit/liburing/
BuildRequires: gcc
+BuildRequires: make
%description
Provides native async IO for the Linux kernel, in a fast and efficient
--
2.30.2

View File

@ -1,473 +0,0 @@
From 808b6c72ab753bda0c300b5683cfd31750d1d49b Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@kernel.dk>
Date: Wed, 31 Mar 2021 13:23:56 -0600
Subject: [PATCH] test: get rid of x86_64'isms in the test code
Most/all of these are from syzbot. Turn them into regular system calls,
and just let liburing sort out the non-x86 ones.
Fixes: https://github.com/axboe/liburing/issues/322
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
test/35fa71a030ca-test.c | 16 +++++------
test/917257daa0fe-test.c | 8 +++---
test/a0908ae19763-test.c | 13 +++------
test/a4c0b3decb33-test.c | 10 +++----
test/accept-reuse.c | 1 -
test/b19062a56726-test.c | 8 +++---
test/double-poll-crash.c | 55 +++++++-------------------------------
test/fc2a85cb02ef-test.c | 10 ++++---
test/sendmsg_fs_cve.c | 1 -
test/sqpoll-disable-exit.c | 50 +++++-----------------------------
test/teardowns.c | 1 -
11 files changed, 43 insertions(+), 130 deletions(-)
diff --git a/test/35fa71a030ca-test.c b/test/35fa71a030ca-test.c
index 7f2124b..f5fcc4d 100644
--- a/test/35fa71a030ca-test.c
+++ b/test/35fa71a030ca-test.c
@@ -24,6 +24,9 @@
#include <linux/futex.h>
+#include "liburing.h"
+#include "../src/syscall.h"
+
#if !defined(SYS_futex) && defined(SYS_futex_time64)
# define SYS_futex SYS_futex_time64
#endif
@@ -259,13 +262,6 @@ static void loop(void)
}
}
-#ifndef __NR_io_uring_register
-#define __NR_io_uring_register 427
-#endif
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup 425
-#endif
-
uint64_t r[1] = {0xffffffffffffffff};
void execute_call(int call)
@@ -301,15 +297,15 @@ void execute_call(int call)
*(uint32_t*)0x200000a8 = 0;
*(uint32_t*)0x200000ac = 0;
*(uint64_t*)0x200000b0 = 0;
- res = syscall(__NR_io_uring_setup, 0x64, 0x20000040);
+ res = __sys_io_uring_setup(0x64, (struct io_uring_params *) 0x20000040UL);
if (res != -1)
r[0] = res;
break;
case 1:
- syscall(__NR_io_uring_register, (long)r[0], 0, 0, 0);
+ __sys_io_uring_register((long)r[0], 0, 0, 0);
break;
case 2:
- syscall(__NR_io_uring_register, (long)r[0], 0, 0, 0);
+ __sys_io_uring_register((long)r[0], 0, 0, 0);
break;
}
}
diff --git a/test/917257daa0fe-test.c b/test/917257daa0fe-test.c
index 2a3cb93..1d00ef1 100644
--- a/test/917257daa0fe-test.c
+++ b/test/917257daa0fe-test.c
@@ -6,14 +6,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h>
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup 425
-#endif
+#include "liburing.h"
+#include "../src/syscall.h"
int main(int argc, char *argv[])
{
@@ -50,6 +48,6 @@ int main(int argc, char *argv[])
*(uint32_t*)0x20000068 = 0;
*(uint32_t*)0x2000006c = 0;
*(uint64_t*)0x20000070 = 0;
- syscall(__NR_io_uring_setup, 0x7a6, 0x20000000);
+ __sys_io_uring_setup(0x7a6, (struct io_uring_params *) 0x20000000UL);
return 0;
}
diff --git a/test/a0908ae19763-test.c b/test/a0908ae19763-test.c
index 1d5741d..00cb559 100644
--- a/test/a0908ae19763-test.c
+++ b/test/a0908ae19763-test.c
@@ -6,17 +6,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h>
-#ifndef __NR_io_uring_register
-#define __NR_io_uring_register 427
-#endif
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup 425
-#endif
+#include "liburing.h"
+#include "../src/syscall.h"
uint64_t r[1] = {0xffffffffffffffff};
@@ -54,10 +49,10 @@ int main(int argc, char *argv[])
*(uint32_t*)0x200000e8 = 0;
*(uint32_t*)0x200000ec = 0;
*(uint64_t*)0x200000f0 = 0;
- res = syscall(__NR_io_uring_setup, 0xa4, 0x20000080);
+ res = __sys_io_uring_setup(0xa4, (struct io_uring_params *) 0x20000080);
if (res != -1)
r[0] = res;
*(uint32_t*)0x20000280 = -1;
- syscall(__NR_io_uring_register, r[0], 2, 0x20000280, 1);
+ __sys_io_uring_register(r[0], 2, (const void *) 0x20000280, 1);
return 0;
}
diff --git a/test/a4c0b3decb33-test.c b/test/a4c0b3decb33-test.c
index 23c20f6..34b0af2 100644
--- a/test/a4c0b3decb33-test.c
+++ b/test/a4c0b3decb33-test.c
@@ -14,13 +14,15 @@
#include <string.h>
#include <sys/prctl.h>
#include <sys/stat.h>
-#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <time.h>
#include <unistd.h>
+#include "liburing.h"
+#include "../src/syscall.h"
+
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
@@ -129,10 +131,6 @@ static void loop(void)
}
}
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup 425
-#endif
-
void execute_one(void)
{
*(uint32_t*)0x20000080 = 0;
@@ -163,7 +161,7 @@ void execute_one(void)
*(uint32_t*)0x200000e8 = 0;
*(uint32_t*)0x200000ec = 0;
*(uint64_t*)0x200000f0 = 0;
- syscall(__NR_io_uring_setup, 0x983, 0x20000080);
+ __sys_io_uring_setup(0x983, (struct io_uring_params *) 0x20000080);
}
static void sig_int(int sig)
diff --git a/test/accept-reuse.c b/test/accept-reuse.c
index 0062729..c95ac70 100644
--- a/test/accept-reuse.c
+++ b/test/accept-reuse.c
@@ -4,7 +4,6 @@
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <syscall.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
diff --git a/test/b19062a56726-test.c b/test/b19062a56726-test.c
index 697a416..6a0f686 100644
--- a/test/b19062a56726-test.c
+++ b/test/b19062a56726-test.c
@@ -6,14 +6,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h>
-#ifndef __NR_io_uring_setup
-#define __NR_io_uring_setup 425
-#endif
+#include "liburing.h"
+#include "../src/syscall.h"
int main(int argc, char *argv[])
{
@@ -50,6 +48,6 @@ int main(int argc, char *argv[])
*(uint32_t*)0x20000268 = 0;
*(uint32_t*)0x2000026c = 0;
*(uint64_t*)0x20000270 = 0;
- syscall(__NR_io_uring_setup, 0xc9f, 0x20000200);
+ __sys_io_uring_setup(0xc9f, (struct io_uring_params *) 0x20000200);
return 0;
}
diff --git a/test/double-poll-crash.c b/test/double-poll-crash.c
index 1a219c7..2a012e5 100644
--- a/test/double-poll-crash.c
+++ b/test/double-poll-crash.c
@@ -9,10 +9,13 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
-#include <sys/syscall.h>
#include <sys/types.h>
+#include <sys/ioctl.h>
#include <unistd.h>
+#include "liburing.h"
+#include "../src/syscall.h"
+
#define SIZEOF_IO_URING_SQE 64
#define SIZEOF_IO_URING_CQE 16
#define SQ_HEAD_OFFSET 0
@@ -29,44 +32,6 @@
#define CQ_FLAGS_OFFSET 280
#define CQ_CQES_OFFSET 320
-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 __NR_io_uring_setup 425
static long syz_io_uring_setup(volatile long a0, volatile long a1,
volatile long a2, volatile long a3,
volatile long a4, volatile long a5)
@@ -77,7 +42,7 @@ static long syz_io_uring_setup(volatile long a0, volatile long a1,
void* vma2 = (void*)a3;
void** ring_ptr_out = (void**)a4;
void** sqes_ptr_out = (void**)a5;
- uint32_t fd_io_uring = syscall(__NR_io_uring_setup, entries, setup_params);
+ uint32_t fd_io_uring = __sys_io_uring_setup(entries, 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 +
@@ -150,9 +115,9 @@ int main(int argc, char *argv[])
if (argc > 1)
return 0;
- syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
- syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
- syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
+ mmap((void *)0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
+ mmap((void *)0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
+ mmap((void *)0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
intptr_t res = 0;
*(uint32_t*)0x20000484 = 0;
*(uint32_t*)0x20000488 = 0;
@@ -207,7 +172,7 @@ int main(int argc, char *argv[])
*(uint8_t*)0x2000003e = 0;
*(uint8_t*)0x2000003f = 0;
syz_io_uring_submit(r[1], r[2], 0x20000000, 0);
- syscall(__NR_io_uring_enter, r[0], 0x20450c, 0, 0ul, 0ul, 0ul);
+ __sys_io_uring_enter(r[0], 0x20450c, 0, 0ul, 0ul);
*(uint32_t*)0x20000080 = 0x7ff;
*(uint32_t*)0x20000084 = 0x8b7;
*(uint32_t*)0x20000088 = 3;
@@ -216,6 +181,6 @@ int main(int argc, char *argv[])
memcpy((void*)0x20000091, "\xaf\x09\x01\xbc\xf9\xc6\xe4\x92\x86\x51\x7d\x7f"
"\xbd\x43\x7d\x16\x69\x3e\x05",
19);
- syscall(__NR_ioctl, r[3], 0x5404, 0x20000080ul);
+ ioctl(r[3], 0x5404, 0x20000080ul);
return 0;
}
diff --git a/test/fc2a85cb02ef-test.c b/test/fc2a85cb02ef-test.c
index e922d17..35addf5 100644
--- a/test/fc2a85cb02ef-test.c
+++ b/test/fc2a85cb02ef-test.c
@@ -11,11 +11,13 @@
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
-#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <unistd.h>
+#include "liburing.h"
+#include "../src/syscall.h"
+
static bool write_file(const char* file, const char* what, ...)
{
char buf[1024];
@@ -123,14 +125,14 @@ int main(int argc, char *argv[])
*(uint32_t*)0x20000068 = 0;
*(uint32_t*)0x2000006c = 0;
*(uint64_t*)0x20000070 = 0;
- res = syscall(__NR_io_uring_setup, 0x6a6, 0x20000000ul);
+ res = __sys_io_uring_setup(0x6a6, (struct io_uring_params *) 0x20000000ul);
if (res != -1)
r[0] = res;
- res = syscall(__NR_socket, 0x11ul, 2ul, 0x300ul);
+ res = socket(0x11ul, 2ul, 0x300ul);
if (res != -1)
r[1] = res;
*(uint32_t*)0x20000080 = r[1];
inject_fault(1);
- syscall(__NR_io_uring_register, r[0], 2ul, 0x20000080ul, 1ul);
+ __sys_io_uring_register(r[0], 2ul, (const void *) 0x20000080ul, 1ul);
return 0;
}
diff --git a/test/sendmsg_fs_cve.c b/test/sendmsg_fs_cve.c
index 85f271b..8de220a 100644
--- a/test/sendmsg_fs_cve.c
+++ b/test/sendmsg_fs_cve.c
@@ -19,7 +19,6 @@
*/
#include <unistd.h>
-#include <syscall.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/socket.h>
diff --git a/test/sqpoll-disable-exit.c b/test/sqpoll-disable-exit.c
index d4e17f8..93bcf42 100644
--- a/test/sqpoll-disable-exit.c
+++ b/test/sqpoll-disable-exit.c
@@ -15,12 +15,14 @@
#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>
+#include "liburing.h"
+#include "../src/syscall.h"
+
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
@@ -72,44 +74,6 @@ static bool write_file(const char* file, const char* what, ...)
#define CQ_FLAGS_OFFSET 280
#define CQ_CQES_OFFSET 320
-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 sys_io_uring_setup 425
static long syz_io_uring_setup(volatile long a0, volatile long a1,
volatile long a2, volatile long a3,
volatile long a4, volatile long a5)
@@ -120,7 +84,7 @@ static long syz_io_uring_setup(volatile long a0, volatile long a1,
void* vma2 = (void*)a3;
void** ring_ptr_out = (void**)a4;
void** sqes_ptr_out = (void**)a5;
- uint32_t fd_io_uring = syscall(sys_io_uring_setup, entries, setup_params);
+ uint32_t fd_io_uring = __sys_io_uring_setup(entries, 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 +
@@ -223,9 +187,9 @@ void execute_one(void)
}
int main(void)
{
- syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
- syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
- syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
+ mmap((void *)0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
+ mmap((void *)0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
+ mmap((void *)0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
loop();
return 0;
}
diff --git a/test/teardowns.c b/test/teardowns.c
index f78fe22..8bd3022 100644
--- a/test/teardowns.c
+++ b/test/teardowns.c
@@ -3,7 +3,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
--
2.30.2

View File

@ -1,82 +0,0 @@
From 595b858eb0576d70884337a61ace3d98a411b949 Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 13 Apr 2021 15:45:52 +0100
Subject: [PATCH] examples/ucontext-cp.c: cope with variable SIGSTKSZ
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The size of C arrays at file scope must be constant. The following
compiler error occurs with recent upstream glibc (2.33.9000):
CC ucontext-cp
ucontext-cp.c:31:23: error: variably modified stack_buf at file scope
31 | unsigned char stack_buf[SIGSTKSZ];
| ^~~~~~~~~
make[1]: *** [Makefile:26: ucontext-cp] Error 1
The following glibc commit changed SIGSTKSZ from a constant value to a
variable:
commit 6c57d320484988e87e446e2e60ce42816bf51d53
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Feb 1 11:00:38 2021 -0800
sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305]
...
+# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
Allocate the stack buffer explicitly to avoid declaring an array at file
scope.
Cc: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
Perhaps the glibc change needs to be revised before releasing glibc 2.34
since it might break applications. That's up to the glibc folks. It
doesn't hurt for liburing to take a safer approach that copes with the
SIGSTKSZ change in any case.
---
examples/ucontext-cp.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/examples/ucontext-cp.c b/examples/ucontext-cp.c
index 0b2a6b5..ea0c934 100644
--- a/examples/ucontext-cp.c
+++ b/examples/ucontext-cp.c
@@ -28,7 +28,7 @@
typedef struct {
struct io_uring *ring;
- unsigned char stack_buf[SIGSTKSZ];
+ unsigned char *stack_buf;
ucontext_t ctx_main, ctx_fnew;
} async_context;
@@ -115,8 +115,13 @@ static int setup_context(async_context *pctx, struct io_uring *ring)
perror("getcontext");
return -1;
}
- pctx->ctx_fnew.uc_stack.ss_sp = &pctx->stack_buf;
- pctx->ctx_fnew.uc_stack.ss_size = sizeof(pctx->stack_buf);
+ pctx->stack_buf = malloc(SIGSTKSZ);
+ if (!pctx->stack_buf) {
+ perror("malloc");
+ return -1;
+ }
+ pctx->ctx_fnew.uc_stack.ss_sp = pctx->stack_buf;
+ pctx->ctx_fnew.uc_stack.ss_size = SIGSTKSZ;
pctx->ctx_fnew.uc_link = &pctx->ctx_main;
return 0;
@@ -174,6 +179,7 @@ static void copy_file_wrapper(arguments_bundle *pbundle)
free(iov.iov_base);
close(pbundle->infd);
close(pbundle->outfd);
+ free(pbundle->pctx->stack_buf);
free(pbundle->pctx);
free(pbundle);
--
2.30.2

View File

@ -1,17 +1,15 @@
Name: liburing
Version: 2.0
Release: 4%{?dist}
Version: 2.2
Release: 1%{?dist}
Summary: Linux-native io_uring I/O access library
License: (GPLv2 with exceptions and LGPLv2+) or MIT
Source0: https://brick.kernel.dk/snaps/%{name}-%{version}.tar.gz
Source1: https://brick.kernel.dk/snaps/%{name}-%{version}.tar.gz.asc
URL: https://git.kernel.dk/cgit/liburing/
Patch1: 0001-test-io_uring_register-kill-old-memfd-test.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
Patch1: 0001-spec-bump-version-to-2.0.patch
Patch2: 0002-spec-add-explicit-build-dependency-on-make.patch
Patch3: 0003-test-get-rid-of-x86_64-isms-in-the-test-code.patch
Patch4: 0004-examples-ucontext-cp.c-cope-with-variable-SIGSTKSZ.patch
%description
Provides native async IO for the Linux kernel, in a fast and efficient
@ -53,6 +51,9 @@ for the Linux-native io_uring.
%{_mandir}/man7/*
%changelog
* Mon Aug 22 2022 Richard W.M. Jones <rjones@redhat.com> - 2.2-1
- Update to liburing 2.2.
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (liburing-2.0.tar.gz) = f895f2c7aae38a9929fa061bc5c648de07935c475b88629efcbf1781ec388f388cf55d6587803bde4fcd2814dfb5c9bd1cd48d62cde933a57bcee890e76b2c71
SHA512 (liburing-2.0.tar.gz.asc) = f3d8cd11ef8a1ff0ac379be1faee058a5affe05579e1273cd9210a7980338253bb11a9f30319fed6c3fb74866ac54d88f6dd418ee72e3298cb5b459c5fd4e623
SHA512 (liburing-2.2.tar.gz) = d33e4a923ee77d72d040321334766a6484d43e6d6281348ec7ad0741518d1282f930795b8e600ef57e85583d0dfe308f8f3536cf226c50cd25786814cfbbbb66
SHA512 (liburing-2.2.tar.gz.asc) = 013e91a8c22c577f1c2205f62ea374eabea331601205b20c62972de6f2264eacefab7110e4dc0c1270d7ac83b6792903c49dca45f2b4b9f3a079ae6f2749fbe3