Sync from SUSE:SLFO:Main liburing revision 0bfad246bcaab43507dd6ff984459f49

This commit is contained in:
Adrian Schröter 2024-08-07 10:46:49 +02:00
parent fd94b48f6d
commit 731422ab6c
7 changed files with 118 additions and 212 deletions

BIN
liburing-2.4.tar.bz2 (Stored with Git LFS)

Binary file not shown.

BIN
liburing-2.6.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,60 @@
-------------------------------------------------------------------
Fri Jul 12 16:49:22 UTC 2024 - David Disseldorp <ddiss@suse.com>
- Fix buf-ring-nommap.t test failure
* test-buf-ring-nommap-zero-the-ringbuf-memory.patch
-------------------------------------------------------------------
Fri Jun 28 08:29:55 UTC 2024 - Jiri Slaby <jslaby@suse.cz>
- Update to 2.6:
* Add getsockopt and setsockopt socket commands
* Add test cases to test/hardlink
* Man page fixes
* Add futex support, and test cases
* Add waitid support, and test cases
* Add read multishot, and test cases
* Add support for IORING_SETUP_NO_SQARRAY
* Use IORING_SETUP_NO_SQARRAY as the default
* Add support for IORING_OP_FIXED_FD_INSTALL
* Add io_uring_prep_fixed_fd_install() helper
* Support for napi busy polling
* Improve/add test cases
* Man page fixes
* Add sample 'proxy' example
- Remove (they are upstream)
* test-no-mmap-inval-0-return-is-fine-too.patch
* test-recv-multishot-wait-for-the-right-amount-of-CQE.patch
- exclude buf-ring-nommap.t test (crashes)
-------------------------------------------------------------------
Wed Apr 3 08:40:14 UTC 2024 - Jiri Slaby <jslaby@suse.cz>
- Update to 2.5:
* Add support for io_uring_prep_cmd_sock()
* Add support for application allocated ring memory, for placing rings
in huge mem. Available through io_uring_queue_init_mem().
* Add support for registered ring fds
* Various documentation updates
* Various fixes
- Remove (they are upstream)
* test-io_uring_register-fix-errno-confusion-and-new-e.patch
* tests-don-t-expect-multishot-recv-overflow-backloggi.patch
- Add
* test-recv-multishot-wait-for-the-right-amount-of-CQE.patch (to fix test
errors on the 6.8.2 kernel)
* test-no-mmap-inval-0-return-is-fine-too.patch (fix the test)
-------------------------------------------------------------------
Mon Dec 4 16:39:29 UTC 2023 - Guillaume GARDET <guillaume.gardet@opensuse.org>
- Fix build on 32-bit x86
-------------------------------------------------------------------
Thu Nov 30 15:26:15 UTC 2023 - Guillaume GARDET <guillaume.gardet@opensuse.org>
- Make use of openSUSE build flags
-------------------------------------------------------------------
Fri Sep 15 05:28:44 UTC 2023 - Jiri Slaby <jslaby@suse.cz>

View File

