public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing 2/2] tests: non-root io_uring_register
Date: Tue, 24 Aug 2021 14:57:52 +0100	[thread overview]
Message-ID: <2d40f84f0fa5e5dc53ef8b55bdcc00a11e0dc5a7.1629813328.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

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

Signed-off-by: Pavel Begunkov <[email protected]>
---
 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


  parent reply	other threads:[~2021-08-24 13:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-08-24 14:07 ` [PATCH liburing 0/2] non-root 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 \
    --in-reply-to=2d40f84f0fa5e5dc53ef8b55bdcc00a11e0dc5a7.1629813328.git.asml.silence@gmail.com \
    [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