From 4f61499e5e96174b934983be936d49b4d38fed56ac9e16ff5fe76ba0cc9b5541 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Fri, 12 Jul 2024 16:50:35 +0000 Subject: [PATCH] - Fix buf-ring-nommap.t test failure * test-buf-ring-nommap-zero-the-ringbuf-memory.patch OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/liburing?expand=0&rev=45 --- liburing.changes | 6 +++ liburing.spec | 4 +- ...-ring-nommap-zero-the-ringbuf-memory.patch | 49 +++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 test-buf-ring-nommap-zero-the-ringbuf-memory.patch diff --git a/liburing.changes b/liburing.changes index 8077cdc..4d341f0 100644 --- a/liburing.changes +++ b/liburing.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jul 12 16:49:22 UTC 2024 - David Disseldorp + +- 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 diff --git a/liburing.spec b/liburing.spec index d93b7f7..19c6337 100644 --- a/liburing.spec +++ b/liburing.spec @@ -25,6 +25,7 @@ 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-buf-ring-nommap-zero-the-ringbuf-memory.patch BuildRequires: gcc-c++ BuildRequires: pkgconfig BuildRequires: procps @@ -86,8 +87,7 @@ sh ./configure --prefix=%{_prefix} \ # io_uring syscalls not supported as of qemu 7.0.0 and would test the host # kernel anyway not the target kernel.. %if !0%{?qemu_user_space_build} -# buf-ring-nommap.t crashes with kernel 6.9 -/usr/bin/make %{?_smp_mflags} runtests TEST_EXCLUDE='buf-ring-nommap.t' +/usr/bin/make %{?_smp_mflags} runtests %endif %install diff --git a/test-buf-ring-nommap-zero-the-ringbuf-memory.patch b/test-buf-ring-nommap-zero-the-ringbuf-memory.patch new file mode 100644 index 0000000..3afc924 --- /dev/null +++ b/test-buf-ring-nommap-zero-the-ringbuf-memory.patch @@ -0,0 +1,49 @@ +From 8100d7b5f862fa514d821e8bd8f99d0de79af571 Mon Sep 17 00:00:00 2001 +From: "Jiri Slaby (SUSE)" +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) +--- + 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 +