Skip to contentSkip to conversation

Add ioctl_ficlone testing suite

PATCH Superseded Andrea Cervesato 3 participants 15 messages May 30, 2024 – Jul 12, 2024

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Add ioctl_ficlone testing suite

This testing suite is testing ioctl() FICLONE functionalities. In particular, file clone and error codes.

---
Andrea Cervesato (3):
Add ioctl_ficlone01 test
Add ioctl_ficlone02 test
Add ioctl_ficlone03 test

 include/lapi/fs.h                                 |   4 +
 runtest/syscalls                                  |   4 +
 testcases/kernel/syscalls/ioctl/.gitignore        |   3 +
 testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c | 116 ++++++++++++++++++++++
 testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c |  49 +++++++++
 testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c |  96 ++++++++++++++++++
 6 files changed, 272 insertions(+)

---
base-commit: 66517b89141fc455ed807f3b95e5260dcf9fb90f
change-id: 20240529-ioctl_ficlone-95c603f71d53

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 1/3 Add ioctl_ficlone01 test

From: Andrea Cervesato <[email protected]>

This test verifies that ioctl() FICLONE feature clones file content from one file to an another.

---
 include/lapi/fs.h                                 |   4 +
 runtest/syscalls                                  |   2 +
 testcases/kernel/syscalls/ioctl/.gitignore        |   1 +
 testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c | 116 ++++++++++++++++++++++
 4 files changed, 123 insertions(+)
include/lapi/fs.h +4 -0
index 635979b02..cc3b7636c 100644
@@ -48,6 +48,10 @@
 # define FS_VERITY_FL	   0x00100000 /* Verity protected inode */
 #endif
 
