[LTP] [PATCH v1] read_all :catch alignment faults while reading sys entries seen in commit :bc21785b7336619fb6a67f1fff5afdaf229acc

Subramanya Swamy subramanya.swamy.linux@gmail.com
Wed Jan 3 13:17:26 CET 2024


Signed-off-by: Subramanya Swamy <subramanya.swamy.linux@gmail.com>
---
 testcases/kernel/fs/read_all/read_all.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index 266678ea7..95e3ca275 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -249,6 +249,20 @@ static void read_test(const int worker, const char *const path)
 	}
 
 	worker_heartbeat(worker);
+	/*
+	 * This could catch any alignment faults while reading sys entries
+	 * seen in commit :bc21785b7336619fb6a67f1fff5afdaf229acc so reading 1024 bytes
+	 * in chunks of 8 bytes 128 times
+	 */
+	char check_buf[7];
+	unsigned int i;
+
+	for (i = 0; i < 128; i++) {
+		count = read(fd, check_buf, sizeof(check_buf));
+		if (count == 0 || count < 0)
+			break;
+	}
+
 	count = read(fd, buf, sizeof(buf) - 1);
 	elapsed = worker_elapsed(worker);
 
@@ -713,5 +727,5 @@ static struct tst_test test = {
 	.cleanup = cleanup,
 	.test_all = run,
 	.forks_child = 1,
-	.max_runtime = 100,
+	.max_runtime = 200,
 };
-- 
2.39.3



More information about the ltp mailing list