All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe
@ 2019-10-08 15:16 Cyril Hrubis
  2019-10-09  8:36 ` Jan Stancek
  0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2019-10-08 15:16 UTC (permalink / raw)
  To: ltp

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?

Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
CC: Amir Goldstein <amir73il@gmail.com>
---
 .../syscalls/copy_file_range/copy_file_range02.c   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
index 6e385adbd..a55de4111 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
@@ -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);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe
  2019-10-08 15:16 [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe Cyril Hrubis
@ 2019-10-09  8:36 ` Jan Stancek
  2019-10-09  9:11   ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2019-10-09  8:36 UTC (permalink / raw)
  To: ltp


----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: ltp@lists.linux.it
> 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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe
  2019-10-09  8:36 ` Jan Stancek
@ 2019-10-09  9:11   ` Cyril Hrubis
  2019-10-09 12:48     ` Jan Stancek
  0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2019-10-09  9:11 UTC (permalink / raw)
  To: ltp

Hi!
> > 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.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe
  2019-10-09  9:11   ` Cyril Hrubis
@ 2019-10-09 12:48     ` Jan Stancek
  2019-10-10 13:04       ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2019-10-09 12:48 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> Hi!
> > > 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe
  2019-10-09 12:48     ` Jan Stancek
@ 2019-10-10 13:04       ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2019-10-10 13:04 UTC (permalink / raw)
  To: ltp

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-10 13:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 15:16 [LTP] [PATCH] syscalls/copy_file_range02: Add check for pipe Cyril Hrubis
2019-10-09  8:36 ` Jan Stancek
2019-10-09  9:11   ` Cyril Hrubis
2019-10-09 12:48     ` Jan Stancek
2019-10-10 13:04       ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.