@ -1,7 +1,7 @@
#
# spec file for package liburing
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -18,15 +18,14 @@
%define lname liburing2
Name: liburing
Version: 2.4
Version: 2.6
Release: 0
Summary: Linux-native io_uring I/O access library
License: (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
Group: Development/Libraries/C and C++
URL: https://git.kernel.dk/cgit/liburing
Source: https://git.kernel.dk/cgit/liburing/snapshot/%{name}-%{version}.tar.bz2
Patch0: test-io_uring_register-fix-errno-confusion-and-new-e.patch
Patch1: tests-don-t-expect-multishot-recv-overflow-backloggi.patch
Patch0: test-buf-ring-nommap-zero-the-ringbuf-memory.patch
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: procps
@ -70,6 +69,12 @@ for the Linux-native io_uring.
%build
# not autotools, so configure macro doesn't work
%set_build_flags
%ifarch %{ix86}
# Otherwise 32-bit x86 fails with: undefined reference to `__stack_chk_fail_local'
export CFLAGS="%{optflags} -fno-stack-protector"
export CPPFLAGS="%{optflags} -fno-stack-protector"
%endif
sh ./configure --prefix=%{_prefix} \
--includedir=%{_includedir} \
--libdir=/%{_libdir} \

View File

@ -0,0 +1,49 @@
From 8100d7b5f862fa514d821e8bd8f99d0de79af571 Mon Sep 17 00:00:00 2001
From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Date: Fri, 12 Jul 2024 13:17:03 +0200
Subject: [PATCH] test/buf-ring-nommap: zero the ringbuf memory
The test crashes when run under the openSUSE build system. It sets
MALLOC_PERTURB_=69 in the environment, so the allocated memory is
initialized to 0xba.
Later in io_uring_get_sqe() -> _io_uring_get_sqe():
1424 if (next - head <= sq->ring_entries) {
(gdb) p *sq
$2 = {khead = 0x55555555d000, ktail = 0x55555555d004,
kring_mask = 0x55555555d010, kring_entries = 0x55555555d018,
kflags = 0x55555555d024, kdropped = 0x55555555d020, array = 0x0,
sqes = 0x55555555c000, sqe_head = 0, sqe_tail = 0, ring_sz = 0,
ring_ptr = 0x55555555d000, ring_mask = 0, ring_entries = 1, pad = {0, 0}}
(gdb) p sq->ring_entries
$3 = 1
(gdb) p next
$4 = 1
(gdb) p/x head
$6 = 0xbabababa
And that causes a crash, of course.
Fix that by zeroing the memory after posix_memalign().
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
test/buf-ring-nommap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/buf-ring-nommap.c b/test/buf-ring-nommap.c
index 1e47f28..17c1495 100644
--- a/test/buf-ring-nommap.c
+++ b/test/buf-ring-nommap.c
@@ -41,6 +41,8 @@ int main(int argc, char *argv[])
if (posix_memalign(&ring_mem, 16384, 16384))
return T_EXIT_FAIL;
+ memset(ring_mem, 0, 16384);
+
p.flags = IORING_SETUP_NO_MMAP;
ret = io_uring_queue_init_mem(1, &ring, &p, ring_mem, 16384);
if (ret < 0) {
--
2.35.3

View File

@ -1,171 +0,0 @@
From: Jens Axboe <axboe@kernel.dk>
Date: Wed, 28 Jun 2023 19:43:02 -0600
Subject: test/io_uring_register: fix errno confusion and new error
Git-commit: 2d3368b73b478a737b2247ef5630be56c3b176b5
Patch-mainline: 2.5
References: kernel 6.5
This test suffers from some serious errno vs liburing function return.
All liburing functions return a negative errno value on failure, there's
no use of errno at all. This means that rather than check for the return
being -1 and then relying on errno being set to EINVAL, liburing
functions return -EINVAL directly instead.
Outside of that, due to recent kernel changes, we may now get -EFAULT
when trying to register a file backed buffers. Before we always returned
-EOPNOTSUPP. Correct that as well.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
test/io_uring_register.c | 51 +++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/test/io_uring_register.c b/test/io_uring_register.c
index ddd4fe374702..0f44af85eed3 100644
--- a/test/io_uring_register.c
+++ b/test/io_uring_register.c
@@ -32,7 +32,7 @@ static rlim_t mlock_limit;
static int devnull;
static int expect_fail(int fd, unsigned int opcode, void *arg,
- unsigned int nr_args, int error)
+ unsigned int nr_args, int error, int error2)
{
int ret;
@@ -55,8 +55,8 @@ static int expect_fail(int fd, unsigned int opcode, void *arg,
return 1;
}
- if (ret != error) {
- fprintf(stderr, "expected %d, got %d\n", error, ret);
+ if (ret != error && (error2 && ret != error2)) {
+ fprintf(stderr, "expected %d/%d, got %d\n", error, error2, ret);
return 1;
}
return 0;
@@ -195,8 +195,7 @@ static int test_max_fds(int uring_fd)
status = 0;
ret = io_uring_register(uring_fd, IORING_UNREGISTER_FILES, 0, 0);
if (ret < 0) {
- ret = errno;
- errno = ret;
+ errno = -ret;
perror("io_uring_register UNREGISTER_FILES");
exit(1);
}
@@ -230,22 +229,20 @@ static int test_memlock_exceeded(int fd)
while (iov.iov_len) {
ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1);
- if (ret < 0) {
- if (errno == ENOMEM) {
- iov.iov_len /= 2;
- continue;
- }
- if (errno == EFAULT) {
- free(buf);
- return 0;
- }
- fprintf(stderr, "expected success or EFAULT, got %d\n", errno);
+ if (ret == -ENOMEM) {
+ iov.iov_len /= 2;
+ continue;
+ } else if (ret == -EFAULT) {
+ free(buf);
+ return 0;
+ } else if (ret) {
+ fprintf(stderr, "expected success or EFAULT, got %d\n", ret);
free(buf);
return 1;
}
ret = io_uring_register(fd, IORING_UNREGISTER_BUFFERS, NULL, 0);
if (ret != 0) {
- fprintf(stderr, "error: unregister failed with %d\n", errno);
+ fprintf(stderr, "error: unregister failed with %d\n", ret);
free(buf);
return 1;
}
@@ -277,15 +274,15 @@ static int test_iovec_nr(int fd)
iovs[i].iov_len = pagesize;
}
- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, iovs, nr, -EINVAL);
+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, iovs, nr, -EINVAL, 0);
/* reduce to UIO_MAXIOV */
nr = UIO_MAXIOV;
ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, iovs, nr);
- if (ret && (errno == ENOMEM || errno == EPERM) && geteuid()) {
+ if ((ret == -ENOMEM || ret == -EPERM) && geteuid()) {
fprintf(stderr, "can't register large iovec for regular users, skip\n");
} else if (ret != 0) {
- fprintf(stderr, "expected success, got %d\n", errno);
+ fprintf(stderr, "expected success, got %d\n", ret);
status = 1;
} else {
io_uring_register(fd, IORING_UNREGISTER_BUFFERS, 0, 0);
@@ -308,12 +305,12 @@ static int test_iovec_size(int fd)
/* NULL pointer for base */
iov.iov_base = 0;
iov.iov_len = 4096;
- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT);
+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, 0);
/* valid base, 0 length */
iov.iov_base = &buf;
iov.iov_len = 0;
- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT);
+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, 0);
/* valid base, length exceeds size */
/* this requires an unampped page directly after buf */
@@ -324,7 +321,7 @@ static int test_iovec_size(int fd)
assert(ret == 0);
iov.iov_base = buf;
iov.iov_len = 2 * pagesize;
- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT);
+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, 0);
munmap(buf, pagesize);
/* huge page */
@@ -372,7 +369,7 @@ static int test_iovec_size(int fd)
status = 1;
iov.iov_base = buf;
iov.iov_len = 2*1024*1024;
- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EOPNOTSUPP);
+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, -EOPNOTSUPP);
munmap(buf, 2*1024*1024);
/* bump up against the soft limit and make sure we get EFAULT
@@ -442,7 +439,7 @@ static int test_poll_ringfd(void)
* fail, because the kernel does not allow registering of the
* ring_fd.
*/
- status |= expect_fail(fd, IORING_REGISTER_FILES, &fd, 1, -EBADF);
+ status |= expect_fail(fd, IORING_REGISTER_FILES, &fd, 1, -EBADF, 0);
/* tear down queue */
io_uring_queue_exit(&ring);
@@ -475,14 +472,14 @@ int main(int argc, char **argv)
}
/* invalid fd */
- status |= expect_fail(-1, 0, NULL, 0, -EBADF);
+ status |= expect_fail(-1, 0, NULL, 0, -EBADF, 0);
/* valid fd that is not an io_uring fd */
- status |= expect_fail(devnull, 0, NULL, 0, -EOPNOTSUPP);
+ status |= expect_fail(devnull, 0, NULL, 0, -EOPNOTSUPP, 0);
/* invalid opcode */
memset(&p, 0, sizeof(p));
fd = new_io_uring(1, &p);
- ret = expect_fail(fd, ~0U, NULL, 0, -EINVAL);
+ ret = expect_fail(fd, ~0U, NULL, 0, -EINVAL, 0);
if (ret) {
/* if this succeeds, tear down the io_uring instance
* and start clean for the next test. */
--
2.42.0

View File

@ -1,34 +0,0 @@
From: Pavel Begunkov <asml.silence@gmail.com>
Date: Fri, 11 Aug 2023 13:58:30 +0100
Subject: tests: don't expect multishot recv overflow backlogging
Patch-mainline: 2.5
Git-commit: b73e940c9dd4ffa8ac121db046c0788376691b99
References: kernel 6.5
Multishots may and are likely to complete when there is no space in CQ,
don't rely on overflows.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/d078c0f797322bd01d8c91743d652b734e83e9ba.1691758633.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
test/recv-multishot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/recv-multishot.c b/test/recv-multishot.c
index e4a07ce976cc..f66f13198dde 100644
--- a/test/recv-multishot.c
+++ b/test/recv-multishot.c
@@ -271,7 +271,7 @@ static int test(struct args *args)
*/
bool const early_last = args->early_error == ERROR_EARLY_OVERFLOW &&
!args->wait_each &&
- i == N_CQE_OVERFLOW &&
+ i >= N_CQE_OVERFLOW &&
!(cqe->flags & IORING_CQE_F_MORE);
bool const should_be_last =
--
2.42.0