Skip to contentSkip to conversation

syscalls/copy_file_range02: Add check for pipe

PATCH New Cyril Hrubis 2 participants 5 messages Oct 8, 2019 – Oct 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/copy_file_range02: Add check for pipe

The original patch that was adding this fell under a table:

http://patchwork.ozlabs.org/patch/1112976/

I guess there is no harm checking that we get EINVAL for pipe as well, or does anyone disagree?

---
 .../syscalls/copy_file_range/copy_file_range02.c   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/copy_file_range/copy_file_range02.c +12 -2
index 6e385adbd..a55de4111 100644
@@ -25,9 +25,10 @@
  * 9) Try to copy contents to a blkdev ->EINVAL
  * 10) Try to copy contents to a chardev ->EINVAL
  * 11) Try to copy contents to a FIFO ->EINVAL
- * 12) Try to copy contents to a file with length beyond
+ * 12) Try to copy contenst to a PIPE ->EINVAL
+ * 13) Try to copy contents to a file with length beyond
  *     16EiB wraps around 0 -> EOVERFLOW
- * 13) Try to copy contents to a file with target file range
+ * 14) Try to copy contents to a file with target file range
  *     beyond maximum supported file size ->EFBIG
  */
 
@@ -48,6 +49,7 @@ static int fd_dup;
 static int fd_blkdev;
 static int fd_chrdev;
 static int fd_fifo;
+static int fd_pipe[2];
 static int fd_copy;
 static int need_unlink;
 
@@ -73,6 +75,7 @@ static struct tcase {
 	{&fd_blkdev,	0,	EINVAL,		CONTSIZE,	"block device"},
 	{&fd_chrdev,	0,	EINVAL,		CONTSIZE,	"char device"},
 	{&fd_fifo,	0,	EINVAL,		CONTSIZE,	"fifo"},
+	{&fd_pipe[0],	0,	EINVAL,		CONTSIZE,	"pipe"},
 	{&fd_copy,	0,	EOVERFLOW,	ULLONG_MAX,	"max length lenght"},
 	{&fd_copy,	0,	EFBIG,		MIN_OFF,	"max file size"},
 };
@@ -163,6 +166,11 @@ static void cleanup(void)
 		SAFE_CLOSE(fd_copy);
 	if (need_unlink > 0)
 		SAFE_UNLINK(FILE_FIFO);
+
+	if (fd_pipe[0] > 0) {
+		SAFE_CLOSE(fd_pipe[0]);
+		SAFE_CLOSE(fd_pipe[1]);
+	}
 }
 
 static void setup(void)
@@ -201,6 +209,8 @@ static void setup(void)
 	fd_chrdev = SAFE_OPEN(FILE_CHRDEV, O_RDWR, 0600);
 	fd_fifo = SAFE_OPEN(FILE_FIFO, O_RDWR, 0600);
 
+	SAFE_PIPE(fd_pipe);
+
 	SAFE_WRITE(1, fd_src, CONTENT, CONTSIZE);
 	close(fd_src);
 	fd_src = SAFE_OPEN(FILE_SRC_PATH, O_RDONLY, 0664);
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 syscalls/copy_file_range02: Add check for pipe

----- Original Message -----

Quoted 11 lines

From: "Cyril Hrubis" <[email protected]>
To: [email protected]
Sent: Tuesday, 8 October, 2019 5:16:24 PM
Subject: [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe

The original patch that was adding this fell under a table:

http://patchwork.ozlabs.org/patch/1112976/

I guess there is no harm checking that we get EINVAL for pipe as well, or does anyone disagree?

Do you know what is kernel behaviour prior to commit 11cbfb10775a ? Does it pass/fail/crash/different errno?

#2 lore raw

PATCH 1/1 syscalls/copy_file_range02: Add check for pipe

Hi!

Quoted 9 lines
Quoted 6 lines

The original patch that was adding this fell under a table:

http://patchwork.ozlabs.org/patch/1112976/

I guess there is no harm checking that we get EINVAL for pipe as well, or does anyone disagree?

Do you know what is kernel behaviour prior to commit 11cbfb10775a ? Does it pass/fail/crash/different errno?

The test is disabled unless cross FS copy support is implemented in kernel, so the test is disabled for anything older than v5.3 anyways.

Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/1 syscalls/copy_file_range02: Add check for pipe

----- Original Message -----

Quoted 5 lines

Hi!

Quoted 4 lines
Quoted 4 lines

The original patch that was adding this fell under a table:

http://patchwork.ozlabs.org/patch/1112976/

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I guess there is no harm checking that we get EINVAL for pipe as well, or does anyone disagree?

Do you know what is kernel behaviour prior to commit 11cbfb10775a ? Does it pass/fail/crash/different errno?

The test is disabled unless cross FS copy support is implemented in kernel, so the test is disabled for anything older than v5.3 anyways.

Thanks, I don't see any potential issues then, ACK.