+#ifndef FICLONE
+# define FICLONE		_IOW(0x94, 9, int)
+#endif
+
 /*
  * Helper function to get MAX_LFS_FILESIZE.
  * Missing PAGE_SHIFT on some libc prevents defining MAX_LFS_FILESIZE.
runtest/syscalls +2 -0
index cf06ee563..07e940f8c 100644
@@ -591,6 +591,8 @@ ioctl_ns07 ioctl_ns07
 
 ioctl_sg01 ioctl_sg01
 
+ioctl_ficlone01 ioctl_ficlone01
+
 inotify_init1_01 inotify_init1_01
 inotify_init1_02 inotify_init1_02
 
testcases/kernel/syscalls/ioctl/.gitignore +1 -0
index 5fff7a61d..5404aa93f 100644
@@ -22,3 +22,4 @@
 /ioctl_ns06
 /ioctl_ns07
 /ioctl_sg01
+/ioctl_ficlone01
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +116 -0

116 lines not on this page · raw message

Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Re: [LTP] [PATCH 1/3] Add ioctl_ficlone01 test

Hi!

Quoted 8 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +8 -0
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Andrea Cervesato [email protected]
+ */
+
+/*\
+ * [Description]
+ *

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 18

Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +10 -0
+ * This test verifies that ioctl() FICLONE feature clones file content from
+ * one file to an another.
+ *
+ * [Algorithm]
+ *
+ * * populate source file
+ * * clone source content inside destination file
+ * * verify that source content has been cloned inside destination file
+ * * write a single byte inside destination file
+ * * verify that source content didn't change while destination did

This is very minor but I find dashes to be a better choice for lists inside of C comments.

Quoted 60 lines

+ */

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +59 -0
+
+#include "tst_test.h"
+#include "lapi/fs.h"
+
+#define MNTPOINT "mnt"
+#define SRCPATH MNTPOINT "/file0"
+#define DSTPATH MNTPOINT "/file1"
+
+#define FILEDATA "qwerty"
+#define FILESIZE sizeof(FILEDATA)
+
+static int src_fd = -1;
+static int dst_fd = -1;
+
+static void run(void)
+{
+	char buff[FILESIZE];
+	struct stat src_stat;
+	struct stat dst_stat;
+
+	src_fd = SAFE_OPEN(SRCPATH, O_CREAT | O_RDWR, 0640);
+	dst_fd = SAFE_OPEN(DSTPATH, O_CREAT | O_RDWR, 0640);
+
+	tst_res(TINFO, "Writing data inside src file");
+
+	SAFE_WRITE(1, src_fd, FILEDATA, FILESIZE);
+	SAFE_FSYNC(src_fd);
+
+	TST_EXP_PASS(ioctl(dst_fd, FICLONE, src_fd));
+	if (TST_RET == -1)
+		return;
+
+	SAFE_FSYNC(dst_fd);
+
+	tst_res(TINFO, "Verifing that data is cloned between files");
+
+	SAFE_FSTAT(src_fd, &src_stat);
+	SAFE_FSTAT(dst_fd, &dst_stat);
+
+	TST_EXP_EXPR(src_stat.st_ino != dst_stat.st_ino,
+		"inode is different. %lu != %lu",
+		src_stat.st_ino,
+		dst_stat.st_ino);
+
+	TST_EXP_EQ_LI(src_stat.st_size, dst_stat.st_size);
+
+	SAFE_READ(0, dst_fd, buff, FILESIZE);
+
+	TST_EXP_EXPR(!strncmp(buff, FILEDATA, FILESIZE),
+		"dst file has the src file content (\"%s\" - %ld bytes)",
+		buff,
+		FILESIZE);
+
+	tst_res(TINFO, "Writing a byte inside dst file");
+
+	SAFE_WRITE(SAFE_WRITE_ALL, dst_fd, "a", 1);
+	SAFE_FSYNC(dst_fd);
+
+	tst_res(TINFO, "Verifing that src file content didn't change");

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 88

Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +10 -0
+
+	SAFE_FSTAT(src_fd, &src_stat);
+	SAFE_FSTAT(dst_fd, &dst_stat);
+
+	TST_EXP_EQ_LI(dst_stat.st_size, src_stat.st_size + 1);
+
+	SAFE_READ(0, src_fd, buff, FILESIZE);
+
+	TST_EXP_EXPR(!strncmp(buff, FILEDATA, FILESIZE),
+		"src file content didn't change");

So you append to the file but then only read the initial part? That does not sound right. I guess that easiest solution is to seek to the start of the file or od pwrite() so that we overwrite the first byte rather than appending.

Or at least check the return value from the read.

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 93

Quoted 4 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +4 -0
+	SAFE_CLOSE(src_fd);
+	SAFE_CLOSE(dst_fd);
+	src_fd = -1;
+	dst_fd = -1;

This is not needed, the SAFE_CLOSE() macro sets the fd to -1.

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 96

Quoted 2 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +2 -0
+	remove(SRCPATH);
+	remove(DSTPATH);

Please use SAFE_UNLINK() instead.

Quoted 9 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +9 -0
+}
+
+static void cleanup(void)
+{
+	if (src_fd != -1)
+		SAFE_CLOSE(src_fd);
+
+	if (dst_fd != -1)
+		SAFE_CLOSE(dst_fd);

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 115

Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +10 -0
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.cleanup = cleanup,
+	.min_kver = "4.5",
+	.needs_root = 1,
+	.mount_device = 1,
+	.mntpoint = MNTPOINT,
+	.dev_fs_type = "btrfs",

I suppose that we need .use_filesystems or similar and convert the dev_fs_type to an array so that we can run this test on xfs as well...

Quoted 8 lines

+};

Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Re: [LTP] [PATCH 1/3] Add ioctl_ficlone01 test

Hi!

Quoted 123 lines · Cyril Hrubis

Hi!

