[PATCH liburing 2/2] tests: non-root io_uring_register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux