[PATCH v2 5/6] kselftest/arm64: mte: user_mem: add more test types
Joey Gouly
joey.gouly at arm.com
Thu Feb 3 06:36:19 PST 2022
Add test support for write, readv, and writev.
Signed-off-by: Joey Gouly <joey.gouly at arm.com>
Cc: Catalin Marinas <catalin.marinas at arm.com>
Cc: Will Deacon <will at kernel.org>
Cc: Mark Brown <broonie at kernel.org>
Cc: Shuah Khan <shuah at kernel.org>
---
.../selftests/arm64/mte/check_user_mem.c | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c
index 6d4aeb14027b..c128bfa81502 100644
--- a/tools/testing/selftests/arm64/mte/check_user_mem.c
+++ b/tools/testing/selftests/arm64/mte/check_user_mem.c
@@ -11,6 +11,7 @@
#include <string.h>
#include <ucontext.h>
#include <unistd.h>
+#include <sys/uio.h>
#include <sys/mman.h>
#include "kselftest.h"
@@ -21,6 +22,9 @@ static size_t page_sz;
enum test_type {
READ_TEST,
+ WRITE_TEST,
+ READV_TEST,
+ WRITEV_TEST,
LAST_TEST,
};
@@ -85,6 +89,23 @@ static int check_usermem_access_fault(int mem_type, int mode, int mapping,
case READ_TEST:
syscall_len = read(fd, ptr + ptroff, size);
break;
+ case WRITE_TEST:
+ syscall_len = write(fd, ptr + ptroff, size);
+ break;
+ case READV_TEST: {
+ struct iovec iov[1];
+ iov[0].iov_base = ptr + ptroff;
+ iov[0].iov_len = size;
+ syscall_len = readv(fd, iov, 1);
+ break;
+ }
+ case WRITEV_TEST: {
+ struct iovec iov[1];
+ iov[0].iov_base = ptr + ptroff;
+ iov[0].iov_len = size;
+ syscall_len = writev(fd, iov, 1);
+ break;
+ }
case LAST_TEST:
goto usermem_acc_err;
}
--
2.17.1
More information about the linux-arm-kernel
mailing list