Quoted 8 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +8 -0
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Andrea Cervesato [email protected]
+ */
+
+/*\
+ * [Description]
+ *

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 18

Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +10 -0
+ * This test verifies that ioctl() FICLONE feature clones file content from
+ * one file to an another.
+ *
+ * [Algorithm]
+ *
+ * * populate source file
+ * * clone source content inside destination file
+ * * verify that source content has been cloned inside destination file
+ * * write a single byte inside destination file
+ * * verify that source content didn't change while destination did

This is very minor but I find dashes to be a better choice for lists inside of C comments.

Quoted 60 lines

+ */

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +59 -0
+
+#include "tst_test.h"
+#include "lapi/fs.h"
+
+#define MNTPOINT "mnt"
+#define SRCPATH MNTPOINT "/file0"
+#define DSTPATH MNTPOINT "/file1"
+
+#define FILEDATA "qwerty"
+#define FILESIZE sizeof(FILEDATA)
+
+static int src_fd = -1;
+static int dst_fd = -1;
+
+static void run(void)
+{
+	char buff[FILESIZE];
+	struct stat src_stat;
+	struct stat dst_stat;
+
+	src_fd = SAFE_OPEN(SRCPATH, O_CREAT | O_RDWR, 0640);
+	dst_fd = SAFE_OPEN(DSTPATH, O_CREAT | O_RDWR, 0640);
+
+	tst_res(TINFO, "Writing data inside src file");
+
+	SAFE_WRITE(1, src_fd, FILEDATA, FILESIZE);
+	SAFE_FSYNC(src_fd);
+
+	TST_EXP_PASS(ioctl(dst_fd, FICLONE, src_fd));
+	if (TST_RET == -1)
+		return;
+
+	SAFE_FSYNC(dst_fd);
+
+	tst_res(TINFO, "Verifing that data is cloned between files");
+
+	SAFE_FSTAT(src_fd, &src_stat);
+	SAFE_FSTAT(dst_fd, &dst_stat);
+
+	TST_EXP_EXPR(src_stat.st_ino != dst_stat.st_ino,
+		"inode is different. %lu != %lu",
+		src_stat.st_ino,
+		dst_stat.st_ino);
+
+	TST_EXP_EQ_LI(src_stat.st_size, dst_stat.st_size);
+
+	SAFE_READ(0, dst_fd, buff, FILESIZE);
+
+	TST_EXP_EXPR(!strncmp(buff, FILEDATA, FILESIZE),
+		"dst file has the src file content (\"%s\" - %ld bytes)",
+		buff,
+		FILESIZE);
+
+	tst_res(TINFO, "Writing a byte inside dst file");
+
+	SAFE_WRITE(SAFE_WRITE_ALL, dst_fd, "a", 1);
+	SAFE_FSYNC(dst_fd);
+
+	tst_res(TINFO, "Verifing that src file content didn't change");

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 88

Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +10 -0
+
+	SAFE_FSTAT(src_fd, &src_stat);
+	SAFE_FSTAT(dst_fd, &dst_stat);
+
+	TST_EXP_EQ_LI(dst_stat.st_size, src_stat.st_size + 1);
+
+	SAFE_READ(0, src_fd, buff, FILESIZE);
+
+	TST_EXP_EXPR(!strncmp(buff, FILEDATA, FILESIZE),
+		"src file content didn't change");

So you append to the file but then only read the initial part? That does not sound right. I guess that easiest solution is to seek to the start of the file or od pwrite() so that we overwrite the first byte rather than appending.

Or at least check the return value from the read.

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 93

Quoted 4 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +4 -0
+	SAFE_CLOSE(src_fd);
+	SAFE_CLOSE(dst_fd);
+	src_fd = -1;
+	dst_fd = -1;

This is not needed, the SAFE_CLOSE() macro sets the fd to -1.

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 96

Quoted 2 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +2 -0
+	remove(SRCPATH);
+	remove(DSTPATH);

Please use SAFE_UNLINK() instead.

Quoted 14 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +14 -0
+}
+
+static void cleanup(void)
+{
+	if (src_fd != -1)
+		SAFE_CLOSE(src_fd);
+
+	if (dst_fd != -1)
+		SAFE_CLOSE(dst_fd);
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.cleanup = cleanup,
Quoted 8 lines

testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c line 115

Quoted 5 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c new file +5 -0
+	.min_kver = "4.5",
+	.needs_root = 1,
+	.mount_device = 1,
+	.mntpoint = MNTPOINT,
+	.dev_fs_type = "btrfs",

I suppose that we need .use_filesystems or similar and convert the dev_fs_type to an array so that we can run this test on xfs as well...

This might be tricky to implement, since we need to adapt .dev_fs_ops as well..

Quoted 8 lines
Quoted 8 lines

+};

Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

Andrea

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Re: [LTP] [PATCH 1/3] Add ioctl_ficlone01 test

Hi!

Quoted 4 lines
Quoted 2 lines

I suppose that we need .use_filesystems or similar and convert the dev_fs_type to an array so that we can run this test on xfs as well...

This might be tricky to implement, since we need to adapt .dev_fs_ops as well..

I guess that we need to do a bigger surgery and put all the device related flags into a structure, e.g.

struct tst_fs {
	const char *dev_fs_type;

	const char *const *mkfs_opts;
        const char *const *mkfs_extra_opts;

	unsigned int mnt_flags;
	const char *mnt_data;
};
struct tst_test {
	...
	struct tst_fs filesystems[];
	...
};

That way we can specify all the options per a filesystems. I can try to do prepare the patchset next week.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Re: [LTP] [PATCH 1/3] Add ioctl_ficlone01 test

Ok thank you

Quoted 27 lines · Cyril Hrubis

Hi!

Quoted 4 lines
Quoted 2 lines

I suppose that we need .use_filesystems or similar and convert the dev_fs_type to an array so that we can run this test on xfs as well...

This might be tricky to implement, since we need to adapt .dev_fs_ops as well..

I guess that we need to do a bigger surgery and put all the device related flags into a structure, e.g.

struct tst_fs {
	const char *dev_fs_type;

