public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: Ammar Faizi <[email protected]>,
	Vitaly Chikunov <[email protected]>,
	Fernanda Ma'rouf <[email protected]>,
	Kanna Scarlet <[email protected]>,
	io-uring Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH liburing v1 01/10] test/cq-overflow: Don't call `io_uring_queue_exit()` if the ring is not initialized
Date: Wed, 10 Aug 2022 07:31:50 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Ammar Faizi <[email protected]>

Don't call `io_uring_queue_exit()` if the ring is not initialized.

Fix this:

  + valgrind -q ./cq-overflow.t
  file open: Invalid argument
  ==3054159== Use of uninitialised value of size 8
  ==3054159==    at 0x10A863: io_uring_queue_exit (setup.c:183)
  ==3054159==    by 0x1095DE: test_io.constprop.0 (cq-overflow.c:148)
  ==3054159==    by 0x109266: main (cq-overflow.c:269)
  ==3054159==
  ==3054159== Invalid read of size 4
  ==3054159==    at 0x10A863: io_uring_queue_exit (setup.c:183)
  ==3054159==    by 0x1095DE: test_io.constprop.0 (cq-overflow.c:148)
  ==3054159==    by 0x109266: main (cq-overflow.c:269)
  ==3054159==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
  ==3054159==
  ==3054159==
  ==3054159== Process terminating with default action of signal 11 (SIGSEGV): dumping core
  ==3054159==  Access not within mapped region at address 0x0

Link: https://github.com/axboe/liburing/issues/640
Reported-by: Vitaly Chikunov <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
 test/cq-overflow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/cq-overflow.c b/test/cq-overflow.c
index 0018081..312b414 100644
--- a/test/cq-overflow.c
+++ b/test/cq-overflow.c
@@ -33,14 +33,15 @@ static int test_io(const char *file, unsigned long usecs, unsigned *drops, int f
 	fd = open(file, O_RDONLY | O_DIRECT);
 	if (fd < 0) {
 		perror("file open");
-		goto err;
+		return 1;
 	}
 
 	memset(&p, 0, sizeof(p));
 	ret = io_uring_queue_init_params(ENTRIES, &ring, &p);
 	if (ret) {
+		close(fd);
 		fprintf(stderr, "ring create failed: %d\n", ret);
-		goto err;
+		return 1;
 	}
 	nodrop = 0;
 	if (p.features & IORING_FEAT_NODROP)
-- 
Ammar Faizi


  reply	other threads:[~2022-08-10  0:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  0:31 [PATCH liburing v1 00/10] liburing test fixes Ammar Faizi
2022-08-10  0:31 ` Ammar Faizi [this message]
2022-08-10  0:31 ` [PATCH liburing v1 02/10] test/eeed8b54e0df: Initialize the `malloc()`ed buffer before `write()` Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 03/10] test/file-verify: Fix reading from uninitialized buffer Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 04/10] test/fixed-reuse: Fix reading from uninitialized array Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 05/10] test/fpos: Fix reading from uninitialized buffer Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 06/10] test/statx: " Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 07/10] test/submit-link-fail: Initialize the buffer before `write()` Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 08/10] test/232c93d07b74: Fix reading from uninitialized buffer Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 09/10] test/eventfd-disable: Fix reading uninitialized variable Ammar Faizi
2022-08-10  0:31 ` [PATCH liburing v1 10/10] test/file-register: Fix reading from uninitialized buffer Ammar Faizi
2022-08-10 13:03 ` [PATCH liburing v1 00/10] liburing test fixes Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox