* [LTP] [PATCH 1/3] lapi/syscalls: Add syscall numbers for preadv2
@ 2018-09-28 9:10 Xiao Yang
2018-09-28 9:10 ` [LTP] [PATCH 2/3] syscalls/preadv201: Add new testcase Xiao Yang
2018-09-28 9:10 ` [LTP] [PATCH 3/3] syscalls/preadv202: " Xiao Yang
0 siblings, 2 replies; 9+ messages in thread
From: Xiao Yang @ 2018-09-28 9:10 UTC (permalink / raw)
To: ltp
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
include/lapi/syscalls/aarch64.in | 1 +
include/lapi/syscalls/arm.in | 1 +
include/lapi/syscalls/hppa.in | 1 +
include/lapi/syscalls/i386.in | 1 +
include/lapi/syscalls/ia64.in | 1 +
include/lapi/syscalls/powerpc.in | 1 +
include/lapi/syscalls/powerpc64.in | 1 +
include/lapi/syscalls/s390.in | 1 +
include/lapi/syscalls/s390x.in | 1 +
include/lapi/syscalls/sh.in | 1 +
include/lapi/syscalls/sparc.in | 1 +
include/lapi/syscalls/sparc64.in | 1 +
include/lapi/syscalls/x86_64.in | 1 +
13 files changed, 13 insertions(+)
diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in
index 9ac7f99..0b6ba3b 100644
--- a/include/lapi/syscalls/aarch64.in
+++ b/include/lapi/syscalls/aarch64.in
@@ -258,4 +258,5 @@ getrandom 278
memfd_create 279
mlock2 284
copy_file_range 285
+preadv2 286
_sysctl 1078
diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in
index 0a7f98a..279130f 100644
--- a/include/lapi/syscalls/arm.in
+++ b/include/lapi/syscalls/arm.in
@@ -343,4 +343,5 @@ memfd_create (__NR_SYSCALL_BASE+385)
execveat (__NR_SYSCALL_BASE+387)
mlock2 (__NR_SYSCALL_BASE+390)
copy_file_range (__NR_SYSCALL_BASE+391)
+preadv2 (__NR_SYSCALL_BASE+392)
statx (__NR_SYSCALL_BASE+397)
diff --git a/include/lapi/syscalls/hppa.in b/include/lapi/syscalls/hppa.in
index 3db9780..0fa6f4e 100644
--- a/include/lapi/syscalls/hppa.in
+++ b/include/lapi/syscalls/hppa.in
@@ -19,3 +19,4 @@ vmsplice 294
memfd_create 340
mlock2 345
copy_file_range 346
+preadv2 347
diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in
index a000564..ee8c4e9 100644
--- a/include/lapi/syscalls/i386.in
+++ b/include/lapi/syscalls/i386.in
@@ -343,4 +343,5 @@ memfd_create 356
execveat 358
mlock2 376
copy_file_range 377
+preadv2 378
statx 383
diff --git a/include/lapi/syscalls/ia64.in b/include/lapi/syscalls/ia64.in
index 2788193..b9f00bc 100644
--- a/include/lapi/syscalls/ia64.in
+++ b/include/lapi/syscalls/ia64.in
@@ -298,3 +298,4 @@ getrandom 1339
memfd_create 1340
mlock2 1346
copy_file_range 1347
+preadv2 1348
diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in
index c0b4226..1e429f4 100644
--- a/include/lapi/syscalls/powerpc.in
+++ b/include/lapi/syscalls/powerpc.in
@@ -349,4 +349,5 @@ getrandom 359
memfd_create 360
mlock2 378
copy_file_range 379
+preadv2 380
statx 383
diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index c0b4226..1e429f4 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -349,4 +349,5 @@ getrandom 359
memfd_create 360
mlock2 378
copy_file_range 379
+preadv2 380
statx 383
diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in
index 47a04de..8780815 100644
--- a/include/lapi/syscalls/s390.in
+++ b/include/lapi/syscalls/s390.in
@@ -334,3 +334,4 @@ memfd_create 350
execveat 354
mlock2 374
copy_file_range 375
+preadv2 376
diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in
index 83732ff..b029e72 100644
--- a/include/lapi/syscalls/s390x.in
+++ b/include/lapi/syscalls/s390x.in
@@ -333,3 +333,4 @@ getrandom 349
memfd_create 350
mlock2 374
copy_file_range 375
+preadv2 376
diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in
index 407be7a..ebf8dad 100644
--- a/include/lapi/syscalls/sh.in
+++ b/include/lapi/syscalls/sh.in
@@ -366,3 +366,4 @@ kcmp 378
memfd_create 385
mlock2 390
copy_file_range 391
+preadv2 392
diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in
index 2b06a79..8d8a54e 100644
--- a/include/lapi/syscalls/sparc.in
+++ b/include/lapi/syscalls/sparc.in
@@ -338,3 +338,4 @@ getrandom 347
memfd_create 348
mlock2 356
copy_file_range 357
+preadv2 358
diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in
index 8c8a866..140e9ce 100644
--- a/include/lapi/syscalls/sparc64.in
+++ b/include/lapi/syscalls/sparc64.in
@@ -314,3 +314,4 @@ getrandom 347
memfd_create 348
mlock2 356
copy_file_range 357
+preadv2 358
diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in
index 4ce8477..1966da2 100644
--- a/include/lapi/syscalls/x86_64.in
+++ b/include/lapi/syscalls/x86_64.in
@@ -310,4 +310,5 @@ memfd_create 319
execveat 322
mlock2 325
copy_file_range 326
+preadv2 327
statx 332
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCH 2/3] syscalls/preadv201: Add new testcase
2018-09-28 9:10 [LTP] [PATCH 1/3] lapi/syscalls: Add syscall numbers for preadv2 Xiao Yang
@ 2018-09-28 9:10 ` Xiao Yang
2018-10-04 12:16 ` Cyril Hrubis
2018-09-28 9:10 ` [LTP] [PATCH 3/3] syscalls/preadv202: " Xiao Yang
1 sibling, 1 reply; 9+ messages in thread
From: Xiao Yang @ 2018-09-28 9:10 UTC (permalink / raw)
To: ltp
Check the basic functionality of the preadv2(2).
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
configure.ac | 1 +
m4/ltp-preadv2.m4 | 9 ++
runtest/ltplite | 2 +
runtest/stress.part3 | 2 +
runtest/syscalls | 3 +
testcases/kernel/syscalls/preadv2/.gitignore | 2 +
testcases/kernel/syscalls/preadv2/Makefile | 14 +++
testcases/kernel/syscalls/preadv2/preadv2.h | 26 ++++++
testcases/kernel/syscalls/preadv2/preadv201.c | 119 ++++++++++++++++++++++++++
9 files changed, 178 insertions(+)
create mode 100644 m4/ltp-preadv2.m4
create mode 100644 testcases/kernel/syscalls/preadv2/.gitignore
create mode 100644 testcases/kernel/syscalls/preadv2/Makefile
create mode 100644 testcases/kernel/syscalls/preadv2/preadv2.h
create mode 100644 testcases/kernel/syscalls/preadv2/preadv201.c
diff --git a/configure.ac b/configure.ac
index e1ecb32..0f0d8c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -218,6 +218,7 @@ LTP_CHECK_KCMP
LTP_CHECK_KCMP_TYPE
LTP_CHECK_PREADV
LTP_CHECK_PWRITEV
+LTP_CHECK_PREADV2
LTP_CHECK_EPOLL_PWAIT
LTP_CHECK_KEYUTILS_SUPPORT
LTP_CHECK_SYNC_ADD_AND_FETCH
diff --git a/m4/ltp-preadv2.m4 b/m4/ltp-preadv2.m4
new file mode 100644
index 0000000..a1e5327
--- /dev/null
+++ b/m4/ltp-preadv2.m4
@@ -0,0 +1,9 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
+dnl Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+
+dnl LTP_CHECK_PREADV2
+dnl ----------------------------
+AC_DEFUN([LTP_CHECK_PREADV2],[
+AC_CHECK_FUNCS(preadv2,,)
+])
diff --git a/runtest/ltplite b/runtest/ltplite
index 61ab275..6959536 100644
--- a/runtest/ltplite
+++ b/runtest/ltplite
@@ -586,6 +586,8 @@ preadv01 preadv01
preadv02 preadv02
preadv03 preadv03
+preadv201 preadv201
+
profil01 profil01
pselect01 pselect01
diff --git a/runtest/stress.part3 b/runtest/stress.part3
index 332daa9..525d33b 100644
--- a/runtest/stress.part3
+++ b/runtest/stress.part3
@@ -495,6 +495,8 @@ preadv01 preadv01
preadv02 preadv02
preadv03 preadv03
+preadv201 preadv201
+
profil01 profil01
pselect01 pselect01
diff --git a/runtest/syscalls b/runtest/syscalls
index 0d0be77..02b02b8 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -834,6 +834,9 @@ preadv02_64 preadv02_64
preadv03 preadv03
preadv03_64 preadv03_64
+preadv201 preadv201
+preadv201_64 preadv201_64
+
profil01 profil01
process_vm_readv01 process_vm01 -r
diff --git a/testcases/kernel/syscalls/preadv2/.gitignore b/testcases/kernel/syscalls/preadv2/.gitignore
new file mode 100644
index 0000000..0ed1a00
--- /dev/null
+++ b/testcases/kernel/syscalls/preadv2/.gitignore
@@ -0,0 +1,2 @@
+/preadv201
+/preadv201_64
diff --git a/testcases/kernel/syscalls/preadv2/Makefile b/testcases/kernel/syscalls/preadv2/Makefile
new file mode 100644
index 0000000..fc1fbf3
--- /dev/null
+++ b/testcases/kernel/syscalls/preadv2/Makefile
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
+# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(abs_srcdir)/../utils/newer_64.mk
+
+%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/preadv2/preadv2.h b/testcases/kernel/syscalls/preadv2/preadv2.h
new file mode 100644
index 0000000..aacf96f
--- /dev/null
+++ b/testcases/kernel/syscalls/preadv2/preadv2.h
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
+ * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+
+#ifndef PREADV2_H
+#define PREADV2_H
+
+#include "config.h"
+#include "lapi/syscalls.h"
+
+#if !defined(HAVE_PREADV2)
+
+/* LO_HI_LONG taken from glibc */
+# define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32)
+
+ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset,
+ int flags)
+{
+ return tst_syscall(__NR_preadv2, fd, iov, iovcnt,
+ LO_HI_LONG(offset), flags);
+}
+#endif
+
+#endif /* PREADV2_H */
diff --git a/testcases/kernel/syscalls/preadv2/preadv201.c b/testcases/kernel/syscalls/preadv2/preadv201.c
new file mode 100644
index 0000000..e8e9e6e
--- /dev/null
+++ b/testcases/kernel/syscalls/preadv2/preadv201.c
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
+ * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+
+/*
+ * Description:
+ * Testcase to check the basic functionality of the preadv2(2).
+ * 1) If the file offset argument is not -1, preadv2() should succeed
+ * in reading the expected content of data and the file offset is
+ * not changed after reading.
+ * 2) If the file offset argument is -1, preadv2() should succeed in
+ * reading the expected content of data and the current file offset
+ * is used and changed after reading.
+ */
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <sys/uio.h>
+
+#include "tst_test.h"
+#include "preadv2.h"
+
+#define CHUNK 64
+
+static int fd;
+static char buf[CHUNK];
+
+static struct iovec rd_iovec[] = {
+ {buf, CHUNK},
+ {NULL, 0},
+};
+
+static struct tcase {
+ off_t seek_off;
+ int count;
+ off_t read_off;
+ ssize_t size;
+ char content;
+ off_t exp_off;
+} tcases[] = {
+ {0, 1, 0, CHUNK, 'a', 0},
+ {CHUNK, 2, 0, CHUNK, 'a', CHUNK},
+ {0, 1, CHUNK * 3 / 2, CHUNK / 2, 'b', 0},
+ {0, 1, -1, CHUNK, 'a', CHUNK},
+ {0, 2, -1, CHUNK, 'a', CHUNK},
+ {CHUNK, 1, -1, CHUNK, 'b', CHUNK * 2},
+};
+
+static void verify_preadv2(unsigned int n)
+{
+ int i;
+ char *vec;
+ struct tcase *tc = &tcases[n];
+
+ vec = rd_iovec[0].iov_base;
+ memset(vec, 0x00, CHUNK);
+
+ SAFE_LSEEK(fd, tc->seek_off, SEEK_SET);
+
+ TEST(preadv2(fd, rd_iovec, tc->count, tc->read_off, 0));
+ if (TST_RET < 0) {
+ tst_res(TFAIL | TTERRNO, "preadv2() failed");
+ return;
+ }
+
+ if (TST_RET != tc->size) {
+ tst_res(TFAIL, "preadv2() read %li bytes, expected %zi",
+ TST_RET, tc->size);
+ return;
+ }
+
+ for (i = 0; i < tc->size; i++) {
+ if (vec[i] != tc->content)
+ break;
+ }
+
+ if (i < tc->size) {
+ tst_res(TFAIL, "Buffer wrong at %i have %02x expected %02x",
+ i, vec[i], tc->content);
+ return;
+ }
+
+ if (SAFE_LSEEK(fd, 0, SEEK_CUR) != tc->exp_off) {
+ tst_res(TFAIL, "preadv2() has changed file offset");
+ return;
+ }
+
+ tst_res(TPASS, "preadv2() read %zi bytes with content '%c' expectedly",
+ tc->size, tc->content);
+}
+
+static void setup(void)
+{
+ char buf[CHUNK];
+
+ fd = SAFE_OPEN("file", O_RDWR | O_CREAT, 0644);
+
+ memset(buf, 'a', sizeof(buf));
+ SAFE_WRITE(1, fd, buf, sizeof(buf));
+
+ memset(buf, 'b', sizeof(buf));
+ SAFE_WRITE(1, fd, buf, sizeof(buf));
+}
+
+static void cleanup(void)
+{
+ if (fd > 0)
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .tcnt = ARRAY_SIZE(tcases),
+ .setup = setup,
+ .cleanup = cleanup,
+ .test = verify_preadv2,
+ .needs_tmpdir = 1,
+};
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCH 3/3] syscalls/preadv202: Add new testcase
2018-09-28 9:10 [LTP] [PATCH 1/3] lapi/syscalls: Add syscall numbers for preadv2 Xiao Yang
2018-09-28 9:10 ` [LTP] [PATCH 2/3] syscalls/preadv201: Add new testcase Xiao Yang
@ 2018-09-28 9:10 ` Xiao Yang
2018-10-04 12:19 ` Cyril Hrubis
1 sibling, 1 reply; 9+ messages in thread
From: Xiao Yang @ 2018-09-28 9:10 UTC (permalink / raw)
To: ltp
Check various errnos for the preadv2(2).
Note:
From preadv2(2) manpage, preadv2() with invalid flag should return
EINVAL, but it actually returned EOPNOTSUPP in current upstream
kernel, as below:
---------------------------------------------------------------
include/uapi/linux/fs.h:
define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
RWF_APPEND)
...
include/linux/fs.h:
static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
{
if (unlikely(flags & ~RWF_SUPPORTED)) {
return -EOPNOTSUPP;
}
...
---------------------------------------------------------------
We use EOPNOTSUPP as expected errno for the time being.
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
runtest/ltplite | 1 +
runtest/stress.part3 | 1 +
runtest/syscalls | 2 +
testcases/kernel/syscalls/preadv2/.gitignore | 2 +
testcases/kernel/syscalls/preadv2/preadv202.c | 123 ++++++++++++++++++++++++++
5 files changed, 129 insertions(+)
create mode 100644 testcases/kernel/syscalls/preadv2/preadv202.c
diff --git a/runtest/ltplite b/runtest/ltplite
index 6959536..c7bcbd2 100644
--- a/runtest/ltplite
+++ b/runtest/ltplite
@@ -587,6 +587,7 @@ preadv02 preadv02
preadv03 preadv03
preadv201 preadv201
+preadv202 preadv202
profil01 profil01
diff --git a/runtest/stress.part3 b/runtest/stress.part3
index 525d33b..79cbc4f 100644
--- a/runtest/stress.part3
+++ b/runtest/stress.part3
@@ -496,6 +496,7 @@ preadv02 preadv02
preadv03 preadv03
preadv201 preadv201
+preadv202 preadv202
profil01 profil01
diff --git a/runtest/syscalls b/runtest/syscalls
index 02b02b8..844bf41 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -836,6 +836,8 @@ preadv03_64 preadv03_64
preadv201 preadv201
preadv201_64 preadv201_64
+preadv202 preadv202
+preadv202_64 preadv202_64
profil01 profil01
diff --git a/testcases/kernel/syscalls/preadv2/.gitignore b/testcases/kernel/syscalls/preadv2/.gitignore
index 0ed1a00..759d9ef 100644
--- a/testcases/kernel/syscalls/preadv2/.gitignore
+++ b/testcases/kernel/syscalls/preadv2/.gitignore
@@ -1,2 +1,4 @@
/preadv201
/preadv201_64
+/preadv202
+/preadv202_64
diff --git a/testcases/kernel/syscalls/preadv2/preadv202.c b/testcases/kernel/syscalls/preadv2/preadv202.c
new file mode 100644
index 0000000..2defaed
--- /dev/null
+++ b/testcases/kernel/syscalls/preadv2/preadv202.c
@@ -0,0 +1,123 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
+ * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+
+/*
+ * Description:
+ * Check various errnos for preadv2(2).
+ * 1) preadv2() fails and sets errno to EINVAL if iov_len is invalid.
+ * 2) preadv2() fails and sets errno to EINVAL if the vector count iovcnt
+ * is less than zero.
+ * 3) preadv2() fails and sets errno to EOPNOTSUPP if flag is invalid.
+ * 4) preadv2() fails and sets errno to EFAULT when attempts to read into
+ * a invalid address.
+ * 5) preadv2() fails and sets errno to EBADF if file descriptor is invalid.
+ * 6) preadv2() fails and sets errno to EBADF if file descriptor is not
+ * open for reading.
+ * 7) preadv2() fails and sets errno to EISDIR when fd refers to a directory.
+ * 8) preadv2() fails and sets errno to ESPIPE if fd is associated with a pipe.
+ */
+
+#define _GNU_SOURCE
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include "tst_test.h"
+#include "preadv2.h"
+
+#define CHUNK 64
+
+static int fd1;
+static int fd2;
+static int fd3 = -1;
+static int fd4;
+static int fd5[2];
+
+static char buf[CHUNK];
+
+static struct iovec rd_iovec1[] = {
+ {buf, -1},
+};
+
+static struct iovec rd_iovec2[] = {
+ {buf, CHUNK},
+};
+
+static struct iovec rd_iovec3[] = {
+ {(char *)-1, CHUNK},
+};
+
+static struct tcase {
+ int *fd;
+ struct iovec *name;
+ int count;
+ off_t offset;
+ int flag;
+ int exp_err;
+} tcases[] = {
+ {&fd1, rd_iovec1, 1, 0, 0, EINVAL},
+ {&fd1, rd_iovec2, -1, 0, 0, EINVAL},
+ {&fd1, rd_iovec2, 1, 1, -1, EOPNOTSUPP},
+ {&fd1, rd_iovec3, 1, 0, 0, EFAULT},
+ {&fd3, rd_iovec2, 1, 0, 0, EBADF},
+ {&fd2, rd_iovec2, 1, 0, 0, EBADF},
+ {&fd4, rd_iovec2, 1, 0, 0, EISDIR},
+ {&fd5[0], rd_iovec2, 1, 0, 0, ESPIPE},
+};
+
+static void verify_preadv2(unsigned int n)
+{
+ struct tcase *tc = &tcases[n];
+
+ TEST(preadv2(*tc->fd, tc->name, tc->count, tc->offset, tc->flag));
+
+ if (TST_RET == 0) {
+ tst_res(TFAIL, "preadv2() succeeded unexpectedly");
+ return;
+ }
+
+ if (TST_ERR == tc->exp_err) {
+ tst_res(TPASS | TTERRNO, "preadv2() failed as expected");
+ return;
+ }
+
+ tst_res(TFAIL | TTERRNO, "preadv2() failed unexpectedly, expected %s",
+ tst_strerrno(tc->exp_err));
+}
+
+static void setup(void)
+{
+ fd1 = SAFE_OPEN("file1", O_RDWR | O_CREAT, 0644);
+ SAFE_FTRUNCATE(fd1, getpagesize());
+ fd2 = SAFE_OPEN("file2", O_WRONLY | O_CREAT, 0644);
+ fd4 = SAFE_OPEN(".", O_RDONLY);
+ SAFE_PIPE(fd5);
+}
+
+static void cleanup(void)
+{
+ if (fd1 > 0)
+ SAFE_CLOSE(fd1);
+
+ if (fd2 > 0)
+ SAFE_CLOSE(fd2);
+
+ if (fd4 > 0)
+ SAFE_CLOSE(fd4);
+
+ if (fd5[0] > 0)
+ SAFE_CLOSE(fd5[0]);
+
+ if (fd5[1] > 0)
+ SAFE_CLOSE(fd5[1]);
+}
+
+static struct tst_test test = {
+ .tcnt = ARRAY_SIZE(tcases),
+ .setup = setup,
+ .cleanup = cleanup,
+ .test = verify_preadv2,
+ .needs_tmpdir = 1,
+};
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCH 2/3] syscalls/preadv201: Add new testcase
2018-09-28 9:10 ` [LTP] [PATCH 2/3] syscalls/preadv201: Add new testcase Xiao Yang
@ 2018-10-04 12:16 ` Cyril Hrubis
0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2018-10-04 12:16 UTC (permalink / raw)
To: ltp
Hi!
Pushed with minor changes:
1. moved the preadv2.h into include/lapi
2. reformatted the struct testcase array so that it's easier to read
Thanks!
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCH 3/3] syscalls/preadv202: Add new testcase
2018-09-28 9:10 ` [LTP] [PATCH 3/3] syscalls/preadv202: " Xiao Yang
@ 2018-10-04 12:19 ` Cyril Hrubis
2018-10-05 1:17 ` Xiao Yang
2019-02-27 8:16 ` Xiao Yang
0 siblings, 2 replies; 9+ messages in thread
From: Cyril Hrubis @ 2018-10-04 12:19 UTC (permalink / raw)
To: ltp
Hi!
> Note:
> From preadv2(2) manpage, preadv2() with invalid flag should return
> EINVAL, but it actually returned EOPNOTSUPP in current upstream
> kernel, as below:
> ---------------------------------------------------------------
> include/uapi/linux/fs.h:
> define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
> RWF_APPEND)
> ...
>
> include/linux/fs.h:
> static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
> {
> if (unlikely(flags & ~RWF_SUPPORTED)) {
> return -EOPNOTSUPP;
> }
> ...
> ---------------------------------------------------------------
>
> We use EOPNOTSUPP as expected errno for the time being.
This is probably worth a patch for the man-pages project, will you take
care of that?
Pushed with a minor change, I've changed the EFAULT test to get address
from tst_get_bad_addr() instead of the hardcoded -1.
Thanks!
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCH 3/3] syscalls/preadv202: Add new testcase
2018-10-04 12:19 ` Cyril Hrubis
@ 2018-10-05 1:17 ` Xiao Yang
2019-02-27 8:16 ` Xiao Yang
1 sibling, 0 replies; 9+ messages in thread
From: Xiao Yang @ 2018-10-05 1:17 UTC (permalink / raw)
To: ltp
Hi Cyril,
Thank you to review the whole patch set.
On 2018/10/04 20:19, Cyril Hrubis wrote:
> Hi!
>> Note:
>> From preadv2(2) manpage, preadv2() with invalid flag should return
>> EINVAL, but it actually returned EOPNOTSUPP in current upstream
>> kernel, as below:
>> ---------------------------------------------------------------
>> include/uapi/linux/fs.h:
>> define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
>> RWF_APPEND)
>> ...
>>
>> include/linux/fs.h:
>> static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
>> {
>> if (unlikely(flags& ~RWF_SUPPORTED)) {
>> return -EOPNOTSUPP;
>> }
>> ...
>> ---------------------------------------------------------------
>>
>> We use EOPNOTSUPP as expected errno for the time being.
> This is probably worth a patch for the man-pages project, will you take
> care of that?
I will try to send a fix patch to the man-pages project as you advised.
Thanks,
Xiao Yang
> Pushed with a minor change, I've changed the EFAULT test to get address
> from tst_get_bad_addr() instead of the hardcoded -1.
>
> Thanks!
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCH 3/3] syscalls/preadv202: Add new testcase
2018-10-04 12:19 ` Cyril Hrubis
2018-10-05 1:17 ` Xiao Yang
@ 2019-02-27 8:16 ` Xiao Yang
2019-02-27 9:07 ` Jan Stancek
1 sibling, 1 reply; 9+ messages in thread
From: Xiao Yang @ 2019-02-27 8:16 UTC (permalink / raw)
To: ltp
Hi Jan,
preadv202 has used tst_get_bad_addr() instead of the hardcoded -1 to
test EFAULT, so is it
necessary to test EFAULT on s390 by truncating file as commit 856383c
does? Perhaps, we
can remove the truncation if it is unnecessary. Sorry, i don't have
s390 to confirm it.
Best Regards,
Xiao Yang
On 2018/10/04 20:19, Cyril Hrubis wrote:
> Hi!
>> Note:
>> From preadv2(2) manpage, preadv2() with invalid flag should return
>> EINVAL, but it actually returned EOPNOTSUPP in current upstream
>> kernel, as below:
>> ---------------------------------------------------------------
>> include/uapi/linux/fs.h:
>> define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
>> RWF_APPEND)
>> ...
>>
>> include/linux/fs.h:
>> static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
>> {
>> if (unlikely(flags& ~RWF_SUPPORTED)) {
>> return -EOPNOTSUPP;
>> }
>> ...
>> ---------------------------------------------------------------
>>
>> We use EOPNOTSUPP as expected errno for the time being.
> This is probably worth a patch for the man-pages project, will you take
> care of that?
>
> Pushed with a minor change, I've changed the EFAULT test to get address
> from tst_get_bad_addr() instead of the hardcoded -1.
>
> Thanks!
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCH 3/3] syscalls/preadv202: Add new testcase
2019-02-27 8:16 ` Xiao Yang
@ 2019-02-27 9:07 ` Jan Stancek
2019-02-27 9:36 ` Xiao Yang
0 siblings, 1 reply; 9+ messages in thread
From: Jan Stancek @ 2019-02-27 9:07 UTC (permalink / raw)
To: ltp
----- Original Message -----
> Hi Jan,
>
> preadv202 has used tst_get_bad_addr() instead of the hardcoded -1 to
> test EFAULT, so is it
> necessary to test EFAULT on s390 by truncating file as commit 856383c
> does?
If s390 doesn't immediately check iovec for validity, I don't see
difference between -1 and other invalid address.
I missing some context for this email, what made you look into this again?
Anyway, I tried dropping truncate and ran test on 5.0.0-rc8 s390x:
# ./preadv202
tst_test.c:1085: INFO: Timeout per run is 0h 05m 00s
preadv202.c:82: PASS: preadv2() failed as expected: EINVAL
preadv202.c:82: PASS: preadv2() failed as expected: EINVAL
preadv202.c:82: PASS: preadv2() failed as expected: EOPNOTSUPP
preadv202.c:77: FAIL: preadv2() succeeded unexpectedly
preadv202.c:82: PASS: preadv2() failed as expected: EBADF
preadv202.c:82: PASS: preadv2() failed as expected: EBADF
preadv202.c:82: PASS: preadv2() failed as expected: EISDIR
preadv202.c:82: PASS: preadv2() failed as expected: ESPIPE
Regards,
Jan
> Perhaps, we
> can remove the truncation if it is unnecessary. Sorry, i don't have
> s390 to confirm it.
>
> Best Regards,
> Xiao Yang
> On 2018/10/04 20:19, Cyril Hrubis wrote:
> > Hi!
> >> Note:
> >> From preadv2(2) manpage, preadv2() with invalid flag should return
> >> EINVAL, but it actually returned EOPNOTSUPP in current upstream
> >> kernel, as below:
> >> ---------------------------------------------------------------
> >> include/uapi/linux/fs.h:
> >> define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
> >> RWF_APPEND)
> >> ...
> >>
> >> include/linux/fs.h:
> >> static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
> >> {
> >> if (unlikely(flags& ~RWF_SUPPORTED)) {
> >> return -EOPNOTSUPP;
> >> }
> >> ...
> >> ---------------------------------------------------------------
> >>
> >> We use EOPNOTSUPP as expected errno for the time being.
> > This is probably worth a patch for the man-pages project, will you take
> > care of that?
> >
> > Pushed with a minor change, I've changed the EFAULT test to get address
> > from tst_get_bad_addr() instead of the hardcoded -1.
> >
> > Thanks!
> >
>
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCH 3/3] syscalls/preadv202: Add new testcase
2019-02-27 9:07 ` Jan Stancek
@ 2019-02-27 9:36 ` Xiao Yang
0 siblings, 0 replies; 9+ messages in thread
From: Xiao Yang @ 2019-02-27 9:36 UTC (permalink / raw)
To: ltp
On 2019/02/27 17:07, Jan Stancek wrote:
>
> ----- Original Message -----
>> Hi Jan,
>>
>> preadv202 has used tst_get_bad_addr() instead of the hardcoded -1 to
>> test EFAULT, so is it
>> necessary to test EFAULT on s390 by truncating file as commit 856383c
>> does?
> If s390 doesn't immediately check iovec for validity, I don't see
> difference between -1 and other invalid address.
>
> I missing some context for this email, what made you look into this again?
> Anyway, I tried dropping truncate and ran test on 5.0.0-rc8 s390x:
>
> # ./preadv202
> tst_test.c:1085: INFO: Timeout per run is 0h 05m 00s
> preadv202.c:82: PASS: preadv2() failed as expected: EINVAL
> preadv202.c:82: PASS: preadv2() failed as expected: EINVAL
> preadv202.c:82: PASS: preadv2() failed as expected: EOPNOTSUPP
> preadv202.c:77: FAIL: preadv2() succeeded unexpectedly
> preadv202.c:82: PASS: preadv2() failed as expected: EBADF
> preadv202.c:82: PASS: preadv2() failed as expected: EBADF
> preadv202.c:82: PASS: preadv2() failed as expected: EISDIR
> preadv202.c:82: PASS: preadv2() failed as expected: ESPIPE
Hi Jan,
Thanks a lot for your reply and test. :-)
Recently, i am looking into pwritev202.c written by Jinhui Huang, and i
just want to
know if it is necessary for both preadv2 and pwritev2 to test EFAULT by
truncating.
Best Regards,
Xiao Yang
> Regards,
> Jan
>
>> Perhaps, we
>> can remove the truncation if it is unnecessary. Sorry, i don't have
>> s390 to confirm it.
>>
>> Best Regards,
>> Xiao Yang
>> On 2018/10/04 20:19, Cyril Hrubis wrote:
>>> Hi!
>>>> Note:
>>>> From preadv2(2) manpage, preadv2() with invalid flag should return
>>>> EINVAL, but it actually returned EOPNOTSUPP in current upstream
>>>> kernel, as below:
>>>> ---------------------------------------------------------------
>>>> include/uapi/linux/fs.h:
>>>> define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
>>>> RWF_APPEND)
>>>> ...
>>>>
>>>> include/linux/fs.h:
>>>> static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
>>>> {
>>>> if (unlikely(flags& ~RWF_SUPPORTED)) {
>>>> return -EOPNOTSUPP;
>>>> }
>>>> ...
>>>> ---------------------------------------------------------------
>>>>
>>>> We use EOPNOTSUPP as expected errno for the time being.
>>> This is probably worth a patch for the man-pages project, will you take
>>> care of that?
>>>
>>> Pushed with a minor change, I've changed the EFAULT test to get address
>>> from tst_get_bad_addr() instead of the hardcoded -1.
>>>
>>> Thanks!
>>>
>>
>>
>>
>
> .
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-02-27 9:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-28 9:10 [LTP] [PATCH 1/3] lapi/syscalls: Add syscall numbers for preadv2 Xiao Yang
2018-09-28 9:10 ` [LTP] [PATCH 2/3] syscalls/preadv201: Add new testcase Xiao Yang
2018-10-04 12:16 ` Cyril Hrubis
2018-09-28 9:10 ` [LTP] [PATCH 3/3] syscalls/preadv202: " Xiao Yang
2018-10-04 12:19 ` Cyril Hrubis
2018-10-05 1:17 ` Xiao Yang
2019-02-27 8:16 ` Xiao Yang
2019-02-27 9:07 ` Jan Stancek
2019-02-27 9:36 ` Xiao Yang
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.