	const char *const *mkfs_opts;
         const char *const *mkfs_extra_opts;

	unsigned int mnt_flags;
	const char *mnt_data;
};
struct tst_test {
	...
	struct tst_fs filesystems[];
	...
};

That way we can specify all the options per a filesystems. I can try to do prepare the patchset next week.

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

PATCH 2/3 Add ioctl_ficlone02 test

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

This test verifies that ioctl() FICLONE feature correctly raises EOPNOTSUPP when unsupported filesystem is used. In particular, filesystems which don't support copy-on-write.

---
 runtest/syscalls                                  |  1 +
 testcases/kernel/syscalls/ioctl/.gitignore        |  1 +
 testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c | 49 +++++++++++++++++++++++
 3 files changed, 51 insertions(+)
runtest/syscalls +1 -0
index 07e940f8c..b049530d3 100644
@@ -592,6 +592,7 @@ ioctl_ns07 ioctl_ns07
 ioctl_sg01 ioctl_sg01
 
 ioctl_ficlone01 ioctl_ficlone01
+ioctl_ficlone02 ioctl_ficlone02
 
 inotify_init1_01 inotify_init1_01
 inotify_init1_02 inotify_init1_02
testcases/kernel/syscalls/ioctl/.gitignore +1 -0
index 5404aa93f..3d25fdfb2 100644
@@ -23,3 +23,4 @@
 /ioctl_ns07
 /ioctl_sg01
 /ioctl_ficlone01
+/ioctl_ficlone02
testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c new file +49 -0

49 lines not on this page · raw message

Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Re: [LTP] [PATCH 2/3] Add ioctl_ficlone02 test

Hi!

Thanks for review. I will send a v2 just to add FICLONERANGE as well, otherwise we need an another identical test for that feature as well.

I will do the same for ioctl_ficlone03 as well.

Andrea

Quoted 3 lines · Cyril Hrubis

Hi!

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

PATCH 3/3 Add ioctl_ficlone03 test

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

This test verifies that ioctl() FICLONE feature correctly raises exceptions when it's supposed to.

---
 runtest/syscalls                                  |  1 +
 testcases/kernel/syscalls/ioctl/.gitignore        |  1 +
 testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c | 96 +++++++++++++++++++++++
 3 files changed, 98 insertions(+)
runtest/syscalls +1 -0
index b049530d3..452a7a071 100644
@@ -593,6 +593,7 @@ ioctl_sg01 ioctl_sg01
 
 ioctl_ficlone01 ioctl_ficlone01
 ioctl_ficlone02 ioctl_ficlone02
+ioctl_ficlone03 ioctl_ficlone03
 
 inotify_init1_01 inotify_init1_01
 inotify_init1_02 inotify_init1_02
testcases/kernel/syscalls/ioctl/.gitignore +1 -0
index 3d25fdfb2..d0b470714 100644
@@ -24,3 +24,4 @@
 /ioctl_sg01
 /ioctl_ficlone01
 /ioctl_ficlone02
+/ioctl_ficlone03
testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c new file +96 -0

96 lines not on this page · raw message

Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw

Re: [LTP] [PATCH 3/3] Add ioctl_ficlone03 test

Hi!

Quoted 40 lines

inotify_init1_01 inotify_init1_01
inotify_init1_02 inotify_init1_02

testcases/kernel/syscalls/ioctl/.gitignore +1 -0
index 3d25fdfb2..d0b470714 100644
@@ -24,3 +24,4 @@
 /ioctl_sg01
 /ioctl_ficlone01
 /ioctl_ficlone02
+/ioctl_ficlone03
testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c new file +23 -0
new file mode 100644
index 000000000..c6f9806a3
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Andrea Cervesato [email protected]
+ */
+
+/*\
+ * [Description]
+ *
+ * This test verifies that ioctl() FICLONE feature correctly raises exceptions
+ * when it's supposed to.
+ */
+
+#include "tst_test.h"
+#include "lapi/fs.h"
+
+#define MNTPOINT "mnt"
+
+static int invalid_fd = -1;
+static int rw_file = -1;
+static int ro_file = -1;
+static int wo_file = -1;
+static int dir_fd = -1;
+static int immut_fd = -1;

testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c line 33

