All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH liburing 0/2] non-root fixes
@ 2021-08-24 13:57 Pavel Begunkov
  2021-08-24 13:57 ` [PATCH liburing 1/2] tests: rw: don't exit ring when init failed Pavel Begunkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-24 13:57 UTC (permalink / raw)
  To: Jens Axboe, io-uring

1/1 fixes non-root rw tests, and 2/2 makes yet another
test case to handle non-root users.

Pavel Begunkov (2):
  tests: rw: don't exit ring when init failed
  tests: non-root io_uring_register

 test/io_uring_register.c | 8 +++++---
 test/iopoll.c            | 3 +--
 test/read-write.c        | 4 +---
 3 files changed, 7 insertions(+), 8 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH liburing 1/2] tests: rw: don't exit ring when init failed
  2021-08-24 13:57 [PATCH liburing 0/2] non-root fixes Pavel Begunkov
@ 2021-08-24 13:57 ` Pavel Begunkov
  2021-08-24 13:57 ` [PATCH liburing 2/2] tests: non-root io_uring_register Pavel Begunkov
  2021-08-24 14:07 ` [PATCH liburing 0/2] non-root fixes Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-24 13:57 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Don't do io_uring_queue_exit() after t_create_ring() got skipped.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/iopoll.c     | 3 +--
 test/read-write.c | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/test/iopoll.c b/test/iopoll.c
index 5273279..7037c31 100644
--- a/test/iopoll.c
+++ b/test/iopoll.c
@@ -278,13 +278,12 @@ static int test_io(const char *file, int write, int sqthread, int fixed,
 
 	ret = t_create_ring(64, &ring, ring_flags);
 	if (ret == T_SETUP_SKIP)
-		goto done;
+		return 0;
 	if (ret != T_SETUP_OK) {
 		fprintf(stderr, "ring create failed: %d\n", ret);
 		return 1;
 	}
 	ret = __test_io(file, &ring, write, sqthread, fixed, buf_select);
-done:
 	io_uring_queue_exit(&ring);
 	return ret;
 }
diff --git a/test/read-write.c b/test/read-write.c
index 93f6803..1cfa2d5 100644
--- a/test/read-write.c
+++ b/test/read-write.c
@@ -242,7 +242,7 @@ static int test_io(const char *file, int write, int buffered, int sqthread,
 
 	ret = t_create_ring(64, &ring, ring_flags);
 	if (ret == T_SETUP_SKIP)
-		goto done;
+		return 0;
 	if (ret != T_SETUP_OK) {
 		fprintf(stderr, "ring create failed: %d\n", ret);
 		return 1;
@@ -250,8 +250,6 @@ static int test_io(const char *file, int write, int buffered, int sqthread,
 
 	ret = __test_io(file, &ring, write, buffered, sqthread, fixed, nonvec,
 			0, 0, exp_len);
-
-done:
 	io_uring_queue_exit(&ring);
 	return ret;
 }
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH liburing 2/2] tests: non-root io_uring_register
  2021-08-24 13:57 [PATCH liburing 0/2] non-root fixes Pavel Begunkov
  2021-08-24 13:57 ` [PATCH liburing 1/2] tests: rw: don't exit ring when init failed Pavel Begunkov
@ 2021-08-24 13:57 ` Pavel Begunkov
  2021-08-24 14:07 ` [PATCH liburing 0/2] non-root fixes Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-24 13:57 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Non-previliged users can't register too many buffers, just skip the test
in this case.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/io_uring_register.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/io_uring_register.c b/test/io_uring_register.c
index 53e3987..9475739 100644
--- a/test/io_uring_register.c
+++ b/test/io_uring_register.c
@@ -303,12 +303,14 @@ test_iovec_nr(int fd)
 	printf("io_uring_register(%d, %u, %p, %u)\n",
 	       fd, IORING_REGISTER_BUFFERS, iovs, nr);
 	ret = __sys_io_uring_register(fd, IORING_REGISTER_BUFFERS, iovs, nr);
-	if (ret != 0) {
+	if (ret && (errno == ENOMEM || errno == EPERM) && geteuid()) {
+		printf("can't register large iovec for regular users, skip\n");
+	} else if (ret != 0) {
 		printf("expected success, got %d\n", errno);
 		status = 1;
-	} else
+	} else {
 		__sys_io_uring_register(fd, IORING_UNREGISTER_BUFFERS, 0, 0);
-
+	}
 	free(buf);
 	free(iovs);
 	return status;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH liburing 0/2] non-root fixes
  2021-08-24 13:57 [PATCH liburing 0/2] non-root fixes Pavel Begunkov
  2021-08-24 13:57 ` [PATCH liburing 1/2] tests: rw: don't exit ring when init failed Pavel Begunkov
  2021-08-24 13:57 ` [PATCH liburing 2/2] tests: non-root io_uring_register Pavel Begunkov
@ 2021-08-24 14:07 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-08-24 14:07 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 8/24/21 7:57 AM, Pavel Begunkov wrote:
> 1/1 fixes non-root rw tests, and 2/2 makes yet another
> test case to handle non-root users.
> 
> Pavel Begunkov (2):
>   tests: rw: don't exit ring when init failed
>   tests: non-root io_uring_register
> 
>  test/io_uring_register.c | 8 +++++---
>  test/iopoll.c            | 3 +--
>  test/read-write.c        | 4 +---
>  3 files changed, 7 insertions(+), 8 deletions(-)

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-24 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 13:57 [PATCH liburing 0/2] non-root fixes Pavel Begunkov
2021-08-24 13:57 ` [PATCH liburing 1/2] tests: rw: don't exit ring when init failed Pavel Begunkov
2021-08-24 13:57 ` [PATCH liburing 2/2] tests: non-root io_uring_register Pavel Begunkov
2021-08-24 14:07 ` [PATCH liburing 0/2] non-root fixes Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.