lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 21 Feb 2023 15:37:36 +0800
From:   Ziyang Zhang <ZiyangZhang@...ux.alibaba.com>
To:     axboe@...nel.dk, asml.silence@...il.com
Cc:     io-uring@...r.kernel.org, linux-kernel@...r.kernel.org,
        Ziyang Zhang <ZiyangZhang@...ux.alibaba.com>
Subject: [PATCH tools/io_uring] tools/io_uring: correctly set "ret" for sq_poll case

For sq_poll case, "ret" is not initialized or cleared/set. In this way,
output of this test program is incorrect and we can not even stop this
program by pressing CTRL-C.

Reset "ret" to zero in each submission/completion round, and assign
"ret" to "this_reap".

Signed-off-by: Ziyang Zhang <ZiyangZhang@...ux.alibaba.com>
---
 tools/io_uring/io_uring-bench.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/io_uring/io_uring-bench.c b/tools/io_uring/io_uring-bench.c
index 7703f0118385..3c0feb48f6f6 100644
--- a/tools/io_uring/io_uring-bench.c
+++ b/tools/io_uring/io_uring-bench.c
@@ -289,6 +289,7 @@ static void *submitter_fn(void *data)
 	do {
 		int to_wait, to_submit, this_reap, to_prep;
 
+		ret = 0;
 		if (!prepped && s->inflight < DEPTH) {
 			to_prep = min(DEPTH - s->inflight, BATCH_SUBMIT);
 			prepped = prep_more_ios(s, to_prep);
@@ -334,6 +335,8 @@ static void *submitter_fn(void *data)
 				this_reap += r;
 		} while (sq_thread_poll && this_reap < to_wait);
 		s->reaps += this_reap;
+		if (sq_thread_poll)
+			ret = this_reap;
 
 		if (ret >= 0) {
 			if (!ret) {
-- 
2.18.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