From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from integral2.. (unknown [180.246.144.41]) by gnuweeb.org (Postfix) with ESMTPSA id 6845080872; Wed, 10 Aug 2022 00:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1660091550; bh=jCCTmOx9NmGfxdpLE7rPWkrAzBsa5pgaAzqzz83v3qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nPiZd6Pba55KtFvWLD4mawnJsHniTZ5AvCqgUwbx6z6WKk/OrkPZJQdAJ7Drbsjiv h4su6R4m+KBm0bbWbp9CpS8rt1CFlUVXcvxSCAQSIOfIYnFtwAS7ulF+lfniv1Ta6k HVLpSrF8qng1UwSsogd6ZcPdQxQ3YdQKLOtJ5XlYJEfv+FvFEcalJgqbdWTYnhpIZn q3OJS09eFSdaawAldxOMQs4FNd6l0KCdgUNBk30m7Y28JcSf6EG4K8nM5EH9a2zZ98 L0P2YwUrMhH0WMDjRPz3iNIIhdYe2Hz5ELecCJJmdWPACU4BXs202FjMtyXDoEGC4z CfNxSf/kLAf6A== From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Vitaly Chikunov , Fernanda Ma'rouf , Kanna Scarlet , io-uring Mailing List , GNU/Weeb Mailing List 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 Message-Id: <20220810002735.2260172-2-ammar.faizi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220810002735.2260172-1-ammar.faizi@intel.com> References: <20220810002735.2260172-1-ammar.faizi@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: From: Ammar Faizi 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 Signed-off-by: Ammar Faizi --- 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