Quoted 10 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c new file +10 -0
+static int mnt_file = -1;
+
+static struct tcase {
+	int *src_fd;
+	int *dst_fd;
+	int errno_exp;
+	char *msg;
+} tcases[] = {
+	{&invalid_fd, &rw_file, EBADF, "invalid source"},
+	{&rw_file, &invalid_fd, EBADF, "invalid destination"},

Can we move these invalid_fd tests into a separate test and use tst_fd to loop over all kinds of invalid input and output file descriptors?

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw

Re: [LTP] [PATCH 3/3] Add ioctl_ficlone03 test

Hi,

Quoted 45 lines · Cyril Hrubis

Hi!

Quoted 44 lines

inotify_init1_01 inotify_init1_01
inotify_init1_02 inotify_init1_02

testcases/kernel/syscalls/ioctl/.gitignore +1 -0
index 3d25fdfb2..d0b470714 100644
@@ -24,3 +24,4 @@
  /ioctl_sg01
  /ioctl_ficlone01
  /ioctl_ficlone02
+/ioctl_ficlone03
testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c new file +27 -0
new file mode 100644
index 000000000..c6f9806a3
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Andrea Cervesato [email protected]
+ */
+
+/*\
+ * [Description]
+ *
+ * This test verifies that ioctl() FICLONE feature correctly raises exceptions
+ * when it's supposed to.
+ */
+
+#include "tst_test.h"
+#include "lapi/fs.h"
+
+#define MNTPOINT "mnt"
+
+static int invalid_fd = -1;
+static int rw_file = -1;
+static int ro_file = -1;
+static int wo_file = -1;
+static int dir_fd = -1;
+static int immut_fd = -1;
+static int mnt_file = -1;
+
+static struct tcase {
+	int *src_fd;
Quoted 9 lines

testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c line 33

Quoted 6 lines
testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c new file +6 -0
+	int *dst_fd;
+	int errno_exp;
+	char *msg;
+} tcases[] = {
+	{&invalid_fd, &rw_file, EBADF, "invalid source"},
+	{&rw_file, &invalid_fd, EBADF, "invalid destination"},

Can we move these invalid_fd tests into a separate test and use tst_fd to loop over all kinds of invalid input and output file descriptors?

I don't know if it's worth to loop over all possible cases. Each one of them has a specific test case. Also, invalid_fd test cases would look so simple that it makes more sense to keep it here.

Andrea

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#12 lore raw

Re: [LTP] [PATCH 3/3] Add ioctl_ficlone03 test

Hi!

Quoted 5 lines
Quoted 3 lines

Can we move these invalid_fd tests into a separate test and use tst_fd to loop over all kinds of invalid input and output file descriptors?

I don't know if it's worth to loop over all possible cases. Each one of them has a specific test case.

This was actually requested by kernel developers, to feed the syscalls with all kind of unexpected file descriptors.

Quoted 2 lines

Also, invalid_fd test cases would look so simple that it makes more sense to keep it here.

Fair enough, we can keep these two here, but we need a tst_fd test as well.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#13 lore raw

Re: [LTP] [PATCH 3/3] Add ioctl_ficlone03 test

Hi!

Quoted 8 lines · Cyril Hrubis

Hi!

Quoted 5 lines
Quoted 3 lines

Can we move these invalid_fd tests into a separate test and use tst_fd to loop over all kinds of invalid input and output file descriptors?

I don't know if it's worth to loop over all possible cases. Each one of them has a specific test case.

This was actually requested by kernel developers, to feed the syscalls with all kind of unexpected file descriptors.

This is what fuzz testing is doing already, isn't it?

Quoted 5 lines
Quoted 2 lines

Also, invalid_fd test cases would look so simple that it makes more sense to keep it here.

Fair enough, we can keep these two here, but we need a tst_fd test as well.

Andrea

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#14 lore raw

Re: [LTP] [PATCH 3/3] Add ioctl_ficlone03 test

In reply to Cyril Hrubis
Quoted 6 lines · Cyril Hrubis

Hi!

Quoted 5 lines
Quoted 3 lines

Can we move these invalid_fd tests into a separate test and use tst_fd to loop over all kinds of invalid input and output file descriptors?

I don't know if it's worth to loop over all possible cases. Each one of them has a specific test case.

Quoted 8 lines

This was actually requested by kernel developers, to feed the syscalls with all kind of unexpected file descriptors.

Quoted 2 lines

Also, invalid_fd test cases would look so simple that it makes more sense to keep it here.

Fair enough, we can keep these two here, but we need a tst_fd test as well.

I'm trying to create a test using tst_fs but it seems quite unpredictable. For example, if the given paths are located on a different mount, EXDEV is raised. But we don't have any control on it and it can happen with literally anything (signalfd, memfd, devices, etc) on the SUT we are testing.

So that ends up skipping 90% of the provided file descriptors. I don't know if I really want to follow this direction.

Andrea

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp